Installing MySQL for Python on Mac OSX Leopard

Yesterday, I have a sudden request from sysadmins group to make a web data presentation from their OVO data. I’ve already had some kind of template for the web apps using CodeIgniter based framework. The only “work” to do now is how to get, process and displaying the data from raw. It’s gonna be supplied via text file.

So, I came up with an idea to use Python to do collection, conversion and inserting into database :P Ya ya ya, I actually I just wanna try to learn Python and use it in a production environment :D So, it’s gonna be my first Python application hehehehehe.

My yukiyanagi (MB403LL/A MacBook) is already equipped with Python 2.5.1. Done with file checking, reading, parsing etc. It’s now time to put all parsed data into database.
What you need to do are:

  1. Download MySQL from dev.mysql.com/downloads and install it as instructed in the documentation.
  2. Download and extract the MySQL for Pythom from sourceforge.net. I’m using MySQL-python-1.2.2.tar.gz
  3. Open Terminal and go to the directory where MySQL-python-1.2.2.tar.gz was unpacked to.
  4. It’s better to delete build/ directory, just in case your installation might be interfered with any previous builds
  5. edit file site.cfg, and edit the value of mysql_config to the correct PATH where your mysql_config reside. Mine is:

    # The path to mysql_config.
    # Only use this if mysql_config is not on your PATH, or you have some weird
    # setup that requires it.
    mysql_config = /usr/local/mysql/bin/mysql_config

  6. After that, run the build and installation script.

    python setup.py build
    python setup.py install

During “python setup.py build”, you might have some problem here like I did. It seems that there is an extra ‘mysql’ in the path that the shared object looks for the .dylib. You may get an error like this:

ImportError: dlopen(./_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib

Referenced from: ./_mysql.so
Reason: image not found

The solution is by making a symlink from /usr/local/mysql/lib to /usr/local/mysql/lib/mysql

cd /usr/local/mysql/lib
ln -s /usr/local/mysql/lib mysql

Another error which might be occured is gcc related like the picture below:
MySQL for Python installation error

Line 47 of /usr/local/mysql/include/mysql.h is:

#include <sys/types.h>

Line 93 (and 93) of /usr/include/sys/types.h is:

typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */

All you need to do is comment those 2 lines (dont forget to make the backup first)
and do the “python setup.py build”.
Voila! Everything will be running well.

Lunch

Late lunch @Ampera, Jl. Dipati Ukur – Bandung

posted using MMS-2-Wordpress – nuy

Selamat jalan, Mbak Tina

Pertengahan tahun 1997, ada 7 orang anak menginjakkan kaki di Jakarta. Baru lulus STM, masih belum punya pengalaman. 7 anak ini lolos seleksi (dari 118 calon di sekolahnya) penerimaan pegawai baru sebuah perusahaan operator GSM baru (yang nantinya menjadi yang terbesar di Indonesia).

Dari kelas A "Ascot": Martono, Soewarno
Dari kelas B "Bheta": Hengki, Pii, Nuri
Dari kelas C "Peche": Budi, Parjono

Sebulan pertama, 7 anak itu kost di bilangan Kebon Sirih. Pengenalan lingkungan akan betapa joroknya Jakarta. Tikus segede sepatu Reebok size 42 nampak joging santai di mana-mana. Bahkan segerombolan kucing nampak enggan -kalau ga mau dibilang takut- utk menemani joging satu di antara mereka. Air got yang sangat hitam, bau, menjijikkan. Kontradiktif dgn suasana dan keadaan kota Malang tempat mereka bersekolah.

Bulan ke-2 keluar dari kebon sirih, kontrak satu rumah di daerah Jl. Rengas dekat Blok S-Tendean.
3 bulan pertama dilalui dgn performance kerja yg outstanding. Jadilah 7 anak itu menjadi pegawai tetap. Banjir bandang pertama dalam hidup 7 anak itu dialami di sini. Rengas-Poncol digenangi air setinggi pinggang. Kemudian peristiwa kerusuhan mei, penjarahan dan lain lain. Belum genap setahun, akhirnya kami memutuskan pindah cari kontrakan baru. Dapalah di daerah Rasamala III.

Continue reading

Jakarta Sux and Sux More

Yang ga aku suka kalo mesti balik ke Jakarta adalah tata kota, polusi dan sarana transportasinya yg berantakan. Amat sangat parah sekali buaaaangeettttt.
Dan hari ini saya butuh waktu 30 menit dari perempatan pancoran sampai lampu merah gatsu-kuningan. Pake taksi.
Buset deh!
Ibu kota negara kok parah gini. Saatnya direlokasi.

Modus Baru Penipuan SMS

Ada modus baru penipuan berbasis (ciyeee) SMS yang sedang marak di masyarakat sekarang ini. Jadi jadi target sekarang adalah Telkomsel POIN.

 

Kronologinya adalah sebagai berikut:

  1. Kamu dapat telpon (missed call) dari nomor yang tidak kamu kenal
    (contoh nomor bangsat tersebut adalah: 085284933881)
  2. Beberapa saat setelah missed call, kamu akan dapat SMS dari nomor tersebut yang isinya:
    "Pelanggan 085284933881 Meninggalkan 1 Pesan Penting Buat Anda di 777 UntukMendengarkan ketik; AS50 085284933881 kirim ke Nomor 777 Terima kasih."

Apa yang akan terjadi jika kamu mengetikkan AS50 085284933881  dan mengirimkannya ke 777?
Kamu akan dianggap memberikan/transfer pulsa senilai Rp.50ribu untuk nomor 085284933991. Detilnya bisa dilihat di sini
Kamu emang harus punya minimal 850 poin untuk bisa menukarkan dengan pulsa senilai 50ribu. Tapi si penipu ini kan untung-untungan. Kalo dia berhasil menjebak 10 orang saja, dia udah punya pulsa senilai 500ribu. Nah, tuh pulsa bisa dijual lagi ama si bangsat.

Kita emang tidak dirugikan secara materi (apabila materi diartikan sebagai uang/pulsa), tapi kerugian yang terjadi adalah hilangnya poin reward kita apabila transaksi yang tidak kita sadari tersebut “berhasil".

Jadi HATI-HATI TERHADAP PENIPUAN.

Nomor-nomor penipu:
081331505231
081345996656
085245349119
085245303265
085284933881

Howto: Setup Huawei E220 HSDPA USB Modem with Leopard

In my previous post, I wrote that I was having trouble to get ZTE MF622 work on my Leopard. Not solved yet until now. 

Today, Derry was kindly enough to lend me his Huawei E220 HSDPA Modem. It’s Telkomsel Flash modem package but already been unlocked. So, I can use any SIM card from any available GSM operator. But unfortunately, the E220 driver for Mac from Telkomsel is not working on Leopard. So, I need to google to find the suitable driver for that.

So, how to install Huawei E220 HSDPA USB modem on Mac OSX Leopard:

  1. Download the driver here or here (add .dmg after the file name)
    E220.dmg
  2. Extract the package file (E220.dmg) and run the file "Mobile_Connect_Drv_App.pkg"
    Run installer
  3. Follow the wizard
    Continue
  4. Read the agreement, and continue if you agree
    Agree

    Aggree

  5. Select installation destination
    Agree

    Aggree

    Password

  6. Continue Installation

 

How to setup GPRS/3G/HSDPA connection with Huawei E220 on OSX Leopard:

  1.  Insert the SIM card into the data card. 
  2. Connect the data card to your PC. 
  3. Open the Finder window, and select Mobile Connect in the Application directory. 
    mobile connect
  4. Then launch the management program of the Mobile Connect. If the Personal Identification Number (PIN) code of the data card is locked, the system displays the Verify PIN dialog box for you to enter the PIN code. 
  5. If you enter wrong PINs for three consecutive times, the system displays the PIN Unblocking Key dialog box for you to enter the valid PIN Unblocking Key (PUK). Then the Mobile Connect interface is displayed.

    Note: 

    • If you enter wrong PUKs for ten consecutive times, the SIM card is invalid permanently
    • The PIN and PUK are delivered with the SIM card provided by your service provider. For details, consult your service provider.
  6.  Now, we create a profile. From Mobile Connect UI above, click on Setting button
    Create profile

    Click on New button
    I’m using Telkomsel Flash service, therefor I create a profile like picture above.
    Dont forget to use PAP as Authentication method.
    Click Save then OK if you finish creating profile

  7.  Select the profile you want to use and click Connect
  8. During the dial-up access, the Mac OS X system requires you to enter the account and password of the system administer. You can access the Internet only when the correct account and password are entered.
  9. When you access the internet successfully, the system displays the prompt, saying “Connection successful!”.

  10. IMHO, I think Huawei have better english in the UI compare to his ‘brother’ :D This is what i’ve got from MF622 UI :P Connect estalish
  11. Voila! Now I’m connected to Telkomsel Flash network

  12. When you try to browse for the first time after connected, you will be redirected to http://flash.telkomsel.com/id/HalamanUtama.php.
    Choose the package you want.

  13. You’ll have this page after finish selecting a package
  14. Checking IP
  15. Start browsing

That’s all. I hope this tutorial can help you (the Leopard & Telkomsel Flash users) to setup Huawei E220 modem on your Mac :)

 

Read this post on my new blog
http://nuy.nurikidy.com/2008/05/21/howto-setup-huawei-e220-hsdpa-usb-modem-with-leopard/