Thursday, November 24, 2005

Pacman kicks serious arse

On of the more deceptive qualities of Open Source software is the
userbase of a particular product. People tend to swarm to what others
are already using, and accept all that is there without much of a
thought about alternatives. The bad part of it is when the authors of
the software don't look out at alternatives to see if they could improve
theirs by learning a thing or two from others.

Case in Point... Linux Package Management Systems.

My distro hopping ended for me when I discovered ArchLinux at least 3yrs
ago or there about. Before then, I had breifly used Gentoo for about 6
months, and I loved the auto-dependency resolution it did. I also felt
cool about the compiling backthen ;), untill I found ArchLinux and found
I didn't HAVE to compile UNLESS I realy WANTED to. For me, Pacman was
Portage without the compiling (and ohh... ArchLinux PKGBUILD files are
so what I expect, as opossed to Gentoos Ebuilds which I kept telling
myself I was going to get into, but that's not the point). The thing is
after using Portage for a while and loving it, and then using Pacman and
adoring it, I'd not really given thought to other distros and their
related package managers... untill recently.

I've had a brush with apt and yum. And frankly, Pacman kicks all their
collective arses in the areas where their functionality overlap. My main
gripe with apt, is the various interfaces (which after using apt for
almost more than a month, I'm still confused when I need to search for
instance, (apt-cache? apt-get? apt-foobar?). I'm all for small programs
that do one thing and do it well, but I'm also all about interfaces for
productivity, and everyone in a while the apt-bleh family of programs
trip me on guessing which should be doing what. Ok... that seems to be
my only gripe with apt actually :) (Its not as intuitive to me as Pacman
is, prolly b/cos i've wrked with Pacman for the past 3yrs? Though I can
vaguely recall grabbing the whole of pacmans major operations after
about 2 or 3 *schemes* thru the man page. I'm still procrastinating when
I'll sit down and STUDY the apt-bleh family of man pages). Its ok, but
well... i prefer pacman in that regard.

For yum, I think it has a more succinct interface than apt, and its
easier to get a grasp of its options, almost and compact as pacman too.
My overwhelming gripe with yum is all the *i think* uneccessary things
it does each time. Maybe there's and option to turn the attitude off,
but i dunno right now. Each time i hit yum install foobar, or yum search
bleh, or yum erase st0pd3l00pz. It refreshes its archives (? or what is
that thing it does each time, fetching base, updates, etc, EVERY
FRIGGING TIME!!!). Its just annoying especially over an SSH connection
that is breaking like burnt, crusty pancakes. I know yum is trying to
build dependencies, etc, but does it build it dynamicaly? I dunno. For
pacman, pacman packages installs these info in a DB of sorts, so it can
easily get back this info, in a very very minute fraction of the time it
takes yum to grab its own dependency information. So far, that's the
only gripe I have with yum.

In summary, I know I'm seriously biased toward ArchLinux, but my head is
not so far gone up my behind that I can't stick it out and do a balanced
assessment (and its not like i set out to do an assessment anyway... its
just my first reactions from my guts). Lets hope in the coming days as I
continue to use apt and yum, I can find admirable features which can be
patched into Pacman, so it kicks even more serious arse...

In parting...

yum: Hey pac... what are you doing? Those boots look huge
pacman: uhhh... could you please just stand over here next to apt
apt: okay d00d, we're here... what do we do next.
pacman: just turn around, with your backs to me, and bend over just a
bit... uhh.. too much... aha... perfect.

*B00T*

------------------------------
LMFAO

Monday, November 21, 2005

Coding Guidelines... MUST READ!!!

sfdisk hacking

Still in a bid to create a self installing router, I’ve had to play around with sfdisk for autopartitioning and stuff. After reading thru the man pages, getting an idea, I grabbed the source of the ArchLinux installer and looked at how Judd did the auto partitioning parts… it looks cool.

My main problem is that I want to be able to detect the size of the disk, then create various partitions sized in percentages of the disk total size. The ArchLinux installer routine doesn’t do this, instead of uses some fixed sizes for /boot, swap and the whole rest of the disk for /.

I’m still looking for the best way to get the disk size (maybe I’ll even go with parted eventually). Anyway, I’ll try stuff out maybe tmrw nite or something… if that works… then the automated router installation CD will be finished sooner than I was expecting.

Good Bye DevFS (sob... sob.. sob)

A lot of folks complained about DevFS and all its issues in the kernel tree... but I really wasn't one of those guys. For me DevFS solved a real problem: When I built initrd images, I didn't have to worry about populating the /dev tree before the kernel was booted up.

I don't really know how UDev based initrds handle this, I've been a bit lazy about finding out, untill last weekend, when I had to build an initrd image for an automated router installer. I tried to build with the lattest ArchLinux 2.6.13 kernel (DevFS was finally removed from this kernel build). I hit a snag, and I hatted the pre-DevFS days of copying some /dev files over manually when building the initrd, and I have this very neat scripts that do everything for me (part of ALE, which i've been revamping seriously as I get to do more work these days). Anyway, I finally chicken'd out just to get things working, and fell back to using 2.6.12 kernel.

I'm going to take out some time to find out more about UDev (FINALLY!!!), since its finally shoved itself in my face... blegh!!!

ok... back to code .NET Web forms DataLists now. :)

Wednesday, November 16, 2005

mod_rewrite voodoo :)

`` Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo. ''

-- Brian Moore
bem@news.cmc.net

The above is one of my best quotes so far, after encountering mod_rewrite. Anyways, onto the meat.

From an anonymous comment on my post yesterday, someone wanted to do something like this using mod_rewrite:

http://www.abc.com/sub ========> http://sub.abc.com

My former solution had to do with some general redirect/MIME forcing and then some PHP trickery, which actually works. But there's even a more mod_rewrite (ty) based solution... the secret is in the use of the RewriteCond expression which I didn't know of when I replied that post initially.

The problem initially was that with RewriteRule, you can only access the part of the url that comes after the host name. For instance, in http://foo.com/bar, you only have access to /bar in RewriteRule. To do this, we actually need access to the foo.com part as well. This is where RewriteCond comes in handdy.

With RewriteCond, you can basically execute a RewriteRule as long as the condition is satisfied. There are special condition variables that you have access to like HTTP_HOST (which we'll be using here), and a bunch of other apache server/environment variables.

Ok... the rule look like this:


RewriteEngine on #this turns on the RewriteEngine... duh!!! :)
RewriteLog /path/to/logfile # i like to turn this on, to see what actually happens
RewriteLogLevel 1 #when testing out a new rule, i set this to 5 so i can see what's happening step by step

RewriteCond %{HTTP_HOST} ^www\.([a-z0-9]+)\.com$ #this will match, www.bleh.com, www.anything.com, www.wassup.com, well...you get the idea. Note that I applied the () grouping so i can access the matched variable later as %1

RewriteRule ^/([a-z0-9]+)$ http://$1.%1.com/ [R,L] #now i pick up the /sub part of the url, and use that to generate the redirect url. The i apply the two flags [R, L]. R means force a redirect. L just makes this the final rule that this match will traverse.

Lets lay it out again without all the nasty/helpfull comments.

RewriteEngine on
RewriteLog /path/to/logfile
RewriteLogLevel 1

RewriteCond %{HTTP_HOST} ^www\.([a-z0-9]+)\.com$
RewriteRule ^/([a-z0-9]+)$ http://$1.%1.com/ [R,L]


Yup... try this out, and see the deep vodoo. On my test apache host, if i do:

http://www.mrouter.com/sub

I end up getting http://sub.mrouter.com

kewl o yeah... voodoo? DEFINITELY!!!

Essien out.

Tuesday, November 15, 2005

guess who's back

so you thought you had me huh? And i was gone for good? well... i'm back.

Seriously though, a lot of things has been going thru my mind this last
weeks, and I thought it was better i sort them out before i went on with
bloggin as usual.

Anyways... now, i'm back bloggin. And for a first taste, i've been
playing with mod_rewrite for apache.. and DANG!!! Its sooo cool.

More on that later.

Essien, out!!!