Passion of Google Summer of Code

It was an epic moment when I was checking the accepted projects for Google Summer of Code. I typed my first name and searched through students. The page stuck “Loading…” I erased the last letter ‘r’, and typed it again to trigger the search once more. I literally closed my eyes, and prayed, and dared to open. There was a result, with my name. I couldn’t believe, so I repeated my last process: typed my name, closed my eyes, and opened again. It was not so much different the moment I was selected for internship at Pardus. I could not stop myself from smiling, and I was shaking, a lot! I was shocked, and constantly reminded myself to breathe. I hit the redial button on my phone, told my mom. I will remember that two and half minutes forever.
Continue reading “Passion of Google Summer of Code”

Install LESS on Ubuntu with npm

LESS is available on Ubuntu repositories as “node-less” package. However, as of writing this post, it is an old version (1.3.1) which contains lots of bugs, while a newer and more stable one (1.3.3) is available. And you can install latest LESS version with npm:

sudo apt-get install npm
sudo npm install -g less

Because the command name of the node.js is nodejs (instead of node) on Ubuntu, when the installation is complete, you need to change this first line of lessc command. Open /usr/local/bin/lessc with your favorite text editor (with root privileges), and change the end of the first line from node to nodejs.

--- lessc.old	2013-05-21 13:50:00 +0300
+++ lessc	2013-05-21 13:51:00 +0300
@@ -1,4 +1,4 @@
-#!/usr/bin/env node
+#!/usr/bin/env nodejs
 
 var path = require('path'),
     fs = require('fs'),

After saving the file, you can test if lessc command is available, and the correct version is installed.

which lessc
lessc -v

If you have any trouble, you can ask me on the comment section below.

VirtualBox, Shared Folders and Cache

I have recently set up a virtual server environment using VirtualBox for quick web development. Using shared folders feature, I wanted to avoid file uploads between VM host and guest. However, when I make request to an updated a file, server responses with the old version.

First, I cleared and disabled my browser cache. The result was the same. Second, I checked the file both on host and guest machines. Both were up to date, so the issue was about the server. Then I have made some experiments with expires headers, again, no luck.

I continued searching on the internet and found this blog post. Sendfile option is disabled by default on Nginx (see documentation), but apparently Ubuntu had turned it on with the configuration file on the package. You can turn it off by setting the flag off or commenting the line:

# sendfile on;
# or
sendfile off;

Sendfile is enabled by default of Apache. In order to turn it off, you can refer to the official documentation here.

IHS Telekom Parolanızı Görüyor

Uyarı: Bu yazı güncellemeler içermektedir. Son durumu yazının en altındaki güncellemelerden takip edebilirsiniz.

Her şey, tek kullanımlık şifrenin (TKŞ) çalışmaması ile başladı. Telefonum fabrika ayarlarına sıfırlandığında uygulamanın kullanıcı kimliği de değişmişti, bu yüzden ürettiği şifreler geçersizdi. Gayet doğal bir durum. Tek kullanımlık şifre sistemi bunun dışında da pek çok farklı sebepten de başarısız olabilirdi. Ancak IHS Telekom böyle bir senaryo için herhangi bir çözüm düşünmemiş gibi görünüyor. Ben de destek talebi oluşturarak beklemeye başladım.

Çok kısa bir süre içinde telefonla geri dönüş sağlandı ve kimlik doğrulama için benden bir takım bilgiler istendi. TC kimlik numaramı ciddi bir rahatsızlık hissederek söyledikten sonra (ki bu bilgi sistemlerinde kayıtlı değil), ilk ismim sistemlerinde kayıtlı olmadığı için kimliğimi başka yöntemlerle de doğrulamak zorunda olduklarını söylediler. Sistemde kayıtlı olan telefon hattı üzerinden görüşürken bu uygulama kulağa epey saçma gelse de, işleme devam ettim.

Sistemde kayıtlı olan e-posta adresimi de söyledikten sonra benden parolam da istendi, hem de çok doğal bir şeymiş gibi bir ses tonuyla. Bu talebi elbette reddettim. Bunun üzerine e-posta adresine erişimim olup olmadığı soruldu ve gönderilen iletinin içeriği ile doğrulama yapıldı. Tek kullanımlık şifre ile ilgili problemim çözüldü.

Fakat gelen ileti ile işler daha da ilginç bir boyut kazandı. Continue reading “IHS Telekom Parolanızı Görüyor”

Start VLC GUI on Remote Host Using SSH

When you connect a remote computer using SSH, and start a media file with VLC, audio plays at remote host and video (if exists, converted to ASCII) is transferred over SSH to local client, which is kinda cool, I think. If you want to start VLC with GUI on remote, the DISPLAY environment variable should be set correctly.

export DISPLAY=:0

Now when you run vlc command, it starts with GUI mode on remote computer. Moreover, if you want to launch it in full-screen mode, you may set -f flag.

vlc -f mediafile

A Month in High Performance Computing Center

It has been a month since I started working at National Center for High Performance Computing of Turkey. This center provides computing resources for scientific researches and R&D department of industrial companies.

I am a part time employer here, and truth to be told, I have no specific job description. I am obligated to run routine tasks, such as checking host and network status several times a day. I also answer emails and phone calls for technical support.

Fortunately that is only the partial of my job. Continue reading “A Month in High Performance Computing Center”

Google Play Port Number for Android Devices

An Android device contacts Google Play servers for several reasons, such as checking internet connectivity, push notifications and application installations triggered from web. These services will fail to operate if the Google Play ports are blocked in your network (mobile data, wireless, vpn).

If you are using a firewall and would like to allow (or block) these services, Google Play uses TCP and UDP 5228 port. You can refer to connectivity requirements page on Google Play Help for more information.

Buying A Nexus 4: The Adventure

Previous summer, I decided to buy a new smartphone. I set a price range for myself, and started searching the ultimate smartphone that suits my needs. I really loved what Sony did with their Xperia products. I made a pro/con list for several phones, and some of the features I considered was: USB on-the-go support, HDMI/MHL, NFC and size (it does matter). My final decision was Xperia Sola, and ordered one in July. The next day, I friend of mine from MIT asked me a favor, and offered to bring me something from US when she returns. I canceled my order for Xperia Sola, because I could buy Xperia P for the same price at Amazon.

On 29th of October, Google announced Nexus 4, in the same price range with Xperia P. All my thoughts had changed… Continue reading “Buying A Nexus 4: The Adventure”

Managing Gunicorn Processes With Supervisor

Last week, I have written a post about gunicorn applications. We started gunicorn manually, and our application worked. Yay!

However, everything is not so great. When (If) the server reboots, gunicorn must be started manually, again. We should find a way to automate this. Actually, there are few ways to accomplish this, such as: init scripts, and supervisord.

Init scripts are more than enough. But they have some drawbacks. They are not so easy to write or maintain. If you have several projects, things get even harder. Supervisord is a relatively easier way for managing multiple gunicorn processes.

Let’s start with installing supervisor:

sudo apt-get install supervisor

Supervisor uses configuration files for applications located in /etc/supervisor/conf.d/ directory. The configuration for our application is below:

[program:hello]
command = gunicorn hello:app
directory = /path/to/hello/
user = username

This is a very basic configuration required to run gunicorn. Since we are using virtualenv, we need to change “command” parameter to use python and gunicorn from our environment instead of global ones.

command = /path/to/virtualenv/bin/python /path/to/virtualenv/bin/gunicorn hello:app

Now we can test, whether our configuration works or does not. Reload supervisor with following commands and start our application. Stop gunicorn if it is running, and start it again with supervisor.

supervisorctl reread
supervisorctl update
supervisorctl start hello

Now gunicorn must be running, you can make sure by visiting page. If server reboots, supervisor starts it. If gunicorn fails, supervisor restarts it. Finally, everything is great!

You can find more information about supervisor configuration parameters in the documentation. You can also read my blog post about restarting and reloading supervisor.

Supervisord: Restarting and Reloading

Supervisord is a great daemon for managing application processes. However it does not have a reload option, and restart works different than we get used to. These command makes the following effects.

service supervisor restart

Restart supervisor service without making configuration changes available. It stops, and re-starts all managed applications.

supervisorctl restart <name>

Restart application without making configuration changes available. It stops, and re-starts the application.

If you create a new configuration. None of the commands above will make it available. If you want to apply your configuration changes in both existing and new configurations, start applications in new configurations, and re-start all managed applications, you should run:

service supervisor stop
service supervisor start

If you do not want to re-start all managed applications, but make your configuration changes available, use this command:

supervisorctl reread

This command only updates the changes. It does not restart any of the managed applications, even if their configuration has changed. New application configurations cannot be started, neither. (See the “update” command below)

supervisorctl update

Restarts the applications whose configuration has changed.
Note: After the update command, new application configurations becomes available to start, but do not start automatically until the supervisor service restarts or system reboots (even if autostart option is not disabled). In order to start new application, e.g app2, simply use the following command:

supervisorctl start app2