I have moved my blog to Wordpress at theunixgeek.wordpress.com. I will still be checking back periodically on this one as well, though. 19 April 2009

featured

Merging Mkdir and Cd | 280 Slides Interview | I Switched to KDE 4

clickable portals

Wednesday, October 31, 2007

uBasic - a really tine BASIC interpreter

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

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.)

Monday, October 29, 2007

OS X Leopard: A Review


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 :P (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!

Wednesday, October 24, 2007

KDE: Friendly for Windows and Mac Switchers


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!

Monday, October 22, 2007

Update: GTK vs. QT

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.

Sunday, October 21, 2007

GTK vs QT

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.

Saturday, October 20, 2007

Ubuntu 7.10 Gutsy Gibbon Review

Price: free

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!



Friday, October 19, 2007

Why torrents? Pick a server!

I think torrents are too slow. I started downloading Gutsy this morning and I wanted to test the differences between using a torrent and using a server - the torrent went at about 100 kbps while the server went at about 500 kbps.... which do you think is better?

Learning to Program in Cocoa

I've been searching to and fro for an easy-to-follow tutorial on how to program in Cocoa since July of this year (2007). I've finally found what seems to be the best source yet (besides Apple's documentation - which are a bit too advanced for me and confusing at times): Cocoa for Scientists on the MacResearch website. It's easy to follow and goes from command-line Objective C (with Cocoa libraries, of course) to GUI (the best part)!

Friday, October 12, 2007

NetBeans: A Visual Studio for the Mac

I love Microsoft's idea of Visual Studio, and I love programming for Visual Basic (free, which isn't available for OS X). Since I don't want to pay for RealBasic, I've been searching and searching for something to let me use drag-and-drop controls for my applications. I found the best tool: NetBeans IDE,which I still haven't tried out, but here's what I really liked about it:


Monday, October 8, 2007

Differences in Software Writing

What's the difference between writing software at home and at work?

http://cplus.about.com/b/a/000069.htm

How to Write a Good Software Review

As seen on this website:
http://www.associatedcontent.com/article/254349/how_to_write_a_computer_software_review.html

How to Write Good Documentation

On this website: http://www.graphic-design.com/news/2006/write_documentation.html I found an interesting article. How to write good documentation. Take a look.

The iPod Touch Cannot be Scratched!

Apparently, the iPod touch's screen cannot be scratched (according to this YouTube video); however, according to comments, the back scratches easily.


Saturday, October 6, 2007

Typesetting with LaTeX

For the 80th Unix Geek blog post, I decided to talk about something that might make some people nostalgic.

On my Ubuntu machine I decided to try out typesetting, something for which Un*x has been famous since the 1970s. With graphical word processors of today, you can see what the result is gonna be and how it's going to look. You can even select templates to help you with your work. But what if you wanted more control over your document? The answer: typesetting.

LaTeX is similar to a programming language, but for writing documents. It is great for scientific and mathematical articles for its ease of use when it comes to writing formulas. For example, if I wanted to write the formula for photosynthesis, I would type this: $6H_2O + 6CO_2 \rightarrow{light} 6O_2 + C_6H_{12}O_6$ and it would give me a great result. If you want to try it out go to this website, type that in, and see what you think of it.

Since one can say LaTeX is similar to a programming language, let's try out the Hello World document!

\documentclass{article}
\begin{document}
Hello, World!
\end{document}

If you want to learn LaTeX (pronounced "Lay-Tek" or "Lah-Tek", by the way), follow this nice tutorial.

JavaNotes: The Best Java Textbook

I've recently come across JavaNotes, the best free Java textbook yet. It assumes you know some basic programming topics, but the first chapter is an in-depth tour of just how computers work and I finally learned how more RAM speeds up the computer.

What really surprised and disappointed me about Java, which I learned from both this textbook and various other online sources, is that for command-line programs (which is what most beginners to Java, like me, will be using), there is no built-in support for a user's input. As the author of JavaNotes describes it, they did this for "some unfathomable reason." He (thankfully) wrote a little Java program called "TextIO.java" (you can find it in the textbook in chapter 2, I believe) which basically provides various input/output functions, somewhat imitating C's #include and C++ #include.

Well, try out JavaNotes if you want to learn Java.

Thursday, October 4, 2007

The Power of Java

For me, Java is turning out to be a very powerful language. I'm loving the built-in actions for objects, like Math.sin(x) or string1.equals(s2); I find it less painful than imporing library files (like in C). Here's an example of Java's powerful non-library-importing abilities; it allows you to test how long it took for your code to run. This can be very useful when testing yoru program out in various systems:

public class TimedProgram{
public static void main(String[] argv){
//Yes; I prefer "argv" over "args"
long startTime;
long endTime;
double time;

startTime = System.currentTimeMillis();

/* INSERT PROGRAM HERE */

endTime = System.currentTimeMillis();
time = (endTime - startTime) / 1000.0;
System.out.print("Total time to run code (seconds): ");
System.out.println(time);
}
}

Wednesday, October 3, 2007

4 October 2007 : Apple to release new products?


It's 3 October 2007, and the Apple Store is down.... wonder what'll be coming soon....

Ubuntu Gutsy is coming!!!!


Monday, October 1, 2007

The Best, Must-Have Mac Apps

Click here

How to Triple-Boot a Mac.... the Easy Way

Ok. You've probably heard of a lot of different methods to triple-boot a Mac with OS X, Vista, and Ubuntu. Boot Camp betas expired recently so I haven't been able to test this out, and Vista's coming as soon as I raise enough money so here's my idea.

  1. Make sure you have OS X Leopard (If you don't know, go to Apple Menu>About this Mac. It should say "Version 10.5" or higher).
  2. Go to /Applications/Utilities (or in the Finder, ⇧⌘U) and select an app entitled "Boot Camp Assistant" or something like that.
  3. Follow the instructions to install Windows (XP SP2 or Vista).
  4. Reboot, holding down the Option (alt) key and boot up Windows. In Windows, install Wubi and select your *buntu.
  5. Reboot, hold down the Option key, and choose the Windows partition. There should be something asking you if you want Windows or Ubuntu.
There you go! If your Boot Camp beta still works, or if you have OS X Leopard beta, or the real OS X Leopard (since it _is_ October), try it out. 

Did it work for you?