Fedora 10 is out!

Fedora 10 was released yesterday, and I'm very impressed. This are much smoother this time around than in Fedora 9, and the Solar artwork is simply stunning. You can see some screenshots in this Phoronix review, and if you like it you can grab the LiveCD/LiveUSB, CD and DVD ISO images here. I've also updated all my blog howtos for Fedora 10, so if you need any help setting up your system with RPM Fusion be sure to check them out!

Rating: 
Tags: 

Data loss & backups survey

I'm taking a small business course at my local college and one of my assignments is to write a business plan for a business which would be offering the product or service of my choice.

Since I'm interested in data recovery and backups, I've written a short online survey  about data loss and backups which will help me collect information for the project. It should only take two minutes to fill out and I would really appreciate it if you could take the time to complete it. The more results I have the better... Thanks! (btw, if you'd like to see the results, then visit this page).

Update: The survey is now closed. Thank you to all who participated!

Rating: 

NiN

I went to see NiN's Lights in the Sky tour at the Bell Center last week, it was one amazing (light) show! If they're coming by your city and you're a fan of NiN, you should definitely consider going.

Rating: 

You're a pirate!

While the poll is on the topic of DRM.... I really enjoyed this xkcd Tongue out

Rating: 
Tags: 

The magic SSH command

I love SSH's port mapping features. They're a bit complex to figure out, but they can prove to be very handy.

Once, I was updating a friends Fedora installation but I had to head home... He was behind a firewall and so I wouldn't be able to do remote access, even though sshd was running. Port mapping to the rescue! I logged in via SSH to my home machine and mapped his port 22 to a port on my local machine, so when I got home I was able to ssh to localhost and thereby get into his machine.

I've come up with my favourite SSH command that combines a few tricks - it goes as follows:

ssh -p port -l username hostname.or.ip -L lport:localhost:rport -D proxyport

I'll run through it step-by-step:

  • ssh -p port -l username hostname.or.ip

    This instructs SSH to connect to hostname.or.ip on port as username.

  • -L lport:localhost:rport

    This maps rport on the remote machine to lport on localhost (aka the machine you're currently using). Essentially, connection to port lport on localhost is the same as connecting to the remote host on port rport. It's very useful for mapping services running on the remote machine (such as VNC) to the local machine over a secure channel.

  • -D proxyport

    This makes SSH act as a SOCKS 4 proxy on localhost using port proxyport, which is needed for allowing traffic on ports which would otherwise be blocked (ie BitTorrent, FTP, POP, SMTP, etc in places that only allow traffic on port 80)

For example:

ssh -p 22 -l me myhost.homelinux.net -L 5905:localhost:5900 -D 5678

This maps the VNC screen :0 on myhost.homelinux.net (port 22, username "me") to the local VNC screen :6, and makes a SOCKS proxy on port 5678. If I connect to localhost:5906, it's the same as connecting to myhost.homelinux.net:5900 except thanks to SSH everything passes through an encrypted channel!

Rating: 
Tags: 

The MacBook Pro Latch

If you've been following my blog (I don't post often do I don't blame you if you don't Wink) you know that I've become a pretty big fan of Apple. Even though you do end up paying a slight premium for Apple hardware compared to a Dell let's say, the peace of mind from using OS X and the bundled software is well worth the extra cost.

I only have three complains about my MacBook Pro 4,1 (early 2008 model): A small and very bright white dot on the screen that only appears when displaying white pixels, small amounts of corrosion on the hand rest area near the trackpad (aluminum pitting), and finally the latch button to pop up the display has been stuck pressed in for the past two days and so the screen won't stay close properly.

Turns out that there isn't much I can do about the first problem; many other owners of MacBook models with LED-backlit screens also seem to have the same problem. The second is slightly annoying, but rather harmless... I doubt my sweat will be able to react all the way through the aluminum casing. However, the last one also seems to be a relatively common problem, and fortunately it's easy to fix! After two hours of fidgeting with a paperclip and protractor trying to push the latch forward, I finally decided to shine a flashlight into the small holes near the trackpad and latch mechanism. Sure enough, there was a small piece of plastic that had fallen into the hole and was blocking the latch from springing forward. I used a small metal hook to carefully move the piece of plastic upwards and not slide it ;across ;(where it would eventually just obstruct the latch again) and then removed it. Voila, the latch was working again!

Rating: 

New website online!

As I talked about a few posts ago, I've been trying out Drupal and designing a new section of the Diffingo website with it that is devoted to its open-source software. I polished it a bit and it's now online at diffingo.com/oss. Now that I have a developer blog there, I'll be posting info relevent to fwbackups and my other software there... But the rest will still be here.

Rating: 

Writing cross-platform applications with Git, Qt and CMake

I've been working a lot on the new fwbackups branch, where my main goal was to make it faster, more versatile and cross-platform. I decided to write it in C++ and use Qt for the interface, since when combined with CMake it would be very easy to have it compiling on all platforms. Stick the code into a git repo and you've got cross-platform building with cross-platform revision control! If you're looking for a way to setup a cross-platform application, I've listed the steps I took below:

Step 1: Install the Dependencies

Before we begin, you'll have to install a few dependencies:

Step 2: Create the git repository

Now that you have Git installed, it's time to create the Git repository which will host your project. Open up a command line and type:

  • Linux (Applications Menu > System Tools > Terminal), Unix or Mac OS X (Macintosh HD > Applications > Utilities > Terminal):

    mkdir -p ~/development/ProjectName
    cd ~/development/ProjectName
    git init
  • Microsoft Windows (Start > Run, type "cmd"):
    mkdir "My Documents"
    mkdir "My Documents\development"
    mkdir "My Documents\development\ProjectName"
    cd "My Documents\development\ProjectName"
    git init

This will initialize a git repository called ProjectName inside the "development" folder in your home. You can replace ProjectName with whatever you'd like, but just remember to replace all further instances of it in this tutorial with the same name.

If you'd like to share the project and authorize with other developers to commit to the Git repository, be sure to check out gitosis.

Step 3: Directory Layout

While it's not required, I chose to use an out-of-source build to help keep the source directories clean and keep the build files for each platform separate. Inside your newly-created ProjectName folder, create the following directory tree:

  • build/
  • build/mingw/
  • build/linux/
  • build/osx/
  • build/unix/
  • pixmaps/
  • src/
  • translations/

Step 4: Configure CMake

The last step is to configure CMake. When CMake is invoked, it reads the CMakeLists.txt file and then automatically generates Makefiles for your platform. Use this template CMakeLists.txt file and save it in the ProjectName directory created earlier:

# Name of the project
project( ProjectName )

# Essentially, just split up your project version numbers by the dot.
# These variables map version 0.0.1 of ProjectName.
set( VERSION_MAJOR "0" )
set( VERSION_MINOR "0" )
set( VERSION_PATCH "1" )

if( APPLE )
  # If we're running OS X, we need CMake 2.6.0
  cmake_minimum_required(VERSION 2.6.0)
  set( CMAKE_OSX_ARCHITECTURES "ppc;i386" )
else( APPLE )
  # Otherwise, CMake 2.4.8 is fine
  cmake_minimum_required( VERSION 2.4.8 )
endif( APPLE )

# This project requires Qt4 and Gettext
# If your project does not use Qt or Gettext, simpy remove these lines.
find_package( Qt4 REQUIRED )
find_package( Gettext REQUIRED )

# Enable all compiler warnings
add_definitions( -Wall )

# Process the "src" subdirectory
add_subdirectory(src)

If you're using gettext for translations (as many open-source projects do) then all you need to change is the ProjectName at the beginning and the version number. You'll notice that "add_subdirectory(src)" is called, so the next step is to create the CMakeLists.txt in the ProjectName/src directory:

# All cpp files go here
set(SRC_FILES
    main.cpp
    ProjectName.cpp
   )

# Headers with signal/slot definitions go here
# Remove me if not using Qt
set(MOC_HDRS
    ProjectName.h
    )

# Qt designer interface files go here
# Remove me if not using Qt
set(UI_FILES
    interface/ProjectName.ui
    )

# Qt RC files go here, uncomment if applicable
# Remove me if not using Qt
#set(RC_FILES ProjectName.qrc)

# Remove me if not using Qt
qt4_wrap_ui( UI_HDRS ${UI_FILES} )
qt4_wrap_cpp( MOC_SRCS ${MOC_HDRS} )
# If you're using Qt RC files, uncomment this too
#qt4_add_resources( RC_SRC_FILES ${RC_FILES} )
# Includes the standard Qt libraries
include( ${QT_USE_FILE} )

# Include your headers in the build and source directories
# If you need to include more directories, add them here
include_directories( ${ProjectName_BINARY_DIR}/src
                     ${ProjectName_SOURCE_DIR}/src
                     )

if( APPLE )
  # Define some settings for the Bundle
  set( MACOSX_BUNDLE_BUNDLE_NAME ProjectName )
  set( MACOSX_BUNDLE_GUI_IDENTIFIER "ProjectName" )
  set( MACOSX_BUNDLE_ICON_FILE ProjectName.icns )
  set( MACOSX_BUNDLE_INFO_STRING ""${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}",
                                 Copyright 2008 ProjectName team" )
  set( MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}" )
  set( MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
  set( MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
  set( MACOSX_BUNDLE_COPYRIGHT "(C) 2005-2008 Stewart Adam" )
  # create a bundle with an icon too!
  # If you're not using Qt, uncomment the next line and comment the line below it:
  #add_executable( ProjectName MACOSX_BUNDLE ${SRC_FILES} )
  add_executable( ProjectName MACOSX_BUNDLE ${SRC_FILES} ${MOC_SRCS} ${RC_SRC_FILES} ${UI_HDRS} )
  
  # Allows for bundle re-creation just by running "make". Also installs bundle icon
  add_custom_target( osx_bundle_dirs
    COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/ProjectName.app/Contents/Resources
    COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/ProjectName.app/Contents/MacOS
    COMMAND cp ../../../pixmaps/${MACOSX_BUNDLE_ICON_FILE}
            ${CMAKE_CURRENT_BINARY_DIR}/ProjectName.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE}
    # Qt translations - uncomment this line when you need to install them to the bundle
    #COMMAND cp *.qm ${CMAKE_CURRENT_BINARY_DIR}/ProjectName.app/Contents/Resources/
   )
  add_dependencies( ProjectName osx_bundle_dirs )
  # This tells cmake where to place files inside the bundle
  set_source_files_properties( ${ProjectName_RESOURCES} ${ProjectName_TRANSLATIONS}
    PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
else( NOT APPLE )
  # Builds a binary for windows (without cmdline showing), regular for Linux
  # If you need the cmdline showing, remove the WIN32 attribute
  
  # If you're not using Qt, uncomment the next line and comment the line below it:
  #add_executable( ProjectName WIN32 ${SRC_FILES} )
  add_executable( ProjectName WIN32 ${SRC_FILES} ${MOC_SRCS} ${RC_SRC_FILES} ${UI_HDRS} )
endif( APPLE )

# Link Qt to the executable
target_link_libraries( ProjectName ${QT_LIBRARIES} ) 

Step 5: Build the project

Now that CMake is configured, you're good to go! To build the project, run:

cd ~/development/ProjectName/build/osx
cmake . ../../
make

If you'd like to build for Unix or Linux instead of Mac OS X, change the "build/osx" to "build/unix" or "build/linux" respectively. If you're running Windows, you need to reverse the slash direction and add an additional parameter to CMake:

cd "My Documents\development\ProjectName\build\mingw"
cmake . ..\..\ -G "MinGW Makefiles"
make
Rating: 

Qt, Drupal, iTunes, DRM and a bunch more

I saw this story on slashdot today and wanted to share it - this is exactly why I will never buy anything DRM-protected. If you missed the other article a while back, this is the second music store to shut down in the past few months and leave its users in the dark. I say "in the dark" because both Yahoo! and MSN took down their key servers along with the service, so any user who needs to authorize a new computer to play the music they legally purchased is unable to do so - forcing them to rebuy the songs they've already paid from for somewhere else. This is the perfect example of why I think DRM is a bad, bad technology. Another reason was something I read in a comment on slashdot (sorry, don't have the link this time): When you think about it, the users who pay are getting the short end of the stick. If you pay and recieve DRM content, you're getting a service that's worse than what you get from pirating that same content! For example, music. People who illegally download music are getting high-quality (320kbps) MP3 files without any content restrictions for free, while the users who pay to download music will typically get a 128kbps AAC or MP3 file, with DRM restrictions... Something has to change. Soon.

If you agree with me, try to opt for DRM-free music or simpy don't purchase DRM-encumbered music. While a CD will cost you a few more dollars, it has a much higher sound quality and it's not restricted in any way. Hopefully if the music industry sees the common trend of users moving towards DRM-free music, we can get rid of DRM once and for all. I've started purchasing from the iTunes store now that iTunes Plus is getting more popular, and I must admit I'm liking it. I can choose to purchase only select songs from an album, the prices are very reasonable ($0.99/song) and the sound quality is great - 256kbps AAC! What's best of all is that I can play the songs anywhere without the need for authorization - including on Linux or on other non-iPod media players (like Creative MuVos for example) since I can convert the song to any format: ogg, flac, mp3, etc.

Anyways, now that that rant is out of my system, I'll tell you what I've been up to recently. I've been creating a new website for the open-source section of Diffingo.com with the Drupal CMS. I still like Joomla since there's lots of support and community extensions available, but Drupal was recommended by a few friends so I figured I'd give it a shot. And I'm happy I did.

The first thing I noticed was that it was lightning-fast - at least twice or three times faster than Joomla. Not only that, but to my surprise it was much easier to use. I found the interface much cleaner and easier to look at... Everything faded nicely and there seems to be some pretty advanced Javascript stuff built right-in to the administator interface. The WYSIWYG "TinyMCE" editor packaged with Joomla is available for Drupal, so I felt right at home. Drupal also does away with the whole sections and category thing which is really nice. Instead, content items are created as "nodes" and you can cross-categorize nodes if you'd like to.

Blogging is also supported out-of-the-box, which was a big plus since I call this a "blog" but really it's just Joomla content items displayed on a homepage (this is going to be moved to Drupal soon, too). I found themeing Drupal to be a bit more difficult than theming Joomla, however that was made up by Drupal's wonderful access controls. Drupal supports creating user roles, and each role hasa set of permissions. This effetively lets my control who gets to what, when, where and how. I created three simple groups to start with (co-administrators, registered users and anonymous users), but there's a lot of potential in there that I'm hoping I can tap into later.

So, as I blogged about last time I'm also working on a new version of fwbackups. I've changed almost everything I could behind the scenes - from autotools to CMake, from GTK to Qt and from Python to C++. I plan on keeping the interface as similar to as it was before, but it's going to be much simpler and easier to use. It's also going to be much faster under the hood - I'm going to have more info about the next version soon, as soon as I get the new drupal site up ;)

One problem I had when making all these changes was how to set things up properly - it took me a few days, but right now the interface in Qt is done and the very little of the program that's been completed is C++ builds on Mac OS X (10.3.9 and later), Windows (MinGW required) and Linux of course. If you're looking for a way to do this with one of your projects, I'm going to blog about getting the structure for all that setup soon, so check back in a week or two!

Rating: 

MacBook and MacBook Pro 4,1 + Fedora 9

I recently bought a new MacBook Pro and had some trouble getting it to work in Fedora - Here's how I did it :)

Before we start

I've discovered three useful tips from playing around and a bit of web research that I should share before we begin. The first is that no matter how many OSs you install on your Mac, you're going to have to put Windows on the last partition of the disk. I have no idea why, but XP SP2 seems to bug out if you don't.

The second useful tip is that because of the way the EFI+MBR overlap when booting multiple operating systems, no extended partitions are supported. Mac also takes its own partition as part of the MBR compatability scheme, so that leaves you with a maximum of 3 OS partitions.

Finally and most importantly, it's very difficult to change the partitioning scheme once it's been finalized/the OSs are installed. I would recommend that if you think you're going to triple-boot later on, you leave the empty partiton in between for Linux or at the end for Windows to save you lots of headaches later... I hope this can help someone, since I almost had to format the entire HD (at that point, Windows AND Mac OS X) when I realized it would be very difficult to repartition and preserve data.

Step 1: Resize your Macintosh HD (HFS+ partition)

If you'd like to dual boot, simply open up the Boot Camp assistant and use it to partition your Mac Drive. When asked to insert the Windows installation disk, simply insert a Linux one and it will do the rest (skip step 2a). I recommend a kernel >= 2.6.24.

If you'd like to triple boot, it would be a good move to create the three partitions ahead of time. Fortunately for us, HFS+ partitions support resizing so it's a breeze to shrink OSX and add two new partitions. Simply boot from your Mac OSX install CD and select Terminal from the Utilities menu once it boots. Resize Macintish HD with this command:

diskutil resizeVolume disk0s2 100G "MS-DOS FAT32" "FormatToLinux" 15G "MS-DOS FAT32" "Windows" 50G

Change the volume sizes to match your preferred setup and hard drive size. Since both Linux can read to NTFS and read HFS+ safely, I figured it didn't need to be that big and so I left the Mac and Windows partitions larger.

When you're done, quit Terminal and reboot back into OS X. Insert the Windows install CD, reboot and hold the left "alt/option" key as the Mac boots. This will offer you the choice of booting from the CD named "Windows".

Step 2a: Install Windows

When it comes to the partition selection, select the last FAT32 partition ("Partition 4"). It should be labelled "Windows" - format it to NTFS (Quick format) and install onto that partition. Hint: One of the two OS X installation disks included with the Mac has Windows drivers for the keyboard backlight, trackpad, graphics card and more. When you're done setting up Windows, reboot holding the left "alt/option" key and boot into Mac OS X.

Step 2b: Install Fedora 9

Since the new Intel CPUs in the Macs have the EM64T extension, they support 64bit operating systems (x86_64). I chose the x86_64 variant of Fedora, however the 32bit (i386) version would work just as well. The installation, either off DVD of live media, goes pretty smoothly until partitioning. You must select "Custom Partition Layout". You'll find /dev/sda3 is type vfat - This is the drive we made that we need to format to ext3. Select it mount as "/", formatting to ext3 as well (you can use xfs or whatever filesystem you prefer here as well, I just like ext3 since it's well supported and tested). From here on you can follow the rest of the installation as usual.

Step 3: Wireless & Sound

Wireless is actually pretty easy for the Mac. The drivers included on the installation disc work perfectly, but Dell offers a driver form the same card that's easier to install than extracting it off the exes. First, download these RPMs on anther computer and transfer them to your home:

32bit (i386):
kmod-ndiswrapper-1.52-30.lvn9.i686.rpm

kmod-ndiswrapper-2.6.25-14.fc9.i686-1.52-30.lvn9.i686.rpm
ndiswrapper-1.52-1.lvn9.i386.rpm
R151517.EXE

64it (x86_64):
kmod-ndiswrapper-1.52-30.lvn9.x86_64.rpm

kmod-ndiswrapper-2.6.25-14.fc9.x86_64-1.52-30.lvn9.x86_64.rpm
ndiswrapper-1.52-1.lvn9.x86_64.rpm
R151517.EXE


Next, run this to install the wifi driver:

mkdir wifidriver
unzip -a R151517.EXE -d wifidriver/
cd wifidriver/DRIVER/
su
# install ndiswrapper and the wifi driver
rpm -Uhv *ndiswrapper*rpm && rm -i *ndiswrapper*rpm
/sbin/modprobe ndiswrapper
ndiswrapper -i bcmwl5.inf && rm -rf wifidriver && rm -i R151517.EXE
echo "options snd_hda_intel model=mbp3" >> /etc/modprobe.d/soundcard
echo "blacklist bcm43xx" >> /etc/modprobe.d/blacklist
echo "blacklist ssb" >> /etc/modprobe.d/blacklist
echo "blacklist b43" >> /etc/modprobe.d/blacklist
# ndiswrapper is used for wlan0
echo "modprobe ndiswrapper" >> /etc/rc.d/rc.local
echo "alias wlan0 ndiswrapper" >> /etc/modprobe.d/ndiswrapper
/sbin/service NetworkManager restart 

Step 5: Akmods

Since we plan on upgrading the kernel in a second, let's install akmods so that the kernel modules (ie, for wireless and nvidia if you're on a Pro) will create themselves when we update the kernel:

su
rpm -Uhv http://rpm.livna.org/livna-release-9.rpm
yum install akmods-ndiswrapper

If you're on a MacBook Pro, install the nvidia driver as well:

yum install akmods-nvidia 

Step 6: Kernel

Kernels 2.6.25.4-35 and newer include a fix for the fn-keys, which enables you to control the current song, volume and backlight, etc. At the moment this kernel hasn't been released to updates or updates-testing so we can use the a more recent koji build here. When a newer kernel is released to updates, just do a "yum update" to update the system (or do it via PackageKit if you prefere a GUI) and skip this entire step.

For 32bit systems, download it with this command:

wget http://koji.fedoraproject.org/packages/kernel/2.6.25.4/39.fc9/i686/\
kernel-2.6.25.4-39.fc9.i686.rpm http://koji.fedoraproject.org/packages/kernel\
/2.6.25.4/39.fc9/i686/kernel-devel-2.6.25.4-39.fc9.i686.rpm

For 64bit systems, download it with this command:

wget http://koji.fedoraproject.org/packages/kernel/2.6.25.4/39.fc9/x86_64/\
kernel-2.6.25.4-39.fc9.x86_64.rpm http://koji.fedoraproject.org/packages/kernel/\
2.6.25.4/39.fc9/x86_64/kernel-devel-2.6.25.4-39.fc9.x86_64.rpm

Next, install it:

su
rpm -ihv kernel*2.6.25.4-39*.rpm 

Reboot and let the akmods work their magic. If you don't have the nVidia driver and wireless working the first try, reboot again and things should return to normal.

Step 7: Pommed

Pommed lets you control the LED and keyboard backlight, soundcard, infrared remote and more. It will (hopefully) soon be included in Fedora, but until then, if you'd like to install it run this:

su
wget http://downloads.diffingo.com/diffingo-repo/diffingo.repo -O \
/etc/yum.repos.d/diffingo.repo
yum install pommed

Enjoy Linux (and Windows if applicable) on your new MacBook!

Rating: