Update

Well, it's been a little while since I wrote in this blog. I've been quite busy, although you might find some of the stuff that I'm doing interesting:

  • I've started a new website, tuxation.com. Well, not quite new. It was hosted on a friend's server until recently. The server was down for a few months, and now I've moved the site so that GoDaddy is hosting it. Tuxation contains Linux articles and tutorials, and (hopefully) the Linux side of this blog. I'm also working on a new layout/theme for the whole Drupal setup, complete with Google advertising and user accounts.
  • Software development has come to a screeching halt. I currently maintain a web store written in C#, as well as writing code in C for my own personal projects. The main reason I stopped programming? No hard drive space left.
  • Because I generally tend to be more productive in a Unix environment, I usually have some kind of *nix operating system installed on my hard drive. I had to redo my entire partition setup on my hard drive recently, and have been having a heck of a time finding a good *nix replacement. Previously, I used Arch Linux for most of my work, but when reinstalled again on my partition, the latest version of gcc/libgcc had some bug with building my kernel. I got ticked, tried a few other operating systems, and now I'm back in Gentoo again. It's working well so far.
  • I've finally realized that my MacBook's 60 gigabyte hard drive is a bit too small to store several operating systems and some data on top of that. So, I've purchased a 500 gigabyte 3.5" IDE hard drive and a USB/firewire hard drive enclosure from NewEgg.com.
So, expect more articles and tutorials on both this blog and on Tuxation.com, but first expect some silence while I try to catch up on everything!

Mac laptop battery saving tips

Interestingly enough, most laptop users rarely get even close to the advertised battery life on their laptops. Apple advertises 6 hours for their MacBooks; in real life use it only gets around 2-3 hours. Why this discrepancy? Part of it is due to using way too many things that you don't need. Here are some tips for gaining optimal battery life without dropping a few hundred dollars on an extra battery.

Calibrate your battery.

If you want to make your battery last as long as possible, perhaps you should try to make your battery hold as much power as possible in the first place. Apple recommends calibrating your battery once a month; you're supposed to do it even more if you don't run off your battery a lot. The process of calibrating your battery is actually quite simple: you charge up the battery, unplug it and let it sit for a few hours. Then, run down your battery until the MacBook puts itself to sleep, and finally, wait a few more hours before charging it back up again. Completing this process will ensure that your battery is charged up as full as possible.

Don't use too many applications.

Probably the first (and most obvious) thing you should do to conserve your battery consumption is to reduce the number of applications you're using at the same time. Many require loads of RAM, and if your system's RAM is all used up, it will use your hard drive as a form of virtual memory. The more this happens, the more power is used to spin up the hard drive, and the more power is used up from your precious battery. So only run the most essential applications if you wish to stretch your battery's length.

Turn off Airport.

If you're not using your built-in wireless, Airport, you should turn it off as it uses power even when not connected to any networks. If the Airport icon is on the menu bar, you can enable it from there by clicking it and choosing "Turn Airport Off" (duh). If it's not on your menubar, you'll have to open up Internet Connect (it's in your Applications folder), switch to the Airport tab, and hit the "Turn Airport Off" button.

Turn off Bluetooth.

Another thing that uses power when you're not using it, and should be turned off to preserve your battery life: Bluetooth. If it's on your menubar like Airport should have been, just click the icon, and hit "Turn Bluetooth Off". If for some reason you've disabled the menubar icon, head over to the Apple System Preferences, choose the Bluetooth preference pane, and there should be a large "Turn Bluetooth Off" button.

Turn down screen brightness.

Not much to say about this one. If you're in a darker environment, you won't need all the screen brightness that Mac laptops provide you with. Turn down the brightness with the dedicated buttons on your keyboard.

Change battery scheme to 'better battery life'.

When you stop using your laptop for a few minutes, you'll probably want your Mac to turn off the screen and hard drive to save power. Make it do so more quickly by going to your menubar, and beneath the battery icon, choose "Better Battery Life". (Again, if this isn't on your menubar, you can access it from System Preferences->Energy Saver.)

Disable dual core processing.

If you've got one of the new Intel Macs, you're probably aware of the fact that they contain Intel Core [2] Duos processors, which means that your Mac has essentially two processors inside of one. While this is a nice feature for speeding up processing tasks, the extra core consumes more power. You can save more power by disabling the second core. And while this does decrease your computing power, you probably won't even notice it if you're only running 1 or 2 applications.

Open up the System Preferences, and open up the Processor pane, Click the check box beside "CPU2" to disable it. For some strange reason, the second core is always re-enabled whenever the Mac is restarted or woken up from Sleep. So you may want to make the task of disabling the second processor core a little bit easier by hitting the "Show control in menu bar" option in the Processor pane. You can then control how many processors are enabled right from the top of your screen.

Stop using hard drive-intensive applications.

Try, whenever possible, to avoid the use of hard drive-intensive applications. A program like iTunes may seem like a relatively easy program for the computer to run, and the processor doesn't have to work very hard. However, the program requires constant disk access to play the song files, and this eats up your precious battery far quicker than you think. Something like Microsoft Word or TextEdit uses almost no battery power because it runs mainly from the RAM.

Choose a good location.

Where you decide to use your laptop also plays a small factor in determining how long your battery charge is going to last. If you look closely at the bottom of your Mac laptop, you'll notice little "feet" near the corners. These raise up the laptop to allow airflow underneath the laptop. If you use your laptop on your lap or another soft surface, beware: the bottom of the laptop is not exposed, and very little air can get underneath the machine to cool it down. When this happens, your laptop warms up, and the fan is required to stay on longer to cool everything down, using your precious battery juice. Whenever you use your Mac laptop for extended periods of time, use it on a flat surface where air can flow underneath it. It's not just saving battery power, you're also making your laptop's life a little bit longer.

FreeBSD 7.0

FreeBSD 7.0 was released last week, and while the beta's been available for quite a while now, I'm quite excited to see it finally released. It's supposed to run faster, have a better kernel, and updated software. Here's the release notes from freebsd.org:


The FreeBSD Release Engineering Team is pleased to announce the availability of FreeBSD 7.0-RELEASE. This is the first release from the 7-STABLE branch which introduces many new features along with many improvements to functionality present in the earlier branches. Some of the highlights:

* Dramatic improvements in performance and SMP scalability shown by various database and other benchmarks, in some cases showing peak performance improvements as high as 350% over FreeBSD 6.X under normal loads and 1500% at high loads. When compared with the best performing Linux kernel (2.6.22 or 2.6.24) performance is 15% better. Results are from benchmarks used to analyze and improve system performance, results with your specific work load may vary. Some of the changes that contribute to this improvement are:
o The 1:1 libthr threading model is now the default.
o Finer-grained IPC, networking, and scheduler locking.
o A major focus on optimizing the SMP architecture that was put in place during the 5.x and 6.x branches.

Some benchmarks show linear scaling up to 8 CPUs. Many workloads see a significant performance improvement with multicore systems.
* The ULE scheduler is vastly improved, providing improved performance and interactive response (the 4BSD scheduler is still the default for 7.0 but ULE may become the default for 7.1).
* Experimental support for Sun's ZFS filesystem.
* gjournal can be used to set up journaled filesystems, gvirstor can be used as a virtualized storage provider.
* Read-only support for the XFS filesystem.
* The unionfs filesystem has been fixed.
* iSCSI initiator.
* TSO and LRO support for some network drivers.
* Experimental SCTP (Stream Control Transmission Protocol) support (FreeBSD's being the reference implementation).
* Much improved wireless (802.11) support.
* Network link aggregation/trunking (lagg(4)) imported from OpenBSD.
* JIT compilation to turn BPF into native code, improving packet capture performance.
* Much improved support for embedded system development for boards based on the ARM architecture.
* jemalloc, a new and highly scalable user-level memory allocator.
* freebsd-update(8) provides officially supported binary upgrades to new releases in addition to security fixes and errata patches.
* X.Org 7.3, KDE 3.5.8, GNOME 2.20.2.
* GNU C compiler 4.2.1.
* BIND 9.4.2.

For a complete list of new features and known problems, please see the online release notes and errata list, available at:

http://www.FreeBSD.org/releases/7.0R/relnotes.html
http://www.FreeBSD.org/releases/7.0R/errata.html

For more information about FreeBSD release engineering activities, please see:

http://www.FreeBSD.org/releng/


Well, I don't really have time to write now, I've got an operating system to install.

Adding a hard drive to a Mac

No, this isn't a howto hardware-oriented tutorial for adding more hard disks to a Macintosh computer. What I'm going to cover is what to do after you've added the hard drive(s) to your computer.

Typically, Mac users run out of hard disk space, and they buy a new hard drive, format it, see it on their desktop, and start putting files on this volume instead. While there's nothing really wrong with this approach, there's a lot more useful ways to put your hard drive into use.


Since it's a Unix system, you can mount filesystems into any directory (permissions allowing). What this means is that you can virtually integrate a new hard drive into your existing filesystem, so that you won't even notice it. It's fairly simple, actually.

  1. Once you've installed your new hard drive and confirmed it's working, you need to draw up some sort of plan as to how you're going to use the disk space. This will become your partition map. To integrate extra hard drive space into your existing filesytem, the partition must be based off of an existing partition. Here are the most common directories you would want to mount from the new hard disk:
    • /Applications - where all the system's applications are stored

    • /Users - where all the userdata is stored

    • /Users/yourname/Music - where your music is stored


  2. Fire up Disk Utility from /Applications/Utilities, select the new hard disk, and go to the 'partition tab'. Now select a partition scheme that has enough partitions for you, and make sure that they're sized appropriately. You'll probably want to use Journaled HFS+ (case insensitive) as the partition types. You can also create an extra partition if you still want an extra volume on your desktop for storing "extra" files.

  3. Copy all files from the old folders into the new ones. For example, if you're mounting a new /Application folder, copy the contents of /Applications into the new partition that is going to hold the applications.

  4. Start up Terminal from /Applications/Utilities, and type the following at the prompt:
    diskutil list

    This lists all the hard drives and partitions on your system. Make sure you write down the identifier for each new partition that you created on the new hard drive, as you'll need them for the next step.

  5. Now enter the following command at the prompt:
    sudo nano /etc/fstab

    Enter your password when prompted, and then proceed with creating the fstab file. The format for every mount point you want should be:
    identifier  /mount/point hfs rw 1 0

    Create a new line in between each mount point. Replace "identifier" and "/mount/point" with the appropriate entries that you want.

  6. Now move the contents of the old folders somewhere else (in case the mounting doesn't work out). Remember, it's only the content -- for example, if you were mounting /Applications, you would have your /Applications folder empty, ready for it to be mounted when you reboot.

  7. Reboot, and all the partitions should be integrated right into your filesystem.

Useful irssi commands

I love the IRC client irssi; it's very fast, simple, and solid. Simply said, it does what I want, although a command-line application often sacrifices an easy-to-learn interface for a quick, shortcut-oriented one. While I'm not completely on either side, I do tend to like irssi's focus on fast commands.


Here are some useful commands that I use often:

  • vim ~/.irssi/config - a configuration file for irssi that quickly allows one to set up accounts on different servers, and configure command shortcuts.

  • /ig AnnoyingPerson msg ignores private messages from 'AnnoyingPerson', but you can still see their messages in channels. You can also use a wildcard '*' to block all private messages, extremely useful if you don't like getting bombarded by PMs from people you don't even know. Use /unig to reverse.

  • /wjoin #channel creates a new window in the chat interface and joins #channel in that window. You can switch between windows with Control-P and Control-N.

  • /kb nick[tab] An extremely quick way of kicking+banning a user. Type the first few letters of their nick, hit tab, and the rest of it will be autocompleted. Hitting enter will ban the user's hostname and kick them off the channel.

  • /mub - remove all bans from the channel.

  • nick[tab] Saves you the trouble of typing out a really long nickname in a chat. When used at the beginning of a line, it changes to "nick: ", assuming that you're addressing someone.

  • /t [tab] - quickly allows you to edit the channel topic. Ah, the joys of tab completion!

  • /help allows you to get help from within irssi. Use /help command for help on a specific comamnd.

New web host found!

I'm pleased to announce that I've found a new (and supposedly free) web host which will allow me to create a full-blown website. I won't disclose the domain yet, as I've got a bit of work to do in the coding of the design and such, but I will mention that it is *nix related and that I've written a number of articles for it already.


The goal of this new website is going to be simplicity. In design, I believe that simplicity is beautiful. Not that everything has to be black-and-white, but that one should use "features" sparingly to draw out important details in the content. I think I'm also going to simplify the backbone of this website so as to make less work in maintaining the whole thing, although I might possibly try to integrate various php and cgi-based applications such as wordpress, drupal, phpBB, etc. as I see fit.


In the meantime, I hope to get some rough mockups done so I can begin some serious coding and uploading over the weekend.

codepad

An interesting little website I discovered today: codepad.org. It's a basic web-based compiler that supports C, C++, D, Haskell, OCaml, Perl, Python, Ruby, Scheme, and Tcl. It also creates a permalink to the source code, allowing it to be linked to in a similar fashion to how pastebin works.

It's not that this is anything new, but I love the simplicity of this website. It has a nice syntax highlighting scheme, and no bells and whistles to trip up the user. (Kudos goes to sarehu for mentioning the website in IRC.)

One thing I find interesting is that many people tend to overcomplicate things when trying to achieve nice things like shared music from a central location. Usually people achieve this by using Rendezvous for doing a multicast DNS server, and then using something like daapd to stream the files wirelessly over a network. While there is nothing wrong with this, and indeed, be my guest if this method suits you better,


However, there's a very simple way of doing this: make a file server! It doesn't matter what operating system the server is running, so long as it can serve files in a protocol your computer can understand. I recommend using the SMB protocol, as it's the easiest and most universal (and if you're using Windows, you'll pretty much have to). Another good choice is NFS if you're running mainly *nix-based systems.


Now, for connecting. On Windows systems it should be present under Network Neighborhood, or you can just type the server's IP address/hostname into the address bar: \\192.168.0.1. On Mac OS X, hit Apple-K in the Finder to bring up the connection window, and enter your server's IP address/hostname: smb://192.168.0.1. It should then prompt you for a username/password, after which it will mount the volume onto your desktop. Or you can do it from the terminal on any other type of Unix system:

mount -t cifs //192.168.0.1/share /mnt/point

...for example.


Copy your entire iTunes folder onto the file server. Everything: configuration files, library files, everything.


Finally, In iTunes, under Preferences/settings, go to the "Advanced" tab. For "iTunes Music folder location", go to the location of the network folder that you copied the iTunes folder to, and choose "iTunes Music". Hit "okay", and voila! You now have a shared library. This has some advantages to a streaming iTunes server, most notably a shared library. This way, your library can still keep track of play count, ratings, you can easily tag songs, and add to and remove from your collection. The only thing an iTunes server would have let you do would be stream the content!

Wireless hotspots are great, but unless you don't care about your privacy, you have to be careful what information you send/transmit through the connection. I recently found out an interesting feature of ssh: being able to double as a SOCKS proxy. Provided your internet connection is fast enough, it's a very useful way to transmit secure information from anywhere in the world. Setup sshd on your computer (assuming it's accessible from the internet), and then from your remote computer, simply open a SOCKS connection like so:


ssh -D 9090 user@server.com

Note that the port (9090 in this case) can be any port you want. Then configure a SOCKS-capable browser (such as Firefox) to use this newly created proxy. Note that in many cases it won't go through the SOCKS proxy for DNS lookup (for example, on Firefox you would have to change network.proxy.socks_remote_dns from about:config to true). But for most of us, this is more than enough security on a wireless hotspot.



Blogroll


DaniWeb
Bruton Garden


About


Hi there, I'm John, and I'm a blogger from Canada. I dabble with C and C++, and enjoy using a variety of operating systems. You can contact me at
john [at] tuxation.com

 

Copyright (c) 2007-2008 by John Altenmueller