Marilag Ang Malaya

Sunday, February 8, 2009

Ubuntu is *not* for Ügeeks

I started using GNU/Linux in January 2000. I joined the Diliman Networks Web Team, and we were asked to learn CGI-Perl for web programming. It was quite a pain to us then. Some stuff didn't just work, and I really learned a lot from exploring the command line, as well as Perl. The first editor that I used was pico, and my mail client was pine. It was also the time that I encountered GNOME, KDE, CDE and the rest of the gang, experimented for a few months, chose GNOME and never switched again.

I was using Red Hat from then on until some time after they changed it to Fedora. I stuck with Fedora for a few years, until I got tired of the release cycle, and decided to try other distributions. I also used SuSE, after they were bought out by Novell, however, my machines were too slow for it. For a year, I was using FreeBSD as my desktop -- which was really an eye-opener as they do things quite differently. And then, I settled on Gentoo which had a very similar program installation method to FreeBSD. I even compiled everything from scratch, with the specific optimizations for my CPU on. I even printed out the instructions so that I could follow them, since I couldn't use my PC (since it was still compiling the programs). I enjoyed having the fastest PC in town (or at least my office). We would compare benchmarks, and Gentoo would come out on top. However, the big disadvantage was that if I ever wanted to use a program, say Open Office, I would download it and then compile it. Sometimes, compiling would take hours or even a day before I could use the program.

It got me thinking, what do I use a computer for? At that moment, it became evident to me that I was spending too much time compiling stuff, hunting down libraries, etc. It just didn't make sense. So I fired up my friendly Google, and began scouring the Net for an alternative distribution. And I came to Ubuntu.

Ubuntu is based on Debian, and not Red Hat so there was some stuff that I need to relearn, such as locations of configuration files and commands.

Nowadays, I continue to use Ubuntu heavily. I find that I have been able to do more if I let some things just be. However, I can switch between distributions easily, including some of the BSD's. I still find OpenBSD, quite a tough nut to crack. LoL

I certainly enjoy using Ubuntu.  I have used its Live CD to rescue a lot of other systems, including Red Hat and Windows machines.  I am still discovering and playing with a lot of new things everyday, such as Compiz settings.  However, no longer to the extent of destroying my GNU/Linux installation.  I want to get some real work done, too, you know. :)

So, yes, Ubuntu is not for geeks who get a hard on everytime we talk about benchmarks.  It is relatively slow if you compare it with Gentoo.  However, for my purposes, it gets the job done with minimal fuss.  And that, for me, is the important criteria.

Labels: , , , , , ,

From C pointers to C++ iterators

Yesterday, we discussed C++ vectors as one of the ways to improve the representation of an C array. C++ iterators allow easy access to elements in a vector safely. However, one must not mistake an iterator to be a pointer, even if it acts like one. Additionally, your vanilla pointers still exist in C++. Don't forget to put #include <vector>
std::vector<int> grades;   // dynamically-sized vector

// push items into the vector
grades.push_back(grade);
...

for (std::vector<int>::iterator grade_itr=grades.begin();
grade_itr < grades.end();
grade_itr++)
std::cout << (*grade_ptr);

Labels: , , ,

Saturday, February 7, 2009

From C arrays to C++ vectors

The C++ STL (Standard Template Library) includes some very useful templates. The main idea behind STL is to re-use some of the best implementations of the most common data structures, such as queues, lists, stacks. One of these implementations is the C++ vector.

In C, we could declare an array of integers like this:
int grades[MAX_SIZE];
This statement will still work with C++, and is still valid. However, a more "C++"-centric way of doing the same thing would be to use vectors:
vector<int> grades(MAX_SIZE);
You can still access each element using:
grades[i]
but now you can use STL vector functions.

Labels: , , , ,

Friday, February 6, 2009

Globe Visibility on Ubuntu 8.10

Globe Visibility Postpaid uses Huawei E160 HSDPA USB Stick to access the Internet.
We simply plug in the USB stick and wait a bit for Ubuntu to set up the connect. We need to edit some settings before we can properly connect to the network.

To do that, we open up our network connections found on the upper-right hand corner.

We go to the "Mobile Broadband" tab and edit the settings for "Globe Telecom."

We authorize the application to use the private keyring (which contains our system-saved keys).

We change the "Number" from "*99#" to "*99***1#" and delete the default "Username", "Password" and "APN".

Click OK and we're done. :)

Update!
If the USB stick that you have is brand new, you need to plug it into a Windows machine so it can configure itself. Once you have verified that it can connect to the Globe network with Windows, you may now use it with your Ubuntu machine. Don't ask me why it's that way. =P

Labels: , ,