Wednesday, February 28, 2007

Anger With Firefox Anger With the W3C

So I posted here about a firefox bug with rendering margin-top and margin-bottom based on the width of the parent div. Well I was wrong . . . yes I freely admit it. There is no bug in firefox 1.5, or 1.0 or 2.0 or IE 5-7 or Safari or Opera or Linx or any of these. There is a bug with the W3C CSS 2 and 2.1 specification. That's right, you heard me, a bug with the W3C specification.

I went on without reporting the bug to firefox, but told my friend Sean about it, and he didn't believe me, so I demonstrated it to him, and he suggest it I report to firefox. Well I love open source, but I'm lazy you see, and so any bugs I've found in Firefox in the past I've let go, just did a work around, published my work around on here or in a forum, and moved on with life. But i decided to listen to Sean and talk to these so-called "firefox developers." Got a Bugzilla account, and went to work giving good examples, and a lengthy explanation of the bug and providing HTML and javascript to reproduce the error. Top-notch bug reporting by me (see the bug report here if you hae an account, if you don't it's bug 371971).

In any case, I started testing other web-browsers: firefox 1.0, 2.0, Opera, IE, Safari and low and behold . . . they all had the exact same bug. Not wanting to file bug reports at so many places I decided to look up the W3C specification for margins in CSS 2 . . . and what did I find . . . I found the bug:

http://www.w3.org/TR/CSS2/box.html#margin-properties

That's the CSS2 spec, the CSS2.1 Spec of the same thing can be found here:

http://www.w3.org/TR/CSS21/box.html#propdef-margin

So . . . explain this to me then . . . if you set top and bottom margins of any element not layed out in a table, the top and bottom margins . . . in percentages . . . are calculated based on the width of the parent element. Hmmmmm, that makes next to no sense . . . so I thought about it a while, and i figured out why they must have decided this.

It makes some sense if you think about it in 2 ways. First If I'm setting an overall margin (using the CSS2 margin shorthand: margin:) and I set it to 10%, I'm expecting to see even margins on both sides. This is a pretty intuitive assumption, if you don't stop to think things through. If you want an even margin, you should set the margin in cm, or em, and if you want an even margin that's relative to the size of the object, you can even you em . . . yes that's right em.

The other reason would be that you might be setting margins to be relative in size to one another: such as 10% for left and right, but only 5% for top and bottom. This could give some odd results if you had . . . let's say, a 10px by 500px div, where the left and right margins calculated to 1px each and the top and bottom margins calculated to 25px each. That would be kind of weird I guess, and a bit unexpected for your average webdesigner.

None the less I think it's weird to do it this way, and I would formally protest to the W3C, except they don't care about me, or what I have to say, because . . . well . . . they are important, and I'm not. I accept this as my fate, and will resign myself to muffled screams and muted anger as I curse their name from the hilltops, and it falls on their deaf ears.

Anyway, that should cover the "fury" part of the blog for awhile.

Enjoy!

Various BASH Installation Scripts

Last week I posted about the bash.zedzone.com CommZone for BASH hackers that I set up. Well late last week I posted a bunch of installation scripts up there, some for Ubuntu and Debian Linux, others are *nix agnostic, and I'll write about them a bit here as well. These are all pretty basic, but they make installing the program that they install a one-liner, as opposed to a several-liner:

PACPL installer Script -



Perl Audio Converter (PACPL) is a gnarly program that boasts that it can convert from everything to everything . . . and it does not boast falsely. This bad mofo does everything, but the program is just a front end for a lot of other programs, all of which need to be installed for this bad mother to work. This installation is a bitch (no seriously it warrents profanity on the Internet, and I used a lot more in real life), as it doesn't do any of the installs automatically aside from the CPAN Perl upgrades. It depends on a myriad of Perl modules, and a whole lot of external applications (LAME, Musepack to name a few), some of which are repository-arized and some of which are not. This script will do everything for you, except that you'll have to fill in the requested CPAN info by yourself . . . if you don't already have CPAN configured on your box (and if you don't than you are obviously not a PERL guru . . . which makes you lame . . . or awesome . . . depending entirely on the circles that you travel in). This script uses aptitude, and so it will require Debian or Ubuntu . . . though I know a guy who installed apt with Redhat (why?). The wiki page in the BASH Hackers CommZone for this script is here:

http://bash.zedzone.com/wiki/view_entry.php?wikiEntryId=18052

Ruby 1.8.5 Install Script -



This script is almost specifically for Debian, because alot of cool Ruby scripts require v 1.8.5 or at least 1.8.4 and Debian . . . well, if you're using Debian, you know exactly what I mean. I think Ubuntu is on 1.8.4 in their repository-arized version of Ruby, so if you really need 1.8.5 this'll do it for Ubuntu too. This script is actually *nix agnostic, as it doesn't use apt at all (whereas PACPL uses apt). This thing is simple enough, but it does require make . . . but doesn't install that for you . . . The wiki page in the BASH Hackers CommZone for this script is here:

http://bash.zedzone.com/wiki/view_entry.php?wikiEntryId=18352

LAME 3.97 Install Script -



This script is for *nix agnostic, but I did it for Debian. LAME doesn't meet the necissary license standards for the Debian requirements, so it's not in the repos. Grrrr, Ubuntu has it in the multiverse Repos, but it's 3.96 not 3.97 . . . so if you really need 3.97 this'll work. And also running this thing is easier than using yum or RPMs or YAST or any of that crap I used to waste my time with . .. (sorry RPM people, but if ESR finally decided to ditch Redhat because RPMs suck terribly, than I can publically diss RPMs for the personal Hell that Suse/Fedora has put me through, and the hours of my life using yum and Yast that I will NEVER GET BACK!). Anyway, you can find this install script here:

http://bash.zedzone.com/wiki/view_entry.php?wikiEntryId=18372

HandBrake 0.7.1 Install Script -



This script is Debian/Ubuntu/Anything with apt specific, as HandBrake has a few uncommon dependancies and they need to be installed first. Call me lazy but I don't like to compile from source when the repository has a copy. So yeah, if you're running an apt-based distro this will work fine. The HandBrake install is notoriously tricky, because it's long and arduous, and it uses jam (an awesome tool like apt, but for source-code not binaries, bascically a developer makes a jam file for a program, which lists dependancies and places where the source is available, and compile options for those programs, and then jam goes and downloads and compiles all the dependancies and then compiles the app itself . . . pretty friggin' sweet huh?). So yeah, this is a hard build for those reasons, and also because the handbrake documentation forgets a step (./configure for jam much?). In any case . . . here's the stuff . . . :

http://bash.zedzone.com/wiki/view_entry.php?wikiEntryId=18832

Enjoy!

Saturday, February 24, 2007

Microsoft's Marketshare and the US Government

I'm a Unix user, anybody who reads this blog knows that, and so I am charged with being the non-microsoft user amongst my friends, the guy who has to defend linux, os X, and every other Unix flavor against microsoft in one fell swoop everytime this argument starts . . . (and it starts plenty). One of the arguments most frequently waged in favor of Microsoft is:

"Microsoft has a huge marketshare in the personal computing market . . . that many people can't be wrong"

Aside from the fact that popularity and quality are mutually exclusive, yes, in fact, taht many people can be wrong. The largest consumer of microsoft products is also the largest employer in the United States. Guesses . . . anyone? That's right, the United States Federal Government. So alot of their marketshare comes from US government purchases, which is not a choice that any single user can make. But when it comes time for that user to make a decision about an operting system, there are going to choose the operating system that they are most comfortable with . . . the one that they were trained to use at work . . . Microsoft Windows.

This is true of anything really, my first PC (not the one my dad got, but my actual first PC, my very own) was a DELL Inpsiron 8200 running Microsoft XP Home Edition. The reason for this choice was 2-fold: My father had Windows in the house since it was a baby . . . all the way back to 3.1, and also my school's computer lab (where i spent alot of time) ran Windows with Turbo C++ (yeah baby). I felt very comfortable with Windows, and so I bought a windows machine. Contrarily I started using Mac in College, and worked as a Mac Systems administrator for a year with the Humanities division, and my next computer was . . . you guessed it . . . a Mac. Linux came in between, but that's another story for another time.

The point is that people buy what they know, not what's the best. Microsoft is successfull for the same reason that McDonald's is successful. When you're in a new town, driving accross the country, are you going to take a chance on that local greasy spoon for a burger that might be great, or are you going to get McDonald's because you know exactly what you're getting. You're going to get McDonald's, and most people who work for the government are going to get Windows in much the same way.

The reason that people try to make an argument about marketshare is simple . . . most people who use windows have never used OS X or linux or solaris or free/net/openBSD, and so if they want to argue about which is better, they have to argue something that has nothing to do with the abilities or technical specifications of the operating system. Which is hard if you've never used it, or have only used it sparingly. I have a better idea, use them. No wait, I have an even better idea, it doesn't matter, you've made your choice, stop talking about it. I have stopped prostelatizing for Mac or Linux, the only thing I do now is when my Windows friends ask for computer help I tell them the truth . . . "I don't know windows very well anymore . . . given some time I could probably figure it out, but i'm not going to. If you want help from me switch to unix and I'll be more than happy to help anytime." And I would expect my Windows admin counterparts to provide the exact same response to unix users.

I believe it's an utter travesty that the federal government uses Windows. Not just in the voting booth . . . which is completely unforgivable . . . but also in the workplace. I don't hate windows, windows is fine, windows is good even for what they need to do. But with the dawn of Ubuntu linux, and Open Office 2.0, Linux is ready. And the government should be criticized for Windows from now on, not because it sucks, or it's insecure or any of that . . . but becaue it's expensive.

In any case, stop saying that a market share is an argument for goodness, unless you want to argue with me that McDonald's cheeseburgers are better than 7/10 cheeseburgers, or In and Out Burgers because they have a bigger marketshare. Didn't think so.

The War on Drugs = The War on Poverty

The basic premise of this post is in no way a new idea: the war on drugs is predominantly a war fought against the poor population of the nation. This is obviously the case as by and large most convicted drug offenders - either dealers or users - are poor. When matched against the fact that there are as many or more drugs flowing through the middle class suburbs (such as the one that I grew up in) as there are in the inner city (such as where I live now) the absurdity of this conviction statistic is revealed.

None the less I feel I have a few things to add to this discourse. If you will take note of a few staggering statistics since Reagan began the "War on Drugs." The prison population in the United States has doubled since the initiation of this program, skyrocketing our prison population to heights never before seen (not even in the Soviet Union). This happened for a variety of reasons, but mostly because drug crimes became much more heavily prosecuted and there were stiffer penalties placed on drug offenders. With the birth of the "War" we also saw the birth of manditory minimum sentances and 3 strike laws, and it is these two factors that have most influenced the size of the prison population. All of these things have also been documented. And also since this war on drugs we've seen a decrease in unemployment, a decrease in the number of people living below the poverty line in the USA and rises in Gross Domestic and Nation Product per Capita.

One might think, based on these stats, that the war on drugs is doing very well, convincing people not to do drugs, and to live healthy and successfull lives. One would be wrong, as drug use in the USA has increased exponentially since the war on drugs began as well. The good improvement we see in these statistics, I believe can largely be attributed to the fact that alot of poor and unemployed people are now in prison. People who are incarcerated are not considered to be "unemployed" and are also not tabulated in the GDP and GNP per capita calculations. I think what's happened here is that we have merely "juked" the stats, to make the USA look stronger on paper, when in fact it has gotten weaker.

In addition to that, the war on drugs costs alot of money. Lots of new prisons need to be built, we need more prison guards, more wardens, more everything. To inforce the war on drugs we also need more intelligence agents, a larger federal intelligence infrasturcture, larger police budgets, more local officers and more training for officers. All of this means jobs, and lots and lots of money. This is considered to be good, because here we actually see the creation of new jobs and wealth, but at what cost? Is it worth giving jobs to millions of american's at the expense of locking up millions of americans? Is more jobs worth freedom?

Friday, February 23, 2007

Anger with Firefox 1.5.x and Maybe More

At home, I have perhaps the crappiest setup for a web-developer to test on. I code exclusively on my Ubuntu Breezy Badger Box, which features all of 1 web-browsers: Mozilla Firefox 1.5 (which i only recently upgraded from Firefox 1.0). In any case I'm working on a dynamic resizing library, and It turns out that Firefox 1.5 is severely boned in at least one category. My basic qualm is with what appears to be a lazy CSS rendering mistake. If you set the margin property with a percentage:


margin: 10%;


Then firefox will extrapolate this out to all of the margin properties individually, which can be read in Javascript with:


element.style.marginTop;
element.style.marginBottom;
element.style.marginRight;
element.style.marginLeft;


So all of those values will also be 10% after the element with the 10% margin is created and appended to the document object. The only problem is that all of these values in actual pixels are calculated solely based on the width of the parent object. So a marginBottom of 10% is actually 10% of the total width of the parent object, as opposed to being 10% of the total Height of the parent object. This is fairly intolerable.

This became noticable to me, while I was in the process of writing functionality to resize all of the children of a dynamic resizable element, and I noticed that when Y-Scaling would turn off, the top and bottom margins would grow/shrink, but when Scaling on the X-axis was turned off, the margins wouldn't change for either the X or Y axis. I hope this is fixed in FireFox 2, and also that I don't discover similar mistakes in IE, Opera, Safari et all.

Enjoy! (angrily)

Thursday, February 22, 2007

Ubuntu: Christian and Satanic Editions

I am a member of the Ubuntu Forums, and while I was waiting for a turorial of mine to be approved for posting I began to peruse some of the more obscure subforums. And while I was doing this I discovered a 3rd party subforum on the canonical hosted forum site for a Ubuntu flavor called Ubuntu CE. CE, as it turns out, stands for Christian Edition, and as soon as I discovered this, I discovered a thread in this subforum about Ubuntu SE, where SE stands for Satanic Edition, and I was utterly baffled.

Ubuntu SE, after further inquiry, turns out to be a joke on the absurdity of Ubuntu CE. Ubuntu SE is regular old Ubuntu, with red and black themes and pictures of Satan everywhere. This is hardly enough to justify it's own flavor, and I think that the creator of Ubuntu SE is fully aware of this fact. When I discovered that this was a hoax, I hoped that Ubuntu CE was also a hoax. But in fact it is not. A brief trip to WhatWouldJesusDownload.com proved that these guys were serious (and also sporting trendy and stylish "Christian Geek" t-shirts).

The main boasts of the Christian Edition of Ubuntu are:


  • It looks more like windows

  • It acts more like windows

  • It features a robust web-content filter

  • This web-content filter has been rigged to content filter the file system

  • It comes pre-installed with WINE

  • It features a Bible Memorizer Program

  • It comes pre-installed with a virtual rosery



I was baffled upon reading this list. Certainly the last two features are Christian, but I'm unaware as to how looking like windows is in any way Christian. Apparently Windows is the operating system of the discerning Christian. Are they not aware of the widely publicized deal with the devil that Steve Baumer and William Gates made (yes, I like Paul Allen, so I left him out). And while certainly the content filtering is something that your average bible-thumping, book-burning, abortionist-torching, heartland Christian would love, it also seems like the kind of thing that your average american-flag-burning, AK47-wielding, burka-wearing Muslim would love as well. And of course anyone with children. So . . . I did what any rational human being would do . . . I started a flame war.

My primary argument going into this flame war was 2-fold:

1. This "edition" violates the non-discriminatory clause of the open source definition and is therefore not open source.

While Ubuntu CE is released under the GPL, and is therefore technically non-discriminatory (as the definition requires only the license to be non-discriminatory), Ubuntu CE seems to defile the spirt of the Open Source movement. A movement started as a way to distance the Open Source guys from the communist Free Software guys, and to seperate politics from source code. And indeed politics should be seperate from source code, and so should religion.

2. This "edition" is not really all that Christian, and calling it so means that a lot of people who would love this software will stay the hell away from it.

Yeah, that's right, like most things called "Christian" this too isn't all that Christian when you get right down to brass tax. This distribution makes an honest effort to ease the pains of transition from Windows to Ubuntu, something that most distros don't do at all. That's great, that's wonderfull, that's . . . Christian? In addition to that this distribution helps people with kids, or with an insatiable appitite for Porn, to not allow their kids to be exposed to the horrible truths of porn sex untill much later . . . something that I know my dad tried to do with me . . . (he should've known more about computers than me . . . god it's so easy to get around that, hide your tracks, or just straight crack the shit out of that software). But this is something that lots of people want, and lots of people includes lots of non-Christian heathens. So why would you call it Christian . . . is it like a church? Is this so you and all your Christian friends can have your own operating system and it's your own exclusive little club? I just don't get the reasoning here at all. Not to mention, only Catholics use rosary beads, and most protestants find them to signify a disgusting practice . . . so it's not even proper to call this a "Christian" edition, CE should stand for "Catholic" edition.

My suggestion to the CE developers:

Take out the overtly Christian programs, and your jesus themes, and do what everybody else with a non-essential program does . . . put it in an apt repository. If Ubuntu won't let you put it in their multiverse, than make a christian repository, and teach your sheep how to edit the /etc/apt/sources.list file as part of bible study. Once you've done this, then change goddamned name (you might want to put a 10 commandments application in the repository while you're at it) to something better . . . like Child Friendly Ubuntu, or Web Friendly Ubuntu or something like that. Then I would be happy.

And to answer your question of what would Jesus download, he'd probably download Ubuntu Jewish Edition, or just straight Ubuntu. If he downloaded Ubuntu CE he'd have his either his picture or a cross on his desktop . . . and a. Jesus isn't that lame kind of dude who puts his own picture on his desktop or wears the shirt of the band to their concert, and b. he probably doesn't want to be reminded of his time on the cross . . . ever again . . .

Enjoy!

bash.zedzone.com

So I took all the BASH Hacks posts and moved them into the wiki of a new site I just created for BASH Hackers to get together and trade scripts and tricks and stuff. The basic idea I had was that I've spent alot of time with BASH and alot of time writing about BASH, and I thought it would be pretty cool to put that on in a more interactive place and get a community together focused solely on BASH.

I have spent alot of time surfing around linux forums and various distro forums and OS X forums, and there are always questions popping up about scripting that by and large go unanswered. bash.zedzone.com is an attempt to fix that problem, and to provide a place for people with various levels of BASH expertise to come and learn BASH, or get help, or just talk about whatever they want.

Monday, February 19, 2007

Overriding Scriptaculous Dragging

Scriptaculous is a fantastic javascript library that lets a developer do alot of very cool things very easily. I've been playing with the Scriptaculous drag&drop library for a while now and have come up with a snippet of code that is very usefull if you are dealing with the dragging of complex objects. Sometimes you want the object to drag, but other times the awesome dragging effect might get in the way of another action we want to take place. Let's say I have a dynamic resizing class (which I do), and using this I make this Object resizable by handles, which are children of a wrapper object that I have made Draggable through scriptaculous. While I'm resizing the object, I don't want it to move around the screen with the mouse . . . so i'll need to kill the scriptaculous dragging. The only problem is that I want the object to be draggable again once I'm done with the resize, and I also want the draggable object to be invoked with the same options as it was invoked before. This bit of code is designed to help you do just that:

ExampleClass = Class.create();

ExampleClass.prototype = {

initialize: function(elementId,dragObject) {
this.element = $(elementId);
this.dragObject = dragObject;
this.dragElement = this.dragObject.element.id;
this.dragOptions = this.dragObject.options;
this.someEvent = this.eventHandler.bindAsEventListener(this);
Event.observe(this.element, 'mousedown', this.someEvent);
},

eventHandler: function(event) {
this.killDraggable();
this.someEndEvent = this.endEventHandler.bindAsEventListener(this);
Event.observe(this.element,'mouseup',this.someEndEvent);
},

endEventHandler: function(event) {
Event.stopObserving(this.element,'mouseup',this.someEndEvent);
this.makeDraggable();
},

makeDraggable: function() {
this.dragObject = new Draggable(this.dragElement,this.dragOptions);
},

killDraggable: function() {
this.dragObject.destroy();
}
}


So we pass as an option to the class creation, the drag object . . . for instance if we had the drag object:



testExampleDiv.draggableObject = new Draggable('elementid',{options});



We would pass testExampleDiv.draggableObject to our class. The initialization function then grabs the elementId and the options passed in the initial Draggable object creation from the draggable object and saves it. At the beginning of the event, the script kills the draggable object, and then at the end of the event the script reinvokes the draggable object, passing the elementId of the original object, and the original options object to the Draggables initialization function.

The above example uses prototype, which is a safe assumption if you're using scriptaculous . . .

Enjoy!