Sunday, May 1, 2011

Why I started to use Windows and Ubuntu again and dumped mac os x

I have been using Windows for many years, and same goes for Ubuntu.

In between, some of my co-workers at different companies have touted about Mac. So when my boss offered to give a Mac Pro desktop, I was excited. But after struggling with Mac for one month, I gave up.

I think Mac, Windows and Ubuntu are great operating systems in their own ways. It just what fits your needs. It's just some people like mangoes, some people like apples, and some people like grapes or strawberry.

I am writing here why Mac didn't fit my needs, so that in future if one of my co-worker tried to brain wash me, I can look at this list and see if situation have improved.

Since the production environment at my company is Linux, for development work, a Linux distribution makes much more sense. Although Mac OS is supposed to be Unix, it is case-insensitive, and if you turn it into case-sensitive by reformatting hard disk, remember many applications on Mac will not work. Moreover, Unix is not Linux; When I work on a Linux, I feel at home, when I work at any Unix variation like FreeBSD and all variations of BSD, HP-UX, Solaris, Mac OS etc, it does not feel home because their is subtle difference in the utilities and their various options. On Windows, Cygwin does come with the same utils which are available on Linux and tried to give same files system as a Red Hat Linux, but somehow I don't feel at home in Cygwin also, because installing application in Cygwin is not as good. And even in Linux distributions, I think Ubuntu is ahead of the crowd. Conclustion - use Ubuntu for work-related development.


Here I will list some of the basic functionality which I couldn't find in Mac os x. Apple has money and has lot of smart people, so obviously these deficiencies (if you call them) are not because they can't do, it is because Apple and its management is arrogant.

1. Fast switching between windows. This is a big deal for me. When I work, most of the time I will be switching between two windows (may be one browser and one editor; or may be a two terminals; or may a browser and a terminal). All modern operating systems except mac os x support this with quick Alt+Tab. In mac os x, Alt+Tab switches between applications (which I found useless), where it will bring all the five windows of an application in the front (and probably the window in which you were interested hidden among those five windows). This is a huge huge blocker. I don't like to use the mouse to switch between windows - that's too slow. In general you can use Alt+Tab to switch to any windows in Ubuntu and Windows. On mac os x, it switches between applications and then u can use Alt+` to switch to the desired window...pretty painful. Thanks to the arrogant Apple!

2. Weird Maximize and Minimize. How do you maximize a window to cover the whole screen in mac os x? You can't. The maximize button is totally unpredictable, and it varies with the application (it is to the application to decide on what it wants to do on clicking maximize button). And when you minimize, it goes off from the Alt+Tab list and you have to use mouse to get it.

3. Keyboard customization - does not allow you to customize keyboard. I want to use keyboard to move window, resize window, maximize window, minimize window. Well good luck with that on mac os x. Apple wants you to use mouse for all of these activities... remember mac os x is about looking beautiful and not about usability or efficiency or productivity.

4. To resize a window, the only way to do that is to use the right bottom corner. I like it that you can resize from all four sides of a window which all modern operating systems except mac os x support. Again it is Apple's arrogant behavior is working.

5. Customization. I want to change the whole theme on Mac OS X, but there are limited choice. The default one looks good, but from productivity point of view it is very inefficient. Since everything is gray and different shades of gray, it takes a bit of time to figure out the boundaries of different windows. In general I like to have contrasting colors for title and border around a window, so it is easy to see which content belong to which window. Again, apple prefers looking good over functionality.

6. In general, I found that if you want to do something on a mac which steve jobs does not do, then you have to really do lot of hacks around. It has been made for steve jobs and if you can live with that, then you are good.

7. Apple hardware comes with its own proprietary ports to work with other apple hardware. If you want to keep a hardware device in the middle of other devices, it will become a pain the ass. A simple example is that it comes with a mini display port which means if you want to connect an extra monitor, you have to get an adapter, if you want to connect it to a projector, you have to carry an adapter.

8. I use visual studio and C#. And really not planning to learn Apple's crap objective C.

I also read about how Microsoft is involved in many programs in fighting poverty and helping in times of natural disasters. While Apple is involved in none. That itself told me to give my money to Microsoft instead of Apple.

Thanks to many of you who use Apple products may be just because it looks nice or may be you want to show off. Because of you, Microsoft gets incentive to be ahead in the game which ultimately improves my life and many other people who like Microsoft and its products.

Currently I use Windows as primary desktop and Ubuntu in a virtual machine. Ubuntu is still lacking when it comes to entertainment. So I use Ubuntu only for work-related development.


Saturday, August 7, 2010

Why I don't use Hotmail or Microsoft Windows Live Mail...

First of all, Microsoft sux big time... instead of calling "Hotmail" or "Live mail" or "Microsoft mail", it is called "Microsoft Windows Live Mail"... sux big time.

I just went to mail.live.com and tried to login...
It does not use HTTPS even for login. It is worst than Yahoo email!!!
There is a small link at the end of the page in tiny fonts "Use enhanced security(SSL)".

In 2010, why login page is not secure????

I replaced HTTP with HTTPS in the inbox screen, and got "connection timeout" message.

Both Microsoft mail and Yahoo mail attach advertisement at the end of each email you send from those accounts, how are you supposed to send professional emails from their account? These companies are just pathetic!

I can't tolerate Yahoo mail or Microsoft mail...
These companies are 10 years behind in terms of security, features, and user experience.

I wish these two companies would have merged together back in 2006 and died together.

Microsoft mail is for absolute fools and totally illiterate people...

Why I no more use Yahoo Mail

Ten years back, yahoo was best!
I used to use Yahoo for everything...and it had a wide variety of services - email, news, groups, photo, calendar, ...

But with today's standard it is pathetic.

I was using Google for search since 2000, so when I got an opportunity to get a gmail account in 2004, I didn't waste a minute. But it was in 2006 when I finally moved to gmail as primary email account. And after that the gap between gmail and yahoo mail has widened a lot.

As of today, Aug 7, 2010, there is no way to access emails in my yahoo inbox securely. Gmail has been offering this for years. Let me just put the facts...

Yahoo Mail:
1. Secure Login to desktop browser : always - good
2. Secure Access to emails on a desktop browser: not possible - sux big time
3. Secure Login to mobile browser (iphone safari): not possible - sux big time
4. Secure Access to email from mobile browser: not possible - sux big time
5. Iphone mail client secure login: not possible - sux big time
6. Iphone mail client secure access to emails: not possible - sux big time

Gmail:
1. Secure Login to desktop browser : always - good
2. Secure Access to emails on a desktop browser: always - good
3. Secure Login to mobile browser (iphone safari): always - good
4. Secure Access to email from mobile browser: always - good
5. Iphone mail client secure login: always - good
6. Iphone mail client secure access to emails: always - good

Of course, there are more than one hundred reasons other than those listed above why I no more use yahoo mail. Like...
  • No distracting ads: gmail yes, yahoo sux
  • No flash ads: gmail ys, yahoo sux
  • More space for emails: gmail yes, yahoo sux
  • No ads on email front page: gmail yes, yahoo sux
  • More space for your emails in the browser: gmail yes, yahoo sux
  • Fast web client: gmail yes, yahoo sux
  • No clunky web interface: gmail yes, yahoo sux
  • Simple interface: gmail yes, yahoo sux
  • Check email in outlook: gmail yes, yahoo sux
  • Forward your emails to other account: gmail yes, yahoo sux
  • Access emails using POP3 and IMAP: gmail yes, yahoo sux
  • First one to give GBs of space and keep updating UIs: gmail yes, yahoo sux
  • Does not attach ads at the end of the email: gmail yes, yahoo sux
Yahoo mail is a big time sucker...

Yahoo mail is for fools and illiterate people...

Saturday, April 3, 2010

A good post on building web apps for iphone

http://building-iphone-apps.labs.oreilly.com/ch02.html

Saturday, March 27, 2010

C/C++ Debugging in Visual Studio 2010

This is a great resource:

http://www.highprogrammer.com/alan/windev/visualstudio.html

Cygwin/X gvim font problem

Gvim under cygwin/X was looking weird with tiny font.

I added following line in .gvimrc file and it solved the problem:

set guifont=Lucida\ Sans\ Typewriter\ Semi-Condensed\ 12

Sometimes even that gives ugly text, then try this (which is not that good, but better than others):

set guifont=LucidaTypewriter\ 13

This one looks much better:

set guifont=Bitstream\ Vera\ Sans\ Mono\ 13

Terminals for Cygwin

Following terminals don't need X server:

1. Cmd - the default where bash, or zsh shell runs in the Windows Command Window. The biggest problem with this is you can't stretch it horizontally without going into options. CTRL+Z does not work.

2. mintty - this is so far best for me. good font size, cut-n-paste, color controls, stretchable in all directions. It is based on putty. CTRL+Z works!

3. puttycyg - I haven't tried.


Terminals which need X server:

1. xterm - no scrollbar, no cut-n-paste, font too small.

2. rxvt - no cut-n-paste, font too small.

3. urxvt - no cut-n-paste, font too big.

Zsh: _main_complete: function definition file not found

If you get an error similar to this one:

zsh:5: _main_complete: function definition file not found

then check for the value of FPATH or fpath and make sure the paths in those variables are valid.

Cygwin: Unable to remap

If you try to launch cygwin processes (for example, zsh) and you get this error:

24295 [main] zsh 3104 C:\cygwin\bin\zsh.exe: *** fatal error - unable to remap C:\cygwin\lib\zsh\4.3.2\zsh\zle.dll to same address as parent(0xAB0000) != 0xC10000 12 [main] zsh 2020 fork: child 3104 - died waiting for dll loading, errno 11

Then follow the following steps:
1. Make sure rebase package is installed (use cygwin setup utitlity)
2. Exit all cygwin processes. Verify in Task Manager that there are no cygwin processes running.
3. Run 'cmd' from the run menu (Windows Key + R). Go to the cygwin bin directory and run ".\ash.exe".
4. Run "./rebaseall". This will take some time.

Friday, March 19, 2010

Change default settings of a Microsoft Word document

Microsoft Word 2007

To change any default settings of a new document, change the default template located here:

%APPDATA%\Microsoft\Templates\Normal.dotm

Open in Microsoft Word and save it back. If it gives error, then save it Normal1.dotm and use Windows Explorer to rename it back to Normal.dotm.

Wednesday, March 17, 2010

More date and day functions


#include "stdio.h"
#include "stdlib.h>"
typedef enum DayOfWeek_ {SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY} DayOfWeek;

// Returns 1 for a leap year, otherwise 0
int isLeap(int year)
{
int leap = 0;
if(year % 4 == 0) {
leap = 1;
if(year % 100 == 0) {
leap = 0;
if(year % 400 == 0) {
leap = 1;
}
}
}
return leap;
}

int dateToInt(int year, int month, int dayOfMonth)
{
static int cumDaysInMonth[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
int num = (year - 1) * 365 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400;
num += cumDaysInMonth[month-1] + dayOfMonth;
if(isLeap(year) && month >= 3)
num++;
return num;
}

int diffDate(int y1, int m1, int d1, int y2, int m2, int d2)
{
int num1 = dateToInt(y1, m1, d1);
int num2 = dateToInt(y2, m2, d2);
int diff = abs(num2 - num1);
printf("Diff days (%d, %d, %d) - (%d, %d, %d) : %d\n", y1, m1, d1, y2, m2, d2, diff);
return diff;
}

char *getDayOfWeekName(int dayOfWeek)
{
switch(dayOfWeek) {
case 0: return "SUNDAY";
case 1: return "MONDAY";
case 2: return "TUEDAY";
case 3: return "WEDNESDAY";
case 4: return "THURSDAY";
case 5: return "FRIDAY";
case 6: return "SATURDAY";
}
// Error condition
return "ERROR";
}

int getDayOfWeek(int year, int month, int dayOfMonth)
{
int num = dateToInt(year, month, dayOfMonth);
int dow = num % 7;
printf("DayOfWeek (%d, %d, %d) : %s\n", year, month, dayOfMonth, getDayOfWeekName(dow));
return dow;
}

void printMonth(int year, int month)
{
static int daysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
static char dayChars[7] = {'N', 'M', 'T', 'W', 'H', 'F', 'S'};
int firstDow = getDayOfWeek(year, month, 1);
int i;
int dm = daysInMonth[month-1];
if(isLeap(year) && month == 2)
dm = 29;
for(i = 0; i < dm; i++)
printf("%3d", i+1);
printf("\n");
for(i = 0; i < dm; i++)
printf("%3c", dayChars[(firstDow + i) % 7]);
printf("\n");
}

int main()
{
printMonth(2010, 3);
printMonth(2000, 5);
printMonth(2203, 5);
getDayOfWeek(2010, 4, 20);
getDayOfWeek(2000, 8, 19);
getDayOfWeek(2203, 10, 5);
diffDate(2203, 11, 13, 1923, 5, 6);

return 0;
}

Tuesday, March 16, 2010

Converting a date to dayOfWeek

Here is the full code in C


#include "stdio.h"

typedef enum DayOfWeek_ {SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY} DayOfWeek;

// month is 1 to 12
int getDayOfWeek(int year, int month, int dayOfMonth)
{
int m[12] = {4, 0, 0, 3, 5, 1, 3, 6,2, 4, 0, 2};
int dayOfWeek = ((year-1) * 5 / 4 - 5) + m[month-1] + dayOfMonth;
int leap = 0;

if(year % 4 == 0) {
leap = 1;
if(year % 100 == 0) {
leap = 0;
if(year % 400 == 0) {
leap = 1;
}
}
}
if(leap && month >= 3)
dayOfWeek++;

return (dayOfWeek % 7);
}

char *getDayOfWeekName(int dayOfWeek)
{
switch(dayOfWeek) {
case 0: return "SUNDAY";
case 1: return "MONDAY";
case 2: return "TUEDAY";
case 3: return "WEDNESDAY";
case 4: return "THURSDAY";
case 5: return "FRIDAY";
case 6: return "SATURDAY";
}
//
return "ERROR";
}

int main()
{
printf("dayOfWeek(2000, 3, 17)=%s\n", getDayOfWeekName(getDayOfWeek(2000, 3, 17)));
printf("dayOfWeek(2000, 1, 15)=%s\n", getDayOfWeekName(getDayOfWeek(2000, 1, 15)));
printf("dayOfWeek(2010, 3, 17)=%s\n", getDayOfWeekName(getDayOfWeek(2010, 3, 17)));

return 0;
}




Enjoy

dosbox and qbasic on ubuntu

sudo apt-get install dosbox
wget http://download.microsoft.com/download/win95upg/tool_s/1.0/w95/en-us/olddos.exe
dosbox
mount c /home/username/QBasic/
C:
QBASIC


1) Go into DosBox, type:
Z:\>config -writeconf dosbox.conf
and hit enter.
2) Exit DosBox, and open the dosbox.conf file that is now in the dos folder you just created.
3) Go to the very end and add:
mount c ~/dos


References:
  • http://ubuntuforums.org/showthread.php?t=608535
  • http://lovehateubuntu.blogspot.com/2008/04/dosbox-on-ubuntu.html

Thursday, March 4, 2010

Gmail Trick: multiple email addresses for the same account

Did you guys know that your one gmail account has infinite number of equivalent email ids? For example all of the following email addresses represent the same email account:

hundred.........THREADS+second100@gmail.com
hundredthreads@gmail.com


Here are the rules:
1. Dots are ignored.
2. It is case-insensitive.
3. Anything after a + sign is ignored.

Gmail rocks!

Monday, March 1, 2010

zsh completion system broken for subversion/svn

I get this error:

% svn add
_arguments:comparguments:303: invalid argument: ARG


Here is a fix for this:
https://bugs.launchpad.net/ubuntu/+source/zsh/+bug/279545

The solution from the above link is:
The problem is in the subversion function file which I found in /usr/share/zsh/4.3.4/functions on my system. The minimal fix is to replace every occurrence of "/ arg/:arg:" with "/ (arg|ARG)/:arg:" in /usr/share/zsh/4.3.4/functions/Completion/Unix/_subversion; see attached patch.

Copy this file to ~/.zsh/functions and modify the file.

Also in .zshrc add the following line:
fpath=($HOME/.zsh/functions /usr/share/zsh/site-functions /usr/share/zsh/4.3.4/functions)

Cracking Programming Interviews

Whether you are applying for internship or part time job or full time job, you need to do some practice before you go for phone interview or on-site interviews.

Here are some of the resources for cracking programming interviews:

Basic
Intermediate

Adavanced

- One Object Language - C++, Java or C# and its design patterns
  • For Java: Effective Java 2nd Edition

- Computer Networks (4th Edition) (Hardcover) ~ Andrew S. Tanenbaum
  • Distance vector .vs. dijkstra’s algorithm.
  • Count to infinity problem.
  • TCP internals: congestion detection, control, sliding window, cumulative acks, etc.
  • What is IP tunneling?
  • When you type "www.google.com" on your browser : what all happens under the hood ? What are the various hops and translations that happen?

- Modern Operating Systems (3rd Edition) (Hardcover) ~ Andrew S. Tanenbaum
  • Scheduling algorithms
  • Paging algorithms/concepts
  • Multi-threaded programming: deadlock detection .vs. avoidance.
  • how to implement semaphore using mutex ?
  • reader/writer problem
  • producer/consumer problem

- Computer Architecture:
  • What is pipelining? RISC architecture.
  • What are some of the pipelining hazards : data hazard etc. how to get around them?
  • Pipeline scheduling algorithms: scoreboarding, tomasulo’s algorithm etc. just a high level understanding and some internals.
  • Shared memory architectures : how to maintain a distributed & shared memory cache?


More Advanced

- Mathematical Prolems - Project Euler - http://projecteuler.net/


References:


I hope this helps you!

Friday, February 26, 2010

Creating a patch and using a patch

Create a patch:
diff -Naur oldDir newDir > patchfile

Use a patch:
cat patchfile | patch -p1

Delete all unread messages in the inbox of gmail

http://www.emaildiscussions.com/showthread.php?t=56319

Linux has huge privacy issues

I knew for long back, but this hit me just now. In Linux, anybody can list processes of any other user. This is a big privacy issue. What is worse is that, you can even see the arguments passed to each of those commands.

Sunday, February 14, 2010

iTunes crashed!

I thought it would be interesting to post a picture of how it looks when iTunes crashes. Here is a picture of it: