Monday, June 20, 2011

[python] NameError: name 'self' is not defined

Bismillah..

I'm currentlt learning about python..
I take this web as my guide.
http://www.sthurlow.com/python/

then in lesson 8 which i learn about how to create class i got problem...

Traceback (most recent call last):
File "D:/workspace/openerp/sourcecode/phython/lesson8class.py", line 1, in ?
class Shape:
File "D:/workspace/openerp/sourcecode/phython/lesson8class.py", line 17, in Shape
self.y = self.y * scale
NameError: name 'self' is not defined

I gugling... and found these simple answer in this link http://stackoverflow.com/questions/2963654/python-nameerror-self-is-not-defined:

The exception is happening while the class is being defined, which means that your indentation is off. Tabs in Python are equivalent to 8 spaces, so if all the preceding lines are using tabs and your tabstop is set to 4 spaces then the indentation only looks correct.


wuihihi... so make sure you use the correct IDE :D

Wednesday, February 09, 2011

install sun-java on lucid

Bismillahirrahmaanirrahiim

lagi2 .. ini hal yang sering aku cari tapi sering lupa
lagi2 buru2 yaa...

package java default di lucid lynx 10.04 adalah openjdk
tapi, beberapa installer tidak bisa comply dengan openjdk tsb..
jadi musti pake sun-java

karena itu, langkahnya adalah:
edit file /etc/apt/sources.list

tambahkan:
deb http://archive.canonical.com/ lucid partner

lalu sudo apt-get update
baru deh cek aja:
sudo apt-cache search java

bisa terlihat sejumlah package yang depannya sun-java

SO, selamat menginstallll

libkrb53 1.6.dfsg.2

Bismillah

langsung aja ya, karena buru2 nih nulisnya.
Awalnya aku mau install postgresql-8.2 di PC dengan ubuntu 10.04 lucid lynx 32bit.
karena gak ada package nya.. kebetulan aku udah download manual package2 yang bersesuaian.

jadi, yang dilakukan adalah:
# sudo dpkg -i postgresql-client-common_87_all.deb
# sudo dpkg -i postgresql-common_87_all.deb
# sudo dpkg -i postgresql-client-8.2_8.2.7-1_i386.deb
# sudo dpkg -i libpq5_8.3.8-0ubuntu8.04_i386.deb
# sudo dpkg -i postgresql-8.2_8.2.7-1_i386.deb

eh di step terakhir malah muncul error yang intinya ada dependensi ke libkrb53 (>=1.6.dfsg.2)

dicari2 muter2 gk nemu tuh package..
ternyata itu salah satu bugs...

dapet solusi sementara spt di:
https://bugs.launchpad.net/ubuntu/+source/root-system/+bug/462059
(lihat di comment #6)

intinya buat libkrb53 palsu dengan
buat file misal krb.txt

yang isinya:

Package: libkrb53
Version: 1.6.dfsg.2+fake1
Depends: libkrb5-3, libgssapi-krb5-2, libk5crypto3, libkrb5support0

lalu jalankan dengan equivs

sudo equivs-build krb.txt

*install dulu package equivs yang juga belibet

akhirnya ke-generate file: libkrb53_1.6.dfsg.2+fake1_all.deb

baru deh jalanin
sudo dpkg -i libkrb53_1.6.dfsg.2+fake1_all.deb

baru deh lancar jalankan :
# sudo dpkg -i postgresql-8.2_8.2.7-1_i386.deb

Semoga membantu :)

Friday, October 29, 2010

Monday, June 28, 2010

install 2 versions postgre (8.2 dan 8.3)

Ahhh saya lagi malas berbahasa Inggriss....
jadi awalnya ada kebutuhan utk install postgre 8.3 karena aplikasi yg mau kuinstall
mewajibkan minimum req postgre 8.3
Sedangkan di laptopku dengan OS Ubuntu 9.04 - the Jaunty Jackalope sudah terinstall postgre-8.2 dan gak mungkin diunsintal karena ada aplikasi yang sudah ditetapkan pakai 8.2 dan malas sekali aku upgrade aplikasi tsb... hehe..
So, akhirnya tanya ke sana ke mari... (thanks to mas toni sutomo and pak reza primardiansyah yg dah kasih solusi)

so, ternyata gampang ajah tinggal instal lagi aja version 8.3 nya spt biasa dengan apt...
# apt-get install postgresql-8.3

kalo 8.2 dulu installnya download paket2nya secara manual, karena paket di ubuntu 9.04 secara default adalah 8.3..

terus bedain deh portnya..
karena yg pertama kali diinstal adalah 8.2 dengan default port 5432, maka yg harus diubah portnya adalah yg version 8.3
yaitu dengan edit file: /etc/postgresql/8.3/main/postgresql.conf
edit bagian ini:
port = 5432 # (change requires restart)
ubah aja jadi 5433
terus restart dah...

terus utk pakai psqlnya...
defaultnya kalo jalankan psql akan masuk ke sever 8.2 dengan port 5432
utk menggunakan psql utk versi 8.3
jalankan:
/usr/lib/postgresql/8.3/bin/psql (bikin aja symlink utk langsung akses ini)

nah ternyata biarpun sudah pakai psql versi 8.3 dia akan tetap akses server postgre versi 8.2
oleh karena itu tampbahkan paramter portnya...
/usr/lib/postgresql/8.3/bin/psql -p 5433
baru deh bisa akses server 8.3

as simple as that..........
^o^

Saturday, June 06, 2009

Kernel panic-not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Last afternoon, I asked my friend to reinstall my ubuntu with Ubuntu9.04..
Installation process was succeed... but when I try to re login to this laptop, I've got an error information that make me being panic successfully... which is:
Kernel panic-not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Whuaaa... I could't enter to ubuntu desktop, I could't enter to bash terminal. I could't do anything, just press F12 or Esc, F2 then nothing. What should I do??
I ask my friend about this error, and he couldn't do anything, because Internet was out of reach. How about me? I also couldn't access internet without this laptop. Then he tell me to use Live CD, so I can access internet and try to fix the problem.
Thanks God, I bring my flash disk which Kubuntu Live OS already placed in.

Okay, I can access internet successfully, I have a chance to repair the problem with that Kubuntu. Found many variation of solution on google (fiuuh I love google =P).
I confused. But, I have found one BIG clue... that I shoud do "chroot", "apt-get update", and "apt-get upgrade".

I see on Nautilus, that there still 3 partition of hardisk. Of course one of them is filesystem partition.
Then from one of ubuntuforum( I'm sorry, I do really forget to save the link), it told me to do mounting filesystem, just by click that partition on Nautilus.

So, what I did is:
  • click filesytem partition, so it mounted to /media/disk (depend on system)
  • do chroot on terminal by typing:
    #sudo chroot /media/disk
  • Do apt-get update
    #sudo apt-get update
The last step, working on the middle, but suddenly stopped and raise an error:
Could not set non-blocking flag Bad file descriptor
E: Method http has died unexpectedly!

Whuaaa.... whats wrong?
Then I chat to my friend who I know that he really smart and familiar witu ubuntu. He said, that mounting process I've done haven't completed yet. I should did these three steps before do chroot:

# sudo mount -t proc proc /media/disk/proc
# sudo mount -t sysfs sysfs /media/disk/sys
# sudo mount -o bind /dev /media/disk/dev

So, what I've done are:
  • click filesytem partition, so it mounted to /media/disk
  • finisihing mounting:
    # sudo mount -t proc proc /media/disk/proc
    # sudo mount -t sysfs sysfs /media/disk/sys
    # sudo mount -o bind /dev /media/disk/dev
  • do chroot on terminal by typing:
    #sudo chroot /media/disk
  • Do apt-get update
    #sudo apt-get update
    Yeiiyyy it worked... apt-get update run smoothly
  • Continue to do apt-get upgrade
    #sudo apt-get upgrade
    Yes it also worked... ALhamdulillah
Then I restarted the PC, and still got error but with different context which is:
/sbin/unsplash_write: not found
and ask me to insert command on initrampfs shell... that I have no any idea what is that..

Then I remember, that one of solution on ubuntuforum told me to do update-initramfs.
So, I back to use Live OS ... do this command:
  • click filesytem partition, so it mounted to /media/disk
  • finisihing mounting:
    # sudo mount -t proc proc /media/disk/proc
    # sudo mount -t sysfs sysfs /media/disk/sys
    # sudo mount -o bind /dev /media/disk/dev
  • do chroot on terminal by typing:
    #sudo chroot /media/disk
  • update inintramfs
    #update-initramfs -c
Restart the PC, and Alhamdulillah I can enter into ununtu desktop successfully..

So, the steps are:
  • click filesytem partition, so it mounted to /media/disk
  • finisihing mounting:
    # sudo mount -t proc proc /media/disk/proc
    # sudo mount -t sysfs sysfs /media/disk/sys
    # sudo mount -o bind /dev /media/disk/dev
  • do chroot on terminal by typing:
    #sudo chroot /media/disk
  • update inintramfs
    #update-initramfs -c
  • Do apt-get update
    #sudo apt-get update
    Yeiiyyy it worked... apt-get update run smoothly
  • Continue to do apt-get upgrade
    #sudo apt-get upgrade
Thanks to Ichsan, Iyang, Google ans also Allah S.W.T

Thursday, June 04, 2009

permisson - binary - etc

Because I'm too lazy to rewrite this topic. So, I just copy the conversation between me and my friend about how to config permission on Linux.

09:09 me: ichsan... kalau ngatur permission spya bisa solve masalah ini, gimana ya?
2009-06-04 09:12:05 WIT DETAIL: File must be owned by the database user or root, must have no write permission for "group", and must have no permissions for "other".
Muhammad: Ubah permissionnya
09:10 chmod
me: nah iya chmod ** berapa ?
09:11 Muhammad: chmod itu terdiri atas: rwxrwxrwx. Masing2 groupnya adalah: user group other
own itu harus pake chown
chown filenya
09:14 me: gini dah
09:15 gimana cara supaya permission-nya: -rw-r-----
Muhammad: rwx itu adalah biner 111
09:16 111 artinya 7
chmod 777 file, artinya:...
?
09:17 me: kalo itu si bisa diakses siapapun
Muhammad: Nah, silahkan disesuaikan
selamat mencoba!
me: kalo rw=110 gitu?
09:18 Muhammad: ya
110 itu kan biner
me: berarti 640
gitu bukan?
Muhammad: 110 != 640 oi
110 itu artinya 6
09:19 me: iya
maksud gw kalo gw mau spt ini:
-rw-r-----
jadinya 640 bukan?
Muhammad: betul
me: yeeiyyyy
hehe gw lupa pelajaran gitu2an
:P
09:20 Muhammad: Itu penting banget di Lniux
ilmu terdasar
09:23 me: baiklah baiklah saya mengerti
09:24 Muhammad: wasurenaide ne
(don't forget)
09:25 me: insyaAllah