Saturday, January 1, 2011

Merge harddisk partition

Okay, It was happen I use ubuntu and make 2 partition (1 the main partition and the other 1 is the swap space)
But then I want to use Window again and 'hey!, the partition is separated. How do I merge it?'

So I'm doing some google and here is the website that solve my problem http://www.extend-partition.com/
They have Home Edition which is FREE

THEN, MY (FRIEND) 2ND PARTITION IS MISSING!!!!!!!!!!!!!

Wednesday, December 15, 2010

Malaysia E-Hadith

Malaysia E-Hadith

Website nih bagus bagi yang tak ada buku hadith dan juga cool sebab boleh search. So boleh lah anda cari hadith-hadith tertentu yang dapat membantu

http://ii.islam.gov.my/hadith/hadith.asp

Mintak panjang umur dan murah rezeki?
http://ii.islam.gov.my/hadith/hadith1.asp?keyID=1264

Siapa orang yang betul-betul miskin?
http://ii.islam.gov.my/hadith/hadith1.asp?keyID=1667

Tuesday, December 14, 2010

FPDF - MutiCell - underline on each line

FPDF - MutiCell - underline on each line


Draw line under each line when new line is created when using FPDF. Or simply like picture below


Lazy to put picture


 


If you are using FPDF and want to make a line at the bottom of the text using Muticell, the parameter you send willl be like this


$pdf->MultiCell( 10, 100, "Hello World", 'B')


Where the 'B' represent line at bottom


 


But if you have a case like $pdf->MultiCell( 10, 100, "Hello \nWorld", 'B') //New line


or $pdf->MultiCell( 10, 100, "Hello World Hello World Hello World Hello World Hello World Hello World ", 'B') //Text too long auto new line


They will look like this


Lazy to put picture


 


And what you want is to look like this


Lazy to put picture


 


If you change the text into underline, it also does solve the purpose but it is not underline upon cell. It will be underline upon text


Lazy to put picture


 


So what left is only a tweak to the FPDF where I will tell you where to modify, which is in the function MultiCell(...) of course


First of all, I'm using FPDF version 1.53 (2004-12-31) where Olivier PLATHEY said "You may use and modify this software as you wish."


So this tweak is legal


Second, this code I write is free you may use and modify what I code as you wish. This is also 'AS IS', if anything happen dont blame me


If got bug, I dont care because with this code I already manage to get what I want


 


Lets start


 


Step 1


Go to the function MultiCell($w,$h,$txt,$border=0,$align='J',$fill=0)


 


Step 2


Inside there, you will see function Cell(...) is called 4 times and what you need to do is add additional code at the bottom of cell number 1 and 3


If I was correct


Cell no 1 is at line 755


Cell no 3 is at line 794


 


Step 3


Make the code to look like this. Make it like that at the 1st and 3rd cell



$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);

//Hassif. If you want the Multicell to have a bottom line at each text. use this
//Common border 'B' only bottom line at the end of text. Not at each line of text
if( strpos($border,'Z')){
$this->Line( $this->x, $this->y, $w+$this->x, $this->y);
}



 


Step 4


It done. So to use this feature you need to put $pdf->MultiCell( 10, 100, "Hello \nWorld", 'BZ') which is additional 'Z' character


 


Im kind of busy right now to explain further, so later...

Thursday, November 25, 2010

mysql find duplicate record

I take it from here. Put in my own blog cause I keep using them
http://www.petefreitag.com/item/169.cfm

SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )

SELECT email
FROM users
GROUP BY email
HAVING ( COUNT(email) = 1 )

31 May 2011
It turns out these code was pretty awesome when I want to make a dynamic drop down selection
I can make it display unique value and sorted by most use at the top

Thursday, November 4, 2010

Redhat I always use command

Last update, 25 April 2011
This is not only for Redhat, but for most of Linux machine (I think)

Source of this command is from here. I keep using them
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/4/html/Step_by_Step_Guide/s1-manipulate-current.html
http://redhat.activeventure.com/71/gettingstartedguide/s1-managing-working-with-files.html

This is a good reference for VI - Visual Editor (Command line interface for text editor)
http://www.cs.colostate.edu/helpdocs/vi.html

Check folder size
du -hs /path/to/directory


Check harddisk space
df


List all the content within the current folder (or path)
ls OR ls -all


Remove file
rm thefilename.txt


Move file
mv thefilename.txt /home/asipo/


Delete directory and all its content
rm -rf /home/asipo/backupdocuments


Zip a file or folder
zip -r iWantTheZipFileNameToBeLikeThisOkay.zip theActualFileName.txt


Unzip a file (not sure for folder)
unzip thefilename.zip


Change folder owner
chown -R asipo.asigroup '/var/www/smellynomore/app/tmp'


Change folder permission
chmod -R 777 '/var/www/smellynomore/app/tmp'


Copy all except one folder

shopt -s extglob
cp -r A/!(B) dest_dir


Execute bin file
chmod u+x qt-sdk-linux-x86-opensource-2010.05.1.bin
./qt-sdk-linux-x86-opensource-2010.05.1.bin

Connect to server and control it (Telnet / SHH I think)
ssh -p 22 asipi@langit.com.my

Monday, October 11, 2010

Detect keyboard button press

This javascript function is to detect KEYCODE of the keyboard you press.
Note that pressing 'P' will not return 'P' but they will send signal in integer called KEYCODE

This is engineering guys who did it, so we IT guys just follow. Dont questioned

To detect and return what is the KEYCODE for each button. Refer this link
http://help.dottoro.com/ljlkwans.php

Or I give you guys the code, ha

Javascript code
function callSearchPressEnter(event)
{
var keyCode = event.which;
if (keyCode == undefined)
{
keyCode = event.keyCode;
}
alert ("The Unicode key code is: " + keyCode);
}


For the HTML
bla bla bla onkeydown="callSearchPressEnter(event)"

Monday, October 4, 2010

Convert PDF into Excel or Words

I use Able2Extract Pro. Of course I download the Pirate one with the crack