Wednesday, July 22, 2009

And Moving Back to Slackware...

I change Linux distros more often than I change underware. It's always for different reasons, but the result is always the same...I get to spend time setting up a brand new system, working out all the little hiccups, until it's running smooth as silk. Today is Part 1 of my decent into madness: The Migration Back To Slackware.

Slackware was my very first Linux distro. Before I even really understood was Linux even was. I ruined about 10 CDs trying to get the iso images to burn correctly because I was using Windows, and that shit is hard! Finally...Slackware was mine. I spent the next few years or so just learning how to manipulate the most basic functionality, culminating in my finest achievement, learning how to successfully compile my own kernel. But really, the furthest I got was building a usable desktop environment. Sure, this is a success in and of itself, but it left huge gaps in my knowledge that other, gentler Linux distros slowly filled. When my friend recommended Arch to me, I was very excited, since it's basically Slackware with package management. Package management eventually became my friend after I worked with Debian (which probably directly influenced my move to Ubuntu as my primary desktop).

Recently, though, I've been dreaming of Slackware again. I think it's finally time to come back to my first toy distro, and see how much I've REALLY learned after all these years.

Resources to start:
How To Install Slackware On The Eee
The Main Slackware Page

Saturday, June 13, 2009

Migration to Arch

The other day I did a dd to my hard drive, and my Crunchbang install got completely wiped out. To the point where the computer refused to boot. The positive side to this story is that I had been thinking about migrating my netbook back over to Arch Linux, and the massive trashing gave me the perfect excuse to do this...

I had used Arch in the past as both a desktop OS and a server OS, after I had moved away from Slackware and before I really understood how nice package managers are. It's lean, mean, lightning fast, and a LOT of work, but I felt like it was more rewarding than working with Slackware (really only because Slackware was my first distro, so I didn't have a very solid understanding of what the hell I was doing). Crunchbang is a beautiful, solid OS to be sure, but I decided it was high time I moved to something even more lightweight for my netbook.

So, I'm currently running Arch Linux with the slick tiling window manager Xmonad (the WM I heard about through my new favorite webcomic, GeekHero :)). It took about 2 days total to get it set up 100% how I want it, and now I have a netbook that boots up and is ready to use in under a minute. Firefox, Evolution, and Audacious are basically the only non-CLI programs I use (I really can't use CLI web-anything), which isn't a fun thing for Linux newbies, but I enjoy quite a bit...it makes the mouse completely optional outside of these programs, which in turn makes use much more efficient and significantly less frustrating (relying on the mouse is definitely an exercise in frustration).

The best part about the Eee is the extremely generic chipset for everything, which means that all drivers needed are already built into the 2.6 kernel, no extra configuration needed. My main recommendation is, of course, regarding the wireless management: installing the NetworkManager (the same one used in Crunchbang!) is absolutely worth it. Other small, but extremely useful additions were Xmobar, a wonderful little status bar application designed for integration with Xmonad; trayer, exclusively to display the little nm-applet in the corner; and feh, for desktop wallpapers. This article was extremely helpful in getting this all set up.

Now, if only I could find a good replacement Twitter/Identi.ca/Facebook status client...

Friday, May 29, 2009

Tales of C# Programming for Win32 Beta APIs, Part 1

Many, many people ask me what, exactly, my job is. I work for the Centre for Media Design basically doing whatever my supervisor wants me to do, and my current project is to develop an interactive data visualisation graph utilising information from a database of attendees of the IDMAA conference, being held here in August. This project has had a massive learning curve for me due to the fact that it is in a language I'm unfamiliar with (C#), using an API I'm unfamiliar with (Microsoft WPF/Surface) and with little to no documentation (the Microsoft surface is a brand-new piece of hardware and there isn't even a book written about it yet). Fortunately someone who is a significantly better programmer than me is assisting, and so far we've managed to hack out a pretty impressive looking demo.

One of the major issues with the Microsoft API is, predictably, how non-transparent it is. It appears that everything is designed to be tied directly into the XAML (the MS XML junk that describes the objects you're working with), making the C# clunky and difficult to follow at points (where do these freaking event handlers come from? why do you add them the way you do? no one knows). Threading was another delightful adventure into "wtf..." land; apparently, you cannot access an object inside of a thread unless it was created within that thread. Sure, this helps prevent synchronisation problems, but it's like cutting off your arm so you won't be tempted to reach for that last doughnut. Another major annoyance: drag and drop functionality isn't really "built in"...if you want to implement drag and drop, there's a rather long, detailed tutorial on the topic. Which is extremely useful considering the hardware is a touch surface.

Regardless, the project is going extremely well and I'm enjoying the challenge quite a bit. Once the project is finished it should be fairly impressive, if it's done right. Beyond that, the challenge will simply be to make it engaging enough for users, so we don't run into a trend of people getting bored with it almost immediately. That opens up the possibility of designing in some rudimentary game elements, maybe allowing users to "collect" interesting data, or garner points for connections, things of that nature. More on that as the project expands!

Wednesday, May 27, 2009

Things Visual Studio Does That Piss Me Off: Part 1

If you don't declare a variable, it will try to autocomplete everything. For example, while trying to write for(i=0; i!=thing; i++), it will ALWAYS autocomplete with for(if=0; if!=thing; if++), and even if I change the first if back to i, it will continue to insist that I was, in fact, trying to use if for each proceeding i. It recognizes the for loop structure but is not smart enough to realize an if is not appropriate in this situation.

Also, it fucking copies blank space.

Monday, April 13, 2009

Things I learned this weekend (or: the list with no point)

1) "Accessing" an element in C++ lists (and related structures) means "make an exact copy of this for me to use temporarily".

2) Don't hardboot a server randomly (especially out of laziness), even if said server is giving you all sorts of sass. You may knock it to the curb for a second, but it will trip you into oncoming traffic.

3) Port forwarding for fun and profit. Also, default router passwords are for win. Too bad this resulted in the death of a server...

4) Crunchbang skimps on language packs. This would be more acceptable if one of the language packs I had to install wasn't for the most widely spoken language on earth. Ethno-centric much...

Reinstalling Ubuntu server this weekend...Все идет по плану

Thursday, January 29, 2009

Project 2: String Length Counter in C

This weekend I spent some time exploring C strings, and comparing/contrasting them with strings in C++ after doing a project in which we were required to write a word length counter without using the built-in stringlen functions (oh noes!).

Strings in C++ are nothing like strings in C. I had a vague idea of this when I was doing the project, as I have used C++ strings in the past, and they don't require as much work as C strings. There is a very good reason for this: while C++ strings are very nice containers with nice built-in functions, C strings are, quite literally, nothing but a group of chars. This can be expressed either as an array or a pointer. The difference between the two being one is a pre-sized block of memory containing a line of chars, while the other is an address to a block of memory (not necessarily pre-sized) containing a line of chars. Array do decay into pointers when being passed as parameters and such, but the two are still fundamentally different.

A very interesting thing about pointers and arrays is that, despite the fact they are represented completely different in memory, they can still be treated the same within this context. If you declare two variables:

char array[] = "Kitty";
char *pointer = "Cat";


you can use the same notation to access the individual characters in both, ie:

array[1] to get i
pointer[1] to get a

In the first case, the compiler will start at the first character of array and move one in order to get the value. In the second case, the compiler will fetch the pointer value, add 1 to this value, and then finally go to this location to load the character.

This is what, for me, makes C so interesting. It is far more low-level than C++, and as such, the fact that you're accessing values in memory is far more transparent. The malloc command I used in my homework literally sets aside a block in memory of the size indicated (returning a pointer), and keeps that memory allocated until it is either deallocted by free or until the program ends.

C++ string containers are just special templates that allow you to do far less damage accidentally (though it is said you can pretty epically destroy the world if you do mess up). They do a lot more to automatically manage your memory for you. You can convert them into a c_str (which is actually a const *char, and is necessary for a few file input functions such as fstream), but for all intents and purposes they are their very own, very easy to use data structure.

Anyway, I hope to do more C programming this year as a way to improve my knowledge of pointers, and hopefully allow me to start writing some more heavy-duty projects such as small compilers and what-have-you. Let the C adventures begin!

Thursday, January 22, 2009

Project of the Week

I decided that since I've stopped posting regularly (unfortunately!) I'm going to start post about a Project of the Week. Essentially, this will be some project that I accomplish, either over the entire week or just on a weekend. Posting my experiences will both help me remember it, and provide a reference for myself. And maybe someone else will enjoy reading about it as well :)

This week's was easy: set up my Ubuntu server with SSH and an IP address manager daemon that would allow me to admin the server remotely, and elimiate the need (for the most part) for the splitter box I have between my Mint desktop and the server itself. This is mainly for convenience, of course, and the fact that the splitter box often cuts off access to the mouse/keyboard and makes the monitor look yucky.

Of course, installing Ubuntu Server edition (CLI only!!) was a breeze; the installer is far more stripped down (it made me nastolgic for Slackware), but still very straight forward. It may scare the Linux n00b, but anyone who has installed a few Linux distros in their time would be comfortable with it.

So next up, I wanted to be able to SSH into my box from anywhere. This is both for convenience, and as I mentioned, removes the need to directly interact with the computer, which is a pain when it's sharing a monitor with my main Linux desktop (which, just to mention, is Mint :3). In order to accomplish this hardly daring feat, I created an account with DynDNS.com, which is a free service and allows you to add your computer as a "host". I can't remember if there is a limit to the number of hosts you can add, but I'm inclined to say there is, since they have account upgrades that you need to pay for.

After doing this I installed ddclient (sudo apt-get install ddclient), which is essentially a daemon that keeps track of when your dynamic IP address changes, and notifies DynDNS of the change. DynDNS then updates you host so, voila, your hostname always resolves to the right computer! During the installation Ubuntu automatically configures ddclient for you, more or less. There is a small amount of hand-configuration, but you need only to change a few lines, and you're off and running!

After doing all this (extremely hard (; ) work, you should be able to directly SSH into your server box and admin from any computer you wish.

The next project I'm considering will be a bit more complicated, and more programming-oriented than server-oriented, so hopefully slightly more interesting :)