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


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

clickable portals

Sunday, November 30, 2008

MacBooks are coming!

Great news - the new aluminum MacBooks will be arriving in Brazil sometime next week! It was a long delay, but I'm glad they're finally coming! 


Thursday, November 27, 2008

MacBook Delays: An Open Letter to Apple

Here's something I wrote to Apple, and I hope they take it into consideration.

I'm very disappointed that tomorrow it will be a month and a half since the next-gen MacBook's announcements and they still haven't arrived in Brazil. As somebody who works daily with technology, programming, etc, I recognize the power of the Mac and love programming for it, working with it, and using it to its maximum extent.

I was extremely excited to try out the new MacBooks after their announcement on October 14th and figured that it should take about two weeks for the notebooks to get here. Then the two weeks passed, a month passed, and tomorrow, a whole six weeks will have passed and whenever I walk into any of the Apple Authorized Resellers nearby, they tell me that there is no expected date for the new MacBooks' arrival.

Sure, Brazil is still considered an emerging economy, but that doesn't necessarily mean it has to be stuck with old technology, one that is being sold for $999 in the United States and about $600 more than the previous version here in Brazil.

I sincerely hope that Apple will reconsider the delay that occurs after product releases in locations outside the United States and the European Union. In fact, I wrote about this issue on my blog, which can be read by following this link: http://theunixgeek.blogspot.com/2008/11/one-month-later.html . I also plan on publishing this text so that the problem can become more visible.

Wednesday, November 26, 2008

Understanding the Linux Filesystem

Ah, the old UNIX adage: everything is either a file or process.

Let's take a closer look at the Linux filesystem and forget about processes for now.

Files can either be regular data-holding files, directories, references to hardware, links, and inter-process communicators. Believe it or not, directories are simply lists of files, links are files that tell where other files are, and those file in /dev contain information about the connected peripherals.

Unlike other operating systems, Linux distributions tend to have many partitions on a disk instead of a single one in order to have more data security. In case something happens to a partition, not all data is lost. There are various worst-case scenarios, such as a partition being completely filled up, bad blocks, etc.

Example: print command in parted
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type filesystem Flags
1 32.3kB 20.5GB 20.5GB primary ext3 boot
2 20.5GB 21.5GB 938MB extended
5 20.5GB 21.5GB 938MB logical linux-swap

As can be seen, there are usually at least two partitions in a Linux system: a primary data partition (at least one root partition, indicated by /, that holds system files) and a swap partition, which serves as extra physical memory (this allows the system to continuously work without running out of memory). In some cases, usually based on your sysadmin's choice, separate kernel, home, or program partitions are created upon installation. This is, again, to make sure that data is always kept intact if something bad happens.

Also, Linux supports various types of filesystems, such as its natives ext3 and ext2, along with those found natively in other operating systems, such as FAT or NTFS.

Partition mounting occurs when the mount command is used to attach a partition to a directory in the root filesystem. This way, the partition can be manipulated as a separate directory without messing with the system partition. The /etc/fstab file defines which partitions should be mounted on startup.

The df ("disk full") command, under GNU/Linux distributions, has a . (dot) command that tells you what non-swap partition the working directory (remember pwd?) is on. If you're familiar with Linux, you should be aware that this dot returns the pwd. However, it prints some information that is not always useful, so the -h option that allows for a more readable listing of information.

$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 19G 2.3G 16G 13% /
tmpfs 252M 0 252M 0% /lib/init/rw
varrun 252M 104K 252M 1% /var/run
varlock 252M 0 252M 0% /var/lock
udev 252M 2.7M 249M 2% /dev
tmpfs 252M 160K 251M 1% /dev/shm

By listing the root directory, one would see the following directories:

bin: programs shared by all of the system's users
boot: kernel and other essential boot files, such as a bootloader
dev: references to all peripheral hardware
etc: system configuration files
home: users' personal files
initrd: info on booting, not on all distros, not always dir
lib: the system library (files necessary for programs to run)
lost+found:files not saved correctly
mnt: mount point for external peripherals and filesystems
net: mount point for networked filesystems
opt: typically for third-party software
proc: a virtual filesystem for system resources (man proc)
root: home for the sysadmin
sbin: sysadmin's version of bin
tmp: temporary directory, emptied on boot
usr: programs, libraries, documentation, images, etc*
var: stores variable files for temporary use by applications

*be careful not to confuse the terms "usr" and "user," as "usr" stands for "Unix System Resources," a naming legacy from System V.

Remember, though, that filesystems are not trees, although they may seem like so. Directories are simply files that list other files. In filesystems, files are represented by an inode, a "serial number" that contains the information about the data in a file, such as:

  • its owner

  • its type

  • permissions

  • timestamps (that is, when it was created, last modified)

  • number of links (remember, links are just files) to it

  • its size (in pure kilobytes! try running df without -h and you'll see what I mean)

  • its location (again, don't imagine UNIX filesystems as trees! This portion of the inode simply says which directory file references this file!)

Be careful, though: not all filesystems have alike. Not all have inodes, many have limits on how many directories can be inside another directory, etc.

I hope you enjoyed this article. You can find out more here, here, and here.

Tuesday, November 25, 2008

Fedora 10 is here

It was released a minute ago.

Monday, November 24, 2008

Ubuntu 8.10: Featureless Ibex?

A few days after Ubuntu 8.10 Intrepid Ibex was released, I decided to give it a test drive in my trial of VMware Fusion. I was hoping for an awesome new experience, like I got back in the days of Gutsy Gibbon, but I didn't get an Intrepid Ibex. Just a Featureless Ibex.

Sure, all operating systems have come of age and are focusing on having better internals while maintaining the pretty look they've had for all this years. I mean, that's the main focus of Snow Leopard and Windows 7, if I'm not mistaken, and Ubuntu's joined the bandwagon.

Sure, it's nice to see that Nautilus has tabs and you can drag files to them and choose to open a folder in a new tab, that Dictionary is now in the Office menu, that there are more Tango-compliant icons, and that you can create a USB startup disk. But what else?

Where is the exciting list of 30 new user-end features? Where's the rest of the wallpapers? It's nice for users to have a nice selection of desktop decoration out of the box. There needs to be more wallpaper choice than either one creative picture and solid color. Ironically enough, a lot of the available themes have no matching wallpaper, resulting in ugly desktops. I must congratulate Windows 7 for having easy wallpaper-theme matching in the new themes preferences, however. 

Overall, I was disappointed with Intrepid Ibex, and I hope we can see a lot more from Jaunty Jackalope next year, but I still love Ubuntu. It has the best support and is the most stable, but I think it needs to have more user-end features and fix stability problems during updates.

Friday, November 14, 2008

I Still Don't Get This

This has probably been around since one of the first version of Word on any platform (I've seen this a lot of times), and I still don't get why it exists.
The font "Nonexistent Font" is not available on your system. Do you want to use it anyway?

... this makes no sense.

One Month Later...

One month after the next-gen MacBook's introduction (14 October), the new model has not arrived in Brazil. If Apple wants to keep an international business in good shape, I would expect they'd want to keep all their products updated, instead of offering previous-generation computers in some countries.

Sure, I'd bet there's something to do with customs, exchange rates, etc, but one month is just too long.

Monday, November 10, 2008

Qt won't benefit from C++0x

According to ahigerd on Freenode, 

"At best, Qt would simply wrap around some STL components if they're present, but (1) I don't expect any useful standardization until somewhere around 2012, (2) I don't expect compiler support to be there for a long time, (3) Qt, especially in the embedded department, is intended to REPLACE STL, not USE STL.

Qt is supposed to provide a consistent API and behavior across platforms; Qt is still going to have to provide those behaviors on platforms that don't have good compiler/library support for it yet. Therefore, Qt will either have to have two versions of the code -- one that uses STL, one that doesn't -- and have to try to keep them always behaving the same way, or it can just not try to worry about using STL and just make sure to remain COMPATIBLE.

Qt can't remove classes without breaking API, so at best it won't be until Qt5, but at the same time, Qt is replacing a lot of STL's uglier classes. You can't compare std::string to QString. You can't even compare std::wstring to QString. You can try to compare std::vector with QList or QVector, but Qt just offers MUCH better APIs for them, as well as a lot more useful functions. 

C++0x may be useful for Qt's internal implementation when it's available, but the C++0x STL won't be any more helpful to Qt than the C++98 STL."

For more about C++0x, see here.

Note: ahigerd is an independent programmer, not a Nokia employee.
Update (11/Nov): Fixed last sentence in quote.

The Future of C++

Bjarne Stroustrup began C with Classes in 1979, as a better C that supports object-oriented programming, generic programming, and data abstraction. In 1983, it became C++ (although many argue it should have been ++C). Nearing the end of the century, 1998, a C++ ANSI-ISO standard was created. Sometime in the near future, C++0x is coming along.

Being that C++0x was expected to come out between 2000 and 2009, they abbreviated 200x to 0x. Nothing hexadecimal related.

C++0x is considered to be the first major revision to the C++ standard, which, as said above, has been around for just about a decade. The following features are some of the things we should be expecting from C++ next year (with comments!):

  • multithreading support (this will ease development for many C++ frameworks)
  • lambda functions (inherited from C#... sorry for the pun)
  • automatic types and type determinations (did anyone say auto from C#?)
  • improvements in templates
  • generalized constant expressions (I've been waiting for something like this for a while now)
  • initialization problems fixed
  • range-based for loop (seems like the for..each loop in Java and foreach in Python)
  • better ways to create objects
  • fixes to enums (strongly-typed now)
  • user-defined literals
  • upgrades to the Standard Library
  • tuples (the good old days of Haskell...)
  • regular expressions (now Qt doesn't have to have a QRegExp class anymore)
  • a better way to generate random numbers (finally!)
Even with all these new features, C++0x is still going to try to be backwards-compatible with C++98 and C99. More detailed information can be found here and on this blog.

Others, however, argue that existing C++ frameworks and APIs won't benefit much from the upgrade.

Saturday, November 8, 2008

XKCD 303

This is definitely one of my favorite XKCD comics:
The #1 Programmer Excuse for Slacking Off: "My Code's Compiling."

Monday, November 3, 2008

QtCreator Announced

Trolltech has finally been working on their own IDE made specially for Qt. It's called QtCreator. Here's the announcement and here's the tech preview.