rss
twitter
  •  

Dear Windows, It’s over

| Posted in Just a joke, Tech-News, ubuntu |

0

Dear Windows:

I didn’t want to tell you this in person, because I thought it might be too complicated, and might take too long. After all, we’ve been together for a long time, almost five years and running now. I know, I know; I know you so well; your control panel, your installation procedures, even when you get mad and go all blue screen on me; what can I say, you kinda grew on me.

But to be honest, things have been going downhill for a long time now. What happened to that lean, fast OS that i first installed? You know, the one that ran Civ 4, Vice City, and even True Crimes without a problem? The one that burned DVD’s, CD’s, the one that shared music with my xbox without a problem? I don’t know; It seems like you’ve let go of yourself, to be honest. You take over 20 minutes to boot up, you run Civ4 slowly, heck, you even freeze up on me now when I try to watch video. What happened windows? Did you get so comfortable that you thought I’d just deal with it?

Well, I’ve been cheating. See, back in tenth grade, i messed around a bit with this chick, her name was Red Hat Linux. We met in school in my networking 5 class, and i got to know her pretty well. I was all up in her terminal, if you know what i mean :P . Well, I took her home, and we had a really rough one night stand. I decided she wasn’t for me, and i went back to you, because i knew what i was missing. Well, Red Hat has a south african cousin, and her name’s Ubuntu…she’s kinda hot, too. She’s got three cousins, Xubuntu, Edubuntu, and Kubuntu, too, and their all sexy.

Well, I guess this letter is to let you know that it’s over. I’m not going back, either. You can tempt me with your games, and all the software, but it’s alright. I can get to know ubuntu, I can learn to work her terminals. Her freeware. Her internet support. After all, what can I say…she’s sexy, fast, and free. Amd you’re expensive, bloated, and well, always sick with viruses. I’m done.

I know, i know. I freaked out and formatted you off my hard drive, and then I called you begging and pleading to take me back, and we briefly made up. But what was I thinking? I remembered all the bad times we had, and I called Ubuntu up and she understood me just fine. Before I knew it, we were hitting it off again. She installed really quickly, and didn’t even need any drivers or anything. Worked beautifully. And did I remind you she’s free?

So Windows Professional Service Pack 2, I’m leaving you for Ubuntu know. It’s over, we had a good run, but all expensive, virus laden, bloated software relationships must come to an end, right? I guess that’s just how it has to be.

Thanks for all the good times though! Nothing like a BSOD when i’m trying to watch a live debate on MSN or CNN, or crashing on me int he middle of civ4.

But i have to go now. It’s time to get down and dirty with ubuntu, and if I ever really miss you again, I’ll just drink it away with some WINE.

Sincerely,

Bruno

VN:F [1.7.2_963]
Rating: 0.0/10 (0 votes cast)
VN:F [1.7.2_963]
Rating: 0 (from 0 votes)

PHP-MySql: Select previous row and next row from current ID

| Posted in Programming |

23

During the dark age, the simplest way to get previous row from current ID was using this query:

  1. SELECT field1
  2. FROM tablename
  3. WHERE id = ($currentId - 1)

and to get next row:

  1. SELECT field1
  2. FROM tablename
  3. WHERE id = ($currentId + 1)

But there’s a problem. Like common data, we need to delete some rows. For example, the current ID is 14 ($currentid = 14) , and i deleted row id number 13, when i run the query to get the previous row, the result will empty. The sql cannot find ID number 13 ($currentid – 1).

How to fix it?
Again, the first simplest way i got is to loop the ID. When it cannot find the first query, it calculate again by looping it with PHP.

//the bad way..
  1. < ?
  2. $ok = false;
  3. $prev = $currentid - 1;
  4. while($ok == false){
  5.    $sql = "select * from tablename where id = $prev ";
  6.    $data = $db->query($sql);
  7.    if(empty($data)){
  8.       $prev = $prev-1;
  9.    }else{
  10.       $ok = true;
  11.    }
  12. }
  13. ?>

This is really bad idea. It will consume more resources by continually query the database. What happen when you deleted 10 rows from current ID?
There will be 10 looping with 10 query to database. How about deleted 100 rows?? You must be insane doing this.

VN:F [1.7.2_963]
Rating: 8.7/10 (3 votes cast)
VN:F [1.7.2_963]
Rating: +2 (from 2 votes)

PHP-GD: Resize Transparent Image PNG & GIF

| Posted in Programming |

43

By default, you will get black background if you resize a transparent image. To fix it, you need set alpha channel imagecolorallocatealpha to 127.
With imagecolorallocatealpha, it will allocate a color for an image.

Usage:
int imagecolorallocatealpha ( resource image, int red, int green, int blue, int alpha)

From PHP manual:
imagecolorallocatealpha() behaves identically to imagecolorallocate() with the addition of the transparency parameter alpha which may have a value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.
Returns FALSE if the allocation failed.

Before using it, you must set to false the blending mode for an image and set true the flag to save full alpha channel information.

Example:

  1. < ?
  2. $newImg = imagecreatetruecolor($nWidth, $nHeight);
  3. imagealphablending($newImg, false);
  4. imagesavealpha($newImg,true);
  5. $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127);
  6. imagefilledrectangle($newImg, 0, 0, $nWidth, $nHeight, $transparent);
  7. imagecopyresampled($newImg, $im, 0, 0, 0, 0, $nWidth, $nHeight, $imgInfo[0], $imgInfo[1]);
  8. ?>
VN:F [1.7.2_963]
Rating: 10.0/10 (1 vote cast)
VN:F [1.7.2_963]
Rating: 0 (from 0 votes)

The Greatest Hacker in the world

| Posted in Just a joke |

8

Dapet postingan lucu dari milis wong-kito, yang di post oleh pak ardy.
Isinya tentang cerita seorang “hacker” yang ribut di chatroom IRC.
Sumpah.. kocak abis…

Berikut potongan ceritanya:

* bitchchecker (~j…@euirc-a97f9137.dip.t-dialin.net) Quit (Ping timeout#)
* bitchchecker (~j…@euirc-61a2169c.dip.t-dialin.net) has joined #stopHipHop
<bitchchecker> kok gw dikick
<bitchchecker> apa ngga bisa diomongin baik2
<bitchchecker> jawab!
<Elch> ngga ada yg kick lu kok
<Elch> lu tadi ping timeout: * bitchchecker
(~j…@euirc-a97f9137.dip.t-dialin.net) Quit (Ping timeout#)
<bitchchecker> ping apaan men
<bitchchecker> timing di kompi gw bener
<bitchchecker> gw malah punya DST
<bitchchecker> lo pasti ban gw kan
<bitchchecker> ngaku aja lo jink
<HopperHunter|afk> LOL
<HopperHunter|afk> buset goblok banget lu, DST^^
<bitchchecker> KITA PUNYA DST!
<bitchchecker> udah dari dua minggu lalu
<bitchchecker> klo lo nyalain kompi pasti ada pesan dari windows: DST
is applied.
<Elch> Wah lu bener2 pakar komputer ya
<bitchchecker> diem! gw hack lo
<Elch> ok, gua diem, semoga lu nggak nunjukin ke kita seberapa hebat
lu ngehack ^^
<bitchchecker> kasih gw nomer network lu, mampus lu men
<Elch> Ehm, 129.0.0.1
<Elch> atau mungkin 127.0.0.1
<Elch> oh iya bener: 127.0.0.1 Gua tunggu serangan lu
<bitchchecker> hardisk lo gw hapus dlm 5 menit
<Elch> oh, aku takut
<bitchchecker> diem! lo bakal lenyap dr sini
<bitchchecker> gw masukin ip lo ke program, lenyap lo
<bitchchecker> say goodbye
<Elch> ke siapa?
<bitchchecker> ke lo men
<bitchchecker> bye bye
<Elch> gua sampe merinding ketemu hacker hebat kaya lu
* bitchchecker (~j…@euirc-61a2169c.dip.t-dialin.net) Quit (Ping timeout#)
* bitchchecker (~j…@euirc-b5cd558e.dip.t-dialin.net) has joined #stopHipHop
<bitchchecker> bah hoki lo jink klo kompi gw ngga hang tadi lo dah mampus
<Metanot> wakaka
<Elch> bitchchecker: Kalo gitu coba hack gua lagi… IP gua masih
sama: 127.0.0.1
<bitchchecker> goblok lu men

VN:F [1.7.2_963]
Rating: 0.0/10 (0 votes cast)
VN:F [1.7.2_963]
Rating: 0 (from 0 votes)

Connection Problem, Site too slow

| Posted in For life.., Tech-News |

2

Too slow!!! opening my site from outside Indonesia is too slow..
My hosting announced this:
http://blogs.masterweb.net/2008/06/28/problem-routing-di-server-noc-indosat/

Yeah, another server problem. its written that on 28 June 2008 16:25 WIB the server is up.
But still, reaaaallly slow when accessing from outside Indonesia..

Complain..complain..
I have 3 site hosted on this server. damn!!

VN:F [1.7.2_963]
Rating: 0.0/10 (0 votes cast)
VN:F [1.7.2_963]
Rating: 0 (from 0 votes)