My term project in GTK was going on pretty well on my Debian until I had to show a demo to my teacher. And currently all the PCs in our labs only run windows. So I was pretty sure that I had no other way but to show the demo in windows. As everyone knows, GTK is multi-platform and with a bit of effort anyone can port GTK programs written in Linux to Windows in no time.
Here is how I compiled my GTK codes in VS 6.0:
Downloaded GTK runtime library and and GTK development installer files from this site
http://gladewin32.sourceforge.net/
There are two separate files, you need 2 download both of them: gtk-2.10.7-win32-1.exe and gtk-dev-2.10.7-win32-1.exe
Installed them both in C:\GTK
Now in VS 6.0 "File" > "New" > "Projects" > "Win32 Console Application" > "An Empty Project"
From Projects menu "Add to Project" > "New" > "Files" > "C++ Source File
Added a demo Gtk Code inside the file I named as gtk1.c:
// blogger seems to have some problem when i put angled brackets around gtk/gtk.h :((
#include gtk/gtk.h
void closeApp(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
int main( int argc, char *argv[] )
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect(GTK_OBJECT(window),"destroy",GTK_SIGNAL_FUNC(closeApp),NULL);
gtk_widget_show (window);
gtk_main ();
return 0;
}
Now again in Project Menu > Settings
Here in "C++" Tab In the "Category" > "Preprocessor" under "Additional Include Directories" I put this
C:\GTK\include\gtk-2.0,C:\GTK\include\cairo,C:\GTK\include\glib-2.0,
C:\GTK\lib\glib-2.0\include,C:\GTK\include\pango-1.0,C:\GTK\lib\gtk-2.0\include,
C:\GTK\include\atk-1.0,C:\GTK\include\libxml2
Now in the "Link" tab under "Object/Library modules" put
glib-2.0.lib gobject-2.0.lib gthread-2.0.lib gdk-win32-2.0.lib gdk_pixbuf-2.0.lib gtk-win32-2.0.lib atk-1.0.lib pango-1.0.lib
Now just just after pressing OK, Ctrl + F7 to compile, F7 to build gtk.exe and then Ctrl + F5 to run the programme.
It rewarded me with this GTK window.
Sunday, February 11, 2007
Tuesday, February 06, 2007
Supervising terminal activity remotely
Suppose you started a process in terminal of your PC and then logged into your PC via ssh from another PC. Now u want to see what's going on in the terminal in the first PC. There are mainly two different approaches that I've come accross. Here's the first solution. This one is fairly simple:
In the main PC I run:
$mkfifo foo; script -f foo
In the second PC, I log in via ssh and then run in the terminal:
$cat foo
Now whatever I run in the 1st PC's terminal, it gets showed (including all the verbose output) in the second PC.
This simple solution has a minor drawback, second PC's terminal becomes read-only, You don't get any kind of interactivity from the second shell. To solve this problem we'll take help of another tool, GNU 'screen'.
#apt-get install screen
$vi ~/.screenrc
Add these lines:
In the main PC I open a shell:
$screen
Now I log in via ssh from the remote PC and run this in shell:
$screen -x
Now whatever I run in the first PC, I get another output in the second terminal and both the terminal's are interactive.
Now you can ask, what if I want to close either of the screens and keep the other one active? Just press Ctrl + a, d in any screen. The screen gets detached.
If you want to resume an already detached screen:
$screen -r
Some tips:
http://www.kuro5hin.org/story/2004/3/9/16838/14935
In the main PC I run:
$mkfifo foo; script -f foo
In the second PC, I log in via ssh and then run in the terminal:
$cat foo
Now whatever I run in the 1st PC's terminal, it gets showed (including all the verbose output) in the second PC.
This simple solution has a minor drawback, second PC's terminal becomes read-only, You don't get any kind of interactivity from the second shell. To solve this problem we'll take help of another tool, GNU 'screen'.
#apt-get install screen
$vi ~/.screenrc
Add these lines:
hardstatus onNow comes the most important part:
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
In the main PC I open a shell:
$screen
Now I log in via ssh from the remote PC and run this in shell:
$screen -x
Now whatever I run in the first PC, I get another output in the second terminal and both the terminal's are interactive.
Now you can ask, what if I want to close either of the screens and keep the other one active? Just press Ctrl + a, d in any screen. The screen gets detached.
If you want to resume an already detached screen:
$screen -r
Some tips:
- Screen can also manage multiple terminal sessions in it. To create new tab, Ctrl + a, c and then you can cruise between the tabs by pressing Ctrl + a, Ctrl + a repeatedly.
- Ctrl + a, " shows you the list of available tabs
- Ctrl + a, A gives you a promt to change the name of current tab
- Ctrl + a, k closes the current tab
- Ctrl + a, S splits the currnt window into two separete workspaces, You can browse between them by Ctrl + a, TAB
- You can also run 'screen' in a nested manner. Cool huh!
http://www.kuro5hin.org/story/2004/3/9/16838/14935
Thursday, February 01, 2007
Term Project and GTK
I have been assigned a project from my Univ for this term. My prject is 'Online Exam System'. I have 2 make it with only C. We were supposed to make this in TC as we'd need graphic.h 4 as the graphics library (now u can guess why I fiddled so much with TC and graphic.h in my earlier posts, lolz). But I wanted to try something else. So I talked with our sir and after a lot of work he gave me the permission to make the project using GTK.
Plese pray 4 me so that I can finish it well.
Plese pray 4 me so that I can finish it well.
Qemu with accelerated module
"QEMU is a fast processor emulator: currently the package supports arm, powerpc, sparc and x86 emulation. By using dynamic translation it achieves reasonable speed while being easy to port on new host CPUs."
To get the best performance outta qemu, it neeeds to be run with kqemu accelerator. Here is a short how-to to achive that.
#apt-get install qemu qemu-launcher qemuctl
#apt-get install kqemu-source
U also need 2 have your kernel header files installed properly. And we shall also need module-assistant
#apt-get install linux-headers-`uname -r`module-assistant
Now comes the module building work:
#m-a prepare; m-a update; m-a a-i kqemu #depmod -a
Reboot ur pc. Then #lsmod, if u dont see something like 'kqemu' then #modprobe kqemu.
Now we can run qemu with the help of qemu-launcher. In qemu-launcher's interface dont forget to check on Full for the acceleration option in the Emulator tab. Otherwise we won't get the speed we are looking for.
Well, here is a screenshot of my Sid running Window XP SP1 with qemu.
To get the best performance outta qemu, it neeeds to be run with kqemu accelerator. Here is a short how-to to achive that.
#apt-get install qemu qemu-launcher qemuctl
#apt-get install kqemu-source
U also need 2 have your kernel header files installed properly. And we shall also need module-assistant
#apt-get install linux-headers-`uname -r`module-assistant
Now comes the module building work:
#m-a prepare; m-a update; m-a a-i kqemu #depmod -a
Reboot ur pc. Then #lsmod, if u dont see something like 'kqemu' then #modprobe kqemu.
Now we can run qemu with the help of qemu-launcher. In qemu-launcher's interface dont forget to check on Full for the acceleration option in the Emulator tab. Otherwise we won't get the speed we are looking for.
Well, here is a screenshot of my Sid running Window XP SP1 with qemu.
Subscribe to:
Posts (Atom)
Back to Blogging
After a failed attempt last year to get back to blogging, I'm trying it again this year. I really wanted to get back, but got busy will...
-
For my Univ project, I need 2 use graphics.h. Everyone knows graphics.h is not in C's standard library. Only Turbo C supports it and for...
-
Make sure you have grub installed in the same partition as the Ubuntu, not in MBR. Now boot into any linux Live CD and do this: $sudo dd if=...
-
Normally, when we are coding java in Eclipse , we do not see any javadoc help when we hover over a keyword. This is because by default, ecli...