Saturday, November 28, 2009

ATI drivers on Karmic Koala

I set out to upgrade my older laptop to ubuntu 9.10 and I knew was going to have problems. Historically, the video card in this thing was a royal pain in the butt and just never seemed to work quite right.

I loaded the OS, logged in, and was rewarded with a jumpy/twitchy user experience. I started researching and found a thread about some tweaks a few folks made to make things better.

It turns out this didn't work for me, but a minor tweak to the tweak fixed me up.

Notably, I downloaded the radeonhd driver from synaptic, changed the xorg.conf (created above) to use radeonhd instead of radeon, then removed the bit that seems to have been autodetected by X11 for thier hardware.

This seems to have fixed my problem (for now). In addition, I can run the compiz visual effects (yeah expo).

Here is my config:

Section "ServerLayout"
Identifier " Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"

Section "Module"
Load "dri2"
Load "dri"
Load "dbe"
Load "extmod"
Load "glx"

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"

Section "Monitor"
Identifier "Monitor0"

Section "Device"
Option "EnableDepthMoves" "True"
Option "EnablePageFlip" "True"
Option "DMAForXv" "True"
Option "AccelDFS" "True"
Option "ColorTiling" "True"
Option "RenderAccel" "True"
Option "VGAAccess" "True"
Option "AccelMethod" "EXA"
Option "DRI" "True"
Option "MigrationHeuristics" "greedy"
Option "TripleBuffer" "True"
Option "EXAOptimizeMigration" "true"
Option "EXANoComposite" "No"
Option "BackingStore" "true"
Option "AGPMode" "8"
Identifier "Card0"
Driver "radeonhd"

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
Option "Accel" "True"
SubSection "Display"
Viewport 0 0
Depth 24

Section "Extensions"
Option "RENDER" "Enable"
Option "Composite" "True"
Option "XVideo" "Enable"
Option "XINERAMA" "False"

Section "DRI"
Mode 0666

Sunday, November 22, 2009

Bad code gone wild

I've been writing software for quite some time (first computer) and have seen a lot of strange stuff.One thing I realized is that there are fundamentally two types of bad programmers.

#1 bad programmers that gets better.
#2 bad programmer that don't.

I can tell you I'm a #1: I routinely do things that are not optimal and "could have been done a better way", but don't beat myself up about. It is what it is and as long as the code "gets the job done", I'm OK with that. In addition, I'm OK with developers writing occasionally bad (wrong/suboptimal) stuff because I believe most folks can learn and get better. To this end, I found this amusing Bad Code Offsets

But occasionally I run across a #2: There are people who do things in broken and difficult manners and no amount of exposure to "better ways of doing things" will yield fruit. These folks, once they find "a way", it becomes magically "the only way" and will likely never find a "better" way. They will copy-paste write entire applications from snippets found on the internet. They will write functions that do the OPPOSITE of the the function says. They will do things that make you stop and ponder if they are deliberately trying to do the wrong thing (industrial espionage?).

For my own example, I can thing of a developer many years ago who was writing an asp application that was connected to a database with millions of rows. Their initial decision was to use a client side cursor and iterate through the resultset filtering rows that way. It worked fine on their dev box with 100 rows of data, but once they started testing, (with millions of rows) it seemed to just "hang" and never come back.

I overheard a pretty heated discussion between the developer and a DBA about why this was a bad idea, but the DBA seemed to not be getting through. I chimed in and tried to help out by drawing pictures but nothing seemed to help. To make matters worse this "developer" then complained to management that they where not getting "any help" in resolving the "performance problems with the test database".

From this developer's perspective the problem was really caused by the DBA team not setting up the test database server properly. It had nothing at all to do with this person's code because it worked on their machine.

For more fun stories, read The Daily WTF
One of my personal faves THE ULTIMATE STATE SELECTOR

Wednesday, November 18, 2009

Ubuntu Cafe

I just read some news about If microsoft, Linux, and OSX were cafe's

I'm wondering... would people pay a few bucks to hang out with some linux (Ubuntu?) folks to help them fix their windows boxes so they run well? I know a lot of people who don't care which OS their running as long as things "work" and don't break.

The latest few ubuntu releases sure seem like good candidates, I wonder if you just charged a cover charge to "non technical folks" and used that money to pay the rent as well as diet coke for the "technical folks" if you could make a business out of this. They techno weenies can run around being the gurus and helping folks out and the other folks can get super customized machines. Could even maybe even set up virtual windows machines on them so quicken and other non-wine software works.

Interesting idea, not sure I have the business chops to make it happen. I know we've been running linux here for almost 2 years and the only thing that we miss are #1 video games (use consoles and flash games) and #2 itunes (virtualbox).

Wednesday, November 11, 2009

Crazy autogenerated email signatures

I was just rereading a few posts from many moons ago (yeah, like 6 years) and realized that my employer at the time was postpending a crazy addendum to every one of my email messages. I really wonder how many people read this thing and exactly how legally applicable it is since the messages are now archived all over the dang internet.

As an example from 2003:

Perhaps this thread from a few months before that caused the company to start applying the extra stuff to the message:


Sometimes you need to break the rules

In honor of veteran's day I thought I post a "war story" to illustrate point.

As a buck sergeant in the US Army many moons ago (1995), I was deployed to Hungary in support of IFOR to enforce the military portion of the Dayton agreement. At some point, I was forward deployed with a team mate to go to all of the personnel service detachments and set up their digital communication links back to germany (and subsequently the US).

While standing around on the tarmac in preparation to get on a plane heading to Tuzla, a few of the other soldiers grabbed their ammo and packed it into the middle of their 'A' bag. I thought nothing of it, but the guy I was with walked over and asked what they where doing. It turns out the Air Force did not want us flying with ammo and they wanted us to give their ammo to them. These other soldiers (old school combat arms guys) where NOT about to give their ammo to some tech sergeant who may or may not remember to give it back, so they hid it.

Once we where getting ready to be manifested onto the plane, the loadmaster came around and asked everyone to give him their ammo. I dutifully did so watching with disgust all these other dishonest folks just shrug and say "I don't have any".

My self-rightousness was very short lived. As soon as we landed, I sought out my ammunition, only to realize it had been left in Hungary. Worse yet, after calling around trying to find it, it turns out my ammo had been turned into the ammmo supply point as "lost". Now I had two problems: #1 I was driving around in a war torn country with NO ammunition and #2 It had been reported that I LOST ammunition (probably worse from some folk's perspective).

Even more interesting, as I drove around in various convoys, I kept trying to figure out how to get some of my own ammunition. Because my unit was actually stationed in Hungary, nobody was willing to give me any ammo because they had signed for it and didn't want to get in trouble for "losing" it.

If I was smart, I should have asked the combat arms guys I ignored in Hungary how to get some ammo instead of trying to work within the convoluted alternate reality of "the system".

In summary, rules are important, but sometimes they're also stupid, counterproductive, and are waiting to be broken. I understand that the Air Force doesn't want unwashed army personnel shooting holes in their planes, but in retrospect, the potential downside of carrying my ammo and lying was a lot better than the downside of giving up my ammo. I'm not even clear on why they thought I shouldn't have my ammo, I guess they thought maybe someone could have gone crazy and tried to hijack the plane?

Monday, November 9, 2009

dd-wrt on a linksys router.

I have a couple of old linksys wrt54g routers lying around. They stopped working 100% over the years and I just bought another one instead of trying to fix the one I had.

Surfing the internet I stumbled across a linux firmware image for them that allowed you to reconfigure them to do some wicked cool stuff Since I just donated an old laptop (without a wireless adapter) to my son and I've been wanting a way to get my old ps2 hooked up the the wireless router, this looked like just the trick.

I downloaded the firmware images, flashed the router, and suddenly I had a little linux router I could configure and tweak to my heart's content. I could do really cool stuff like connect wirelessly from my router to another wireless router and bridge the networks together. This means my ps2 upstairs can now connect to my old linksys and it will forward all the traffic to my new wireless access point downstairs (sweet!). It also allowed me to bump up the radio power as well as super tweak the radio (like I can tell the right antenna to transmit and the left one to receive).

If you're a hacker and have some spare time or a need to create a mesh of wireless access points, I HIGHLY recommend this package.

three thumbs up.

Sunday, November 8, 2009

Building a custom debian package

We run debian (or ubuntu) as our platform of choice, and largely this is great. If we want software we just apt-get install the package and we're ready to go. The downside is, however, that occasionally a package won't exist (or only an older one will exist). In my case I wanted tomcat 6 on lenny. Previously what we would do is each server install would require a set of instructions to follow (untar foo into bar, symlink this or that, etc). This led to a situation where we had 4 different ways our various server where set up.

In order to make this "better", I wanted to build a .deb to make the install/removal/upgrade process easier. I could have done the "right" thing and build the proper package from the source, but it turns out it is relatively simple to build your own .deb binary, so I did this instead.

I used these instructions

After about 4 hours (there were some false starts), I had a package that could be installed and removed. Hopefully this will go a long way to making our server installs go more smoothly.

Next step will be to add the extra scripting pieces to allow us to configure our tomcat instances instead of hacking xml files.

opennms install on ubuntu

We currently user nagios for network monitoring, but it has a buttload of crazy config files to even remotely work correctly. As an alternative I decided to give opennms a try to see if there wan easier way to keep track of thing. Note, my home network is probably more complicated that many small businesses as I've got around 10-12 computers/printers/wireless bridges/media servers/etc running at any given time and I have android, linux, windows, Mac all connected at various times.

The reasons for trying opennms where:
#1 free (as in both speech and beer)
#2 it purportedly supports autodiscovery (please work!)
#3 it's java based (no shell scripts??)

So I installed via synaptic, and promptly dicovered that it requires postgres out of the box. I additionally had a couple of "gotchas", which I'll document here.

Off the bat, I tried to start via sudo /etc/init.d/opnenms start and it immediately complained and said I needed to do some extra setup steps. Let me say that there ARE instructions here for those weak kneed sissys who actually NEED them. They are, however, not tailored for ubuntu and "the Debian way".

In the context of the above directions (yes Nancy, you'll need to read them) on ubuntu, OPENNMS_HOME is /usr/share/opennms.

You'll need to get postgres and sun-java6-jdk. For some reason I had the openjdk installed and it complained that this MIGHT not work, so I installed the sun jdk and reconfigured to be the default:

sudo update-java-alternatives -s java-6-sun


sudo /usr/share/opennms/bin/runjava -s

I then tried this

sudo /usr/share/opennms/bin/install -dis

But got exceptions connecting to the database. Evidently, by default, the postgres user cannot connect via a password. To get around this, I created a new account "opennmsadmin" that is a superuser that can connect via a password.

sudo su - postgres
createuser -s postgresadmin
createlang plpgsql opennms
> create user opennms password 'opennms';
> create database opennms;
> create database opennmsadmin;
> alter user opennmsadmin with password 'opennmsadmin';
> grant all privileges on database opennms to user opennms;
> grant all privileges on database opennmsadmin to user opennms;


I realize that there are a couple of extra steps in there... I probably could have just done a
createuser -s postgresadmin -P (to set the password) and skipped the alter user step.


I then could edited the connection info contained in /etc/opennms/opennms-datasources.xml

sudo vi /etc/opennms/opennms-datasources.xml

and then run the setup.

sudo /usr/share/opennms/bin/install -dis

It SAID it completed correctly, so now I can run

/etc/init.d/opennms start

and wait while the JVM consumes all available resources on your machine (just kidding, but it IS slow to startup IMHO).

after that, you can navigate to:

You can then configure which ranges of IPs should be scanned (there are also instructions on how to do this a different way here):

Seems to work, autodiscovery is NICE... need to talk to the network guys tomorrow.