Saturday, December 08, 2007

Compiling C# + gtk 2 + glade 2 on Ubuntu 7.10

Before that you need to install these packages :
glade-gnome
libglade2.0-cil
mono-mcs
libgtk2.0-cil

And also your favorite text editor or IDE.
Create a new file GladeApp.cs with the source-code below.

using System;
using Gtk;
using Glade;

public class GladeApp
{
// declare the widgets you will use from glade
[Glade.WidgetAttribute]
Gtk.Entry MyEntry;

public static void Main (string[] args)
{
new GladeApp (args);
}

public GladeApp (string[] args)
{
Application.Init();

Glade.XML gxml = new Glade.XML ("gui.glade", "MyWindow", null);
gxml.Autoconnect (this);
Application.Run();
}

// Connect the Signals defined in Glade
public void OnMyWindowDeleteEvent (object o, DeleteEventArgs args)
{
Application.Quit ();
args.RetVal = true;
}

public void OnMyButtonClicked(object o, EventArgs args)
{
Console.WriteLine("In entry: " + MyEntry.Text);
}
}

Then, start your Glade.
Build a simple window with a text entry and a button. It will be looked like this :



With additional event & signal. delete_event event for MyWindow



and clicked signal for MyButton.


Saved the glade file as gui.glade . You may need to learn a little bit to create these user-interface. Please keep trying.

Then you are ready to compile our code.


myprompt: mcs -pkg:gtk-sharp-2.0 -pkg:glade-sharp-2.0 GladeApp.cs


And run our application.


myprompt: mono GladeApp.exe




Congratulation...

Friday, December 07, 2007

Instalasi Zekr

After I installed Zekr from Ubuntu 7.10 repositories I found that It didn't support to play a recitation.
So I downloaded the newest release from http://siahe.com/zekr/ . Zekr version 0.6.6 Debian package.
You also need sun-java5-jre or sun-java6-jre to complete required dependency. I use sun-java5-jre in my case.
Also I downloaded http://siahe.com/zekr/download/recitation/minshawi.zip as I want to hear recitation as my first objective.

Just follow installation instruction here http://siahe.com/zekr/wiki/index.php?title=Installation#Ubuntu.2FDebian .

It works as I expected but the recitation is not as smooth as I wanted to enjoy the hear it.

Wednesday, December 05, 2007

3GP Player di Ubuntu 7.10


In order to play the 3gp movie (ex. you get it from mobile phone) you need to install RealPlayer (from Helix Community website) not the HelixPlayer one.
Pengingat Waktu Sholat

I tried to install minbar from http://khaled.djihed.com/ubuntu/minbar/minbar_0.1-4_i386.deb .
I still need to install libitl0 before I can install minbar.
You still need to manually enter the Long/Lat of your location + GMT zone.
In my case I got from here http://www.islamicfinder.org/prayerDetail.php?city=Jakarta&state=06&country=indonesia&lang=&home=2007-12-5
due to I live at Jakarta Indonesia.

Latitude: -6.1744
Longitude: 106.8294
Timezone: GMT +7.00

But when I see the prayer time list, the Ashr time is quite different from the usual time of Ashr in Jakarta.
I try all the "Calculation Method" listed in minbar, but I can't get the Ashr time that approximate with Jakarta's Ashr time. Almost all list Ashr time about an hour before except for Hanafi method is about half an hour after the time.

So, I think I should better use Pray Time! FireFox Add-on Extention.

Thursday, November 08, 2007

Bluetooth connect

In my previous post, I can't connect my bluetooth device via "Bluetooth Manager" or "Bluetooth Preferences" on Ubuntu 7.10.
After I install gnome-vfs-obexftp the problem is gone.
Just
>>> sudo apt-get install gnome-vfs-obexftp

Saturday, November 03, 2007

Linux : Ubuntu 7.10
Provider : XL & Centrin
Mobile : Nokia E61
using Bluetooth (Dial Up Network/DUN) service

Create new file /etc/ppp/peers/centrin

connect "/usr/sbin/chat -v -f /etc/chatscripts/centrin"
usepeerdns
noauth
defaultroute
noipdefault
nocrtscts
nocdtrcts
modem /dev/rfcomm0 115200
user "user@xl.centrin.net.id"

Replace user@xl..... with your username given by centrin.
File /etc/ppp/pap-secrets, add this line at the end of the file.
"user@xl.centrin.net.id" * "mypassword"

Also replace the mypassword with your password.
Create new file /etc/chatscripts/centrin

TIMEOUT 60
ABORT ERROR
ABORT BUSY
ABORT VOICE
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "NO DIAL TONE"
ABORT "NO ANSWER"
"" "ATZ"
OK AT+cgdcont=1,"IP","centrin.net.id"
OK-AT-OK "ATDT*99#"
TIMEOUT 75
CONNECT


Prepare your bluetooth connection, so your computer can see your mobile phone. But somehow I cannot pairing from "Bluetooth Manager" :-( .
CLI rulezz .... :-)
Next, some commands need root priviledge.
Search for device and channel for Dial-Up Network.
$ sdptool search DUN

In my case, the device-id is 00:12:D2:6B:1F:4F
and the channel is 2.

We'll use rfcomm0 . So release old connection, if any.
$ rfcomm release 0

Bind the device, use sdptool's result.
$ rfcomm bind 0 00:12:D2:6B:1F:4F 2 

Next, we need to pair your computer and your mobile-phone.
Well, I don't know how to do it better. Please advice ....
But we need to open xhost security.
$ xhost +

Place the PIN at the handset.
Match the Bluetooth PIN at the Ubuntu.
$ cat < /dev/rfcomm0


Control-C to back to prompt.
Then close the X security.
$ xhost -


Then call the pppd
$ pppd call centrin


Happy surfing ....

Tuesday, February 20, 2007

To flush unused memory on Linux

Original source : http://www.hdfgroup.org/HDF5/faq/linux-mem.html

% dd if=/dev/zero of=junk bs=10MB count=200 #generate a 2000MB file
% # by now top will show not much free memory left.
% rm junk

You will then see a big jump of free memory because the data in the dirty buffers is no longer valid and the memory is free for other use.