Nexus 7 Screen Replacement

If you have little ones around you know they love to play with tablets. Our 14 months boy Kian is used to watching Baby Einstein series on my Nexus 7 while having a meal on his high chair. After the meal he sometimes takes the tablet and keeps watching on the floor. The other day he put the tablet on a chair but it dropped face down on the stone surface. Although the distance was less than 50 cm and it has a chunky cover on but I was shocked that the screen just trashed.

On ebay some there are separate screens and digitizer but I suggest buying both together. It is around AUD 60. This video tells how to open it up.  To remove the cracked screen from the bezel I just put it under the sun for about an hour. The video is not very clear on how to attach the new screen to the bezel. For that I used Loctite Super Glue for Glass. It all went very smooth and I have a brand new Nexus again. I suggest affixing a screen protector as well…

After disassembly
The new screen is on top

VB Script to Send Mail From Outlook

In our office we cannot create Outlook rules to forward emails outside the corporate network  (say to Gmail) automatically but you can write a VB script/Macro to do that. Although I have never done that as it might be illegal but this just explains that it is feasible!

The script basically is called whenever Outlook received a new email:

private Sub Application_NewMail()

 Dim newMail As MailItem
 Dim s As String
 Dim b As String
 Set newMail = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.GetLast
 s = CStr(newMail.SenderName + ": " + newMail.subject)
 b = CStr(newMail.body + "")
 Call CreateEmail(s, b)
 'later you can delete these from your sent items folder

End Sub

Sub CreateEmail(subject As String, body As String)

Dim olApp As Object
 Dim OlMail As MailItem
 Dim ToRecipient As Variant
 Dim CcRecipient As Variant

Set olApp = Application
 Set OlMail = olApp.CreateItem(olMailItem)

OlMail.Recipients.Add "<me>"

OlMail.subject = subject
 OlMail.body = body

End Sub

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<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.


  • 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.


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!


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:


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.


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:


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).


  1. More information can be found at:
  2. Countdown to the New Year moment:
  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{

private List<B> stateTransitions;


class B{

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



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

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

Build Light

A build light is rather a new (?) thing teams do to indicate their software build/test status. It has become very common in Agile teams. I did one for our project although not entirely Agile but it indicates the status of our builds being made in our in-house build server.

Read more about it in wikipedia:

I purchased the light from which sells them very expensive! A USB RGY LED light (  costed me (our project) around 120 AUD to reach Sydney from US! Quite an expensive light!

If you are into electronics you should be able to make one easily I suppose. I am not really a hardware person and also have no time for it.

Anyway the light arrived quickly with no documents attached but everything can be found online. In Windows there is a command line application “USBCMDAP.exe” that can quickly turn it on:

USBCMDAP.exe 0 0 101 12 1 0 #green on
USBCMDAP.exe 0 0 101 12 2 0 #red on
USBCMDAP.exe 0 0 101 12 0 3 # all off

my build light

Now all you need to do is to read the status of your build/test/project/whatever and turn this on/off accordingly.

There are drivers for different OSes and hardware information in their website if you want to get more serious.

If you found a similar light but cheaper (together with software) then let me know!