Saturday, September 10, 2011

... wanting equals luck, .... feeling of having combined with released energies rather make things easy ...
You cannot solve a problem from the same consciousness that created it - Albert Einstein
The unexamined mind is not worth living ...

Thursday, September 08, 2011

Yes, Microsoft Did Change The World More Than Apple, http://goo.gl/wzeLE

Tuesday, September 06, 2011

Yahoo! CEO Carol Bartz is out ... coincidental that I read more of Michael Arrington last night, who in May this year interviewed her.
No business is without database, and now-a-days, usual that data are sync between backups and business related interfaces ...

Saturday, September 03, 2011

... the mindfulness of things other than the unwanted emotions and thoughts ... http://goo.gl/bfttT

Sunday, August 28, 2011

Web Camera + Credit Card = Secure Payment, http://ping.fm/9urdW Cool!

Friday, August 26, 2011

Cook's message to employees as the new CEO of Apple, http://goo.gl/Wjzqi

Monday, August 15, 2011

How true that Microsoft is dominating over Linux in ALL aspect of the IT market, yes, even outside of Desktop computing, http://goo.gl/BX6kg
97% of $104 million of Mozilla's income is from Google. In November 2011, Mozilla's contract with Google will expire. Will Google renew it?

Monday, August 08, 2011

So, now I have compelling reason not to go the Mac way, and ditch the Windows ... :) http://t.co/7nWC59h

Thursday, August 04, 2011

Generating Unique Primary Key In MySQL To Avoid Collision

Since I'm having a bit of trouble publishing this at stackoverflow.com, I'm posting it here instead.

One may want to consider using BIGINT data type in MySQL for table primary key index. Thanks to the following link,

http://forums.mysql.com/read.php?24,423422,423697#msg-423697

I was able to finalize my solution.

A bit of modification from its original suggestion, I made use of:

- PHP microtime: 14 digit number, after removing the decimal point
- zerofill autoincrement column from "Accounts" table

I have a utility class in PHP with the following static method:


public static function generateIdx($isFloat, $random=NULL) {
$idx = (String)microtime($isFloat);
$idx = preg_replace("/\./", "", $idx);
$maxMicrotimeLength = 14;
$max = 18;

if (strlen($idx) < $max)
{
if (strlen($idx) < maxMicrotimeLength)
{
$diff = (maxMicrotimeLength - strlen($idx));
while($diff > 0)
{
$idx .= 0;
$diff--;
}
}
if (!is_null($random))
{
$idx += $random;
}
}

return $idx;
}


This generates 18 digit unique code that combines 14-digit from microtime and 4-digit from account code. Hence I have up to 9999 accounts to fit in the 4 digit allotment. But in actuality, BIGINT can still be extended up to a total of 20 digit, so I still have 999999 accounts that can be created. Instead of account code, you may rather use the server id, to further avoid key collision.


In my apps case, accounts are created per client who accesses my app offline in their premises. Each offline app has a sync capability to a central app that contains universal data from the offline clients, hence collision is apparent, especially for the logs table which has to be sequential as well for the synchronization to work correctly.


With this solution, I'm at peace, knowing that numeric index keys are a lot faster than character keys.


Hope this helps.

Wednesday, August 03, 2011

Using rSSH in combination with restrictive apache config and appropriate file permission for a temporary web server user ...

Thursday, July 21, 2011

How Generics And ObamaCare Led To Express Scripts' Mammoth Purchase Of Medco http://t.co/8AJpNEI via @forbes

Thursday, July 07, 2011

Preserving Relationship Diagram in MySQL after export

Discovered a smooth technique on preserving the relationship constraints when uncertain error occurs as one attempts to recreate a db into a new one via phpMyAdmin. First, attempt to to copy db via operations tab, Second, export structure only, then copy paste the whole constraint part, then run them against the new db, and viola! Hope this helps.

Monday, July 04, 2011

... principals should be able to evaluate top 4 seafarer ranks via online interface ... major, major feature, need emphasis in the video ..
After seafarers medical records module, I thought the qualification assessment is easy, it's challenging enough to need few diversions .. :)

Friday, July 01, 2011

Hope to start initial production of video tutorial for the crewing system using Camtasia ...
Accept credit card payments via Android, http://ping.fm/juSjx