Bitbucket Behind Proxy

I was having difficulty playing with Bitbucket behind the corporate proxy. Our local proxy servers alone didn’t work for me on http/https and I had to switch to the ssh solution.

This is how it worked:

  1. Created a set of keys from within the SourceTree.
  2. Launch SSH Agent. Import the private key.
  3. Upload your public key to Bitbucket site.
  4. Change the remote/origin in the SourceTree to use ssh instead of https (something like git@bitbucket.org:<username>/<project>.git. Find this from your project on the Bitbucket.
  5. Enter the proxy details in SourceTree Options.
  6. Now “push to remote” works fine in SourceTree

Why I will never install Linux on my Mac

These are the reasons why I will never install a Linux on my personal Mac or PC as the main OS, at least for now.

I have to stress that these are more of a taste and the way I use my computers and might not be an issue for other people.

I also have to say that I work with linux servers in my day to day work and love them but in the desktop world I doubt Linux has a place yet. I even have an Ubuntu desktop on another computer at work that I use for some tasks.

Now:

  • As long as there are articles in the Linux world starting with “how to install” that means things are not yet user friendly
  • All I need from linux is a terminal that I have in Mac or I can ssh to a remote linux machine
  • Linux does not have Facetime
  • Skype is dodgy in linux. You will never know whether your audio card will work in the next release of linux or not!
  • Many apps do not have proper/strong counterparts in linux or if they have it is dodgy or buggy: Libre Office crap; different messengers all buggy, either video or audio not working properly; graphics editors, nothing close to photoshop; sound editors, don’t even think about it; Evolution/Thunderbird vs Outlook haha…
  • You always have to look for the drivers. Whether my webcam, printer, this and that work in linux or not.
  • For simple tasks you have to waste your whole day on Internet searching and finally someone suggested on their weblog that you have to put a flag on a config file for that thing to work!!

I didn’t mean to hurt anyones feelings, just for a bit of laugh 😉

Tablet as Photo Frame

I long wanted to have a good photo frame. Then from somewhere came the idea of using a tablet as one. After deciding for months on what tablet to get finally I went for a cheap no-brand android tablet under $60. It is a 7″ Android 4.0 from ebay with 512 RAM, 1.2 GHz CPU, 4GB internal memory, wifi, camera, etc.

Using a $2.5 slide show application from Google Play I can show photos from network. At this time we have around 35,000 photos sitting in the NAS to be viewed!

For mounting I purchased a PadTab which is a brilliant mounting idea for vertical smooth surfaces (i.e. fridge)

This is not just a photo viewer. I have also installed few useful apps and widgets to show calendar, weather, etc that we use when we are tired of seeing photos!

We can also quickly check emails or facebook while standing although hasn’t happened yet!

Total cost: $71

My wife was initially sceptic of the whole idea but now she seems happy about the final setup. I also have to confess that at first I wasn’t quite confident of a tablet with that price range and 800×600 resolution but it is producing pretty decent images.

2013-08-18 12.52.34

Clean rebuild to Mountain Lion

As this was my first Mac, I had done lots changes here and there to experiment and it was time to start afresh. Also I wanted to get rid of stupid packages and applications that I had installed in the past few years (including Xcode!)

When it comes to MS Windows installation I am an expert but in the Mac world I am hopeless.

Searched the Internet for ways to cleanup the hard disk and start a clean OS and saw different ways of doing it by different people.

The best way that works for me was:

  1. Shutdown
  2. Press cmd+R and power on (You can also restart and do this)
  3. System goes into recovery mode
  4. Format the entire disk
  5. Install the OS from Internet

This saved me from creating boot disks, etc.

See: http://support.apple.com/kb/HT4718

String Phobia in Software Development

String phobia in software development is different from the medical condition of Linonophobia!
It is when teams or individuals do not use strings and want to replace every constant with enums.
Probably using enums is acceptable if they will not really change; for example “days of the week” but if they keep changing and the component has dependencies that are affected by this change then I see no point in using enums. This is very annoying in enterprise environments where a component has a number of dependencies and a change will affect multiple silos.
The clients on the other hand can convert these string to enums if they want to.
SOA Cook Book says:
Keep the types in the canonical schemas somewhat flexible and general, as they will potentially need to absorb a variety of service entity definitions. For example, it’s probably fine to use an enumeration in a service schema, but use a string to represent that same type in a canonical schema. It is surprising how little we can actually agree on. Maybe your USState enumeration has 50 items, but maybe the enum in the schema of the service you need to integrate with includes Guam and Puerto Rico.

Learn Persian New Year (Norooz) Rituals!

2

Norooz (Nowruz), in word, means “New Day”. It is the exact astronomical beginning of the spring in the northern hemisphere (note3). It usually falls on 20 or 21th of March.

This ancient festival is celebrated and observed by many people in Asia and Middle East, even in North-western China and Balkan.

Iranians take that as the beginning of the year. This exact second is called “Saal Tahvil” meaning “Year Delivered”. Norooz (Nowruz) with its unique Iranian characteristics has been celebrated for at least 3,000 years and is deeply rooted in the rituals and traditions of the Zoroastrians (The religion of ancient Persia).

Iranians consider Nowruz as their biggest celebration of the year which includes a few days of public holiday and sometimes up to 2 weeks for schools.

Major New Year rituals include:

  • Cleaning the house (Khaane Tekaani – meaning home cleaning) before the New Year and buying new clothes!
  • Setting a special table (Haft Seen – meaning seven ‘S’) before the New Year. This table has 7 specific items on it starting with ‘S’ in Farsi (Persian language).
  • Fire Festival (“Chahar-shanbe Suri” – meaning feast of Wednesday) the night before the last Wednesday of the old year is celebrated by going into the streets to make bonfires, and jump over them.
  • The New Year moment (Saal Tahvil – meaning year delivered) is celebrated by music and kisses.
  • Parties and family gatherings after New Year
  • 13th day (Sizdah Bedar – meaning 13th day out) 13 days after the New Year is the outdoor and picnic day.

Now I explain these in short.

Haft Seen (7 Seen) Table:

3

A special table laid with seven specific items on it. All the 7 (Haft in Farsi) items start with the letter “S” in Farsi. These seven things usually are:

  • sabzeh – wheat, barley or lentil sprouts growing in a dish – symbolizing rebirth
  • samanu – a sweet pudding made from wheat– symbolizing affluence
  • senjed – the dried fruit of the oleaster tree – symbolizing love
  • sir – garlic – symbolizing medicine
  • sib – apples – symbolizing beauty and health
  • somaq – sumac berries – symbolizing the colour of sunrise
  • serkeh – vinegar – symbolizing age and patience

Other items on the table may include:

  • sekkeh – Coins – representative of wealth
  • lit candles – symbolizing enlightenment and happiness
  • Mirror – symbolizing cleanness and honesty
  • Decorated eggs, one for each member of the family – symbolizing fertility
  • A bowl of water with goldfish – symbolizing life
  • Traditional Iranian pastries and sweets
  • Dried nuts, berries and raisins
  • A holy book (Avesta, Quran, and/or a poetry book, Shahnameh or the book of Hafez)

Decorated with colourful ribbons, the 7 Seen table is kept for 13 days and then disposed outdoors.

4

The New Year Moment:

People usually listen to radio or television at the moment of year change (saal tahvil) which is identified by a countdown or a cannon blast after which people hug and kiss each other and wish each other a happy new year.

Then they give presents to each other (traditionally cash, coins or gold coins), usually older ones to the younger ones. The first few days are spent visiting older members of the family, relatives and friends. Children receive presents and sweets. Traditionally on the night before or after the New Year, most Iranians will have a special dish of fish and rice (Sabzi Polo Mahi).

6 7

13th Day:

The 13th day of the New Year is called “Sizdah Bedar” meaning 13th day out and spent mostly outdoors. People go to the parks and the nature for a festive picnic. Also in this day, people throw the Sabze (the seeds grown in Haft Seen table) away.

Old Iranian culture regard number 13 as a bad omen and believe that by going out they avoid misfortunes.

Fire Festival:

5

Another tradition before the New Year is “Chahar-Shanbe Suri”. It takes place at the night before the last Wednesday of the old year. People set up bon fires, young and old leap over the fires and sing special songs.

This festival is the celebration of the light (the good) winning over the darkness (the bad).

Notes:

  1. More information can be found at: http://en.wikipedia.org/wiki/Nowruz
  2. Countdown to the New Year moment: http://www.7seen.com/
  3. For Persian calendar see KhayyamHejri Calendar and Jalali Calendar
  4. Photos in this page link to their original location

Hibernate Filters

This is one way of writing a Hibernate filter. We have to define a filter first using @FilterDef as a global annotation, meaning that it can be applied anywhere in the code.

Then we apply the filter to where ever we want using @Filter and then we need to enable the filter in the session.

The reason for the filter is that when I do A.getstateTransitions() I want the list of B’s returned to be filtered.

@FilterDef(name=”myfilter”, defaultCondition=”TRANSITION_DATE > trunc (sysdate)”)

class A{

@OneToMany(…)
@Filter(name=”myfilter”)
private List<B> stateTransitions;

}

class B{

@NotNull
@Column (name=”TRANSITION_DATE”, columnDefinition=”DATE”)
private Calendar transitionDate;

}

Using:

org.hibernate.Session session = (Session) entityManager.getDelegate();
session.enableFilter(“myfilter”);
query.getResultList() // returns list of A’s where B.stateTransitions are after now.

Filters can have parameters but I didn’t need one here.