Archive

Author Archive

X terminal with Windows 10 and Ubuntu 17

30 years ago i was more an sysadmin than a programmer and i was configuring X Terminals on HP-UX and AIX for CAD systems.
I still remember the HP Turbo SRX, a graphic accelerator for the HP9000 series big as a bedside table (and very heavy..) and the AIX strange problem about network interrupts, killed under heavy processor load so the X terminals were killed.
And the HP demo of the bee walking inside the monitor glass? how many memories…
Now, after many years, i needed to launch on a Windows 10 instance Linux apps with a graphical interface.
After the traditional search on Google, I found a viable solution.
For the first thing it is requested to install the OpenSSH server:

sudo apt-get install openssh-server

Then make a copy on your local folder of the configuration file:

sudo cp /etc/ssh/sshd_config ~

Change with vi (if vi is awkward, also Nano is ok) the config file:

sudo vi /etc/ssh/sshd_config

By default the port is 22, could be useful change this value (In my case i left Port 22 because is only a test instance.); also set

PermitRootLogin no

to avoid logins as root, could be very dangerous.
Very important to uncomment (the comment is the # char)

X11Forwarding yes
X11DisplayOffset 10

Then configure specific users allowed to login: this can be tricky, because when you make login in a Ubuntu instance tipically is used an alias , the true user name is the one in the first column when you type cat /etc/passwd.
For example in my Ubuntu instance i see

But the real user name , as i can see in /etc/passwd, is “alessi”.
So in my case at the end of sshd_config i placed

AllowUsers alessi

Other users can be listed with a space between names.
At this point :

sudo /etc/init.d/ssh restart

And the Ubuntu part is done.
For the Windows part, the first software requested is a Putty client and i used this: simple and working.
With this you can do a remote SSH and you work without problems with the character shell:

Here you can use vi, nano, bash commands.
But if you try to launch for example gedit , the Ubuntu counterpart of Windows Notepad, you get:

In order to show an X Terminal window, you need a local Xserver.
There are many solution, i use Xming.
The use is very simple, install with defaults and launch Xming.
The other program XLaunch is a wizard where you can configure how to see the windows:


XMing server icon is then placed on the Windows toolbar:

Now we set Putty.
Verify that in Connection/Data there is:

Then in X11 part:

That is it must be enabled the X11 forwarding and must be set the “X display location” as “localhost:0”.
So entering the gedit command we can see the X Window:

One problem that can arise is: ok now i want to launch the MySQL Workbench which is installed on Ubuntu, but which is the shell command? an icon on Ubuntu has no properties as in Windows.
I discovered this article, answer “just for fun”, so saving the extended version (with the description) for example as programs.py launching

python programs.py

You see the installed programs (the ones with a graphic interface) and with a click the program is launched.
Is not the same as displaying the Ubuntu desktop (i searched, but it seems a problem) anyway is working; but not all programs can run, for example Files and Visual Studio Code on Ubuntu.
Anyway there is a problem: you can launch programs as normal user (when there is the $ prompt, in practice) but if you try sudo su and then at the # prompt you try for esample xclock (or the old, nostalgic xeyes..) you have an error:

root@dockerserver:/home/alessi/web# xclock
PuTTY X11 proxy: Unsupported authorisation protocol
Error: Can't open display: localhost:10.0

Fortunately this can be fixed: back as normal user ($ prompt) and given your username for example the mine, alessi, launch this command:

xauth add $(xauth -f ~alessi/.Xauthority list|tail -1)

Launch sudo su, and as root the XWindows programs for example xclock are working.

Categories: Python, Ubuntu, VmWare

Dump a .NET DataTable in VB.NET as XML file


If we have a DataTable named rstData in our VB.NET code:

Dim ds As New DataSet
ds.Tables.Add(rstData)
ds.Tables(0).TableName = "ATableNameYouWant"
ds.WriteXml("e:\MyTableDump.xml")

Categories: .NET, VB.NET

TeamViewer in Ubuntu 17.04


In theory Ubuntu should have by default the connection via Vnc, but after some struggle having no time i switched to TeamViewer.
But even in this case, the things are not easy.
Using the above link, it is downloaded a file named (the current version) teamviewer_12.0.76279_i386.deb.
By right clicking this file in the Ubuntu file manager is proposed the installation (“Open with software install”), you see a window with an button “install” that does nothing.
After some struggle i found that must the installed the package gdebi with (as root with “sudo su”, obvious)

apt-get install gdebi

In my case i got some errors about “unmet dependencies”,with the advice to run

apt --fix-broken install

Done this, with apt-get install gdebi was installed.
At this point by running

gdebi teamviewer_12.0.76279_i386.deb

finally TeamViewer was installed and it runs.

Categories: Ubuntu

SQL Server 2016 Service Pack 1 with updates

Categories: SQL Server

Publish .NET Core 1.0 site to Azure


I’m working to my first Angular2 site , and now that something is working i tried to publish on Azure.
First lesson learned: if you use ASP.NET Identity copy only the table structures(of AspNetRoles table, AspNetUsers and so on) to Azure SQL , but not the data: use a DbSeeder code in Startup .cs to create the initial set of Users, Roles, etc. otherwise you never get successfully the token.
The deployment is simple, as the normal (not Core) ASP.NET sites: right clic on the project then Deploy.
It is recommended to download from Azure the WebApp publish profile

when publish from Visual Studio (in my case, Vs2015)

In order to simplify the process.
Now the site started, but i got an error:

connecting to http://yourazuresite.scm.azurewebsites.net/DebugConsole i noticed that there are not visible .json files… note that opening the web.config it says:
“Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
Oh well, but the Vs2015 publisher does not copy appsettings.json.. and the Core packages? where are? i should try with Vs2017…
So I created with the scm file manager an empty appsettings.json file and an empty package.json file, copied from my pc the text for both files, changed the connection string in appsettings.json.
Then i launched “npm install” in the scm console, that reloads the missing Core packages.
Finally, the site is working.

Categories: .NET Core, Angular 2, Azure

Not only my sites..

5-15-2017 11-49-43 PM

Categories: .NET

Sys.WebForms.PageRequestManagerServerErrorException

Followed by:Object reference not set to an instance of an object.
I was struggling in an old Asp.Net site, which is using Microsoft Ajax Toolkit, with this error.

In order to reduce the postbacks i used some jquery for partial page updates, and using a simple html select with a button for change the parameter to a REST call, i got this error.
The problem solution is very simple.. the HTML button tag by default causes a postback, and the error was caused from a null value in the Page_Load event of the behind code: the button type must be “button”, otherwise without specifying the type is considered as “submit”.

Then the HTML is:

<button id="cmdUpdateByFilter" onclick="updateSint();" type="button" class="Botton">Update</button>

Categories: .NET, Ajax, HTML5, VB.NET

Error in Delve (Office 365)

A curious error message:
delverr

Categories: Office365

Angular2 changes


I’m working to a .NET Core site using Angular2, by default at every update to Angular new problems.
This time was easy: before in order to retrieve a textbox in a Typescript file i used

this.userForm.find("email")

Now the syntax has changed, .get instead of .find

this.userForm.get("email")

Categories: .NET Core, Angular 2