Electric NEVS based on SAAB 9.3

So my SAAB 9.3 is still alive and kicking ?

Categories: Saab

Material icons in Android

I’m not frequently working as Android Developer, and now i updated Android Studio to the latest version (3.0.1) and tried to create a new project starting with a “Navigation Drawer Activity”.
I also noticed that now in a project you can insert support for C++ and Kotlin, a more concise Java.
The first problem raised were the icons for the lateral menu (the “drawer”) , by default are created some icons

and examining these icons you can see that are not images, but an XML definition , for example ic_menu_camera.xml:

The problem is: ok, i want to use another icon, but how?
The solution is to use this site for the Material icons, where you can right click on an icon, choose “View Vector Drawable” from menu, then copy the XML definition and paste it in the new res/drawable created in Android Studio; for example a winner cup image is defined as:

Categories: Android

Another certification

Certificated as Docker Expert.
Is not difficult as the Microsoft certifications where you sit in front of a computer (not yours) without any help in a foreign room and the questions are sometimes very difficult (here the exam is a project on your pc and you must send also the screenshots), but anyway it was a good course with good material.

Categories: Docker

7 years of blogging

But not from Tibet.
Today it is 7 years from the my first post, it was about the worst IT conference i ever seen.
I could add this: the downloads instead of an ftp, some cloud hosting, were possible only using a Windows application with an awkward interface, something as a treasure hunt in a tree interface: i was not able to download something.
This conference was my first encounter with Node.js, a demonstration with running numbers where i understood nothing.
But the worst part was the fact that this conference was not free..and they requested to send via fax my credit card numbers! obviously i closed the bill via a bank transfer.
Fortunately in the past years no more experiences as this.

Categories: Uncategorized

Ludwig search engine

An interesting search engine is Ludwig.
Created from an Italian startup, it is very useful if you are not mother language and there is a doubt about an English sentence.

Categories: Uncategorized

Ubuntu 17 reset

I had an Ubuntu vm (Hyper-V) with troubles, as the software updater gone after an uninstall of double items that i don’t figure how were generated, Docker not working (continuously launching mySQL containers immediately expired).
Before the deleting of the vm i tried with success:
Delete the Docker folders

service docker stop
rm -rf /var/lib/docker/containers/*
rm -rf /var/lib/docker/vfs/dir/*
service docker start

Configuration of unconfigured packages:

dpkg --configure -a

Update repositories

apt-get update

Fix missing dependencies:

apt-get -f install

Update system:

apt-get dist-upgrade

Reinstall Ubuntu desktop:

apt-get install --reinstall ubuntu-desktop

Remove unnecessary packages:

apt-get autoremove

Clean downloaded packages already installed:

apt-get clean

Now Docker has no more problems, the Ubuntu updater is working, it seems all ok.
I discovered this Resetter, but i would try this only as a last desperate resource before the total reinstall from scratch.

Categories: Docker, Ubuntu

Still on Docker for Windows

In this previous post i wrote about the connection from the Docker host to a local container.
Ok, but for the connection from another host? the Windows 10 host is in the subnet 192.168.0.xx, the container has a subnet 172.
So the host can ping the container because the virtual network between host and container, but it is private: no way that another host can ping the container.
My first attempt was to use the Hyper-V network used from the Hyper-V host in order to give connection to the VMs (converted from VmWare Workstation with WinImage): so the External network in my Hyper-V is named “exvmware”

I thought: if I’m able to use “exvmware” instead of the default network…
But without hope:

docker run -d -p 1433:1433 --network=exvmware --ip --name sqlcontainer1 --hostname thorsql -v G:\DbAndMail:c:\data -e sa_password=<somepwd> -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer

causes error:

docker: Error response from daemon: user specified IP address is supported only when connecting to networks with user configured subnets.

Having some troubles with the network interfaces i followed the instructions in this discussion: in practice i downloaded this PowerShell script and launched

.\CleanupContainerHostNetworking.ps1 -Cleanup -ForceDeleteAllSwitches

After i tried a

docker network create -d transparent mynet

because i was thinking to create a “transparent” network that seems can permit communications with the containers from another host, but i got:

Error response from daemon: HNS failed with error : Element not found.

Uninstalled Docker and reinstalled, still no way to create the network… i remember that was working.
Finally i tried

docker run -d -p 1433:1433 --network=exvmware --name sqlcontainer1 --hostname thorsql -v G:\DbAndMail:c:\data -e sa_password= -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer

That is without specifying the IP, and surprise, it worked!
A Docker inspect was revealing that there was no ip:

"Networks": {
	"exvmware": {
		"IPAMConfig": null,
		"Links": null,
		"Aliases": [
		"NetworkID": "18e....",
		"EndpointID": "ab2....",
		"Gateway": "",
		"IPAddress": "",
		"IPPrefixLen": 0,
		"IPv6Gateway": "",
		"GlobalIPv6Address": "",
		"GlobalIPv6PrefixLen": 0,
		"MacAddress": "00:…",
		"DriverOpts": null

Argh.. and now?
But if this damn SQL is running.. no way to reach him? i explored the network with Advanced IP Scanner and surprise: ?? ( is the Docker host, my ASUS notebook).. but Docker inspect says that there is no IP…
Effectively now i can ping “thorsql” from the Docker host, another real desktop, another Hyper-V vm and it responds

The only problem comes if i stop the container, and then relaunch with

docker start -ai <containerid given from docker ps -a>

The IP changes, but fortunately it can used the container hostname: i should investigate if is possible to maintain the IP.
So at the end i caused some troubles with the PowerShell script, securely it was not needed and could be it causes troubles on a pc which is a Docker Host and also a Hyper-V host: anyway i don’t need to create Docker networks at the moment and is my development pc.
But i know, pc formatting at the horizon.

Categories: Docker

SQLDMO for older programs

Sometimes i must maintain ancient software, Visual Basic 6 applications of the last millennium.
I still wondering why opening an Visual Basic 6 project after some years, i remember that was all ok and i’m the only one in the world that opens this ancient vm, magically some DLL reference is no more working.
So some code that was using SQL-DMO was causing the error “can’t create the object”.
In a folder there was a sqldmo.dll, no way to register/unregister, delete and the add the reference.
Fortunately i found this download, after the install pointing the dll reference to c:\Programs\Microsoft SQL Server\80\Tools\binn\sqldmo.dll (is a Windows XP vm…) my program can run; by the way connecting to SQL Server 2016 Developer inside a Docker Windows container.

Categories: SQL Server, Visual Basic 6

SQL Server Developer 2016 containerized under Docker for Windows

Until the last format of my notebook (end of August: there was no way to repair Office 2016 , and after i got a malware from the infamous CCleaner 5.33) SQL Server Developer was installed with the other programs.
But this time my approach was “no more VmWare Workstation” because it conflicts with Hyper-V needed from Docker.
Currently i’m ok with Hyper-V even if there are issues, as the access from the vm to the host that i resolved with the mapping of the host disks as “Local resouces” in the remote desktop connection: not the better approach, but for me works.
Then I decided to use SQL Server 2016 Developer in a container: could be that one day in my pc there will be only Windows 10, Hyper-V, Docker and all of the programs (Office, Visual Studio, Android Studio, SQL Server..) will be containerized?
Installed Docker for Windows, i opened a cmd shell and launched

c:\>docker pull microsoft/mssql-server-windows-developer

After some Gb of download, the Docker page tell us that we can launch

c:\>docker run -d -p 1433:1433 -e sa_password=<SA_PASSWORD> -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer

Well, at this point our server is running, the sa user password was initialized to the passed value and i can do

c:\>docker ps
CONTAINER ID        IMAGE                                   <other columns..>
5fd521dc8565        microsoft/mssql-server-windows-developer

We have the CONTAINER ID that we can use for connecting to our instance, for example (note that we can use the entire CONTAINER ID but also only the first 3 chars)

docker exec -it 5fd sqlcmd -S. -Usa -P<SA_PASSWORD>

and if all is ok we can see the SQLcmd prompt, launch some commands:

1> select @@version
2> go
Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64)
        Oct 28 2016 18:17:30
        Copyright (c) Microsoft Corporation
        Developer Edition (64-bit) on Windows Server 2016 Datacenter 6.3 <X64> (Build 14393: ) (Hypervisor)

(1 rows affected)
3> Quit

Ok well, but at this point I would use SQL Server Management Studio, use my MDF files that are in the main pc filesystem.
First of all, by default the containers change the container name (sometimes with hilarious names, as “drunken_borg”) and the IP, which is tipically a private IP network 172.xx.xx.xx.
If you do a

c:\>docker stop 5fd

and then relaunch the “docker run” you will see (with a docker inspect CONTAINER_ID) that the container name and the IP are changed, and if some services rely on your SQL is a problem.
But for the moment we connect from SQL Management studio on the host, if our server has IP we would try

But without success, we have an error about the certificate chain:

After some head scratching, i finally found that we need to set in Options >> Additional Connection Parameters this magic setting, TrustServerCertificate=True:

Done this, we can finally see our server:

But if we try to attach our MDF files that are in the host, no way, we can explore only the local c: (of the containerized Windows Server which runs our SQL instance)

The solution is to use the Docker Volume parameter: we need to changes some parameters in the SQL server starting, so close SQL Management Studio, run a

c:\>docker stop <CONTAINER ID>

and then

c:\>docker rm <CONTAINER ID>

The new command is:

c:\>docker run -d -p 1433:1433 --name sqlcontainer1 –hostname mysqlhost --ip -v G:\DbAndMail:c:\data -e sa_password=<SA_PASSWORD> -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer

In this command:

-p 1433:1433 : maps the local port 1433 to the 1433 port of the container

–name mysqlhost: we will have our defined host name, no “drunken_borg”

–ip we define a fixed IP for our instance, so the connected clients that uses our SQL can rely on a certain value

-v G:\DbAndMail:c:\data : we map the host path G:\DbAndMail on the container c:\data; the path inside the container will be created if not exists.

Entering in SQL Management Studio, we can this time explore our host path mounted in c:\data in order to attach the already existents MDF files.

At this point if we launch

c:\>docker stop <CONTAINER ID>

and then

c:\>docker run -d -p 1433:1433 --name sqlcontainer1 …

Docker complains that sqlcontainer1 already exists, we need a docker rm.
But in this manner we lose the changes, if we attached an existing MDF in the previous SQL Management Studio session every previous change in the SQL data is maintained but we must re-attach the MDF, every configuration change for example

exec sp_configure "remote access", 1

is lost: is another instance.
So we need to see the NEW_CONTAINER_ID with

c:\>docker ps – a 
CONTAINER ID        IMAGE                                      …
05e581c12329        microsoft/mssql-server-windows-developer …

where we can see the stopped containers, and then launch

c:\>docker start -ai  05e
CONTAINER ID        IMAGE                                      …
05e581c12329        microsoft/mssql-server-windows-developer …
where we can see the stopped containers, and then launch
c:\>docker start -ai  05e
VERBOSE: Starting SQL Server
VERBOSE: Changing SA login credentials
VERBOSE: Started SQL Server.

TimeGenerated          EntryType Message
-------------          --------- -------
9/26/2017 4:55:56 PM Information Software Usage Metrics is enabled.
9/26/2017 4:55:55 PM Information Recovery is complete. This is an informatio...
9/26/2017 4:55:55 PM Information Service Broker manager has started.
9/26/2017 4:55:55 PM Information The Database Mirroring endpoint is in disab...
9/26/2017 4:55:55 PM Information The Service Broker endpoint is in disabled ...
9/26/2017 4:55:55 PM Information The tempdb database has 2 data file(s).

We can see that in SQL Management Studio nothing was changed, we find our previously attached MDF and other changes.

Categories: Docker, SQL Server