Linux User Group of Mauritius Promoting open source software in our beautiful island

18Oct/150

Extend battery life on Linux with PowerTop

Posted by Ish

One of the greatest fun spoilers when loading your favorite Linux distribution on your new laptop is battery life.

Yes, the battery life that goes upto 4 hours with Microsoft Windows could easily drain down to 2.5 hours with a classic Ubuntu installation. A major argument will be that Linux distributions do not come with optimized under-the-hood power settings. We should not forget that most Linux distributions aim to support a majority of computer hardware out of the box. We are surely happy that we do not need to struggle with hardware incompatibility issues, driver versions etc, as it could be the case with a Windows installation. However, the downside is that the Linux kernel could be bloated with “stuffs” not required for your laptop.

In a recent past there was a tool called Jupiter that allowed some handy power consumption optimizations. The project is now discontinued.

Some claim that TLP which was originally designed for ThinkPads, could optimize power consumption on other brands. I had no such luck with an Acer Aspire notebook.

Recently, I tried PowerTop, a power-management utility by Intel that enables a series of powersaving modes in userspace, kernel and hardware. PowerTop can also monitor and identify applications with a high power demand. I’ve used PowerTop to extend the battery life of my ThinkPad from 3.5 hours to 6 hours; a whopping 2.5 hours gain.

Powertop can be installed from the Ubuntu software repository.

sudo apt-get install powertop

At first run, you need to calibrate it so as it gathers as much information about your machine.

sudo powertop --calibrate

This could take up some minutes and the screen would flicker and even turn off for a while. Do not panic, just let it run and go grab a coffee.

Once done, PowerTop will load with an “overview” of your running applications, their power consumption and battery life estimation. Press the “tab” button to navigate through. The “tunables” tab lists a series of settings that have been applied to your system.

powertop-tunables

After the calibration, PowerTop will have a list of measurements that it could use to tune your system every time you launch it. Therefore, next time you may launch PowerTop as follows:

sudo powertop --auto-tune

Ideally, you could also start PowerTop when the laptop boots. Just add the following in the /etc/rc.local file before the exit 0:

# Loading power-saving schemes
powertop --auto-tune

On that note, happy power saving :)

The post Extend battery life on Linux with PowerTop appeared first on HACKLOG.

Tagged as: No Comments
11Oct/150

Node.js smart server by Yog Lokhesh Ujhoodha

Posted by Ish

The Linux User Group of Mauritius organized a Node.js presentation yesterday at the University of Mauritius. Logan announced the same weeks ago and the prez was done by fellow Yog Lokhesh Ujhoodha.

The night before I had a “Happy Hour” party with colleagues and consequently Saturday morning left me drowsy. I reached the University of Mauritius before noon and was damn hungry. I was looking for room 2.12 when I met Yog, Logan and Humeira who were chatting near in the corridor. Others were having a casual talk in a smaller room while waiting for another class to be free. We needed the projector and a little bit of electricity to power Logan’s laptop :) The fellow has been doing a nice job by supplying gear for broadcasting the meetups on YouTube and allowing remote participation through Google Hangout. Kudos for that!

Thanks to Veer who was heading for the cafeteria, I asked him to bring me some food too. That saved my life :)

The prez started around 12h30 with a dozen participants in the class and several others through Google Hangout.

yog-nodejs-prez

Node.js presentation by Yog Lokhesh Ujhoodha

lugm-usual-suspects-at-nodejs-prez

LUGM usual suspects :)

Yog introduced Node.js and cleared the myth whether ‘Node.js’ is a webserver. It’s a runtime that executes JavaScript on the server-side using Google’s V8 open source JavaScript engine. I particularly liked the flow of his prez in the sense that he described a problem and what followed was how he would tackle it. Along the way, he gave an overview of web server architectures laying emphasis on multi-threaded vs event-driven; while taking Apache and Nginx as examples.

Yog explained through his code, how he identifies the number of CPU cores in a machine and proceeds with forking of child processes.

var cluster = require('cluster');
var numCPUs = require('os').cpus().length;

if (cluster.isMaster) {
    // fork workers
    var proc = Array();
    for  (var i = 0; i < numCPUs; i++) {
        proc[i]=cluster.fork();
    }
}else{ //forked worker

}

Later on he would explain how he runs the child process on a specific CPU core and thus eliminates delays caused by CPU switching [etc..] which he explained initially when describing webserver architectures. Those who missed the meetup can catch up on YouTube.

As and when Logan would switch to remote participants, Nitin and I grabbed the moment to discuss about his new blog tunnelix.com. I also showed Humeira the Firefox OS running Orange Klif mobile.

While others left after the presentation, some of us headed to Bagatelle Mall for a chill-out moment.

The post Node.js smart server by Yog Lokhesh Ujhoodha appeared first on HACKLOG.

Tagged as: No Comments
2Oct/150

LUGM at Infotech 2015

Posted by Ish

I had a brief visit to Infotech 2015 today. An important task was to deliver Logan the banner of the Linux User Group of Mauritius (LUGM). He’s been demo’ing some cool Arduino based robots since yesterday along with Christian Gunnoo. When I reached the Swami Vivekananda Int’l Convention Centre today, I first looked out for the LUGM fellows. I saw Mike & Jessica were there having a chat with the geeks. Cool, I jumped in the convo, greeted everyone and gave Logan the banner.

lugm-infotech-2015

Next to LUGM, there were fellows from the Middlesex University. They also had some cool Arduino projects to display.

On a sad note, the table arrangements got both LUGM and Middlesex University in a blind spot. They were on the same row as the National Computer Board outside the main hall. Nevertheless, I should commend the good work achieved by Logan & Christian to interact with young fellows who made it till there.

Next, I headed inside the main hall. I was looking for the stand of Amazon Web Services (AWS) but before that I got to meet Louis from ICT.io. I had a chat with him and another fellow I happened to meet there. In fact, they showed me where the AWS stand was and I hopped there.

I met Chris Perkins from AWS and we talked quite lengthily about the various cloud services. My main mission was to meet some technical guys and we could have a geek chat about how we’re building up the infrastructure for the next lexpress.mu. Yes! If that comes as a surprise, I now work for LSL Digital :)

aws-infotech-2015

Chris happens to be a Manager within AWS Cloud Support and we had a very interesting chat about operations, sysadmin skill set and all. Chris and his colleagues are in Mauritius to recruit for AWS South Africa. If you’re interested to put your genius in action and be part of the AWS family, you still got two days; put your laptop in the backpack and go meet Chris at Infotech 2015.

I then met Dinesh, an ex-colleague from Linkbynet :) We had a chat about the fun days when I was a Unix System Administrator at Linkbynet. We talked about the shortage of sysadmins and the gap that needs to be filled.

linkbynet-infotech-2015

I left around 13h30 and headed back to LSL Digital. I should be there, at Infotech 2015, tomorrow along with other LUGM members talking about Linux. Meet us at the LUGM stand :)

The post LUGM at Infotech 2015 appeared first on HACKLOG.

Tagged as: No Comments
26Sep/150

Introduction to Flask

Posted by Ish

On the 14th of September 2015, Avinash Meetoo replied to this email on the Linux User Group of Mauritius (LUGM) mailing list and showed interest in doing a presentation for the next LUGM meetup.

The meetup happened today in Curepipe. I was not able to attend it physically, but thanks to Logan who did the necessary for setting up a Google Hangout session, I joined around 13h00. Shortly after, Avinash started his presentation “Introduction to Flask”.

flask-intro-avinash-meetoo

He welcomed everyone who joined and gave a quick brief about the underlying infrastructure of webapps. I particularly liked the way he explained the model-view-controller (MVC) software design pattern; taking from there he talked about Python frameworks. The popular Django framework comes first, Avinash says. Django should be a powerful framework when a lot is needed for a project, like an interface for backend etc. However, if someone wants a pretty quick setup, say for example a prototype for demo’ing to customers or a small web application, there is this Python micro-framework called Flask that comes handy. Avinash explains why it’s called a “micro” framework; reason being it’s limitation to a subset of functions that full stack Python frameworks would offer. Nonetheless, the functions in Flask are pretty enough for setting up web applications.

flask-logo

Avinash mentioned how he uses Flask in his many projects at Knowledge Seven and how he designed his web application electionsmauritius.com. He and his wife, Christina, came up with an idea about a web application to help Mauritians vote intelligently, two weeks before the General Elections 2014. Avinash then put his genius in the making of the “Elections Mauritius” webapp.

During the presentation, Avinash showed a demo of a simple web application and unveiled the code behind his “Elections Mauritius” web application. The prez lasted for approximately 50 mins including the questions & answers at the end. Those who missed the Hangout session can still catch up on YouTube and once again, thank you Avinash :)


Flask logo used from flask.pocoo.org.

The post Introduction to Flask appeared first on HACKLOG.

Tagged as: No Comments
18Sep/150

Nginx virtual host configuration

Posted by Ish

What is Nginx?

Nginx (pronounced engine-x) is a reverse proxy which gained popularity in the recent years. A lot of people, including me, use Nginx as a web server thanks to its event based multi-protocol support. Nginx supports HTTP and that is what we need to run it as a web server. The strong point of Nginx compared to traditional web servers is that each spawned process of Nginx can handle thousands of concurrent connections. Nginx does not embed programming languages within its own process, therefore all dynamic handling (such as PHP) is done through a backend server. PHP-FPM works great as a backend server to handle PHP scripts.

Nginx configuration

Nginx virtual host configurationBefore we dive into the Nginx virtual host configuration, we might need to grasp a little bit of the basics. The Nginx configuration can be classified in two parts; the directives and the contexts. A directive is an identifier that can accept one or several configuration options. A context on the other hand is a section which may contain several directives. The word “context” is mostly used in the Nginx documentation rather than “section”.

A directive would be as follows:

worker_connections 768;

A context would be like:

events {
    worker_connections 768;
    # multi_accept on;
}

A context may contain one or several directives within curly brackets {}. Directives can be disabled by commenting them with the # symbol.

To define a virtual host in Nginx we create a “server” context. This context will handle configuration directives like the hostname, the root directory etc. A basic virtual host in Nginx looks as follows:

server {
    listen 80;
    server_name mysite.com;
    
    root /var/www/mysite;
    index index.html;
}

The configuration tells Nginx to listen to port 80, handle requests for “mysite.com” and serve contents from the /var/www/mysite directory. The index directive tells Nginx to set “index.html” as the default file to serve.

Backend interaction

There is a sub-context called “location” within the server block. The location context handles URI matching. It tells Nginx what to do when a particular URI is sent by the client. Backend communication happens by sending the request to the backend server once the URI matching is completed and conditions are met. The server context may have server location sub-contexts; as we in the example below:

server {
    listen 80;
    server_name mysite.com;
    
    root /var/www/mysite;
    index index.html;

    location / {
        try_files $uri $uri/ /index.php;
    }

    location ~ .php$ {
        include fastcgi.conf;
        fastcgi_pass 127.0.0.1:9000;
    }
}

If a URI ends with .php the request is sent to the PHP5-FPM backend server. If a URI does not end with .php the location / is used. Nginx tries to search a file that matches the URI; if that fails, it tries to find a directory of that name and serves the index file. If both fail, the request is redirected internally to /index.php and the request is handled by the backend server.

The post Nginx virtual host configuration appeared first on HACKLOG.

Tagged as: No Comments
31Aug/150

Quick fix for fast forward youtube

Posted by logan



Symptom

Youtube loads but there is no sound, and youtube seems to be playing in fast forward mode.

After digging around, I realised that the sound sub-system of Linux needs to be badly fixed. It tries to play through the audio HDMI port first. Youtube should also fix their sound output code on Linux. The trick is to disable the HDMI codec driver for the sound.

Add this line in modprobe.conf: blacklist snd_hda_codec_hdmi

I've seen huge threads about this problem on various forums. Maybe this will help a few people.

Tagged as: No Comments
29Aug/150

Linux Meetup (29/08/2015)

Posted by logan




A Linux Meetup after a long time !

We held our first meetup after a very very long time :) I wasn't expecting 71 people, but we got around 13 people who showed up. Quite a few couldn't make it at the last minute. The usual suspects showed up with the addition of Ashvin, who made it this time :) 2 employees of Mauritius Telecom were also present.

group

Bufferbloat explained

I demo'ed and explained the bad latency that Internet Users experienced on the DSLresport website. I explained how, once you cross 5MB/s, your bandwidth isn't that important anymore. Now, we need to talk about latency . When, I showed how by implementing CoDEL we could solve the latency problem, the 2 employees of Mauritius Telecom understood the issue at hand. Unfortunately, none of Emtel, Canal+ or Bharat Telecom engineers were around, sadly.

I hope that ISP guys get the message concerning the need for low latency in Mauritius for us to be able to benefit from a good service for services like VOIP, gaming, teleconference, and IMs.

With Open Source software and Linux, we were able to show how we can still achieve low latency while saturating both our uplink and downlink on a Mauritius Telecom MyT/30 Mbit/s connection. Quite a few people, in particular, Ajay Ramjatan & Shaan Nobee asked a lot of questions regarding fq_coDEL and the theory behind AQM.

I sincerely hope to see University Students pick up on research related to bufferbloat and how to fix it. I hope that Wifi will be fixed, as well as possibly adjusting coDEL for Mauritius.

There were a few questions regarding the IETF, and the applicability of standards. I explained how participation in standards is crucial for emerging countries like ours. In particular, I emphasize on the importance of sending Networking and Systems Engineers to conferences like the IETF, through the budget for training, rather than sending marketting guys, who would never be able to sell anything to a knowledgeable engineer. Too many IT companies think that investing in training is too expensive, and do not realise how they can grow their portolio of services for their customers.

Overall, It was a fun meetup. I hope that we, Linux users, can work together with ISPs to fix the latency issues that 99% of customers are currently experiencing right now.

URL for my presentation: my presentation
Dave Taht's talk on Bufferbloat At Stanford:
Dave Taht talk at Stanford

--Logan
C-x-C-c

Tagged as: No Comments
5Aug/150

LibreOffice 5 installation on openSUSE, Fedora, CentOS etc…

Posted by Ish

Twitter’s flooding with LibreOffice 5’s arrival. Oh! Flooding? Well, only if you’re following the *nix geeks :)

LibreOffice 5 was released today. Those who are used to only hear about the Microsoft Suite, well there exist other productivity suites out in the wild. LibreOffice is among them. It was forked from OpenOffice in 2010. Since then several Linux distributions bundled the LibreOffice Suite in their default install. LibreOffice is written in C++, Java and Python, and is available in 114 languages.

The LibreOffice 5 official package should be rolled out for the stable distros in the coming weeks, if not months. As for the curious who’d like to get hands dirty, just follow the article for a LibreOffice 5 installation. One thing, I’ve kept in the title openSUSE, Fedora and CentOS but the installation would cater for any RPM-based distribution. I haven’t tested the DEB archive but I guess it should be somewhat similar.

LibreOffice 5 installation

The tarball can be either downloaded by visiting the download page at libreoffice.org or from this mirror. Torrent links are available too. Once you have obtained the package LibreOffice_5.0.0_Linux_x86-64_rpm.tar.gz you uncompress it as follows:

tar zxvf LibreOffice_5.0.0_Linux_x86-64_rpm.tar.gz

The extracted files & folders include an installation script licensed under MPL v2. You may peek into if you’d want to know what it does.

Enter the directory that contains the install script and launch the installation as follows:

./install RPMS .

The second dot implies that it should be installed at the current path. Hit enter and the progress will be shown.

####################################################################
#     Installation of the found packages                           #
####################################################################

Path to the database:        /home/ish/Downloads/LibreOffice_5.0.0.5_Linux_x86-64_rpm/.RPM_OFFICE_DATABASE
Path to the packages:        RPMS
Path to the installation:    .

Installing the RPMs
Preparing...                          ################################# [100%]
Updating / installing...
   1:libreoffice5.0-ure-5.0.0.5-5     ################################# [  2%]
   2:libobasis5.0-core-5.0.0.5-5      ################################# [  4%]
   3:libobasis5.0-en-US-5.0.0.5-5     ################################# [  7%]
   4:libobasis5.0-writer-5.0.0.5-5    ################################# [  9%]
   5:libobasis5.0-base-5.0.0.5-5      ################################# [ 11%]
   6:libobasis5.0-impress-5.0.0.5-5   ################################# [ 13%]
   7:libobasis5.0-en-US-calc-5.0.0.5-5################################# [ 16%]
   8:libobasis5.0-en-US-writer-5.0.0.5################################# [ 18%]
   9:libobasis5.0-en-US-res-5.0.0.5-5 ################################# [ 20%]
  10:libobasis5.0-en-US-math-5.0.0.5-5################################# [ 22%]
  11:libobasis5.0-en-US-base-5.0.0.5-5################################# [ 24%]
  12:libobasis5.0-images-5.0.0.5-5    ################################# [ 27%]
  13:libreoffice5.0-5.0.0.5-5         ################################# [ 29%]
  14:libobasis5.0-math-5.0.0.5-5      ################################# [ 31%]
  15:libobasis5.0-draw-5.0.0.5-5      ################################# [ 33%]
  16:libobasis5.0-calc-5.0.0.5-5      ################################# [ 36%]
  17:libobasis5.0-pyuno-5.0.0.5-5     ################################# [ 38%]
  18:libobasis5.0-librelogo-5.0.0.5-5 ################################# [ 40%]
  19:libreoffice5.0-calc-5.0.0.5-5    ################################# [ 42%]
  20:libreoffice5.0-draw-5.0.0.5-5    ################################# [ 44%]
  21:libreoffice5.0-math-5.0.0.5-5    ################################# [ 47%]
  22:libreoffice5.0-dict-en-5.0.0.5-5 ################################# [ 49%]
  23:libreoffice5.0-impress-5.0.0.5-5 ################################# [ 51%]
  24:libreoffice5.0-base-5.0.0.5-5    ################################# [ 53%]
  25:libreoffice5.0-en-US-5.0.0.5-5   ################################# [ 56%]
  26:libreoffice5.0-dict-es-5.0.0.5-5 ################################# [ 58%]
  27:libreoffice5.0-dict-fr-5.0.0.5-5 ################################# [ 60%]
  28:libreoffice5.0-writer-5.0.0.5-5  ################################# [ 62%]
  29:libobasis5.0-ogltrans-5.0.0.5-5  ################################# [ 64%]
  30:libobasis5.0-postgresql-sdbc-5.0.################################# [ 67%]
  31:libobasis5.0-onlineupdate-5.0.0.5################################# [ 69%]
  32:libobasis5.0-ooofonts-5.0.0.5-5  ################################# [ 71%]
  33:libobasis5.0-filter-data-5.0.0.5-################################# [ 73%]
  34:libobasis5.0-kde-integration-5.0.################################# [ 76%]
  35:libobasis5.0-extension-javascript################################# [ 78%]
  36:libobasis5.0-xsltfilter-5.0.0.5-5################################# [ 80%]
  37:libobasis5.0-python-script-provid################################# [ 82%]
  38:libobasis5.0-ooolinguistic-5.0.0.################################# [ 84%]
  39:libobasis5.0-extension-report-bui################################# [ 87%]
  40:libobasis5.0-graphicfilter-5.0.0.################################# [ 89%]
  41:libobasis5.0-extension-mediawiki-################################# [ 91%]
  42:libobasis5.0-extension-beanshell-################################# [ 93%]
  43:libobasis5.0-extension-nlpsolver-################################# [ 96%]
  44:libobasis5.0-extension-pdf-import################################# [ 98%]
  45:libobasis5.0-gnome-integration-5.################################# [100%]

Installation done ...

If no errors occurred you should find a folder named opt created. This makes it easy if you want to move your LibreOffice 5 instance to the traditional /opt path. However, from the current path you can launch LibreOffice Writer as follows:

./opt/libreoffice5.0/program/swriter

LibreOffice 5 installation

You will get LibreOffice Writer, Calc, Base, Draw, Math and Impress with the following commands:

./opt/libreoffice5.0/program/swriter
./opt/libreoffice5.0/program/scalc
./opt/libreoffice5.0/program/sbase
./opt/libreoffice5.0/program/sdraw
./opt/libreoffice5.0/program/smath
./opt/libreoffice5.0/program/simpress

Otherwise, just shoot ./opt/libreoffice5.0/program/soffice and you get the LibreOffice 5 welcome screen with shortcuts to each application.

LibreOffice 5 installation


To have a clean setup, you could move the libreoffice5.0 folder to /opt and have some sweet symlinks. Let’s do it; stay on the current path and shoot:

sudo mv opt/libreoffice5.0 /opt
ln -s /opt/libreoffice5.0/program/swriter /usr/local/bin/writer

You could do for the rest, right? Now, press Alt + F2, type writer and hit the return button. LibreOffice Writer shoots up!

To my fellow non-Linux friendly folks, the free software community makes LibreOffice available for Windows and Mac OS X as well and installation is painless :)

The post LibreOffice 5 installation on openSUSE, Fedora, CentOS etc… appeared first on HACKLOG.

Tagged as: No Comments
24Jul/150

Installing Visual Studio Code on Linux (Ubuntu)

Posted by Jochen Kirstaetter

During this year's //build conference Microsoft officially announced a new member of the Visual Studio series called Code. As described by several people already it is a HTML5, JavaScript/TypeScript based text editor hosted inside the Electron shell and it runs natively on Windows, Mac OS X and Linux. This article gives you some ideas and assistance to get a better experience out of the package compared to the standard one - at least at the time of writing this article.

Getting Visual Studio Code

I started using Visual Studio Code since the first released version 0.1.0, and being part of the Insider Preview program for VS Code I managed to download and get the latest version always using this short-listed link:

http://aka.ms/vscode

Which is an alias for this web address: https://code.visualstudio.com/

Get the latest version of Visual Studio Code from the web site
Get the latest version of Visual Studio Code from the web site

Microsoft's web site of Code detects your operating system and directly offers you the best download option based on your current browser. I'm currently running Xubuntu 15.04 x64 - Vivid Vervet and the site offers me a direct link to get the latest 64-bit version of Visual Studio Code. In case that you'd like to download a different version please scroll down to the bottom of the site and check the additional options.

Note: Originally, I started using Code 0.1.0 on Xubuntu 14.10 and then upgraded my machine around mid of May. Also, on a different machine running Ubuntu 14.04 LTS I can confirm to use of Visual Studio Code successfully.

Unzip the archive

After you downloaded the latest ZIP archive for your architecture, here: VSCode-linux-x64.zip, you should decide where to extract the content of the compressed file. Well, in my case, I'd like to have third party products below the appropriate location, and therefore I usually choose /opt. Eventually you might ask yourself why? Well, here's a decent chapter about the Linux Filesystem Hierarchy written by The Linux Documentation Project (TLDP):

1.13 /opt

This directory is reserved for all the software and add-on packages that are not part of the default installation. For example, StarOffice, Kylix, Netscape Communicator and WordPerfect packages are normally found here. To comply with the FSSTND, all third party applications should be installed in this directory. Any package to be installed here must locate its static files (ie. extra fonts, clipart, database files) must locate its static files in a separate /opt/'package' or /opt/'provider' directory tree (similar to the way in which Windows will install new software to its own directory tree C:WindowsProgam Files"Program Name"), where 'package' is a name that describes the software package and 'provider' is the provider's LANANA registered name.

Looks good to me, or?

Anyway, let's just use this as base - given that you're root on the machine - it's surely a good choice, otherwise feel free to unzip the archive in your personal user space below your home directory. Next, let's extract the content as suggested using the console (or terminal in case that you'd prefer this term):

$ cd /opt
/opt$ sudo unzip ~/Downloads/VSCode-linux-x64.zip

This is going to create a new directory VSCode-linux-x64 which contains the static binary to run Visual Studio Code on your system. Right now, you would be able to launch the text editor by executing the following command:

/opt$ ./VSCode-linux-x64/Code

Despite some warnings and errors on the console output, similar to those:

[3437:0724/220852:ERROR:browser_main_loop.cc(173)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

Visual Studio Code is up and running...

Welcome screen of Visual Studio Code on first start of the text editor
Welcome screen of Visual Studio Code on first start of the text editor

Adding a little bit more comfort

Hopefully, you were able to launch Visual Studio Code based on the description given above. Now, let's add a little bit more comfort to your user experience. Unfortunately, there is no out-of-the-box installation package for the usual distributions - at least not yet, and we are obliged to do some manual steps. Following, I'm going to give you my steps with some brief explanations about the why and how. Of course, there are always multiple choices and you might either skip one or the other step or even have better suggestions. Please use the comment section at the bottom to give me your tips & tricks. Thanks!

Version-(in)dependent folder and symbolic link

Not sure about you but given the manual installation steps I would like to have a better control each time I consider to install a newer version of Code. Also, this helps to keep some adjustments on constant path information like Application launcher and shortcuts to run Visual Studio Code. Okay, let's dig into that and first rename (move) the base directory of Code to a version-specific one:

/opt $ sudo mv VSCode-linux-x64 VSCode-0.5.0

Again, as of writing this article 0.5.0 was the latest available version. Meanwhile, the are good chances that you might have a higher version already - good! Next, I usually create a symbolic soft link back to the newly renamed folder in order to stay version-independent. Sounds confusing, right? Hold on, I'll explain it in a short, and you will see the benefits, too.

/opt$ sudo ln -s VSCode-0.5.0 VSCode

Your current /opt folder look similar to this right now:

Extract the Visual Studio Code zip archive below /opt directory and create a version-independent symlink
Extract the Visual Studio Code zip archive below /opt directory and create a version-independent symlink

As you can see on the screenshot I've been using Code since the very beginning, and using this approach I am actually able to keep all versions installed side-by-side to each other. The only interesting part is the version-independent symlink in the /opt directory. This allows me to launch Visual Studio Code by executing the following line from anywhere:

/opt/VSCode/Code

Like using the Application Finder on Xubuntu while pressing Alt+F2:

Launch Visual Studio Code from the Application Finder with fully qualified path to executable
Launch Visual Studio Code from the Application Finder with fully qualified path to executable

The current situation gives us a good head start for further activities.

The power of PATH

Now that we have a "fixed" location for Visual Studio Code, it would be more comfortable to avoid to specify the full path information each time that we would like to launch the text editor. Also, looking to some of the cool command line options of Code on other platforms, it would be nice to have them as well on Linux. Okay, then let's do it using the PATH environment variable. The Linux Information Project has a good definition online:

PATH Definition

PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files (i.e., ready-to-run programs) in response to commands issued by a user. It increases both the convenience and the safety of such operating systems and is widely considered to be the single most important environmental variable.

That sounds exactly like what we are looking for. And in compliance with other operating systems, we are going to create another symlink for our purpose, like this:

~$ sudo ln -s /opt/VSCode/Code /usr/local/bin/code

Changing the letter casing of the executable from proper writing - Code - to lower case writing - code - isn't a typo actually.

Commonly, UNIX and Linux commands are written in lower-case writing anyway, so why should we break with this tradition? Of course, you will be able to launch the text editor now with this new path, too. Either on the console / terminal, like so

~$ code

or using the Application Finder - the choice is yours.

Launch Visual Studio Code from the Application Finder
Launch Visual Studio Code from the Application Finder

Thanks to the PATH environment variable we can now completely omit the path information. Linux knows where to find our executable now.

Application launcher in Main Menu

Being able to start Visual Studio Code anywhere from the console has already given us some comfort but compared to Windows and Mac OS X users we are still living in the digital stone age, and no application is fully installed on your Linux OS without an application launcher in your main menu. In Xubuntu you would open Application Menu (or press Alt+F1) - Settings - Main Menu in order to add a new launcher to the menu. In the menu editor select the Development section or any other where you would like to place the launcher and click on New Item to define the Launcher Properties. Eventually, you might like to enter the following on your machine:

Add a new item to the main menu for Visual Studio Code
Add a new item to the main menu for Visual Studio Code

Unfortunately, this leaves us with an empty icon for now. Quickly open a new terminal and switch to an existing one and let's see which graphics are provided by Microsoft, like so:

~$ find /opt/VSCode/* -type f -iname '*.png'
/opt/VSCode/resources/app/vso.png
/opt/VSCode/resources/app/client/vs/base/ui/scrollbar/impl/arrow-up.png
/opt/VSCode/resources/app/client/vs/base/ui/scrollbar/impl/arrow-left.png
/opt/VSCode/resources/app/client/vs/base/ui/scrollbar/impl/arrow-right.png
/opt/VSCode/resources/app/client/vs/base/ui/scrollbar/impl/arrow-right-dark.png
/opt/VSCode/resources/app/client/vs/base/ui/scrollbar/impl/arrow-left-dark.png
/opt/VSCode/resources/app/client/vs/base/ui/scrollbar/impl/arrow-down-dark.png
/opt/VSCode/resources/app/client/vs/base/ui/scrollbar/impl/arrow-down.png
/opt/VSCode/resources/app/client/vs/base/ui/scrollbar/impl/arrow-up-dark.png
/opt/VSCode/resources/app/client/vs/editor/diff/diagonal-fill.png
/opt/VSCode/resources/app/client/vs/editor/css/arrow-left.png
/opt/VSCode/resources/app/client/vs/editor/css/arrow-right.png
/opt/VSCode/resources/app/client/vs/workbench/contrib/daytona/TestPlugin/Resources/Images.png
/opt/VSCode/resources/app/client/vs/workbench/contrib/daytona/TestPlugin/Images/FileIdentifier.png
/opt/VSCode/resources/app/client/vs/workbench/contrib/daytona/TestPlugin/Images/icon2.png
/opt/VSCode/resources/app/client/vs/workbench/contrib/daytona/TestPlugin/Images/icon3.png
/opt/VSCode/resources/app/client/vs/workbench/contrib/daytona/TestPlugin/Images/icon1.png
/opt/VSCode/resources/app/client/vs/workbench/contrib/daytona/TestPlugin/Images/console-icons.png
/opt/VSCode/resources/app/client/vs/workbench/ui/parts/editor/media/letterpress.png
/opt/VSCode/resources/app/client/vs/workbench/ui/parts/editor/media/letterpress-dark@2x.png
/opt/VSCode/resources/app/client/vs/workbench/ui/parts/editor/media/letterpress-dark.png
/opt/VSCode/resources/app/client/vs/workbench/ui/parts/editor/media/letterpress@2x.png
/opt/VSCode/resources/app/node_modules/emmet/Icon.png

Alternatively, you might also have a look at the SVG graphics provided by Visual Studio Code.

I chose the vso.png and to simplify my life in regards of future upgrades and unexpected changes, I placed a copy of the graphic file into the usual location on a Linux system:

~$ sudo cp /opt/VSCode/resources/app/vso.png /usr/share/icons/

Hint: Use the Move option in the window menu to relocate the dialog using the arrow keys, and then confirm your selection with a click on the OK button of the dialog.

Your Main Menu editor might look like this now:

Visual Studio Code as proper entry in the main menu of Xubuntu
Visual Studio Code as proper entry in the main menu of Xubuntu

Congratulations, your new application launcher has been added to the menu and you can either navigate into the Development section (or the one you chose) or type your choice into the application quick filter textbox to find and execute Visual Studio Code.

Navigate the application menu to launch Visual Studio Code
Navigate the application menu to launch Visual Studio Code

Use the quick filter entry of the application menu to launch Visual Studio Code
Use the quick filter entry of the application menu to launch Visual Studio Code

Creating a Desktop Entry file

As we are working with Linux there are always multiple ways to achieve the same or similar result. And eventually you might prefer the possibility to create and use a file-based application launcher which adds itself to the menu structure automatically. Creating a .desktop file is not too challenging and requires a simple text editor - like Visual Studio Code ;-) - to write the following definition into it:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Visual Studio Code
GenericName=Integrated Development Environment
Comment=Code Editing. Redefined. Build and debug modern web and cloud applications.
Exec=code
TryExec=code
Icon=vso
StartupNotify=true
Terminal=false
Type=Application
MimeType=text/x-csharp;application/x-mds;application/x-mdp;application/x-cmbx;application/x-prjx;application/x-csproj;application/x-vbproj;application/x-sln;application/x-aspx;text/xml;application/xhtml+xml;text/html;text/plain;
Categories=GNOME;GTK;Development;IDE;

Save it as vscode.desktop and then put this file into the appropriate location for a Linux system:

~$ sudo cp vscode.desktop /usr/share/applications/vscode.desktop

Thanks to the proper location of the shared icon and the symlinks we created earlier, we do not have to specify any absolute paths in our Desktop Entry file. As soon as the file has been copied below the shared applications folder it automatically appears in your main menu and is ready to be used.

For your extra comfort you might like to download the vscode.desktop file. You will have to rename the file and place it accordingly on your system.

Make it a launcher to Cairo Dock

As for the different options of Ubuntu I have to admit that I'm a long-year user of the Xfce environment, called Xubuntu, and on top I also like using a flexible dock panel (or two or three). Cairo dock is a fantastic package in case that you would like to have a little bit of Mac OS X flavour on your Linux desktop, and adding a launcher for Visual Studio Code is very simply to do.

Add Visual Studio Code to a dock panel like cairo dock or similar
Add Visual Studio Code to a dock panel like cairo dock or similar

First, run Visual Studio Code using one of the previously described methods. Next, after the application runs and an icon of code appears in the dock panel right-click the icon, then select the sub-menu entry "Make it a launcher" from the "code" context menu entry and you're done. Close the text editor and the launcher will still remain in the dock panel.

Resume on installing Visual Studio Code

Without any question it is fantastic to have an identical text editor for all three major operating system. But Linux users are currently confronted with some lack of comfort compared to their Windows and Mac OS X friends. Although there are several and in my opinion easy ways to increase the user experience in using Visual Studio Code under Linux I'm a bit concerned whether Microsoft is keeping it on par to the other systems. Right now, installation takes some manual steps, there are essential parts missing in order to provide an excellent first contact and other editor features like automatic updates aren't yet available for the Linux variation compared to Windows and Mac OS X.

Bearing in mind that the product has been launched back in April/May this year only and we are currently on version 0.5.0, I am very interested in the future development. The documentation online has some neat features for you, and the team at Microsoft has an open ear to the feedback and wishes given on their UserVoice website, too.

That's all for the installation part of Visual Studio Code. Please leave your comments as well as tips & tricks for me.

Happy coding!

Tagged as: No Comments
18Jul/150

Ubuntu Jam at the University of Mauritius

Posted by Jochen Kirstaetter

Operating systems are simply tools to do a job...

And therefore, I have to admit that even though I use Microsoft Windows on a daily base to earn my living, I'm also using Linux since almost two decades on various machines. Together with different types of virtualisation I actually do not care whether an OS is running on bare-metal or inside a virtual machine. And given the computing power of recent machines it's not a question after all anymore. Given this little insight, let's directly hop into the Ubuntu Jam event from February 2015.

Saturday is usually the time the children are on tour with me and so why not take them to the University of Mauritius and have some fun together. Also, they know quite a number of folks of the Linux User Group of Mauritius, too. When we arrived at the campus it was actually simple to get a proper parking - just speak to the security guys around POWA, they are actually very friendly and willing to help. ;-)

Next, we had to look for those Linux geeks and penguins... Near the cafeteria they said, as if I know where the cafeteria is. Frankly, it was on our direct way to ask a group of students. Even though they gave us a strange but curious look, they were really glad to help and we managed to be around in time. Well, even too early... Anyway, enough time to get our gear in place. Even though that my dear son was more busy with his Nintendo DS than a Linux-driven laptop but hey that's absolutely fine. He's already geeky enough. Actually, later on - I don't know he managed it - he was gaming on someone else's Android smartphone.

Disclaimer: I won't be accountable for any hacks and root kit installations on your device that he's going to do!

So better keep your smartphone under your control. Anyway, it seems that the phone owner and my son had a good time checking out some gaming apps. This gave me a bit of liberty to show my older laptop running on Xubuntu 14.10, to answer a couple of Xfce4 related questions and to advertise the Developers Conference. Yes, I keep a git clone on that machine, too - actually running on different TCP ports on Apache and nginx simultaneously. Geeky style... 

Lots of hardware and software during the Ubuntu Jam - and the choice of tools covered a wide range...
Lots of hardware and software during the Ubuntu Jam - and the choice of tools covered a wide range...

Despite some light spray of rain, we had a great time during the Ubuntu Jam at the University of Mauritius (UoM)
Despite some light spray of rain, we had a great time during the Ubuntu Jam at the University of Mauritius (UoM)

Thanks to the vicinity of the UoM cafeteria it was a no-brainer to just get inside and grab some drinks and food for the lunch-break. Quite surprisingly, they also offer power drinks and other selections. Now, again well fed and still ambitious to handle Linux questions, I managed to get some exchange with Ish, Nirvan, Nadim, Pritvi and others regarding the organisation and ideas for the DevCon. Even though that there was a slight spray of rain, it seems that we all had a good time on the campus and I'm looking forward to attend the next Linux Jam - maybe then on openSUSE Leap or other distributions.

Tagged as: No Comments