uBasic – a really tine BASIC interpreter

31 October, 2007

http://www.sics.se/~adam/ubasic

uBasic is pretty cool; type your old BASIC program in the use-ubasic.c file and compile using make. ./use-ubasic and watch your program work.

GeekThought: Why C Really is a Small Language

31 October, 2007

When you start learning C, you always see the sentence “C is a small programming language,” but when you dive into it, it doesn’t seem that small. But if you think about it, C is really tiny! That largeness really comes from the libraries. All C can do by itself is declare functions, return variables, import classes, and do some math. Not much to it, really. So next time someone tells you C isn’t small, remind them of the libraries.

What are your thoughts?

(GeekThoughts are written to get opinions from the computing community.  Share your thoughts on the topic by commenting on this post.)

OS X Leopard: A Review

29 October, 2007


I must say that OS X Leopard is one of the best products Apple has ever created. Some say looks and computing should never interfere with each other, but if you’re trying to sell your product, nobody would buy something Windows 1.0-ish today. I think Apple was right when they made the menu bar transparent and the Dock reflective. Compared to a Tiger desktop, the new Leopard one makes the screen seem larger and more spacious (pun intended with the “Spaces” feature).

Spotlight is now no longer a novelty. Now, it searches web history, dictionary, calculator, remote computers, and even supports Boolean searches.
Leopard is now environmentally friendly – MUCH more than either the old AppleWorks or the current MS Office:mac 2004 box, which happen to be the same size. Ubuntu still beats it, though 😛 (environmentally, of course)

Now, if I ever wanted to do some simple chroma keying for a movie, I’d have to get on Linux, run Cinelerra, and import my new file back into iMovie. No more is this the case. With the new Photo Booth, you can not only capture images, but also video. You can also add any video or photo as a background, so Linux might be left alone for a while.
Stacks are a really good feature, in my opinion. I have instant access to my documents/downloads and are perfect when I’m working on a big programming project (although it’s quite small). I’m working on a Java application now, and with the 10 files my “big” project, Stacks lets me easily access them without having to open a Finder window.
Time Machine is an awesome new feature. If you say “Oh, but Apple copied it from Microsoft,” you’re wrong. Automatic backups, yes, have been part of Windows for a while now, but never was Microsoft able to make it look nice. And yes, you *can* make it work on a single hard disk. With disk utility, partitioning your HD is quick and easy, and you can easily add and remove partitions on the fly.
So you can see that Leopard is a very nice operating system. Much better than Vista, in my opinion, and a great evolution  ahead of Tiger. Hey, it’s only $129!

KDE: Friendly for Windows and Mac Switchers

24 October, 2007


I’ve found KDE 3 to be very friendly for Windows and Mac switchers. The K Menu very strongly resembles a Start menu, and the taskbar, well, looks like the taskbar. For Mac people, it might be a bit different, although easy to set up. Right-click on the desktop and select “Configure Desktop…”, go to Behavior, and check off “Current application’s menu bar (Mac OS-style)”. Voila! Now, for the Dock. To make the main Panel look like the dock, right-click on the panel, select “Configure Panel…” select a centered screen position and drag the percentage slider down and you have a Mac-y Linux desktop!


Update: GTK vs. QT

22 October, 2007

22 July 2008: Now I take more into account than mentioned in these two posts. Please, this was a long time ago, do not comment on it. I use both GTK and Qt today, using each for different purposes that accommodates to their strengths.

Apparently, Digg put my GTK vs QT article on the front page of their Linux/Unix section (giving me about 1500 visits today) and I read the various comments replying my post (both here and on Digg), and I apologize if I made anyone feel uneasy about this comparison. I know that a Hello World program may not show much, but how do all beginners learn to program with a certain API or programming language? Hello World! I’m a beginner to Linux GUI programming APIs, so the Hello World programs give me a glimpse as to what the API/language is like. 

From the looks of this simple Hello World application in both QT and GTK, I became biased over QT. However, I must also note that a thought came to me that because GTK’s code tends to be longer, programmers might have more control of their code because of that. 
Also, due to my Visual Studio programming roots, I found that QT’s syntax seemed more familiar to me in some places, like hello.resize(100, 30); I’m really used to the dots.
Again, I apologize for my unfair examination of the two APIs and hope you can understand my viewpoint for being biased toward QT. But this is just like comparing apples and oranges. Whichever one you choose depends on your taste.
If you’d like to feel happy, read a list of improvements in Gutsy Gibbon over Feisty Fawn. Or, vote on which API is your favorite in the sidebar.

GTK vs QT

21 October, 2007
UPDATE: PLEASE READ THE FOLLOWUP. THANK YOU!

This topic was once removed for its controversial nature. Please do not read this article if you feel offended by the examination of the two APIs. Read the followup (link just above this) for my reasons on such a biased viewpoint. Due to common demand, it has returned.

~~~~~~~~~ORIGINAL ARTICLE~~~~~~~~

Note: I did not try to make GTK look bad; both these programs are from the official tutorials for each API.

When it comes to developing GUI applications on Linux, people either will program in GTK or QT. GTK has no formal support and you can develop any time of application with it for free. QT, on the other hand, has an “open source” version, in which you must agree to make all programs you write with QT open-source. If you want to write commercial applications, you have to shell out some cash (of course, Trolltech provides commercial support).

So, from the looks of this, you’d most probably want to go with GTK. Wrong! QT makes programmers more productive that GTK. Compare a simple app where there’s a small window on the screen with a button saying “Hello World” on it:

GTK (57 lines)

#include
static void hello( GtkWidget *widget,
gpointer data )
{
g_print (“Hello World\n”);
}

static gboolean delete_event( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
g_print (“delete event occurred\n”);

return TRUE;
}

static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}

int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *button;

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

g_signal_connect (G_OBJECT (window), “delete_event”,
G_CALLBACK (delete_event), NULL);

g_signal_connect (G_OBJECT (window), “destroy”,
G_CALLBACK (destroy), NULL);

gtk_container_set_border_width (GTK_CONTAINER (window), 10);

button = gtk_button_new_with_label (“Hello World”);

g_signal_connect (G_OBJECT (button), “clicked”,
G_CALLBACK (hello), NULL);

g_signal_connect_swapped (G_OBJECT (button), “clicked”,
G_CALLBACK (gtk_widget_destroy),
G_OBJECT (window));

gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show (button);
gtk_widget_show (window);

gtk_main ();

return 0;
}

QT (13 lines)

#include
#include

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QPushButton hello(“Hello world!”);
hello.resize(100, 30);

hello.show();
return app.exec();
}

Again, both these programs do the same thing. With QT, less code means more productivity and ability to code more in a shorter period of time.

Of course, if you don’t like C (GTK) or C++ (QT, the one I’m sticking with), you can always choose Python, Ada, PHP, etc. GTK and QT are just APIs, not programming languages.

Before posting your comment, please take into account what was said at the first line of this post and the followup (link at top). Thank you.


Ubuntu 7.10 Gutsy Gibbon Review

20 October, 2007

Price: free

Shopping: Ubuntu Download Page
The new Ubuntu release, 7.10 Gutsy Gibbon, is a wonderful improvement over Feisty Fawn (7.04) and ready enough to be able to start fighting Windows and give end-users a choice.

The following new features I think are the best:

  • the computer auto-hibernates after being left on for a certain period of time
  • after coming back from locking the screen, if you don’t know the user’s password, you can leave them a message
  • screen resolutions are better
  • tracker (spotlight-like search tool, but with links to Wikipedia, Google, etc. and not just your files); it can be accessed through Alt+F3
  • I don’t use this feature much but it’s useful – fast user switching
  • an all-in-one appearance preferences
  • Add/Remove Applications is easier to use
  • automatic printer recognition (works very well, might I add – I hooked up a printer and it was recognized in 12 seconds; mind you – this is a 1.3 GHz machine from 2001)
  • Pidgin over GAIM (much better interface)
  • WINE has it’s own cool little start-menu thing under “Applications”
  • preset Documents, Pictures, and Videos folders in home
  • better built-in help documentation
  • Gimp 2.4 release candidate (easier access to features)
  • OpenOffice 2.3 branded with the Ubuntu logo
  • specialized Ubuntu add-ons for Firefox (Ubufox)
  • when using sudo in the terminal, instead of just asking for the password it says “[sudo] password for *****” where ***** is the user name

there are many more new features, but those are the main ones that stand out, especially the screen resolution one. I haven’t been able to find any bugs yetIf you haven’t tried Gutsy yet, download it now!

Ubuntu 7.10 - Coming soon