Blog xaie

Bahasa Pemrograman “Go” dari Google

15 November 2009 · Tinggalkan sebuah Komentar

Holy crap! A new programming language from Google!

http://golang.org/

Busyet, gw mesti lihat yang satu ini. Dari contoh program yang diberikan nampaknya Python-ish dengan rasa C. Saya bersemangat dengan prospek bahasa ini, bukan karena nama besar Google dibelakangnya tapi karena sederet feature yang masih “katanya” (soalnya belum coba sendiri :D ). Baguslah, saya sedang tunggu-tunggu yang seperti ini: fleksibilitas Python dengan power dan workflow C.

Yang paling penting menurut gw, ini bukan interpreted language! Kalau memang betul bisa kompilasi dengan cepat, seperti Object Pascal, maka asik juga bisa menyaingi Python yang (IMHO) bagus tapi sayangnya interpreted. Artinya Go, dari kesan yang gw dapat setelah membaca sekilas, memiliki kecepatan kompilasi seperti Object Pascal, menghasilkan native object bukan intermediate yang dijalankan oleh VM seperti Python atau Java, tapi dengan sifat ekspresif seperti Python.

Hmm.. very interesting. Pertanyaannya sekarang, apakah bahasa ini akan “sukses”?

→ Tinggalkan KomentarKategori: Uncategorized
Ditandai: , ,

Upgrade to Ubuntu 9.10

15 November 2009 · Tinggalkan sebuah Komentar

Kubuntu 9.10 ScreenshotAs if continuing to my own tradition, that is to upgrade to every x.10 release, I just manage to upgrade my Linux install to Kubuntu 9.10. Yay, another 600-`somthing` megabytes wasted. I would like to report my experience so far, and if you don’t like about it you are more than welcome to navigate away from this page, on my seemingly dead blog.

First, the download, as usual, filled with guilt and curses. Mainly moaning about my slow internet connection and various hate-themed blog drafts on the subject never made it here just because the connection was too crappy while downloading.

Next, the live CD session was a good thing. I’ve seen worse from the Kubuntu dev team *cough*8.10*cough* so I didn’t budge at the very least. Kubuntu 9.10 featuring a sane interface, IMO, and everything seems shiny. The QtCurve is a big factor in this release because in the very first minute with Karmic Koala I switched from Oxygen to QtCurve because I’m too lazy to waste my time by getting senile over inconsistency between Qt and GTK apps. Karmic Koala with QtCurve made my day, or night, whatever.

Next, as upgrading on every-other Kubuntu release made me learn, is `that GRUB menu` issue. Because I want to allocate more space for linux partition, (don’t worry here I did backup my stuff, I think..) and I want to use the sexxxxy ext4, so reformat it is. The usual drill for Windows partition: backup, scan, defrag, have been done before I made the final plunge. *aargh!*

I was half surprised, although it is obvious because I just formatted my partition so I’m going to see new files but my gotcha moment came from the missing /boot/grub/menu.lst file. Instead, I was greeted by a shell-script-like grub.cfg file with fancy *.mod files scattered all around. Okay now, I have to confess that I didn’t follow GRUB development progress like EVERY Kubuntu user, so I did (a little, a little bit.. coz you know, I have to maintain my image as a resourceful IT dude *hehehehe..*) freaked out for 5 seconds or so. The vulnerability feeling sucks, even for a minute. I have to get online, Google for a while, before learning the NEW and IMPROVED(tm) way to do the same old stuff. Bastards.

After the mandatory apt-get update, pulling in a few important apps, setting up ssh, compiling FPC + Lazarus, mucking around with python installation, and sudo nvidia-settings, and a futile attempt browsing the games package (in short: getting used to the new environment) I realized my audio didn’t work. Somewhere along the line between my first login to a few sudo apt-get install killed the sound. I recalled there was audio on login but somehow sox cant play my ogg files now.

The solution to my audio problem was to create the .asoundrc, .pulse/default.pa, and .pulse/daemon.conf file, add myself to pulse group, and crank the volume using alsa-mixer, a minute of BIG DEAL. So I’m a little bit experienced with PulseAudio, so what? Pull in gmpc (and its dependency) from the repository and in no time I can listen to music streaming from my server computer.

Now I’m sitting here, headphone in my ears, sipping coffee while one hand typing this post.

→ Tinggalkan KomentarKategori: Orang bego punya kegiatan
Ditandai: , ,

Tidak Enak Badan Redux

6 September 2009 · Tinggalkan sebuah Komentar

Sedang tidak enak badan nih. Kepala pusing, tenggorokan sakit waktu coba menelan ludah. Aneh, kok sakitnya bisa bareng dengan kakak gw ya?

Karena sudah pernah seperti ini kira-kira setahun yang lalu, jadi minum obat seadanya: Panadol dan Amoxan. Panadol untuk sakit kepala, sedangkan amoxan untuk membantu sistem ketahanan tubuh karena antibiotik.

Setelah minum obat, browsing tentang Panadol di Wikipedia, ternyata paracetamol/acetaminophen cukup berbahaya juga. Pokoknya jangan minum diatas 4000mg, karena 2000mg pun sudah bisa menyebabkan gagal liver, keracunan hati .. hepato.. apalah itu.

Serem juga, terlebih lagi karena 1 tablet Panadol itu berisi 500mg (!!), gw kira cuma 100mg atau lebih rendah. Jadi pada intinya tidak boleh minum 8 tablet Panadol sekaligus. Untung baru minum 1 :D kekekeke..

→ Tinggalkan KomentarKategori: Orang bego punya kegiatan
Ditandai:

Lupa-lupa Ingat: Double SSH Stupidity

1 September 2009 · Tinggalkan sebuah Komentar

Login menggunakan Open SSH dari komputer A ke komputer B, pada saat asik kerja tiba-tiba ingat perlu file dari komputer A. Karena tidak tahu letak persisnya di mana, SSH ke komputer A untuk find file yang dimaksud. Gunakan scp (!!!) untuk kirim file ke komputer B.

Baru sadar setelah ketik exit. :D :D cengengesan maksudnya :D :D

PS: Sedang terlalu fokus, terburu-buru, apalah..

→ Tinggalkan KomentarKategori: Orang bego punya kegiatan
Ditandai: , ,

The Joy Of New Toy

23 Agustus 2009 · Tinggalkan sebuah Komentar

I think I just found out how to download a file from an online file storage for free without that silly ‘waiting time’ thing. It doesn’t require anything else than a not-your-everyday web-browser, a decent web proxy which I have to say not so difficult to find, and a bit of brain cells.

No, this is not using proxy to skip IP-based detection from the server’s part. I use proxy because as I also found out, in the past, that they put downloads limit for my country. This might sound unfair, but I know that I can think one reason why they put a downloads limit; anyway that’s not the point.

If I did’t know better I might post it on the internet, but I know (and I think anybody else who smart enough) once it made into public knowledge then bye bye to no ‘waiting time’.

Hmm… now let me see, is there anything else I would like to download from this file storage website?

→ Tinggalkan KomentarKategori: Orang bego punya kegiatan
Ditandai: , ,

Wow, even Geocities is closing down

20 Juli 2009 · Tinggalkan sebuah Komentar

Although I didn’t put any attention to Geocities for the past few years; I never log in TO Geocities for years, maybe, but apparently the service is closing.

I do have an account there (who doesn’t?), and it was from way back 2002. I remember back then when Geocities was a company of its own, before Yahoo! bought them. It IS a great service, provided if you dont mind using HTML-only website, I know one or two guys who do. So here I am, waiting for another hour because my hourly limit just sets off from downloading my files.

I don’t know what’s next, will Google close its GMail service in 2018? I hope I’ll live long enough to see that happening.

→ Tinggalkan KomentarKategori: Orang bego punya kegiatan
Ditandai: ,

Stupid Debian Kernel

5 Juli 2009 · Tinggalkan sebuah Komentar

I freaked out when my server computer didn’t boot to my new Debian install. I guess something about this generic kernel just ain’t right; I mean at least on this computer, because somehow it ran just fine on VirtualBox.

For a quick hack I tried booting from some live cd (I think it was a Slax) so at least I can mount it and get an older kernel from my other computer, extract the old 2.6.22-generic kernel from backup archive (that was coming from an Ubuntu 7.04 partition, because that’s my only kernel backup) and get that damned grub to play nicely by setting it to default. Why? Because I’m using an old CRT monitor, so old that I can’t see anything before 3 to 5 minutes after the first time i press power-on button or reset; I know.. I know it’s time to get a new one;).

Now at least I can get online from LAN-sharing because I can’t get Huawei E220 to work yet. Something that was as trivial as ‘wvdial MyNetProfile &’ have to wait because I know that I have to get/compile a better kernel. So, yeah busy. But the bright side of this whole situation is nothing of value deleted from this install …….. yet (O’ UNIX gods, please guide my fingers).

Aaaarrrggghhh!!!!

→ Tinggalkan KomentarKategori: Orang bego punya kegiatan
Ditandai: , ,

updateln.py

18 Juni 2009 · Tinggalkan sebuah Komentar

A Python script to update links under a path to use new prefix.


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, sys, getopt;
options = {'start': None, 'oprefix': None, 'nprefix': None, 'simulate': True};

class PathError (Exception):
  pass;

def ShowUsage():
  progname = os.path.split(sys.argv[0])[1];
  print progname;
  print '-'*len(progname)
  print " Usage: %s [-w] [-s startpath] -o oldprefix -n newprefix\n" % progname;
  print " Parameters: "
  print " -w, --write       Dont run the program run in simulation mode.\n";
  print " -s, --start-path  Use custom starting directory.\n";
  print " -o, --old-prefix  Find link(s) with prefix as specified by this parameter.\n";
  print " -n, --new-prefix  New prefix for the offending link(s) to use.\n";
####  

def GetOptions():
  global options;
  ret = 0;

  arguments = sys.argv[1:];

  try:
    wnt, dummy = getopt.getopt(arguments, "o:n:s:w", ["old-prefix=",
                    "new-prefix=", "start-path=", "write"]);
    for name, val in wnt:
      if name in ('-o', '--old-prefix'):
        options['oprefix'] = val;
      elif name in ('-n', '--new-prefix'):
        options['nprefix'] = val;
      elif name in ('-s', '--start-path'):
        options['start'] = val;
      elif name in ('-w', '--write'):
        options['simulate'] = False;
    ##

    if options['start'] == None:
      options['start'] = os.getcwd();
  except getopt.GetoptError:
    ret = -1;
  ##

  if (options['oprefix'] == None) or (options['nprefix'] == None): ret = -1;
  if ret != -1:
    print "Start      : %s" % options['start'];
    print "Old prefix : %s" % options['oprefix'];
    print "New prefix : %s" % options['nprefix'];
    if options['simulate'] == False:  print "WARNING    : This program may change links.";
    print;
  ##

  return ret;
####

def ProcessPath(curPath, recursive):
  proccount = 0;
  files = os.listdir(curPath);

  if len(files) > 0:
    print "Examining %s" % curPath;

  for entry in files:
    curFile = os.path.join(curPath, entry);

    if os.path.islink(curFile):
      linkPath = os.readlink(curFile);
      if linkPath.find(options['oprefix']) == 0:
        # we need to update this one
        newLinkPath = linkPath.replace(options['oprefix'], options['nprefix'],
                                      1);
        print "Fixing %s\n   Old path: %s\n   New path: %s" % (curFile,
          linkPath, newLinkPath);

        if options['simulate'] == False:
          # these two lines will modify/regenerate the symbolic link
          os.unlink(curFile);
          os.symlink(newLinkPath, curFile);
          proccount += 1;
        ##
      else:
        # good link, skip it
        pass;
    elif os.path.isdir( curFile ) and recursive:
      proccount += ProcessPath(curFile, recursive);
  ##    

  return proccount;
####

def main():
    if GetOptions() == 0:
      i = ProcessPath(options['start'], True);
      print;
      print ["Nothing processed by this program", \
             "There are %s link(s) processed" % i][i > 0] + '.';
    else:
      ShowUsage();
####

if __name__ == '__main__':
    main();
##

→ Tinggalkan KomentarKategori: Ilmu
Ditandai: , , ,

ssh_mp32ogg.sh

17 Juni 2009 · Tinggalkan sebuah Komentar

‘cos those MP3 wont convert by themselves.


#!/bin/sh

# -----------------------------------------------------------------------------
# It is a simple script to convert mp3 files (one at a time) to ogg on my
# other computer, because that's where the LAME codec is installed.
# Last edit: 5 June 2009
#
# It requires sox (with LAME installed) on the other computer.
#
# Usage: ssh_mp32ogg.sh [-s SERVER] [-u USERNAME] [-r BITRATE] infile outfile
# -----------------------------------------------------------------------------

mp3_fn=;
out_fn=;
server="CHIKUZA.KRYIE";	# default server
server_usr="ariel"	# default user @ server, must be exists
out_rate=4	# output bitrate to ~ 128

for cur_arg in "$@" ; do
  if [ -z "$mp3_fn" ] && [ -f "$cur_arg" ] ; then
    mp3_fn="$cur_arg";
    echo "Input file is $mp3_fn";
  elif [ -z "$out_fn" ] && [ ! -z "$mp3_fn" ] ; then
    out_fn="$cur_arg";
    echo "Output file is $out_fn";
  fi
done

while getopts s:u:r: OPTION; do
  case "$OPTION" in
	s)	shift `echo "$OPTIND -1" | bc`;
		server="$OPTARG";
		;;
	u)	shift `echo "$OPTIND -1" | bc`;
		server_usr="$OPTARG";
		;;
	r)	shift `echo "$OPTIND -1" | bc`;
		out_rate=`echo "$OPTARG / 32" | bc`;
		;;
  esac
done

# do the format conversion
cat "$1" | ssh $server_usr@$server "sox -S -t mp3 - -C $out_rate -t ogg -" > "$2"

→ Tinggalkan KomentarKategori: Ilmu · Orang bego punya kegiatan
Ditandai: , , ,

Holy crackamoley Batman! I just know how to use escape keys in OpenSSH!

22 Mei 2009 · Tinggalkan sebuah Komentar

Few minutes ago I just found out that I can actually send SSH session into background by suspending it. From now on I can use one terminal for everything I need.

How is it done? That sneaky escape_char is the key. A quick glance at the ssh manual should explain you all about it, but I found it hard to practice; I just can’t understand what “The escape character is only recognized at the beginning of a line” is supposed to mean.

I mean I know that sentence in English, duh, but what the heck is this “at the beginning of a line” is all about? Are we talking about the shell prompt here or what, Vim? I recall that every time I send a command it occupy its own line, is this a trick to confuse newbie? Even though I know that you CAN type multiple-line commands, but that is not what I’m concerned about.

I tried to type ‘~?’ literally, but that didn’t work. As I just found out (by bashing my keyboard like a space chimps) “the beginning of a line” mentioned here is to put empty command before entering ~. So all I have to do in my terminal is this:

$ < press Return / Enter >
$ < just press key combination to '~', which in my case Shift + ` >

It will be easier that way especially because I’m accustomed to reuse commands from history, walking through the command each character/word at a time, or plain-ol’ Ctrl + C.

For practice purpose I recommend you to try the ~? command. It will print the other available commands, lookup the manual to find out more.

All this time… can you imagine that??

→ Tinggalkan KomentarKategori: Ilmu · Orang bego punya kegiatan
Ditandai: , ,