Monthly Archives: June 2013

The “Last Lecture”

Most of people I know doesn’t like lectures. I think I have been at 1000 lectures so far. 1 course = ~10 lectures per semester. During my undergraduate studies I had ~7 courses per semester, and 7 semesters. That is 10*7*7 = ~500. Another 500 is conferences, scientific groups meetings and Graduate School courses.

There is one lecture I like the most of them all. The “Last Lecture” by Randy Pausch. It is amazing, and I watch it every 1-2 years. I did it again today. Randy Pausch was a professor of Computer Science at Carnegie Mellon University. A month before giving the lecture, Pausch had received a prognosis that the pancreatic cancer, with which he had been diagnosed a year earlier, was terminal. Despite this, he didn’t lose optimistic life approach. His last lecture is about achieving childhood dreams and…you just need to see it! I promise: you won’t regret it!

The lecture took place at Carnegie Mellon on September 18, 2007. Randy Pausch died on July 25th, 2008. There is also a book written by him after worldwide success of the lecture (16 millions views on youtube).

The future of Mobile Apps

I think that in next 5 years Web Mobile apps will be more popular than classic Mobile apps we are using today.

Me, June 28, 2013

That is what happend in case of PCs. 10 years ago we were installing apps instead of just use them in the browser. Now we can edit Word documents, play games and even use IDE in Web Browser. I am not saying that it will be no classic Mobile apps at all, but e.g. apps like Calendar, gmail, Evernote, OneNote or games should be easilly accessible through Mobile Web Browser. The advantage of that would be lack of necessity to install bunch of apps.

What that means for developers? People who are currently working as Mobile Developers will need to learn Web Development. People who are currently working as Web Developers will need to learn Mobile Development. Additionally, future developers will not necessary need to know all different platforms (iOS, Android, WP), because they will be able to create apps in HTML5 and JavaScript (which should be well supported and compatible with Mobile Web Browsers in next 5 years).

This is my prediction. We’ll see what happens after 5 years.

Customize Terminal in Mac

Mac (UNIX) users use to be working with Terminal a lot. There is a few tips, which can make your life easier. First of all, if you are working on Mac – install iTerm2 and use it instead of standard Terminal. It is just more powerful. There is many features not available in standard Terminal. I find very useful the possibilities to search with CMD+F and copy entire path with double click by mouse (when you double click in standard Terminal it copies only one word). Another cool thing is ‘split terminal’ view. You can have multiple panes in one window.
iTerm2 - multipane

Second improvement to work faster is creation some aliases for commonly use commands. E.g. ls, clear or la -ls. You might also want to customize command prompt. I don’t like the standard one with Machine and user name (I always know in which Machine I am, and which user I am using – in case of doubts I can use whoami). To do add aliases and change default command prompt you need to modify your ~/.bashrc file. There is my .bashrc:

alias dir='ls -lap'
alias l='ls'
alias p='pwd'
alias c='clear'
alias o='open'
alias tree="ls -R | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e '\s/^/   /' -e 's/-/|/'"
export PS1="[\W]$ "

Here you can find a list of various options to customize your command prompt.

To load this settings automatically each time you run Terminal, you also need to add below command to ~/.profile file:

source ~/.bashrc

After above improvements my terminal looks like that:


Hint: when you are playing with your command prompt (or aliases), you can simple run command source ~/.bashrc from terminal to check the result of changes you made.

And of course I use black terminal with green font color.

We are Hackers

.NET Developer on Mac

I am PC person. I have never used Mac until I start my work as Research Assistant in SAnToS lab (Kansas State University). Now I am using it almost half year and I would like to summarize my experience.

I am using MacBook Pro (i5 2.4GHz, 8GB RAM and 128GB SSD) with Mac OS X 10.8 Mountain Lion.

MacBook Pro

First of all, I noticed missing features (which are available on PC/Windows):

  • Click on app icon in dock (dock is equivalent to taskbar in Windows) does not hide application. It can only move the app to the top. The only way to hide the app is to click minimize button.
  • Lack of good alternative for Total Commander, which is not available on Mac. There is muCommander (no tabs) and double commander (less functional), but both are way behind TC.
  • No Shift-Delete to permanently remove files. You need to move them to trash first, and then empty the trash.
  • No ‘cut’ in context menu (after right click). To have this luxury you need to install e.g. Total Finder (beyond the ‘cut’ option it also provides the possibility to have tabs and some other useful features).

Now, a few differences between Mac OS and Windows:

  • The default file manager is called Finder instead of Explorer.
  • In general, when you would use CTRL+KEY in Windows, then in MacOS you need to use CMD+KEY.
  • To change file name you need to click RETURN(ENTER) instead of F2(in Windows).
  • To open the file you need to click CMD+O, instead of ENTER (in Windows).
  • DELETE key is working like PC’s RETURN (delete character on the left side of the cursor).
  • Instead of HOME key you have CMD+LEFT_ARROW, and instead of END key – CMD+RIGHT_ARROW.

I use OneNote a lot. One of my favorite features is WIN+S, which allows me to make a screenshot of selected area in desktop. On Mac OS this feature is provided along with the operating system. CMD+SHIFT+4 saves the photo into Desktop, and CMD+OPTION+SHIFT+4 saves it into clipboard. Very useful feature. However I think Apple should consider to create some two-key shortcut like CMD+4 or CMD+F4, because clicking 4 keys in the same time is quite a challenging.

Another nice feature is possibility to use country specific letters like ę, ń, ś, ć, ä, ö even when you have english version of the system. You just need to hold the key and then there is small tooltip showing possible special letters. You can choose the letter with mouse or using keyboard (by picking the number).

MacBook special letters

The last thing I would like to mention is my favorite: the trackpad (touchpad). It is just awesome! Maybe it is not strict part of operating system, but the gestures are implemented in it. You can see the demo of the gestures here. The MacBook Pro trackpad is also well made. Much better than touchpad in all notebooks I have used before.

When you are working on Mac, you use Terminal a lot (when you are developer). In that case it will be nice to have ‘Open Terminal here’ option in finder, which open the Terminal in directory you have clicked on. That is just my wish to Apple 🙂

I think it took me about a month to become comfortable with using Mac.

EDIT: There is one more nice feature I just find out: you can past text without formatting by clicking CMD+ALT+SHIFT+V. And again…4 keys in the same time. But in this case I can’t push them all with one hand 🙂 Maybe CMD+SHIFT+V would be more user friendly?

Python jump start

In my current job (Research Assistant at SAnToS lab) I had to learn Python. I was very happy because of that. It gaves me an opportunity to get familiar with one of the most popular programming languages nowadays.

I was very lucky to find awesome Google’s Python Class by Nick Parlante. It is great! If you want to start programming with Python or just learn it for fun, start with this tutorial!

As a supplement to above course you can read some more detailed tutorial. I went through two: Learn Python The Hard Way and Tutorial from Python documentation. However if you already know some other programming language(s), your should learn during development. Python contains almost all common features of programming languages such as if/else, loops, exceptions, functions, classes etc. I said ‘almost’, because there is e.g. no switch instruction. However to check things like that there is very well written documentation. It contains a lot of examples. The main difference between other popular languages like (C, C# or Java) and Python is that there is no semicolons. We use colons and indentation instead.

if number > 0:
  print "This is natural number."
  print "This is not natural number."

Python is dynamic, strongly typed programming language. It means type checking occurs during the run time, instead of compilation time. Programming in Python is a real pleasure. Sometimes you can explicitly put your mind into the code. That is because of high level of abstraction. E.g. file operations are so simple and intuitive. You do not need to remember any StreamReaders or BufferedReaders and bunch of functions for simple I/O operations. Below example reads content of file.

f = open('file.txt')

Cool feature is the possibility to call functions explicitly on string. Like that:


There is a lot of implemented (widely used) functions in Python. As a comparison, let’s see how to reverse words in a sentence using C, Java and Python.

In C:

void reverse_words(char *sentence)
   char *start = sentence;
   char *end = sentence;

   while (*end != '\0') {

   reverse_chars(start, end);
   while (*start != '\0') {
      for (; *start != '\0' && *start == ' '; start++) ;
      for (end=start; *end != '\0' && *end != ' '; end++) ;
      reverse_chars(start, end);
      start = ++end;

void reverse_chars(char *left, char *right)
   char temp;

   while( left < right) {
      temp = *left;
      *left = *right;
      *right = temp;

In Java:

public string ReverseWords(string sentence)
  string[] words =  sentence.split(" ");
  string rev = "";
  for(int i = words.length - 1; i >= 0 ; i--)
    rev += words[i] + " ";
  return rev;

In Python:

def reverse_words(sentence):
  return " ".join(reversed(sentence.split(" ")))

That’s why Python is good for Rapid Development.

I am also using PyGTK (graphic library for Python) in my work. There is a great tutorial Python GTK on youtube! PyGTK requires very less code than e.g. C# to create some simple application. We do not to have tons of generated code when we start. We create application from scratch. Look at below Hello World example.

import pygtk
import gtk

class HelloWorld:
    def hello(self, widget, data=None):
        print "Hello World"

    def destroy(self, widget, data=None):

    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
        self.button = gtk.Button("Hello World")
        self.button.connect("clicked", self.hello, None)

    def main(self):

if __name__ == "__main__":
    hello = HelloWorld()

The result is the window with button ‘Hello World’. When you click the button, then ‘Hello World’ will be printed on console. All of that with 22 lines of code (I do not count white lines).

Hello Python

If you don’t know python yet, I encourage you to try it. Programming in python requires a little bit different way of thinking. It also allows you to look at the programming from the different perspective.

Python installation is easy on all operating systems and you can find it in google. To install PyGTK in Windows you can use all in-one installer. There is also all-in-one installer for Mac. PyGTK is included in most Linux distributions, so you won’t need to install it if you are using Linux.