Archive for Blog

» Database/SQL Illustrations

By ivc at 23:24, March 31, 2010

Databases and SQL can be hard to grasp by just reading text, as I learned. To visualize two concepts I made a quick vector illustration for both; log based recovery and two-phase locking. A quick glaze:

Log based recovery – To ensure consistency after a crash or interruption of a transaction (bunch of queries), log files are used to check what made it from the cachemanager to the physical disk before the interruption. All committed translations (in the log but not database/disk) are normally redone, while transactions with only a start marker is reverted/undo. This is the basis for 4 concepts of log based recovery; undo/redo, no-undo/redo, undo/no-redo, and no-undo/no-redo.

Two-Phase Locking – For consistency during a transaction the order of which reads and writes are made to a row/table/database is essential. Locking makes it possible to restrict access to (lock) a row/table/database and have exclusive right to (exclusive lock) write a value, excluding everyone else until the restricting is lifted (unlock). Likewise when a exclusive lock is active, no-one can read the row/table/database. Lastly, if only a read is made a simple shared lock is used, other transactions can also read the same row/table/database at the same time, placing more shared locks. Once a transaction wants to write, an exclusive lock is requested.

For structure and order all transactions need to lock in the beginning and unlock before finishing, this creates a phase system. Phavse 1 is the start and phase 2 finishing the transation. A transaction changes phase once a lock is released or lock is downgraded from exclusive to shared. In phase 2 new locks can not be requested and shared locks can not be upgraded, thus the transaction is in the unlock/falling phase. The opposite is phase 1 where locks can be made and shared can be upgraded to exclusive.

The illustrations:

» Matrix Operations on Calculators

By ivc at 12:09, January 25, 2010

When doing matrix calcualtions it’s handy to do a comparison with a calculator. I’ve made two guides showing the basic steps for Casio and Texas Instruments calculators.

The guides are in Norwegian and I actually got it published for the MA-109 course at UiA. They might be useful for others too.

» Droid Message Sound

By ivc at 20:08, November 2, 2009

The new Android based device, called Droid, has just been announced. And it has a cool sound when a SMS is received.

To use the sound as a text message-tone on an iPhone, you need a jailbroken device and a AIFF version of the file. Download the already converted and corretly named file:

Or convert it yourself. In iTunes change the Import settings in Preferences to AIFF, add the droid sound to the iTunes library and right-click it, pick Convert to AIFF, drag the new AIFF file to the desktop, rename it to sms-received6.caf.

Connect to the iPhone via SCP and go to /System/Library/Audio/UISounds/. Rename the existing sms-received6.caf to sms-received6-org.caf, and upload the new droid sms-received6.caf. Go into Settings, Sounds, New Text Message, and pick Electronic as the SMS sound. Voila!

To use it as a ringtone, just sync this droid-alert.m4r with the iPhone in iTunes.

Previous entries »