Monday, 21 March 2016

New blog/website

Last week I introduced my new website/blog. After a big break I started writing again. You can find all the new posts on the following website:

Thursday, 8 January 2015

Install drivers for USB2.0-CRW - Realtek Cardreader

A few (4?) years ago I bought a Asus K53SJ-SX216V notebook which has a card-reader from Realtek. This card-reader is used in many notebooks from Asus and other brands. Unfortunately the driver of this card-reader is not automatically installed for Windows 8.1 and I didn't get the right results at the first search attempt on the internet. Hereby some simple instructions to install the driver for Windows 7, 8 and 8.1.

The card-reader is visible in the device manager of Windows by the name "USB2.0-CRW". This is the Realtek card-reader device.

The right drivers for this device can be found on the site of ASUS and you can download them here. Notice that this driver is originally for Windows 7. However it will also work for the newer versions of Windows. Both 32 and 64 bit.

Just extract the folder. Run the "setup.exe" executable and follow the instructions. Reboot and enjoy the fully working card-reader.

Sunday, 14 December 2014

Install Pycharm 4 Professional on Ubuntu

Recently I've set up two Linux based development machines. Since my main programming language is Python I wanted to install the PyCharm Professional IDE from JetBrains. However this appeared to be more difficult than expected since the install instructions are in a descriptive writing style. Here is a more to the point alternative which should help to get everything up and running in a few minutes.

To install PyCharm 4 on Ubuntu you first need to install Java. I personally prefer to stick to the Oracle version instead of the openjdk version.

sudo apt-get -y purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

Now it's time to install PyCharm. Currently 4.0.2 is the most recent version. You can update the script to download a newer PyCharm version if available. The most recent version of PyCharm can be found on this page.

cd /tmp
curl -s -L | tar -xz
sudo mv pycharm-4.0.2 /opt/pycharm

After launching PyCharm and registering your license key you need to go to Tools → Create Desktop Entry to add a icon to the Unity Launcher.

Monday, 24 November 2014

Python packaging/freezing experiment with Nuitka and cx_Freeze

A while ago I made the decision to move to Ubuntu Linux at the PC that I use at the office as well as the computer that I use at home. To me a Linux environment is more appealing. Although I've used Windows for a very long time I'm very attracted to the freedom that I have in Linux and that's why I started to clean up my Windows devices to be able to make a smooth transition to the new operating system. Recently I started with finishing some unfinished projects. Some of them can only run or Windows or take too much time to set up within the new Linux environment. So the easiest way was to finish them. One of this projects was a small experiment with Python freezing tools to find out how well Nuitka was able to freeze packages.

Freezing is an interesting process which allows you to distribute your Python based apps to other users. What you basically do during a freezing process is grabbing all the Python code and the related dependencies and you place them in a single place together with a Python interpreter. In this way the users can run your app.

During my experiment I played with two packages which allow you to freeze a Python project: Nuitka and cx_Freeze. The last one is a very well known tool to me. cx_Freeze allowed me to package a production grade app without problems. Although the configuration can be a little bit frustrating because the documentation lacks some examples it is a very reliable package. I would advice it to everybody who wants to freeze Python 3.x apps.

The second freezing tool is Nuitka. It's a Python compiler which compiles every construct of Python to C++. The parts that can't be compiled to C++ are executed by the default Python interpreter (libpython). This is done in a very compatible manner. This means it speeds up some parts of your application without breaking it. A nice addition to the compiler is that it can create standalone packages just like cx_Freeze and similar packages like py2exe and Pyinstaller.

screenshot example appsDuring my experiment I've frozen 2 small “Hello World!” applications: One CLI application and one GUI application based on Qt (PySide).
During the experiment I've found out that both packages are able to freeze the applications without problems. The main advantage of Nuitka was that it created a (signable) file without a library zip file which makes it less easy for people to decompile the application. It seems like Nuitka is promising because of it's performance gains and the highly compatible standalone feature. However there is still work to be done and the author needs some help in this.

At my project GitHub page you can check out the two examples. Hopefully it can help you out if you want to freeze one of your Python applications using one of these tools. I've tested it on a Windows 8.1 machine, but I'm quite sure that it will also work on other platforms.

Because I want to focus more on web development I'll not continue actively with experimenting with freezing tools. So this project is finished for now. However I'll watch the freezing projects because there are quite some interesting things going on like the updater package for Pyinstaller and I think projects like these can become a very nice foundation for upcoming (desktop) apps written in Python.

Wednesday, 19 November 2014

Automate your development laptop - Reinout van Rees @ Brainport Python Meetup #2

Last Tuesday there was a second Python meeting of The Brainport Python meetup group in Eindhoven.
The first meeting was two months ago and was received very well. Many of the people who visited the fist meeting did also attend the second one. It was really nice to see them again and to meet people who were new to the meeting group.

For the second meeting we introduced presentations as part of the program.
First Reinout van Rees did an excellent presentation about Development laptop automation. After eating some pizza I told about my journey and view on Desktop application development with use of Python. The slides can be found here.


Reinout did already summarize my talk. However nobody did summarize his one yet. So let me give some extra explanation about his slides. I think he did an excellent presentation about how you can optimize and automate your Development machine and it's really worth to take this topic serious. It already saved me some minutes of useless fiddling around while setting up my new development PC.

Reinout started with a very nice statement: "The shoemaker's children go barefoot". This saying is also applicable to many developers. We use version control, provisioning tools and we set up automated tasks for our products and clients, but most of us do not develop for themselves with the same care. We write scripts, but we lose them. We install software on our PC's and setup our IDE's. However we don't store the configurations. So when disaster strikes and you have to replace your machine it takes hours, days or weeks to fully recover.

The call to action is easy: "Automate your development laptop with the same care as your regular projects". You have to change your mindset a little for this: Be explicit and do something regularly.

Being explicit means that you create a safe central place where you can store your scripts, small programs and configurations. A good place for this is an on-line GIT repository.
Being explicit also means that you make an good overview of what's in your toolbox. You can do this by maintaining a README file in the repository.

The second mindset that you need is to do something regularly. So if you change something: Adjust your README file! It's also good to check which apps you have installed and to check regularly if every app is up to date. I now have for example a nice list of tools which I use very often and which I can install by just running a single command: Make install-essentials. This list of essentials will grow and shrink at some moments over time and by improving it regularly it ensures me that I'll install the right software when I need to install my essentials.

Reinout also advised to get out and start talking to other people about their setup. You can join them while programming and ask them how they organize their environment in order to find out how you can improve your own situation and increase your productivity. At last it's important to automate, improve or fix something regularly (e.g. every week) to ensure everything stays up to date.

A great tip of Reinout is to be not too perfectionistic. Reinout explained this in a very nice way. He showed us the roof of the train station of Eindhoven and some parts of the movie "A bridge too far". In that movie you see a temporary Bailey bridge being constructed. Similar bridge parts are now used as the roof in the Eindhoven station. Re-used second-hand parts, but it works fine. So you don't need to be too perfectionistic.

At last Reinout showed us some examples like zest.releaser which can automate the process of releasing zest components. Checkoutmanager is also useful since it allows you to manage multiple git repositories and it reminds you to push your changes or when to commit stuff. Various skeleton projects of Reinout help his colleagues out when they have to bootstrap a project. Beside this Reinout pointed out the trick to symlink .dotfile locations to your central toolbox so you're always using the right configurations.

I want to thank Reinout for his wonderful presentation and all the visitors of the meeting for coming to the meeting. It was nice to see everybody and to share ideas and experiences. I also want to thank BounceSpace and SendCloud for the location, the food and the drinks. I think the second meeting set a good example for the upcoming meetings and I hope that we can improve the meetings over time as well as the overall Python community in the area.