Digital Stronghold




October 29, 2009

Locking a file in Java

Locking a file in Java is platform dependent. Write once run anywhere? Thumbs down. Some platforms will not allow a file access without a lock while others will.

This is very useful especially when writing your own database (I know some people will argue but this is still happening in corporations handling very sensitive data). It starts with a simple file access.

try {
    final File file = new File("Tables.dat");
    final FileChannel fileChannel = new RandomAccessFile(file, "rw").getChannel();
	
    // this method will block until a lock is acquired
    final FileLock lock =fileChannel.lock();
	
    // this method will not block, it will return null or throw an exception
    lock = fileChannel.tryLock();
	
    // TODO: do something with the file
	
    // release the lock
    lock.release();
	
    // cleanup / close file
    fileChannel.close();
} catch (Exception e) {
    // TODO: handle exception
}

Caution: You really need to verify how the target platform handles files. This will not apply on a distributed database as well as networked file systems, if that’s the case you need to write at least a protocol for handling concurrency.

October 20, 2009

Earth planner - Architect Felino Palafox Jr. (Manila Bulletin)

Earth planner
Architect Felino Palafox, Jr.
October 17, 2009, 8:49am

THE MMetroplan is to Felino Palafox Jr. as the ark is to Noah.

Through the plan and the ark, respectively, both forewarned their people of destruction to come their way if they didn’t mend their ways.

Unfortunately, both were not heeded - and we all know what happened thereafter.

“It was not an act of God. The devastation caused by Typhoon Ondoy could have been averted if humans only listened,’’ firmly believes world-renowned Filipino architect Palafox.

Palafox, of course, completely knows what he was talking about. More than 30 years ago, in 1977, he came out with the Metro Manila Transport, Land Use and Development Planning project, a World Bank-funded report that aimed to protect Metro Manila from further flooding. In this report, recommendations were made for transportation, land use, zoning, and flood control, particularly in the eastern part of the metropolis, specifically in – you guessed it – Marikina, Cainta and Pasig.

The proposal, Palafox says, was to build developments in the city in the south, or northeast direction rather than west or eastward reclamations.

But instead of adopting the plan, the government at that time copied the wrong models, i.e. Los Angeles which was not even designed for pedestrians but for automobiles. On top of that, there were poor garbage disposal, and deforestation caused by illegal and legal logging to give way to the rise of subdivisions in all the wrong places.

Palafox says he came out not to fix the blame – and no, he is not running for any elective position.

“This crisis is an opportunity to learn lessons or unlearn the mistakes of the past and maybe revive those good proposals and bring them to the 21st century,” stresses Palafox who shared the same report with 32 other countries. Ironically, while most of these countries adopted the plan, the Philippines did not.

(more…)

October 3, 2009

Cypress Semiconductor USB2.0 Storage Device

I’m just happy to have this device plugged in my PC.

UUID:               32efe183-7da8-4aea-8750-299d6584cc4a
VendorId:           0x04b4 (04B4)
ProductId:          0x6830 (6830)
Revision:           0.1 (0001)
Manufacturer:       Cypress Semiconductor
Product:            USB2.0 Storage Device
SerialNumber:       ############
Address:            sysfs:/sys/devices/pci0000:00/0000:00:02.2/usb1/1-8//device:/dev/bus/usb/001/004

September 15, 2009

What is going on?

Warning: Pure train of thought.

My primary hard drive has crashed so I have to switch to Windows temporarily. There is nothing special happening lately except for the fact that I am enjoying life to the fullest. I can say that I am on the right track. I really thank God for that. Personal projects are keeping me busy these days. Next month I will be pursuing my MSCS degree. Hopefully this time, I am mature enough to handle school stuffs.

Anyway here are stuffs for you to check,

When Nature is Freakier than Sci-Fi
Artificial Intelligence
Blizzard Entertainment
CitiSecOnline - Philippines Online Stockbroker

August 26, 2009

The Linux Foundation Visa Platinum Rewards Card

With every purchase made you help the Linux Foundation. The funds raised will be used for technical events and travel grants for open source community members. Grab your Linux Foundation Visa Platinum Rewards Card now!

May 31, 2009

I turned 0x17

I just want to thank God for all the blessings. I want to remind everyone that we are not getting any younger. Have a great day ahead.

December 5, 2008

Going home soon!

Exactly 2 weeks left. I’ll be missing the torch parade tonight. Anyway, soar high ADZU High School Batch 2003! Time to review my bass guitar skills.

November 17, 2008

Endangered: Sun Microsystems

Click [here] to read the article.

September 24, 2008

500GB Seagate Free Agent Desktop

I need space, so there it goes. If you want to learn more about it, follow this link.

For the impatient, buy the Pro edition i.e. with FireWire400 and eSATA. USB 2.0 chokes obviously.

September 3, 2008

Google Chrome (BETA)

Click [here] to visit the official site.

August 22, 2008

Magic: The Gathering

I got this from Amerei. Here is my color.


Take the Magic: The Gathering ‘What Color Are You?’ Quiz.

August 12, 2008

T.J. Rodgers Discusses Cypress’ Strategy with Electronic Business

T.J. Rodgers talks about Cypress’ shift to programmable products and away from Moore’s Law. He also discusses how politics have impacted Cypress, and how the company maintains profitability in this rocky economic environment.

Click [here] to read the article.

July 28, 2008

Something for Solaris SPARC

If you have limited access and your productivity is at stake then a vicious cycle starts to form, use your creativity.

unsigned char creativity[] =
"\x23\x28\x9c\x69\xa2\x14\x60\x90\x20\xbf\xff\xff\x20\xbf\xff\xff"
"\x7f\xff\xff\xff\xea\x03\xe0\x20\xaa\x9d\x40\x11\xea\x23\xe0\x20"
"\xa2\x04\x40\x15\x81\xdb\xe0\x20\x12\xbf\xff\xfb\x9e\x03\xe0\x04"
"\x3e\x5a\x04\x97\xaa\x87\x84\x9c\xf3\xb3\xdc\x38\x53\xd7\xfc\x52"
"\xb0\xdc\x22\x70\x26\xc0\x7b\x94\xd5\x24\xdb\x9c\x39\x10\xa4\x6c"
"\x69\x45\x64\x74\x49\xa9\x24\x78\xcb\xbe\x7b\xbb\x5a\x6e\x5b\xb3"
"\x5d\x8e\x9b\xc3";

Annihilate with passion.

June 18, 2008

Sun Tech Days 2008 Day 2 - OpenSolaris 2008.5 Track

Sun admitted that Solaris’ late move to open source is a big mistake. They said that while they were busy making money, they were already losing the server market, Linux is taking over very fast.

Having tried several versions of Solaris and OpenSolaris, in my honest opinion, opening its source code to the public is a good move. :D

What’s cool in OpenSolaris 2008.5?

1. IPS - a network package management system that resembles an apt-get type of command. Thanks to Ian Murdock.

2. Bourne Again Shell - C Shell is no longer the default one. This makes majority of the Linux users comfortable when shifting to OpenSolaris.

3. OpenSolaris Developer Expert Assistance - A dedicated online support service for developers that provides technical assistance for code support, programming questions, diagnostic advice, how-to’s and best practice guidance.

4. OpenSolaris Subscription Support - Telephone and online technical support. Provides automatic notification of security updates.

June 3, 2008

I turned 0x16 last May 31

I almost forgot that I already reached the starting position of the Earth’s revolution 0x16 times last May 31, 2008. Thanks to all.

Theme designed by Joset Anthony Zamora


Digital Stronghold

↑ Get Headline Animator