Showing posts with label LINUX. Show all posts
Showing posts with label LINUX. Show all posts

Sunday, January 29, 2017

Creating self extracting zip EXE under Linux for windows

Recently, I had a need to create a self extracting zip archive, which will open on any windows machine. Because, I am using Linux, I did not want to go through the process of installing the windows with 7z on it just for a sake of creating that archive. I was expecting that the process will be not trivial, as some of internet resources show, but all turned out very simple. Peazip archiver available for Windows as well as Linux, which is able to create self extracting exe archive. I downloaded portable version for 64 bit machine and when creating a new archive you get an option to create self extracting file in a single volume or split by chosen size.









What I found, peazip creates small archives that extract under windows machine just fine. If you need to zip large amount of files say > 1 GB, I would suggest to create normal archive, which can span several files of set size and then use 7zip on windows computer to extract them.





References:




0

Monday, December 5, 2016

Reading appsettings.json in .Net Core Console Application under Linux

Recently I was looking at how to load and use appsettings.json file in .Net Core Console application. Many resources on .Net forums and sites were descripting use of appsettings.json file in ASP.NET Core web App, but very little described appsettings with .Net Core Console app. I managed to created sample .Net Core app with the minimum required libraries. Creation of this sample program I am going to describe here. Let's call our App "appsettings".

$mkdir appsettings
$cd appsettings
$dotnet new
$dotnet restore

Now create appsettings.json file:

{
"AppSettings": {
"Date": "1900-01-01"
}
}

Date is the setting I am interested in loading from AppSettings section.



Edit project.json file to include "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0" in dependencies section. This is the only extra library we need in order to use ConfigurationBuilder functions.

{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"outputName": "AppSettings"
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
},
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0"
},
"imports": "dnxcore50"
}
}
}

Now lets edit the Program.cs file. We are going to load the Date setting and display it in Console. Don't forget to include "using Microsoft.Extensions.Configuration;"

using System;
using System.IO;
using Microsoft.Extensions.Configuration;

namespace ConsoleApplication
{
public class Program
{
public static string AppSettingsFile = "appsettings.json";
public static string AppSettingsSection = "AppSettings";
public static string DateSetting = "Date";

public static void Main(string[] args)
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile(Program.AppSettingsFile, optional: true,
reloadOnChange: true);

var
config = builder.Build();
var appSettings = config.GetSection(Program.AppSettingsSection);
string dateString = appSettings[Program.DateSetting];
Console.WriteLine("Date:" + dateString);
}
}
}

That is pretty much all. Now let's build and run it.

$dotnet build
$dotnet run
Date:1900-01-01

0

Saturday, January 23, 2016

Install NVidia Graphic Drivers on ASUS ROG G750JW

ASUS ROG G750JW comes with GEFORCE GTX NVidia 2GB graphic card. To get a full power of this card on Debian we need to install nvidia drivers for it. Debian Wiki NvidiaGraphicsDrivers article describes several ways to do it. Here I am going to summarise the steps that worked for me.

  1. Add SteamOS repository to /etc/apt/sources.list.d/steamos.list, for example:

  2. deb http://repo.steampowered.com/steamos brewmaster main contrib non-free
  3. Update the list of available packages. Install the appropriate nvidia driver and related packages from SteamOS repository:

  4. # aptitude update
    # aptitude install -t brewmaster libegl1-nvidia:amd64 libgl1-nvidia-glx:amd64 libgl1-nvidia-glx:i386 libgl1-nvidia-glx-i386 libgles1-nvidia:amd64 libgles2-nvidia:amd64 libnvidia-eglcore:amd64 libnvidia-ml1:amd64 libxnvctrl0 nvidia-alternative nvidia-driver nvidia-driver-bin nvidia-kernel-dkms nvidia-modprobe nvidia-settings nvidia-vdpau-driver:amd64 xserver-xorg-video-nvidia
This will also install the recommended nvidia-driver package. DKMS will build the nvidia module for your system. Restart your system to enable the nouveau blacklist.



References:



0

Tuesday, November 10, 2015

Debian 8 – Jessie - Enabling Wifi on ASUS ROG G750JW

Debian Jessie installer managed to detect most of hardware during install like LAN, sound and video, but WIFI had to be configured separately.


  1. Add a "non-free" component to /etc/apt/sources.list for your Debian version, for example:

    # Debian 8 "Jessie"
    deb http://http.debian.net/debian/ jessie main contrib non-free


  2. Update the list of available packages. Install the relevant linux-headers.
    # apt-get update
    # apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms


  3. Unload conflicting modules:

    # modprobe -r b44 b43 b43legacy ssb brcmsmac


  4. Load wl module:

    # modprobe wl


  5. Edit /etc/network/interfaces and comment out or remove allow-hotplug eth0



References:



0

Monday, October 12, 2015

Setup Lexmark X8350 printer under Debian Linux using Virtualbox and Win XP

After installing Debian 8.0 Jessie I failed to locate drivers for my multifunctional Lexmark x8350 printer. The Windows printer driver support was available only up to Vista, there were no drivers for Windows 7 and above.  So I decided to try to setup Windows under Vrtualbox with pass-through USB device. First I tried with Windows 7 Virtualbox client (Under normal Win 7 install printer drivers for Vista worked fine), which was very very slow to install and I did not get it to print, only to scan. So the best option left is to install Win XP. This article will describe installation of Lexmark printer on Win XP Virtualbox client.




Step 1: Install and configure latest Virtualbox package and extensions






I am not going to go describing installation of Virtualbox and extensions. www.virtualbox.org download page has clear instructions on what to download and install. After installation is done make sure that your /etc/fstab has the following line:





none /proc/bus/usb usbfs devgid=500,devmode=664 0 0





The devgid has to match your gid of your vboxusers group. Also make sure that user you logged in as is member of the vboxusers group. Please log out and log back in after adding it to a group.





Step 2: Setup Win XP client and configure USP pass-through


Make sure that Lexmark printer is connected to USB. There is no need to turn it on yet.



Start Oracle VM Virtual Box Manager. Click New. If you have already setup Win XP client just click on it and scroll down to USB section in Options. Click on USB link. Select USB 2.0 (EHCI) Controller, click on icon with green cross and select your printer from list. Click OK.








Now you can start Virtualbox client and complete Windows XP and printer setup. You can use your disc that comes with printer or download drivers from Lexmark support site.




References:











0

Saturday, May 23, 2015

Debian 8.0 Jessie - Install Mono 4.0

Mono 4.0 was released in May 2015.



In order to install it it on Debian 8.0 Jessie do the following as root or with sudo.

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 
3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF 

echo "deb http://download.mono-project.com/repo/debian wheezy main" 
| tee /etc/apt/sources.list.d/mono-xamarin.list 

echo "deb http://download.mono-project.com/repo/debian 
wheezy-apache24-compat main"
| tee -a /etc/apt/sources.list.d/mono-xamarin.list 

echo "deb http://download.mono-project.com/repo/debian 
wheezy-libjpeg62-compat main"
| tee -a /etc/apt/sources.list.d/mono-xamarin.list

apt-get update

apt-get install mono-complete

To get development IDE run:
apt-get install monodevelop



I had also to run several times apt-get -f install to force installation of failed dependences and run apt-get install monodevelop to get development IDE.




Reference:


Install Mono on Linux



 
0