Tag - linux

Entries feed - Comments feed

Thursday, August 5 2010, 05:43 pm

Thirty Ways a Software Grows

The following recount is rather generic in nature so I do not have to worry about stepping on any toes, but it is all true.


Everyone has a workplace story to tell and I've finally gotten around to writing about my own. I have had a rare opportunity to write and maintain software for a company that has plenty of history. The company I, still, work for has been around almost as long as Microsoft to give you a point of reference.

In The Beginning In traditional fashion of the time, which still holds true today, the company started by buying the rights to a software that someone else wrote. The country of origin: Canada. I do not know much about the company or who were the original authors besides a few names I've seen in copyrights, so unfortunately I do not have any juicy stories to tell about them. They wrote to Minix, which surprisingly still exists today. The data was stored in ISAM databases (Google it), which unfortunately still exists today. The program displayed via a terminal-based text screen with support for input fields and displaying different types of screen layouts, which, also unfortunately, still exists today. The only saving grace was that it was written in the C language.

Abraham Lincoln The company originated in a log cabin, now turned historical landmark. I heard the winters were cold, and the summers were hot. The size of the cabin is about the size of a traditional living room with two whole stories. There was also the shift from Minix to UNIX and DOS operating systems to keep up with growing demand.

Enterprise Split Eventually the software became outdated, in a sense, for the customer base the company wished to sell to. Enterprises wanted a more robust and fully featured software. The solution? Rewrite! The company moved to a different city, but left behind the original software - to live in its own filth.

Dungeon Upkeep Keeping the software maintained to a point people could still use it was the job of a fellow I only met once when I was being interviewed (for an unrelated position!) so I can't tell you any juicy stories about them either. However, I can tell you the software essence remained the same. They continued to use the original UNIX compiler and coding techniques. These techniques include typedefs to normal C keywords and functions. Numerous programs that simply copy & paste code from other programs. Global pointers ruled the entire source code base from top to bottom. Return values were rarely checked. Instead of calling the standard rename or delete functions, system calls were made to the operating system's shell tools. The source control system involved cloning the main source directory per release - some of which I did not find when I took over. Take this scenario for instance: One customer was given a compiled program on Monday but changes would be made to the same program and given to a different customer on Tuesday. Every customer had a unique compiled version of the software. Let that settle in your mind for a moment.

Change of Hands A friend of mine, who has moved on to greener pastures, took over a few years ago. He began a very important and rigorous job of evolving the software into a state that a guy off the street could come in and program to. The code went from 1980s leftovers to 1990s l33tsauce. It was now source controlled in CVS and macros were removed. Some of the copied code were moved into libraries that were compiled against. A small set back to the improvements happened when another programmer was hired and began transforming perfectly good code into obfuscated and over coded code. String pointers were turned into "static const char *const variable;" nightmares. Functions were rewritten to be twice as long and contained bugs that I had to find and fix for about a year.

Modern Tools After I took over we released a major version. This version was the first version where all of the software was released in one update. It was all source controlled, and I implemented a sane update system that insured customers would all be on the same software level. Lately we've moved the code into git and I have been loving every minute of it. The software is slowly emerging from its colorful past.

Over the Rainbow GUI, SQL, Cross-platform. These three words are the embodiment of the future of the company. If I get a chance to finish the project, it should provide the company and its customers with a fresh breath of life.

Saturday, February 6 2010, 10:23 am

Developing Openly on Proprietary Land

My programming adventures continue. Nokia's experiment into Linux with Maemo is very alluring and since I've applied myself into a few Linux projects, I felt it would be worth looking into what Nokia has put together.

The Maemo SDK runs under Scratchbox, a virtual environment created in part by Nokia. The Scratchbox toolkit can run under any Linux distribution, and it requires it. If you wish to run the SDK under Windows, your only option is to use a virtual machine. Once your SDK is running, it is nearly identical to a running Maemo device. In order to use the SDK, basic knowledge of Linux goes a long way, but since Maemo is derived from Debian there are some distribution specific programs. I've been using Red Hat based distributions for years, so it took some time to get used to using dpkg and apt-get to handle packages. After a few months of using my N900, creating and handling packages takes less work under an RPM system, but it's adequate.

Since Maemo is Linux, any Linux application has a chance of life. This makes building new applications or porting existing Linux applications a walk in the park. You can literally compile any Linux program for ARM and run it, however, the necessary screen space and physical size of a N900 can make it difficult to use a large application such as Open Office, which has dozens of menus and toolbars. This is where Maemo ports come in. A finger-friendly UI can be designed and added, even sent to the upstream authors, and makes the app you port usable everyday on your device.

I started with building a brand new application. A stopwatch seemed like an easy first project. I noticed several stopwatch applications already existed, however they were written in Python or were not maintained in a long time. The Maemo Garage is a center for Maemo projects, so I created my own project page and began work. I decided to write in C, the native language of many Linux core libraries, and use GTK for the UI, a cross-platform, and the native toolkit for Maemo 5. During the programming process, I learned the Hildon additions to GTK made by Nokia, and the dbus methods to activate and listen for accelerator changes to allow my applications to turn into portrait mode when the user turns their N900. Here's the first incarnation: Stopish 0.9.0

Other programming projects are endless. I wanted to look at fixing a few usability issues. One was the RSS reader, which used a slider that was too thin for a finger. I submitted a patch to Nokia and it will be included in the next major firmware update. The second was the lack of FLAC tags in the media player. I now enjoy FLAC as my music format of choice, and it's possible to use since the Maemo media player uses gstreamer for media codecs and tracker for tags. In order to add FLAC tags, I had to extend the tracker program to be able to read them. Someone had already created such a plugin for vorbis, and so using it as a template, I made one for FLAC.

There are two Maemo repositories for projects, Maemo Devel and Maemo Extras. Finalized applications live in Maemo Extras, while developers can play with new applications in Maemo Devel Adding my projects to Maemo's repositories was a breeze. Just create a Maemo account and request upload access. I can use scp (SSH CoPy) to send my source code to the Maemo build server and it will package my projects and makes them available on the Maemo Devel repository. From this repository a developer can choose to promote it to Maemo Extras. During this promotion, other Maemo users vote on the application and if enough positive votes are made the project is automatically pushed into Maemo Extras.

Although most of Maemo is open source and source provided through gitorious, there's still a lot left closed - such as the phone, contact, and media player. Nokia's plans include more open source goodness in Maemo 6. The future of Maemo definitely looks bright even if they are forcing Qt down everyone's collective throats.

Saturday, December 12 2009, 08:28 pm

Maemo, Smaemo they Say

The world welcomes another Linux phone. This time around we have something a little more mature and more appealing to the eye. Behold, the Nokia N900:

As with all my blog posts, I won't bore you with details. Google is your friend. After handling the N900 for a week, I begin my review:

  • Feel
    Plastic encased all around, the feel of the phone doesn't feel like plastic. It's a refreshing, solid, stout feel. When I first picked it up it felt heavy, but now I hardly notice the weight. The slider is solid and does not wiggle. It slides in and out of place securely. The keyboard keys are just the right size and it feels great to type on it, but if you don't want to slide out for it, an on-screen keyboard is available.
  • Screen
    While the technology of the screen is not new, I cannot find a problem with it. The 800x480 resolution alone will leave other "phones" in the dust. Most folks now-a-days want the latest and greatest technology and will spit on the N900 for using a resistive screen. I've used touchscreens for a long time starting with Palm Pilots to a Nokia 5800, iPhone, and Google G1 phone. This covers both resistive and capacitive technologies over the past 10 years. The N900 screen is extremely responsive and I cannot tell a difference between it and a G1. I've read other reviews saying the N900 is terrible, but I believe there's some fanboyism hidden under their text. In fact, I wrote brainstorm ideas for this blog post on my N900 with the included stylus. As I was writing I noticed it picked up every tiny detail of my strokes just as if I was using a real pen. Judge for yourself. I used Xournal (Maemo Extras repo) to generate it and Bluetooth'd it to my PC with two clicks of the screen.
  •  CPU/RAM
    The included Cortex A8 is in fact the same as the iPhone and is plenty fast. I have yet to benchmark it, but I have yet to find anything that stresses it too much. The phone remains responsive at all times no matter what you are running. Even when someone calls you.
    RAM isn't too much of an issue as it includes 256 megs of hardware RAM and partitions 768 megs of swap memory on the embedded flash drive.
  • Battery
    Lifetimes of the battery depend on what you do. No news there. Comparing to my N95, I get about the same battery life. One day if I am making calls, surfing the web, and using apps, or two days if I limit my usage to a phone call or two. The included micro USB port and cable allow you to charge anywhere there is a USB port and extra batteries are dirt cheap on Newegg. Battery life isn't too much of a concern to me for how much I get in return out of the device.
  • Linux
    Nokia has made Maemo their Linux distribution and left most of it open source. Maemo 5, included with the N900, provides kernel 2.6.28. However, Nokia felt that IPv6 support was "bad" and left it out of the provided kernel. There's a bug report for it on Maemo.org. It was included for the WiMax N810 tablet, but now it is removed. Quite a head scratcher, especially since Nokia's Symbian OS has provided IPv6 for a long time.
    All of that aside, if enjoy what Linux has to offer and want that same freedom on your phone that is supported by a major corporation, this is your dream come true. Nokia has stuck with a standard Linux environment instead of building their own, and if you are already familiar to Maemo this isn't news to you.
  • Multi-tasking
    Switching between apps is a breeze and is as simple as if you were using a PC. The included compositing manager allows fancy transition graphics and live resizing of windows so when you view all open windows, you can see what is going on without having to bring them up fullscreen. This technology has been present with Compiz (and now finally Windows 7) so nothing too new, but it is great to have it on a device that fits in one hand.
  • Application Compatibility
    Any Linux app will run on the N900. People have Quake 3 or Duke Nukem 3D running on it. Granted, the screen resolution isn't the same as a PC, so some apps are not usable on a small screen. In that case forks of the UI's for some apps are rewritten and made useable. A big example is Firefox. Mozilla's Fennec is Firefox with a UI for mobile devices. It is a full-fledged copy of Firefox and will render every web page exactly the same as if you were on a PC. All other phones include browsers that render differently and do not provide support any where close to Fennec. In fact, I have installed Adblock Plus on my N900. It works identical to my PC. No ads! This is the first device to provides this sort of environment. Not the iPhone, not the Pre, not even the Android phones can hold a candle to it.
    I have even started my own app for Maemo and did it in just a few hours. Check it out on the Maemo Garage where all Maemo apps are hosted.
    Nokia is even providing an Ovi Store for Maemo apps so businesses who wish to sell apps can do so. All of this is centralized through the app manager and relies on Debian-derived repositories for searching and installing apps. It's brain dead simple and keeps your phone clean for easy installing and uninstalling. You don't have to google search for apps.
  • Phone
    Contact support is brilliant. It merges traditional phone contacts with IM contacts and uses the open source libraries of telepathy to do so. I have my friends with not only their phone numbers, but AIM, MSN, Skype, and Jabber accounts all on one contact. This bleeds over into a conversation app that keeps SMS and IM conversations together. It's dead simple and brilliantly put together. The phone can take contacts off of Ovi or S60 phones so I was able to easily sync with my old N95 and get all my contacts and all their details (address, birthdays, etc).
    It's not perfect though. You can't assign a ring tone per person or use provider numbers to check minutes or data information (bugs in maemo.org for them).
    In all my phone conversations, I didn't have a problem with the speaker or mic. Everyone was able to hear me clearly. It does support speaker phone. The really cool thing is that it supports face detection - the phone will blank the screen when it is next to your face (saving some battery). Other high-end, phone-only devices support this same feature so it is nice to see it available here, too.
  • GTK/QT
    Maemo was originally designed for the GTK graphical interface toolkit. Nokia spent many man hours developing special add-ons to GTK for better tablet support, called Hildon. This past year, Nokia purchased Trolltech, makers of the QT graphical interface toolkit. Starting with Maemo 6, QT will take GTK's place. It was purely a high-level business decision as Nokia, with all businesses, are looking to make a profit. Nokia wants to keep Symbian and they have already invested time in bringing QT support to Symbian. With the Trolltech purchase, Nokia hopes to build a cross-platform design with QT so that all their devices they sell can run the same apps. This helps the small amount of businesses still investing in Symbian... because most of them have left to work on iPhone fart apps or work for Google now. All in all, I don't see this move as a bright business decision. I hope GTK still remains prominent in Maemo as it is the toolkit of choice for my programming both at work and at home.
  • Community
    It's a widely known fact that the Maemo distribution is gaining presence. Several Nokia employees have stated that the maemo.org site has seen huge increases in traffic with the release of the N900. Their garage and other sites have sometimes been susceptible to the heavy loads and become unresponsive. Nokia has stated they do plan on moving to better servers and better hosting ASAP.
If you've skipped to the bottom, screw you. My choice to buy this phone was a good one. I see it being a long time device in my collection, that is, until a faster one comes out. ;) There's so much more to write about the N900, but I want to get back to my life now.

Monday, October 19 2009, 05:38 am

How-To: Earn Your Carbon Credits

The past few years have showed us a boom in the fad of "going green" with everything from automobiles to your home. Some people have taken advantage of the situation and claimed the need to put a price on the amount of carbon emissions each individual puts in the air. Everyone should be given a quota and if you go over that quota you need to buy "carbon credits" otherwise you face "penalties." I'm glad we haven't reached la-la land just yet, but there are simple ways to go green without going overboard.

I run a server at home for routing, web, email, files, and almost any little idea I think of. Now that I've told you I will have to kill you as ISPs frown on this freedom of expression. Anyway, this server has been comprised of spare parts and/or whatever I could buy for $20. Now that I have a decent job, I decided I wanted a computer I could call a server and stand by it. It also had to draw less electricity and put out less heat and noise. Let's compare my setups:

  • 1.4ghz "Tualatin" Pentium III-S
  • 512mb PC-133 RAM (i815 chipset limitation)
  • ASUS TUSL2 motherboard
  • 320gb Seagate 7200.10
  • Intel 100 mbit and 1000 mbit PCI cards
  • $50 case with 350watt PSU (all-in-one)

  • 1.86ghz "Lynnfield" Xeon L3426
  • 4gb DDR3 1333 ECC RAM
  • Supermicro X8SIL-F motherboard
  • 2x1TB Seagate 7200.12 (RAID 1)
  • Dual on-board Intel 1gb NICs
  • Antec MicroATX case + SeaSonic 500watt 80 Plus Bronze PSU

The junker runs at a nice loud, slow pace. PHP and any disk intensive request was a several second ordeal. Most of that is due to the limited amount of RAM. I hooked up the Kill-a-watt power meter to the junker to see how much electricity I'm wasting. 62 watts - at idle. The computer is lifeless and it's eating enough energy to power an old school light bulb. Think of all the nuclear power I'm wasting; I can't sleep at night.

Putting the new server together was the fastest assembly for me yet. Most things are now on-board and the only power connections were for the motherboard and hard drives. Hitting the power switch brought forth... silence. Ah... What's this? A BIOS prompt. After installing Fedora 11 x86_64 using my USB drive (no CDs or floppies were hurt in this process, something other OSes can't say), I ran the power meter on it. A whole... 40 watts at idle. With more than 10 times the computing power (and 1 vs 4 cores) and an additional hard drive, the new system was eating 22 (woot math) less watts! Just to put this in an even more interesting twist, my one year old desktop computer pulls a hefty 96 watts out of the Earth. It has a 9800 GTX+ helping it get that high though.

What's the meaning of all this? Well, I should get some nice medal from Al Gore for saving the planet, right? Heck, I'd take just a letter. Now get out there and green up your computing environment. Doctor's orders.

Saturday, February 28 2009, 07:45 pm

Chug, chug, chug, chug...

How on earth does the world use Vista? Yes, Microsoft Windows Vista. Backstory: I received a new laptop two days ago. An ASUS N80Vn-X5. It came with Vista Home Premium 64-bit. This is my first copy of Vista as I run Linux on all my machines. I did have a copy of XP but I stopped using that a few years ago. Why did I stop using XP? Because I wanted something more out of my computer. XP is fine and all, but I can accomplish more with Linux - not just because it is free.

I unpack it from its box and I plug in the AC adapter and boot the thing. Vista starts to load - and load - and load. 10 minutes later I get to the desktop. Why on earth did it take that long to get to my desktop? Wait a minute... the hard drive is still chugging. Why?

The first thing I do is kill the hideous sidebar that takes an extra 5 minutes to load on startup. Gone. The second thing I do is disable automatic updates. Now, I realize some readers will think better of themselves and call me an idiot, but I rarely use Windows and I know how to update it so I'm quite OK running updates when I should instead of having Windows do it for me.

It came with SP1 so I figured it should be pretty harmless. Where to update this thing? Hm, I don't see anything. Ah, I'll just use IE's "Windows Update" link. Oh what's this? There's an update to Windows Update. Oh! It requires a reboot. *Reboot* Ah, that was a nice 10 minute reboot. Windows update has about 30 updates for me. Fine. Downloading/updating takes about 15 minutes thanks to the attrociously large 100 meg .NET update. I'm on 20 megabit Internet mind you. Rebooting again. Seems that I'm up to date now, or am I?

The only thing loaded on this thing is about 5 ASUS utilities for the fingerprint reader, webcam, and some software that looks like it encrypts files. Grand total of hard disk space in use? 20 gigabytes. That alone is enough for me to be offended permenently because what does that 20 gigabytes net me? A video player, picture viewer, a web browser, and a movie maker. The features don't match the disk space requirements. It's also using 1 gig of RAM with no programs running. Yes, I uninstalled the Office 2007 trial.

Why would I be offended? Example: My default Fedora install cost me 4.5gigs. What did I get besides the stuff already in Vista? Full office suite, photo manipulation, SELinux, bittorent, GPS mapping, SIP phone, Pidgin, GCC, and a few other of my programming utilities, not to mention Wine, which will allow me to run Windows apps.

Time to reboot just to see that reboot time again. *clicks Restart* "Configuring updates stage 2 of 3..." What's this? WHAT'S THIS? I have updates turned *OFF* and Windows is installing updates. Stealth updates - w00t. The little trust I had with Microsoft is completely gone at this point.

I let it reboot and go back into Vista just to find that after I log in the hard drive is chugging - and chugging - and chugging. 10 minutes later it finally quiets down and I decide to reboot to get into Fedora. *Clicks Restart* "Configuring updates stage 2 of 3..." Yeah. I'm done with Microsoft.

- page 2 of 3 -