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…)

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

November 17, 2008

Endangered: Sun Microsystems

Click [here] to read the article.

September 3, 2008

Google Chrome (BETA)

Click [here] to visit the official site.

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.

May 7, 2008

The power within

How T.J. Rodgers grew Cypress Semiconductor by incubating innovative ideas - no matter the source.

Click here to read the article.

April 2, 2008

Legacy systems

When an identifier becomes a keyword in the later versions of the language, boom! It’s time to Find and Replace All!

When a subprogram implements spaghetti, move your ass engineer!

When a language becomes more strict in the later versions and the current code review metrics extends it, again, move your ass engineer!

October 31, 2006

MS Firefox 2007

I find this funny, click here.

October 25, 2006

ISP lock-ins

Globe Broadband and Bayantel please invest here as soon as possible. We need the quality of services that you offer. Majority of the broadband subscribers here are not that satisfied. One year contract is not worth it. I have received the first bill already. Does it mean that I will be suffering 11 months more? Geez!

pldc ka kasi tol! ang hina ng broadband mo! ano yan pentium poor? sm*rt broken ata yan eh! [bayantel only] join now! tol, ipconfig /release tapos ipconfig /renew lol!

I can’t even access the website of Mindanao Open Source Society. Damn it.

Hoping for better days.

October 10, 2006

Joke?

Now tell me is there something really funny about this?

I did not find a single bit of humor in this video. This man is with his glasses for Pete’s sake!

September 5, 2006

Redesigned

[Thesis]

Well, it was rejected as expected. Plan B was accepted. Do you know what Plan B is? Look for another project that is.

[Redesigned]

Got nothing to do right now. I tried redesigning my blog. I was executed in The Reincarnation. I failed to defend my country. I didn’t have any time for offensive moves. Opposing guilds were a step ahead. I had 5 fortresses left and 5 attacks went in. I had no choice. I guess it’s time to quit playing. Redesigning the blog as well as the attitude for a big blow.

August 23, 2006

Moving on

So I bought my self a 2.5″ hard drive enclosure for about 750 bucks. I wish I have my own tools for constructing a device as such. Instead of going for a 2GB USB flash drive, I chose to salvage the 30GB hard drive of an incapacitated laptop. Cool isn’t it? Though relatively slower than a typical USB flash drive, the storage capacity outweighs it.

[To God]

Thanks for being there always.

August 22, 2006

Hetero-stress experience

I didn’t make the CS 315 (Elementary Computer Graphics w/ OpenGL) midterm examination. Sad, but I have to admit that I am mentally, emotionally and physically disturbed these days. It seems that I am carrying a magnet attracting bad luck. I have turned out restless and confused with almost eveything. From waking up to lying down, I don’t know what to do, I don’t know how to start my day. This is the dullest day of my life.

Stress, pressure. Some thrive on it, others find the spotlight and the responsibility to be too much for them. It distracts and scares them. The fear translates in to a physical stiffness. Mentally they become less focused and more self-conscious. Thus, their performance deteriorates.

July 22, 2006

Antidote for insanity

Simple programming stuffs save me from insanity. This a86 assembly program tells if str1 is a palindrome.

start:
        cld
        mov cx, 7
        lea si, str1
        lea di, temp
	
reverse:
        mov al, [si+6]
        mov [di], al
        inc di
        dec si
        loop reverse
	
        mov ah, 09h
        lea dx, temp
        int 21h
	
        cld
        mov cx, 4
	
compare:
        lea di, temp
        lea si, str1
        repe cmpsb
        jne exit
	
        mov ah, 09h
        lea dx, yes
        int 21h
	
exit:
        mov ah, 4Ch
        mov al, 00
        int 21h
        int 20h
	
str1    db 'racecar$'
yes     db '',10,'string is a palindrome!$'
temp    db 8 dup ('$')

[Middle-East Crisis]

Israel, known as the chosen people of God called a thousand reservists in a possible prelude to a ground offensive against Lebanon. Accordingly, they have to clean up bunkers and tunnels that are invulnerable to air attacks. Isn’t it ironic for the Mossads to be called as the chosen people of God?

Theme designed by Joset Anthony Zamora


Digital Stronghold

↑ Get Headline Animator