.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."
else:
  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')
f.read()
f.close()

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

"jakub".upper()

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') {
      ++end;
   }
   --end;

   reverse_chars(start, end);
   
   while (*start != '\0') {
      for (; *start != '\0' && *start == ' '; start++) ;
      for (end=start; *end != '\0' && *end != ' '; 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;
      ++left;
      --right;
   }
}

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
pygtk.require('2.0')
import gtk

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

    def destroy(self, widget, data=None):
        gtk.main_quit()

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

    def main(self):
        gtk.main()

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

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.


Tech Ed North America 2013

In June 3 – 6, there was Tech Ed North America conference in New Orleans. The videos are available on channel9. I have watched a few very good sessions, and I can recommend you especially 5 of them.

Live Demonstration: Hacker Tools You Should Know and Worry About (Hasain Alshakarti and Marcus Murray)

This is my favourite session. You can learn about various security tools. They show things we should be aware of.

APTs: Cybercrime, Cyber Attacks, Warfare and Threats Exposed (Hasain Alshakarti and Marcus Murray)

Another session. Now in enterprise point of view. They discussed techniques how companies are getting hacked.

Adventures in Underland: What Passwords Do When No One Is Watching (Paula Januszkiewicz)

This session shows that our passwords are not 100% secure when stored in Windows.

Hackers (Not) Halted (Paula Januszkiewicz)

Session about most common mistakes, which can be used to hack you.

Microsoft ASP.NET, Web, and Cloud Tools Preview (Damian Edwards)

General overview and new enchancements of Web Tools and Features in .NET.

There was NDC conference in Oslo, in last week (June 12-14), but Videos are not available yet. The next big thing is build 2013 in San Francisco, June 26 – 28.


Studying in the USA

Studying in United States is a way different than in Poland. In October 2008 I started Bachelor of Science at Wroclaw University of Technology (Poland). In Fall 2011 I was exchange student at the Kansas State University (USA). After that I camealt back and graduated at WUT (Wroclaw University of Technology) in January 2012. Then I started Master of Science (in English) and I also applied for Master program at the KSU (Kansas State University) and UA (University of Arizona) for Fall 2012. I was admitted to both Universities, but I didn’t get assistantship offer (to be Teaching Assistant or Research Assistant). Everybody knows that studying in USA is pretty expensive, but not when you have assistantship. Then department is paying for your tuition and you have salary/scholarship, which enables you to cover living expenses (such as rent apartment, food etc.). However I got an RA (Research Assistant) offer from KSU in July and finally started Master program in Spring 2013 (because it was too late to make VISA related issues done before Fall 2012).

In USA there are Fall and Spring semesters. Fall starts usually in the middle of August and ends in December before Christmas. Then there is winter break till middle January. After that Spring semester starts, and it ends in mid-May.

Kansas State Campus

One of my friends (who got PhD at KSU) said that the difference between KSU and WUT is that KSU gives you real opportunity to learn something: it is easier to get good grades but it is also easier to learn a lot. I agree in 100%. The standard amount of classes for Undergraduate student (Bachelor degree) is 15 credit hours (30 ECTS), which is about 5 courses (usually one course has 3 credits). At WUT sometimes I had 10 courses. The standard amount for Graduate Student (Master or PhD) is only 9 credits (3 courses). It is not because it is easier, but courses are more time consuming. That is because there is much more to learn than in typical 6 ECTS course in WUT. Usually Master Student is also TA (Teaching Assistant) or RA (Research Assistant), which means additionally 20 or more hours. Last semester I took one class, which consumed about 10 hours (excluding classes) per week for me (you can find estimated work amount here). It is like 2 hours every day, and I had two more classes and research. As a reward I learnt a lot.

Another difference is that there is no strict list of courses you need to take. In Poland, all students from the same major has the same classes (only in last two semesters you can choose specialty but you still have the same classes with ~40 people). In USA, student choose courses on his own. There are minimum requirements, but usually you have a choice to pick one of a few proposed courses to satisfy one area requirement. You can find a degree requirements for Master degree in my department here.

Kansas State Campus

Sometimes in WUT it is enough to study only one day before exam (if there is no laboratory or tutorials for that course). Here in USA it is impossible. You need to study every week, because of homeworks, quizes, required reading etc. In some courses there are quizzes in every week. Additionally ‘quiz’ not necessarily means ABCD. In my department it is always open-question test. The 90% of International students coming here for exchange from Europe, after two weeks says: “In last two weeks I was that busy like in finals week at my University”. In last semester, the day before semester start I received an email that I have a quiz in my first class and I need to be prepared for it (by reading given materials).

In USA everybody cares about studying. Students are not playing games during the lectures. Even when lecture is not obligatory, almost everybody is there and they interact with instructor a lot.

Disclaimer: All information given above are based on my personal experience. Everything can be different depends on the University, Department and even course you take.


Developer mouse

When you are looking for a good mouse, you always find lists of ‘top mouses for gamers’. However good mouse is also very important for developers. People who spend most of their time on computer. Usually we use various of applications and moving between them is like playing Call of Duty. When you want to click maximize button in VirtualBox or VMWare and you hit close instead, you are dead (VM start closing). You need to start your mission over (run the VM again). Some developers have problems with their hands (pain) caused by mouse use. It is good to invest some money in mouse instead of buying the cheapest or random one. However I have never spend on mouse more than $30. I tried various types of cheapest ones and medium-price.

A4Tech SnakeX-750BFRazer SamlosaLogitech M100

Five years ago I made one of my best purchase: A4-Tech XL-750BF. I paid about $20. It was very good mouse in the notion of precision and comfort. I like to have high DPI. This mouse has 6 modes: 600-800-1200-1600-2000-2500 DPI (adjustable by a little key on top). I use to work on 2500 DPI. Unfortunately, after 3 years the left key broke down. Not completely though, but when I was dragging items, sometimes they were dropped when key was still pushed (instead of MOUSE_DOWN I had MOUSE_DOWN-MOUSE_UP-MOUSE_DOWN sequence).

Then I decided to invest in better brand and I bought Razer Salmosa. I found good deal on eBay for ~$25. It was quite good, but too small for my hand, and not that comfortable as A4-Tech was. This mouse was good for less than 2 years. Then (again!) left button broke down. Maybe I am not using it appropriate?

A4Tech OscarX-748K

After that I thought my next mouse’s left button will probably be broken too after some time and I decided to buy the cheapest Logitech: M100 ($7 on eBay). It is good mouse, but only if you do not have any other. A few weeks after purchase I found new A4-Tech: X-748K. It had good reviews and I decided to buy it. And again A4-Tech becomes very good choice. I paid $20 and I love this mouse! It has also 6 DPI modes (like X-750BF): 600-800-1200-1600-2400-3200. It fits perfectly to my hand and is nice in touch. The slightly rough surface is very cool. I am using it almost three weeks and it’s working fine. It is the best mouse I have ever use. We’ll see how long it lasts 🙂