oscartheduckin’ around

November 8, 2009

test driven development

Filed under: Uncategorized — Tags: , , — oscartheduck @ 9:16 pm

So, it’s been a while since I’ve done this.

 

Test driven development.

 

I’m taking the time out on tabbr to refactor completely with test driven development from the bottom down. Why? Because I’m so fucking sick of small errors appearing because I was reworking code slightly and didn’t notice a typo, or a cmd-X and cmd-V took a wrong character with it because of a bad selection or something similar.

 

The latest misfire: I just discovered that a dump of an object to yaml is coming back with dumping the false object instead. When did this error happen? It’s such a simple thing, what the fuck is going wrong? All I can imagine is that an array that’s being initialised in the object creation isn’t being created properly, because I’ve been working on methods that alter data structures. And that’s simple to find and fix, but I should have something automatic that’s telling me about it. Maybe I can write a pre-commit hook in git that runs all the tests, as soon as I’ve written them up.

 

I’ve been writing code too long to keep ignoring what is, really, the basis of the current vogue trends for behaviour driven development and the like. Test driven development is the real basis that makes agile programming completely doable, and I’m not doing myself justice by ignoring it.

 

I did have some shell scripts I was keeping up to date that did similar things, but dumped the output of a bunch of config files to stdout instead of just being automated testing suites that’re built in. Serious duplication of effort somewhere there.

 

Blah. I should learn from the crowds more.

Advertisements

November 4, 2009

gnomr

Filed under: Uncategorized — Tags: , , , , , , , — oscartheduck @ 9:52 pm

I’ve been thinking for a while that it’d be useful as all hell to have a solid configuration tool for gnome to generate kiosks. Internet kiosks. With one click of a checkbox.

 

So, I started reading the gnome sys admin guide today. It looks like this won’t be too hard to pull off, especially if I concentrate on getting it working well in just one linux distribution and in FreeBSD and accept that that’s the limit of my ambitions. In either case, FreeBSD’s gnome configuration is different enough to most linuxes that I imagine that alone would be a good couple of cases to ensure cross-distro viability.

 

It might be simplest to configure things how I want using the tools in gnome2 itself, rather than attacking the xml config files, then dump out the xml configs and write a tool that’ll just copy ’em over a user’s defaults.

October 31, 2009

what was that, the old you from eight words ago?

Filed under: Uncategorized — oscartheduck @ 3:58 am

Reading man pages and the like really helps.

To install all the packages quickly:

mount /dev/hdc /mnt/cdrom && cd /mnt/cdrom/slackware/a && installpkg *

and so on.

October 30, 2009

slackware networking.

Filed under: Uncategorized — Tags: , , — oscartheduck @ 5:04 am

I got ifconfig running by installing the correct package with pkgtool and then being all awesome and installing some other stuff and doing dhclient eth0.

Next, I used curl to grab the openssh tarball and was told my c compiler cannot create executables.

Awesome.

 

Research led me to thinkk I needed to install glibc. I installed it. I can now compile openssh mostly. I don’t have openssl, though, so not all the way. More work on this tomorrow!

October 29, 2009

slackware

Filed under: Uncategorized — oscartheduck @ 6:58 am

Not sure how, but I managed to balls up the installation initially. Didn’t install a boot partition. Rather than take a risk that something else was missing too, I went ahead and reinstalled. For whatever reason it seems to have gone fine this time; I seem to think I didn’t do the configuration after selecting packages last time, but some of the screens for it were familiar.

 

Whatever, it’s working fine now. Slackware lesson one: because it’s not fancy, you can treat it like any other basic set of packages that’re there to get the hardware working. A big complaint with Ubuntu that I have is that it’s hard to work out how to fix shit if it doesn’t automatically install just fine first time. With slackware, I was able to go back to my “wait a second, what does a shell do if I try that out?” approach and see what the issue was. Ubuntu’s shells always have fucked up fonts for me.

stripping down

Filed under: Uncategorized — oscartheduck @ 5:46 am

Now that OpenBSD has an installer that’s basically 13.times do { |keystroke| }, I wanted to install something hard again. I picked slackware because I’ve never installed it before, not because I’ve heard anything about its installer.

Also because I wanted a linux I’ve never used before so I can do this thing in my head where I start managing my installed programs by tracking tarballs instead of using a package manager. I feel like I’ve got a lot of corner shite I can learn from that. I think I got into linux just as package management was becoming solved, and it means I missed a lot. I learned a ton from doing linux from scratch a couple of times at my former employer; that was really fun, really neat and gave me a good idea of what makes an OS.

Then making a stripped down distro or two, and doing the FreeBSD stuff for GSOC was really informative, but I still think I’d have difficulties if I were thrown into an environment where I was using RH 5 or something where the RPM support was total shit. So I am looking to solve that if I can.

I was thinking about using ubuntu or something as a base, but I want an OS that’s totally alien.

Alien’s nice sometimes.

The installer’s neat. Had to use cfdisk for the first time in a while. Well, I don’t know that I did, but I didn’t realise I could just type “setup” and get a nice ncurses installer because I didn’t read the instructions until I started page-up-ing to see what to do after I had partitioned my virtual drive.

I just installed a bunch of stuff except emacs. I’ll see what happens. I only have disc 1 in there, so we’ll see what gets installed.

Aw, fuck. It’s installing a bunch of stuff like QT that I wanted to do by hand. Really, I want a compiler and the basic libraries in there and then build and track everything else. I have no idea how folks used to track package versions and resolve install conflicts between two battling installed programs, and I want to get down and dirty with that. I imagine it’ll involve improving my scripting skills, too, to keep track of this stuff more easily and to have reminders to check for updated packages.

We shall see.

October 22, 2009

Installing vmware tools on fedora core 11

Filed under: Uncategorized — oscartheduck @ 2:49 pm

Simple enough jobbie, totally standard.

Install your virtual machine, then run:

sudo yum -y install gcc kernel-devel patch make

I forget whether fedora set up sudo by default or if I did it myself. Either way, not a hard job. /etc/sudoers will have everything in it you need. Might want to consider setting up the wheel integration and adding yourself in /etc/groups

Anyway, after that it’s as simple as clicking the “install vmware tools” jobbie in vmware, then extract the tarball and run ./vmware-install.pl as root from the appropriate directory. Simple. VMware will automatically add itself as a startup service, so no worries after that.

Now I can install opennms and refamiliarise…

October 17, 2009

reading old code

Filed under: Uncategorized — oscartheduck @ 4:37 am

http://github.com/jamesh/tabbr

I’m retracing that code so I can pick up my command line guitar tablature tool again. And I’m stuck with a problem many folks complain of: what the hell was I doing and why was I doing it?

I’m reminded of Knuth’s contention that literate programming makes sense. It seems to right now; if I had a solid documented ream that was telling me “Okay, do this next”, I’d be happier.

Fortunately, I’ve got the handy indicator:

0.5 — write an addChordToSong method

So I know what I’m meant to do next. But what the hell does that do?

Ah!
#TODO: Print isn’t building the known song array; that’s because there’s no fucking method for adding chords to the song array
if print
currentSong.printSong()
exit 0
end

I just added a BSD license to the code, so feel free to take a look at it.

—-

I have a good idea where to look now, at least. If the printSong method ain’t workin’, then I need to fix that! printSong() reads:

def printSong()
self.loadSong
self.printSongArray
end

so I also know to read loadSong and printSongArray. loadSong should presumably tell me what array I’m trying to load:

def loadSong()
safeMakeFile(@songFile)
@song = YAML.load_file(@songFile)
end

Who would have thought: the song array! Getting somewhere feels good, especially when it’s this simple.

November 7, 2008

Installing memcached gem on Ubuntu intrepid

Filed under: how to — oscartheduck @ 4:58 am

This one took forever to work out. For the second time. If I’d written things down the first time…

Okay. First things first: the memcache gem can only install from rubygems 1.2 or lower. So visit rubygems, and download the source for the relevant version.

Second, memcached gem requires several libraries to be in place to compile against. However, only one version of the libmemcached is compatible with the mecached gem. Where did I get such a ludicrous idea, you ask, when you’ve clearly read other blog posts telling you to check the README file for compatability instructions?

http://blog.evanweaver.com/files/doc/fauna/memcached/files/README.html

There are also compatability issues with memcache itself; various versions of the gem are specifically compatible with various versions of the software.

Anyway, start here:

http://tangent.org/552/libmemcached.html

Download version 0.21, compile and install.

Then read the README that comes with the memcached gem and download and install the appropriately compatible version of memcache. How to read the README if the gem isn’t installed?

http://github.com/fauna/memcached/tree/master/COMPATIBILITY

There y’arr.

Now that you’ve done both of those, you can install the memcached gem.

And after you’ve done that, if you want to be able to use it in development, you have to install the memcache-client gem. The memcached gem is intended to run on your server, the memcache-client gem is meant to run locally in development.

November 6, 2008

Installing rails 2.02 on ubuntu Intrepid with ruby 1.8.6

Filed under: how to, ruby, ubuntu — oscartheduck @ 5:26 pm

I’ve done this too many times to have not documented it somewhere.

Ruby 1.8.7 is the default on Intrepid; 1.8.6 is needed to run rails < 2.1, so it’s useful to know how to do it.

1. Install ruby from source.

http://ruby.mirrors-r-us.net/news/2007/03/12/ruby-1-8-6-released/index.html

2. install rubygems from source

http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.3.1.tgz

3. You’ll get the following error:

in `gem_original_require’: no such file to load — zlib (LoadError)

if you try to use rubygems.

To solve this, go into your ruby source directory:

cd ruby-1.8.6/

then:

cd ext/zlib

ruby extconf.rb

make

sudo make install

4. sudo gem install rails -v 2.0.2

Older Posts »

Create a free website or blog at WordPress.com.