SQL resultset to CSV

Question: I want to grab data from SQL database and show it in csv file.

Answer:

SELECT * INTO OUTFILE '/tmp/out.csv'  
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'
    FROM myTable;

More: MySQL manual
Credit: nyem at lowyat.net

Download Centos 5.2

What’s up doc?

[charles@smallville /home/charles]# wget http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-1of6.iso
--14:58:00--  http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-1of6.iso
Resolving ftp.osuosl.org... 140.211.166.134
Connecting to ftp.osuosl.org|140.211.166.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 654061568 (624M) [application/octet-stream]
Saving to: `CentOS-5.2-i386-bin-1of6.iso'
 
100%[====================================================================================================================>] 654,061,568 6.10M/s   in 1m 53s
 
14:59:53 (5.54 MB/s) - `CentOS-5.2-i386-bin-1of6.iso' saved [654061568/654061568]
 
[charles@smallville /home/charles]# wget http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-2of6.iso
--15:00:12--  http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-2of6.iso
Resolving ftp.osuosl.org... 140.211.166.134
Connecting to ftp.osuosl.org|140.211.166.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 666683392 (636M) [application/octet-stream]
Saving to: `CentOS-5.2-i386-bin-2of6.iso'
 
100%[====================================================================================================================>] 666,683,392 5.80M/s   in 1m 57s
 
15:02:10 (5.43 MB/s) - `CentOS-5.2-i386-bin-2of6.iso' saved [666683392/666683392]
 
[charles@smallville /home/charles]# wget http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-3of6.iso
--15:02:27--  http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-3of6.iso
Resolving ftp.osuosl.org... 140.211.166.134
Connecting to ftp.osuosl.org|140.211.166.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 665231360 (634M) [application/octet-stream]
Saving to: `CentOS-5.2-i386-bin-3of6.iso'
 
100%[====================================================================================================================>] 665,231,360 5.90M/s   in 1m 53s
 
15:04:21 (5.62 MB/s) - `CentOS-5.2-i386-bin-3of6.iso' saved [665231360/665231360]
 
[charles@smallville /home/charles]# wget http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-4of6.iso
--15:04:50--  http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-4of6.iso
Resolving ftp.osuosl.org... 140.211.166.134
Connecting to ftp.osuosl.org|140.211.166.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 666519552 (636M) [application/octet-stream]
Saving to: `CentOS-5.2-i386-bin-4of6.iso'
 
100%[====================================================================================================================>] 666,519,552 5.74M/s   in 1m 54s
 
15:06:45 (5.59 MB/s) - `CentOS-5.2-i386-bin-4of6.iso' saved [666519552/666519552]
 
[charles@smallville /home/charles]# wget http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-5of6.iso
--15:07:20--  http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-5of6.iso
Resolving ftp.osuosl.org... 140.211.166.134
Connecting to ftp.osuosl.org|140.211.166.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 667863040 (637M) [application/octet-stream]
Saving to: `CentOS-5.2-i386-bin-5of6.iso'
 
100%[====================================================================================================================>] 667,863,040 6.00M/s   in 1m 56s
 
15:09:16 (5.51 MB/s) - `CentOS-5.2-i386-bin-5of6.iso' saved [667863040/667863040]
 
[charles@smallville /home/charles]# wget http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-6of6.iso
--15:09:37--  http://ftp.osuosl.org/pub/centos/5.2/isos/i386/CentOS-5.2-i386-bin-6of6.iso
Resolving ftp.osuosl.org... 140.211.166.134
Connecting to ftp.osuosl.org|140.211.166.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 683225088 (652M) [application/octet-stream]
Saving to: `CentOS-5.2-i386-bin-6of6.iso'
 
100%[====================================================================================================================>] 683,225,088 5.55M/s   in 2m 0s
 
15:11:38 (5.44 MB/s) - `CentOS-5.2-i386-bin-6of6.iso' saved [683225088/683225088]
 
[charles@smallville /home/charles]#

The Software Business 101

Creating something cool is easy but maintaining can be disastrous. The code works but real challenges are when several different system involved. There are 2 things that client will always request by default.

  1. Get the cheapest deal
  2. Complete it ASAP

This is what usually happens:

Damn Right!

How to download myspace songs

Jason Mraz is one of my favorite singer. He is gifted. While waiting in agony for my girlfriend to finish her monthly window shopping and fortunately enough manage to find an unoccupied bench which supposedly for the older/pregnant/less ability people, there this song I heard. Jason Mraz was the first thing in my mind. Yes. This is definitely Jason Mraz, I thought. To cut long story short, I was wrong. The singer was not Jason Mraz.

After finding it out the hard way, it was actually Colbie Caillat. As usual, I Google and found out her myspace homepage. She is also gifted.

How to download myspace songs, a screencast tutorial. Requirement:

  1. Firefox Web browser that works
  2. Firebug (Firefox addon for web developer)
  3. K-Lite Codec Pack (if you’re unable to play the video)

In short:

http://mediaservices.myspace.com/services/media/musicplayerxml.ashx?b=<ID>

Starting Firefox with profile manager

Whenever I go to perform a demo at client site, I will switch my Firefox profile to ‘demo’ which I created specifically for demo session. This is handy because I don’t want to use the default profile which have lots of personal bookmarks and this will distract/annoyed the client. Changing between different profiles is easy with the -p switch:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
 
C:\Documents and Settings\Charles>cd \
 
C:\>cd "Program Files"
 
C:\Program Files>cd "Mozilla Firefox"
 
C:\Program Files\Mozilla Firefox>firefox.exe -p

Lots of bookmarks

Lots of bookmarks

Di mana Helena?

Missing Children: Helena Hairy Lojimin:

Hellena Hairy Lojimin

Take a good look at the picture, close your eyes and memorize the face. Déjà vu will guide you.

Quote from The New Sabah Times. Thanks to The Dogoes and Cikgu Carol

Distressed parents Hairy Lojimin, 53 and Rosnie Majamin, 49, are pleading to the public to help find their daughter who disappeared about a year ago.

Their youngest child Helena (pictured), now 17, was last seen leaving her aunt’s house in July last year to meet her friends in the city.

She never returned home after that. Hairy, a Menggatal resident, said his daughter used to live with her aunt when she was in Form Four. “We do not know why she did not come home.

We never had any heated argument but if we had offended her in any way, we would like to say sorry…we just want her to come home,” he said. Hairy said he has already lodged a police report on Helena’s disappearance.

Anyone who knows Helena’s whereabouts can contact Hairy (013-8720697) or Rosnie (012-8306510) or her elder sister Rozita (016-5853566).

Well it didn’t bothers me to post this. It just copy paste and I can. You should copy and paste too.

I don’t know the parents or Helena Hairy Lojimin but probably I watched too many Lions Gate production and assured/brainwashed that this world is full of shit with you and me living in it.

I do have a small concern though. She disappeared a year ago. Why now? The simple common sense is, if your child is missing, IMMEDIATELY call the local law enforcement agency a.k.a the police and start a massive alert/announcements.

I have a cousin who was ‘missing’ once. She runaway with a guy. Was once lost, but now found. All I can say to the parent, don’t give up.

English Mistakes from Language Students

English Mistakes from Language Students.

  1. Do you like this food? I made it from scratching!
  2. A cold is caused by micro-orgasms in your nose.
  3. I had a little ass dent this morning but I’m okay now.
  4. Yesterday I had strong wind here.
  5. Should I have a coma in the middle of this sentence?
  6. The cheerleaders threw up high into the air!
  7. Christians believe if they do not sin they will have salivation.

For loops in file operations

Examples demonstrating the use of FOR loops in converting .wav file to mp3 using LAME

Linux:

for f in *.wav; do lame "$f" "${f%.wav}.mp3"; done

Windows:

FOR %%i IN (*.wav) DO bin\lame.exe -b 32 --resample 22.05 -m m -h %1 "sounds/%~n1.mp3" "%%i"

How to enable vnc-server on CentOS

VNC (an abbreviation for Virtual Network Computing) is a great client/server software package allowing remote network access to graphical desktops. With VNC, you can access your machine from everywhere provided that your machine is connected to the Internet. VNC is free (released under the GNU General Public License) and it’s available on most platforms.

To enable vnc:

[root@releaseserver ~]# vncserver --help
 
usage: vncserver [:<number>] [-nohttpd] [-name <desktop-name>] [-depth <depth>]
                 [-geometry <width>x<height>]
                 [-pixelformat rgbNNN|bgrNNN]
                 <Xvnc-options>...
 
       vncserver -kill <X-display>
 
[root@releaseserver ~]# vncserver :1 -depth 16 -geometry 800x600
 
New 'releaseserver:1 (root)' desktop is releaseserver:1
 
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/releaseserver:1.log
 
[root@releaseserver ~]#

Then from my windows XP, using TightVNC, I will connect to the server. Note: The server is in the office (LAN) with no monitor/keyboard/mouse attached to it 24/7 hours ON.

vnc

vnc

vnc

vnc

If you get a not very nice GUI (gray eveywhere), edit the /root/.vnc/xstartup file to start the gnome or KDE. The folder ‘.vnc’ is hidden so you might wanna do ‘ls -lha’

#!/bin/sh
 
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
 
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
exec gnome-session &

WGET for Windows

GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.

Windows version is available here: WGET for Windows

 
E:\>cd "E:\Softwares\Trial\wgetwin-1_5_3_1-binary"
 
E:\Softwares\Trial\wgetwin-1_5_3_1-binary>wget.exe http://amp.channelv.com:80/amp/resources/_user/8545/aDkumLkaXJDRiwckNXDa.flv
--23:12:51--  http://amp.channelv.com:80/amp/resources/_user/8545/aDkumLkaXJDRiwckNXDa.flv           => `aDkumLkaXJDRiwckNXDa.flv'
Connecting to amp.channelv.com:80... connected!
HTTP request sent, awaiting response... 200 OK
Length: 2,129,282 [text/plain]
 
    0K -> .......... .......... .......... .......... .......... [  2%]
   50K -> .......... .......... .......... .......... .......... [  4%]
  100K -> .......... .......... .......... .......... .......... [  7%]
  150K -> .......... .......... .......... .......... .......... [  9%]
  200K -> .......... .......... .......... .......... .......... [ 12%]
  250K -> .......... .......... .......... .......... .......... [ 14%]
  300K -> .......... .......... .......... .......... .......... [ 16%]
  350K -> .......... .......... .......... .......... .......... [ 19%]
  400K -> .......... .......... .......... .......... .......... [ 21%]
  450K -> .......... .......... .......... .......... .......... [ 24%]
  500K -> .......... .......... .......... .......... .......... [ 26%]
  550K -> .......... .......... .......... .......... .......... [ 28%]
  600K -> .......... .......... .......... .......... .......... [ 31%]
  650K -> .......... .......... .......... .......... .......... [ 33%]
  700K -> .......... .......... .......... .......... .......... [ 36%]
  750K -> .......... .......... .......... .......... .......... [ 38%]
  800K -> .......... .......... .......... .......... .......... [ 40%]
  850K -> .......... .......... .......... .......... .......... [ 43%]
  900K -> .......... .......... .......... .......... .......... [ 45%]
  950K -> .......... .......... .......... .......... .......... [ 48%]
 1000K -> .......... .......... .......... .......... .......... [ 50%]
 1050K -> .......... .......... .......... .......... .......... [ 52%]
 1100K -> .......... .......... .......... .......... .......... [ 55%]
 1150K -> .......... .......... .......... .......... .......... [ 57%]
 1200K -> .......... .......... .......... .......... .......... [ 60%]
 1250K -> .......... .......... .......... .......... .......... [ 62%]
 1300K -> .......... .......... .......... .......... .......... [ 64%]
 1350K -> .......... .......... .......... .......... .......... [ 67%]
 1400K -> .......... .......... .......... .......... .......... [ 69%]
 1450K -> .......... .......... .......... .......... .......... [ 72%]
 1500K -> .......... .......... .......... .......... .......... [ 74%]
 1550K -> .......... .......... .......... .......... .......... [ 76%]
 1600K -> .......... .......... .......... .......... .......... [ 79%]
 1650K -> .......... .......... .......... .......... .......... [ 81%]
 1700K -> .......... .......... .......... .......... .......... [ 84%]
 1750K -> .......... .......... .......... .......... .......... [ 86%]
 1800K -> .......... .......... .......... .......... .......... [ 88%]
 1850K -> .......... .......... .......... .......... .......... [ 91%]
 1900K -> .......... .......... .......... .......... .......... [ 93%]
 1950K -> .......... .......... .......... .......... .......... [ 96%]
 2000K -> .......... .......... .......... .......... .......... [ 98%]
 2050K -> .......... .......... .........                        [100%]
 
23:13:47 (37.81 KB/s) - `aDkumLkaXJDRiwckNXDa.flv' saved [2129282/2129282]
 
 
E:\Softwares\Trial\wgetwin-1_5_3_1-binary>
Copyright © 2007 sunsuron. All rights reserved.