Skip to content

Installing and using EXIF with Perl in Ubuntu

I’m jotting down some notes on installing and using EXIF with Perl.  I have multiple directories of photos that I’d like to rename using the date and timestamps found in each photo’s EXIF information.  However, I’d need both Ubuntu’s EXIF library and Perl’s Image::EXIF package to pull out the date and timestamps I need.  Here is a list of steps I took.

On the command line-

  • sudo apt-get install libexif-dev
  • Download Image::EXIF for perl from CPAN here
  • Build and install the Image::EXIF package
    • Extract the Image-EXIF-0.99.4.tgz package to a local work dir: eg: ImageEXIF
    • cd ImageEXIF
    • perl Makefile.PL
    • sudo make install

Linux Mint is Impressive!

With a free couple of days on my hands while on staycation, I thought I’d try resurrecting my long-dead T21 ThinkPad, a 256Mb RAM, Pentium III dinosaur with a flickering LCD screen. With all the linux derivatives, one must suffice to work well on a 10 year old machine?

Over the past few days, I gave at least four different linux variations a try:

  • Ubuntu 10.10
  • Xubuntu 10.10, alternate install
  • Kubuntu 10.10, alternate install
  • CrunchBang linux
  • Linux Mint

None except Linux Mint would install and run properly on the Thinkpad.? In fact, some couldn’t even install at all.

Linux Mint, a variation derived from Debian, on the other hand, installed and ran without even a hiccup.? It correctly chose the highest possible video resolution and worked with my PCMIA wifi card right out of the box.? I am extremely impressed.? Fluxbox is also working well.

Investment in Singapore

Today we made the biggest investment yet in Singapore. We bought a $110 bicycle. After getting a $20 baby chair attached to the back of the bicycle, the bike shop owner even chopped $10 off the total price. What a deal.

Singapore F1

Great pictures of the F1 race in Singapore.

7 Weeks and Counting

It’s been quite a 7 weeks. We’re now settled more or less in Bedok, Singapore. Let me summarize the past 7 weeks:
Week:

  • Landed on Friday morning, July 23. Took refuge in Liang Somerset in Clarke Quay. Took company provided tour around Singapore. Saw downtown, East Coast Park, and Ikea. Fell asleep in tour van. Worked in office the following Monday. Started real estate rental search.
  • First time seeing all rental possibilities. The rental market caters much to the foreigners- since something like 90% of Singaporeans already live in privately owned local housing. The foreigners, then, drive up the rental prices. The upper top stratum of the rental market consists of condos- which are well appointed apartments with private security, fancy pools, tennis courts, gyms, and private walled gardens. Condos rent regularly for 3200 and up for 2 or 3 bedroom apartments. The lower, mass market, end of the rental market consists of HDB apartments. HDBs are government built housing. They look like standard cookie cutter apartments. And they are heavily regulated by the government with all kinds of sale and resale stipulations. On the other hand, the rental prices for HDBs are quite acceptable. 1800 to 2200 for 3 bedrooms are quite standard. And most come with room furnishings- the better to welcome temporarily assigned foreign workers.
    While not looking for rentals, we went to Sentosa, where I dozed off on the beach. Doing the same in NYC would get me knifed and butchered for sure. Moreover, the Sentosa park is only about a 15 minute MRT ride. And each MRT is only about $1 or $1.25 SGD or so.

  • Week 3. Settled on a two-bedroom HDB rental in Bedok. It’s right on the green line MTR and right in between downtown to the west and the Changi business park area to the east. On the weekend, we visited Singapore’s Botanical Garden. And did I mention the park’s free?
    And ah- Singapore’s National Day- celebrating 45 years of the country’s founding. The parade made my boss feel proud to be a singaporean- although he’s really Japanese and moving back to Japan. haha.
  • Week 4. The Youth Olympics appear to be in full swing here. Many people are wearing the purple colors of the games. But internationally, I haven’t heard much about these games. It hardly caused a mention on nytimes.com.
  • Week 5. Preparing for the move from the hotel accomodations to the rental property. I called up a mover I found on craigslist. Two movers with a truck for one hour costs $80 SGD. Not a bad deal. That’s the kind of help I need.
    Also, we went to look for a school for the kid. We found one that runs a full day schedule for kindergarteners- at a cost of about $520 SGD a month. We figure the kid could use some more hours in school now to catch up with the language and culture here before attending primary school for real with the locals. The schedule starts with breakfast at 8:30, english lessons in the morning, lunch, a 2 hour naptime, then chinese lessons in the afternoon. Pick up time after 5pm. A full day.
  • Week 6. Moved. Settling in. The movers on Saturday morning moved in all our stuff from the US. The packages consisted of 71 boxes- including one queen sized mattress, one baby-sized mattress, one bicycle, one bicycle trailer, a kitchen table, four chairs, 2 office chairs, 3 computers, 2 cabinets, and more. We wound up giving away the cabinets and one office chair.
    The kid’s first day in school- and we were nervous as heck. Came out okay but she was upset on the second day. We had to scale back some school hours for the kid.
    The first weekend we didn’t go anywhere far. Took the kid to the Bedok Resevoir park.
  • Week 7. Malaysian holiday long weekend. Went to Sentosa to play on the beach again. Then on Sunday, took the kid in the bicycle trailer to the East Coast park.

C# Static and Instance Constructor Order

Investigating the ordering of static and instance constructor calls.

Static constructors get called only once in the entire program’s lifetime- the first time the class or any of its members gets referenced.

Instance constructors are called per object instantiation.

public class Base

{
static Base()
{
Console.WriteLine("Base static class constructor");
}

public Base()
{
Console.WriteLine("Base instance constructor");
}
}

public class Derived : Base
{
static Derived()
{
Console.WriteLine("Derived static class constructor");
}

public Derived()
{
Console.WriteLine("Derived instance constructor");
}
}

class Program
{
static void Main(string[] args)
{
Base b = new Derived();
Console.WriteLine("Done");
}
}

The program results are shown here:

[sourcecode language="csharp"]
Derived static class constructor
Base static class constructor
Base instance constructor
Derived instance constructor
Done
[/sourcecode]

Something interesting came out of this test.
- instance constructors are called base class first, derived class second
- static constructors are called derived class first, base class second

Singapore First Impressions

  • Food heaven
  • Pricey housing
  • Temperature not so bad

Day count conventions

For accrued interest calculations, the calculator must be clear on the use of day count conventions.

Accrued interest is calculated as follows:
AI = P x IR x T
where
AI = accrued interest
P = principal
IR = interest rate, annualised
T = fraction of the year

The fraction of the year is calculated as follows:

  1. actual/360, Each month is treated normally and the year is assumed to be 360 days e.g. in a period from February 1, 2005 to April 1, 2005 T is considered to be 59 days divided by 360.
  2. 30/360, Each month is treated as having 30 days, so a period from February 1, 2005 to April 1, 2005 is considered to be 60 days. The year is considered to have 360 days. This convention is frequently chosen for ease of calculation: the payments tend to be regular and at predictable amounts.
  3. actual/365, Each month is treated normally, and the year is assumed to have 365 days, regardless of leap year status. For example, a period from February 1, 2005 to April 1, 2005 is considered to be 59 days. This convention results in periods having slightly different lengths.
  4. actual/actual (ACT/ACT), Each month is treated normally, and the year has the usual number of days. For example, a period from February 1, 2005 to April 1, 2005 is considered to be 59 days. In this convention leap years do affect the final result.

Unreal

The 19 hour ride into Singapore from NYC was smooth. So smooth I didn’t want to leave the plane cabin’s double-width flat beds.

It was also the first time I’ve ever gotten an airline’s escort boarding the plane. We were the only passengers with a baby on the all business seat plane- and the airline staff carried our baggage and stroller onto the plane. All along the flight- 40,000 feet over Canada, the Arctic, Siberia, and China- the service was high class. A big shoutout kudos to Singapore Airlines!

A waiting company-hired driver awaiting us at the airport whisked us efficiently in the early morning to our residence. Upon arrival, he refused to take a tip. Is that the culture here?

The company-provided residence likewise is first world first class.

Today, a day after our arrival, a company-provided guide took us to a local food court. WOWZERS. It’s like a living dream come true. Food stalls lined up from one of a football stadium-sized court to the other end. And cheap! Needless to say, the wife was very happy.

And at the same time, there was a live Chinese opera show in Mandarin. Awesome. This is the exact reason why I took my kids here- to infuse them with a love of Chinese culture- and yet take on an education with westernized touches. Livin’ da Dream.

Singapore At Long Last

A picture is worth a thousand words. Here’s a thousand words for now. In brief, Singapore is even more beautiful in person than in pictures.

It’s been an unbelievable ride.