Friday, October 12, 2012

Possessive Noun

I previously thought making a noun into possessive form was as simple as adding an apostrophe-s ('s) if it does not end with an "s", and just a simple apostrophe if it does.  I was tutoring my Grade 4 daughter on possessive nouns last night and I was surprised at all the other rules.

Rule #1 - If the noun is common and singular, always put apostrophe-s -- even if the noun already ends with an "s" already. So for example, you should say "princess's gown" instead of "princess' gown".

Rule #2 - If the noun is proper and single syllable, always put an apostrophe-s also except if the word following it starts with an "s".  For example, its "James's car", but "Kris' shoes".

Rule #3 - If the noun is proper and multi-syllable, then you follow the standard rule of apostrophe-s if it does not end with an "s", and just apostrophe if it does.

Wow!  I learned something new from 4th grade!

Saturday, September 29, 2012

Preserving State Between Web Server Instances

One of my web site applications has been giving me headaches.  Every few days, I would encounter an incident when one of the user session seem to lockout the application causing other users to time out.  I used Microsoft IIS' application pool function to separate it from the other apps running on the same server so I can easily restart its pool without affecting the others.  But still, having to restart the pool every so often is a chore.

I decided to spread out the load to several threads by initially setting up a Web Garden.  A Web Garden uses multiple worker processes and uses a queue manager to process incoming requests to the application pool.  Unlike a Web Farm, which comprises of multiple web servers, a Web Garden just uses multiple worker threads in the same multi-CPU server.

The problem I encountered with running apps in a web garden is that values stored in Session variables are local to the worker thread that was assigned to it.  So if IIS decide to send you to a different worker thread in subsequent requests, the Session variables used in the other worker thread will completely disappear.  I thought of using ViewState at first so that the values are stored on the client side and just passed back on every request.  Unfortunately, ViewStates only seem to work for postbacks to the same URL.  Once the URL changes, the previous ViewState value is also gone.

I found this interesting article on how to use OutOfProc Session State servers.  By using the StateServer instance, one can save session variables between apps or even between servers.  Its not as robust as the SQLServer solution, but its relatively lower overhead.  One only need to add the following lines in the web.config's system.web section:


< sessionState mode="stateserver" stateConnectionString="tcpip=127.0.0.1:42424" />

Will be observing if performance improves with this modest adjustment on the design.

Wednesday, September 26, 2012

Taking the Camry for a spin

I had a meeting at Clark, Pampanga today with a client so I took our new Toyota Camry for its first long distance drive.  I've been wanting to figure out what its mileage is like under a long, smooth driving condition with no traffic.  One of the nifty features of the car's dashboard is a real-time calculator of its gasoline mileage.  Under Manila's normal city traffic conditions, the best I can do is between 6 to 8 km/liter under "Eco Drive" mode.  A long distance drive with no traffic should show a much better performance.

At its peak, I was able to clock a sweet 16.1 km/liter!  I cruised between 80 to 110 kmph during the whole stretch.  It seems that the optimal mileage can be reached by the car if you set it at cruise control and just let the computer take over; or maybe it was just my imagination.  Sigh... if only inner city driving was as fuel efficient.


Saturday, September 15, 2012

Hello World Conner Drake

Cols and I woke up early today because we were supposed to drive Ethan to Xavier for his Saturday make-up class.  But because its been raining heavily the whole night, the school decided to postpone the make-up class.  Cols and I proceeded to Cardinal Santos to have a check-up since she is scheduled to give birth already anytime this week.  The maternity unit said she is already open 2cm and when they contacted Dr. Madamba, she told the staff to inform us to come back later in the day to induce labor already.

We went home first to have lunch and relax a bit.  We drove back to Cardinal Santos around 4:30pm.  When we got to the maternity unit, we were surprised when they told us Cols is now at 5cm and can give birth in 2 hours time!

I proceeded to the admission counter while they prepared Cols to go into labor.  By around 8:30pm, Dr. Madamba predicted baby will be out by around 9pm.  So at quarter to 9, we were moved already from the labor room to the delivery room.  With just a couple of push, and almost right on the dot, Conner Drake popped out of his mom's tummy!


Conner weighed in at 6.7 lbs.

Tuesday, August 21, 2012

The Bungi Family

I bit on something really hard about 3 weeks ago while eating pizza.  I cracked my upper left molar (the one next to the incisor).  The fracture has been bothering me for several days, and finally today, I decided to have it removed!

It was actually not as painful as I was expecting.  Kudos to Dr. Alicia Tan of Mt. Sinai Dental Clinic!  She did inject anesthesia to numb my gums.  But pulling the tooth out turned out to be very effortless.  I hardly felt anything.

Caitlin also had a tooth extracted because her permanent tooth underneath was already pushing it out.  Ethan lost one of his front tooth about a month ago.  Then he lost the other one while playing badminton a couple of weeks ago.  So here we are -- all with missing teeth.
Look at our missing teeth!

Sunday, July 29, 2012

GCHS Batch 87 Reunion

Hard to believe it has been 25 years since we left the gates of Grace Christian High School!  But thanks to the selfless efforts of a few batchmates, several of us got together last night at Chivz in Greenhills for a night of fun and memories.

From GCHS Batch 87 Reunion

It was fun trying to figure who is who after all these years.  Some classmates still looked exactly the same, while others, err..., have "matured" more.  hehehe.  Section 3 (my section) was the most represented (thanks, classmates).  Lets hope the next reunion will not take another 25 years!

Wednesday, July 4, 2012

Importing and Exporting Data across Firebird Databases


In the past couple of weeks, I've encountered a few problems with the Firebird databases that I maintain.  In both cases, I had to retrieve data from a backup and restore it to the one running in production.

Firebird does not come with any built-in utility to do that function.  Thankfully, as with majority of open source projects, there are 3rd party solutions that seem to do what you want.  In this case, I found FBExport:

http://fbexport.sourceforge.net/

The command-line syntax is very straightforward.  First, you extract:

fbexport -S -H hostname -D database1.gdb -U username -P password -F file.fbx -Q "select * from sometable"

Then, you import:

fbexport -I -H hostname -D database2.gdb -U username -P password -F file.fbx -Q "INSERT INTO sometable(field1, field2, field3)"

It works great!