Tuesday, December 20, 2011
Monday, December 19, 2011
Wednesday, December 14, 2011
Tuesday, December 13, 2011
Friday, December 09, 2011
Thursday, December 08, 2011
Wednesday, December 07, 2011
Tuesday, December 06, 2011
Monday, December 05, 2011
Our team will continue to use MySQL, for the main reason being that FB is using it, http://goo.gl/oEPld
Sunday, December 04, 2011
Saturday, December 03, 2011
Just do it, and do it, and do it, and do it until the job is done! Be inspired .... http://goo.gl/ZZ0V6 iaffirm
Wednesday, November 30, 2011
Tuesday, November 29, 2011
Monday, November 28, 2011
Sunday, November 27, 2011
Saturday, November 26, 2011
If we could serve as much patients as this, http://goo.gl/gH6Xl ... we'll be genuinely fulfilled ...
Friday, November 25, 2011
Thursday, November 24, 2011
Saturday, November 19, 2011
Wednesday, November 16, 2011
All Philippine-based software developers, attention .. you're invited at DevCon Summit 2011, http://devcon.ph/
Tuesday, November 15, 2011
Monday, November 14, 2011
Sunday, November 13, 2011
Saturday, November 12, 2011
Friday, November 11, 2011
Wednesday, November 09, 2011
Friday, November 04, 2011
Thursday, November 03, 2011
Tuesday, November 01, 2011
Monday, October 31, 2011
Dart: a language for structured web programming, newest language from Google, http://www.dartlang.org
Wednesday, October 05, 2011
Saturday, September 24, 2011
Wednesday, September 21, 2011
Monday, September 19, 2011
To change timezone for Redhat linux make sure to download correct tz from http://goo.gl/l22VX, then modify /etc/localtime accordingly
Saturday, September 17, 2011
Wednesday, September 14, 2011
Saturday, September 10, 2011
Thursday, September 08, 2011
Tuesday, September 06, 2011
Saturday, September 03, 2011
Sunday, August 28, 2011
Friday, August 26, 2011
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
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:
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.
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.
Subscribe to:
Posts (Atom)
