How to Create Hyperlink DIV Elements

Today, I encountered a problem: making div element a hyperlink. For example:

<a href="http://www.onurguzel.com/"><div>content</div></a>

It works, but SHOULD NOT be used. Because it is against the web law: W3C (X)HTML specifications!

A very basic (and valid) solution:

div a { display: block; height: 100%; }
<div><a href="http://www.onurguzel.com/">content</a></div>

However my case was a little bit more difficult:

<a href="http://www.onurguzel.com/">
	<div id="first">
		<div>some content</div>
		<div>some other content</div>
	</div>
</a>

We already know that is not a valid layout. Because a block element (div) is used in an inline element. If I change layout, a have to insert hyperlink tags (a) in all block elements, and the background of the “first” div element will not be clickable. So here comes the solution:
Continue reading “How to Create Hyperlink DIV Elements”

Android on iPhone 3G

I’ve been trying to jailbreak my iPhone (iOS 4.2.1) for few days. I thought it would be cool if I install Android on my phone, after jailbreaking it. I used redsn0w several times to jailbreak, however I couldn’t manage to jailbreak even if it says “it’s done”.

I didn’t want to downgrade the firmware. If I downgrade to iOS 4.0.1, I can easily jailbreak my phone over JailbreakMe.com, but this method does not provide me full access that I need for installing custom bootloader. So I had to try something else.

I found a tool (sn0wbreeze), that is not only able to jailbreak iOS 4.2.1, but also allow me to install custom boot loader. It sounds perfect! I created a custom (jailbroken) iOS 4.2.1 firmware using sn0wbreeze 2.2.1, restored it using iTunes and boom! My iPhone is now jailbroken!

After jailbreaking, I installed Android. There is a package in Cydia that handles this process. Install Bootlace to your phone using Cydia. Open it and follow the instructions. Once, your kernel is patched and your phone is rebooted, run Bootlace again. Go to OpeniBoot tab and install it. It’s a custom boot loader for iPhone which can boot both iOS and Android.

Installing Android requires download of lots of data. I recommend you to switch to Wi-Fi connection if you’re connected to the internet using cellular data network. There is a project which creates custom Android for iPhone. In Bootlace, go to iDroid tab and install it. This process can take a while. After installation is finished, click to “info” button on the top right corner. Install multitouch and wireless device firmwares too. Installation is now finished. You can switch to Android using QuickBoot tab in Bootlace. Voila!

Now, I have a iPhone which can dual boot iOS 4.2.1 and Android 2.3.2. Some features and not supported yet, and power consumption is high. But I loved it!

For list of supported devices and more information please refer to the official Installing iDroid using Bootlace document.

Comparison of Free Twitter Apps in iPhone

I have iPhone 3G which is running on iOS 4.2.1. Since it has a slow processor and low memory, some apps crash all the time. Official Twitter app, “Twitter for iPhone” drove me crazy last weekend. So I decided to switch to a new app.

I tested some of popular apps in App Store with my own criteria. I also re-installed official app and tested it too.

Please note: The tests are not finished yet. Since I do not have an iPhone anymore, I will not be able to finish these tests.

Twitter Echofon for Twitter Seesmic for iPhone TweetDeck for iPhone Twitterrific for Twitter TwitBird free for Twitter HootSuite for Twitter
Twitter Echofon for Twitter Seesmic TweetDeck for iPhone Twitterrific for iPhone TwitBird free for Twitter HootSuite for Twitter
by Twitter, Inc. by naan studio, Inc. by Seesmic, Inc. by TweetDeck by The IconFactory by NibiruTech Limited by Hootsuite Media Inc.
link link link link link link link
Performance (out of 5) 3 5 4 5 4 3 4
Ease of use (out of 5) 5 5 4 6 4 4 4
Notifications
Mentions ?
Direct messages ? ?
RT’d tweets of me ?
Faved tweets of me ?
Supported features
Geolocation ?
URL shortening – bit.ly ?
Image upload – TwitPic ?
ReadItLater ?
Multiple accounts ?

“Performance” and “ease of use” was scored by my own observations.

How Fast is Pardus?

Today, I made a Pardus 2011 installation to my notebook PC. I used an USB flash drive as my installation media. If truth be told, I was -really- fast.

I agreed the license terms, hit start button on the stopwatch timer and clicked next. I also check the integrity of my installation media by clicking validate. I have a lot to configure. Since I use my operating systems in English, I had to change keyboard layout and timezone with “Turkish Q” and “Europe/Istanbul” in YALI. I also created and used a custom disk layout.

After the installation has finished, configuration with YALI continues. I created my user account, and set it for auto-login. Finally, when the desktop had shown, I’ve personalized my installation with Kaptan. After installation, configuration and personalization, I pushed the stop button on my stopwatch. Guess it?

It took approximately 15 minutes! Go ahead and enjoy the speed. 😉

Windows İadesi Macerası – Gün 1

Recently, I bought a new laptop. Not suprisingly, a Microsoft Windows operating-system had been preinstalled. I wanted it to be removed. This post tells the first day of the story… in Turkish.

Geçtiğimiz perşembe günü (13.01.2011) Profilo AVM’deki (Mecidiyeköy / İstanbul) Teknosa Extra mağazasından Casper marka bir bilgisayar satın aldım. Şaşırtıcı olmayan bir şekilde, Microsoft Windows (7 Home Premium) işletim sistemi yüklüydü. Bilgisayarın herhangi bir işletim sistemi yüklü gelmesi, benim istediğim işletim sistemini kurmama engel değil. Fakat kullanmayacağım ürün(ler)e (bilgisayarın içindeki işletim sistemi, virüs koruma yazılımı, DVD hazırlama yazılımı gibi) lisans ücreti vermiş olma düşüncesi ve bu ücretin, bilgisayar ücretinin %10-15 gibi büyük bir bölümünü oluşturuyor olması oldukça rahatsız edici.

Bu sebeple bugün, Çanakkale’deki Teknosa şubesine giderek işletim sisteminin iadesi için yapabileceklerimi konuştum. İade alınan işletim sistemi tekrar mağazada satılabilir (kutulu olmaması, kurulum medyasının Casper tarafından hazırlanmış olması, lisans etiketinin bilgisayar kasasından sökülecek olması) durumda olmadığından, doğrudan iade kabul edemeyeceğini belirtti. Anlaşılabilir, makul bir itiraz.

Teknosa’nın ürünü kabul etmesi için Casper yetkili servisinin kaldırma işlemini kabul etmesi ve iade için “uygundur” raporu hazırlaması gerekliymiş. Teknosadaki yetkili kişinin gösterdiği yolu takip ederek, verdiği adresteki Casper yetkili servisine gittim. Yetkili servisten sorumlu kişi, daha önce böyle bir taleple karşılaşmadığını belirtip Casper çağrı merkezinin telefon numarasını verdi. Bugün cumartesi olduğundan, pazartesi günü numarayı arayıp talebimi iletmemi, olumlu yanıt alırsam, çağrı merkezinde görüştüğüm kişinin ismi ile birlikte servise tekrar gelmemi söyledi.

Pazartesi günü Casper çağrı merkezinden olumlu yanıt alırsam, bilgisayarımla birlikte yetkili servise gideceğim. Bilgisayarımdan işletim sistemini kaldırmak için iade kabul edilebileceğine dair bir rapor hazırlayacaklar. Bu raporla birlikte Teknosa’ya gidecek ve bilgisayarımı tüm paketiyle iade edeceğim. Teknosa, bilgisayarı yeniden teknik servise gönderecek, orada işletim sistemi bilgisayardan kaldırılacak.

Anladığım kadarıyla süreç yukarıdaki şekilde işleyecek. Nasıl sonuçlanacağını henüz bilmiyor, merak ediyorum. Bu yöndeki taleplerin artması, bilgisayarların herhangi bir işletim sistemiyle önyüklü gelmesine engel olmayacak, şüphesiz. Ama işletim sistemi iade etme sürecinin hızlanacağı konusunda umutluyum.

Storing MAC address in a MySQL database

Today, I encountered a problem: storing MAC address in a MySQL database. MAC addresses (something like “01:23:45:67:78:AB”) contain six hexadecimal (base 16) values. This means each hexadecimal field can store 256 (2 to the power of 8, in base 10) values. It’s 8 bits (= 1 byte) for each value.

6 field x 8 bit = 48 bit = 6 bytes

Thus, instead of storing the address as string, I prefer to store it as an integer. Because as a string (without colons “0123456789AB”), it can be stored in 12 bytes. Storing MAC address as integer allows us to store it using less space and also fast indexing.

In database, we can use unsigned BIGINT data type as it can store up to 8 bytes. While reading from database,

SELECT HEX(mac_addr) FROM `devices`;

While saving,

INSERT INTO `devices` (mac_addr) VALUES (x'0123456789AB');

If you prefer to make conversions in PHP,

function mac2int($mac) {
    return base_convert($mac, 16, 10);
}

function int2mac($int) {
    return base_convert($int, 10, 16);
}

You can use this function to make the address human readable

function int2macaddress($int) {
    $hex = base_convert($int, 10, 16);
    while (strlen($hex) < 12)
        $hex = '0'.$hex;
    return strtoupper(implode(':', str_split($hex,2)));
}