• 201001.02

    beeets 2.0 launch

    Hey, this will be short. Me and my brother just launched our event site, beeets.com, in the Santa Cruz area. Check it out, post events, give feedback. We've been slaving away and we're really excited about it. Thanks!

    Comments
  • 200912.12

    MooTools forge - central plugin spot for MooTool framework

    I just stumbled onto this tonight: The Mootools plugin forge. Pretty sweet. Tons of fan-based plugins for Mootools in one spot. Check it out!

    Comments
  • 200912.05

    Tomato - router firmware

    I recently got a WRT54G v3 (an older version of a Linksys router) off of ebay. I specifically got a version 3 because it's the best router known to man that's under $300. If you can get one for less than $50, my advice is to take it. Up until a few days ago, it was running the stock Linksys firmware. It's not terrible but it's not very extravagant either. We had a power outage and after that, wireless stopped working. I tried many things, including slapping the unit with my balls to make sure this wasn't some sort of misguided power struggle. Putting it back in its place should fix that. No luck.

    I had heard many, many times about the dd-wrt firmware. One of the good things about the WRT53Gv3 is that you can install just about any custom firmware you want onto it. I'd also heard in the past about a firmware called Tomato. It's supposedly light, lean, fast, and has great QoS (although I never even bother with QoS).

    I decided to give it a shot. I'm in love. It gives you all the options you need for the things you'd want, but doesn't bloat up the interface with extra junk. It's simply amazing. I really think Linksys should just stop bothering to make their own shitty firmware and just install Tomato on their routers.

    Unfortunately, Tomato didn't fix the wireless problem, so I had to plug in an old nemesis Netgear router I had laying around. It starting, in memory of times past, dropping my connection every 5 minutes. Fine for browsing the interweb, but not for streaming music or "videos." I decided to give the Linksys one more shot...and it worked! Thank god. The best router ever with the best firmware I've seen so far, NOW with wireless. It must have been some strange hardware issue that fixed itself.

    To be fair, I've never used dd-wrt and therefor can't give a good comparison between it and Tomato. If I had a few extra routers laying around, I'd try it out...but each firmware flash is a dance with the devil and I can't afford to get / find another one.

    Comments
  • 200912.02

    SSH Agent on Cygwin

    There are probably a billion guides for this already, but whatever. If you DON'T have a ~/.bash_profile (a file that gets executed every time you start cyg):

    touch ~/.bash_profile
    chmod a+x ~/.bash_profile
    

    Now that you have the file, add this to it:

    SSHAGENT=/usr/bin/ssh-agent
    SSHAGENTARGS="-s"
    if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
    	eval `$SSHAGENT $SSHAGENTARGS`
    	trap "kill $SSH_AGENT_PID" 0
    fi
    

    This will start up ssh-agent for each Cygwin shell you have open. Close your Cygwin shell (if one is open) and open a new one. Now type:

    ssh-add ~/.ssh/id_rsa
    [enter your password]
    

    Voila! No more typing your stupid password every time you need to ssh somewhere. Note that if you close the Cygwin window, you'll have to ssh-add your key again! This is good security...you can close the window when you're done and someone who happens on your computer sitting there won't have password-less access to any of your secure logins.

    Comments
  • 200912.01

    A simple (but long-winded) guide to REST web services

    After all my research on what it means for a service to be RESTful, I think I've finally got a very good understanding. Once you understand a critical mass of information on the subject, something clicks and the first thing that comes in to your head is "Oh yeah! That makes sense!"

    It's important to think of a REST web service as a web site. How does a website work?

    • A website works using HTTP. If you need to fetch something on a website, you use the HTTP verb "GET." If you need to change something, you use "POST." A RESTful web service uses other HTTP verbs as well, namely PUT and DELETE, and can also implement OPTIONS to show which methods are appropriate for a resource.
    • A website has resources. A resource can be information, images, flash, etc. These resources can have different representations: HTML, a jpeg, an embedded video. REST is the same way. It is resource-centric. Want a list of users? GET /users. Want an event? GET /events/5. Want to edit that event? PUT /events/5. Every resource has a unique URL to identify it!
    • Resources are not dealt with directly. Instead, representations of resources are used. This can be a bit hard to grasp. What is a user? It's a nebulous object somewhere that I cannot interact with. It is an idea, an entity. A representation is a form of the user resource I can interact with. A representation can be a comma delimited list, JSON, XML...anything the client and server both understand. How do we know what we're interacting with? Media types:
    • As a website will tell you what kind of image you're requesting, a REST service tells you what kind of resource representation you are receiving. This is done using media types. For instance, if I do a GET /events/7, the Content-Type may be "application/vnd.beeets.event+json" which tells us this is a vendor specific media (the "vnd") and it's an event in JSON format. You can pass these media types in your Accept headers to specify what type of representation you would like. These media types are documented somewhere so that client will know exactly what to expect when consuming them.
    • If you request a page that doesn't exist or you aren't authorized to view, a website will tell you. This is done using headers. A good REST service will utilize HTTP status headers to do the same. 200 Ok, 404 Not Found, 500 Internal Server Error, etc. These have already been defined and refined over many, many years by people who have been doing this a lot longer than you (probably)...use them.
    • A website will have links from one page to another. This is one of the main points of a REST service, and is also widely forgotten or misunderstood (it took me a while to figure it out even doing intense research). Resources in a REST service link to eachother, letting a client know what resources can be found where, and how they relate to eachother. An HTML page has links to it. So does a REST resource. Links can be structured however you like, but some good things to include are the URI of the linked resource, the relationship it has with the current resource, and the media type. This creates what's known as a "loose coupling" between client and server. A client can crawl the server and figure out, only knowing a pre-defined set of media types, what resources are where and how to find them. This principal is known as HATEOAS (or "Hypermedia as the Engine of Application State").
    • REST is stateless. This means that the server does not track any sort of client state. There are no session tokens the client uses to identify itself. There are no cookies set. Every request to the REST service must contain all information needed to make that request. Need to access a restricted resource? Send your authentication info for each request. It's that simple. Isn't it easier to track session? Not really. Maybe it's easier on a small level, but once you start needing to scale, you will wish you'd gone stateless. Using a combination of HTTP basic authentication and API/Secret request signing, you don't have to send over plain text passwords at all. Hell, even throw in a timestamp with each request to minimize replay attacks. You can get as crazy as you'd like with security. Or for those who prefer security over performance, use SSL.

    Now for some examples. Because I'm currently working on an event application, we'll use that for most of the examples.

    Let's get a list of events from our server:

    GET /events
    Host: api.beeets.com
    Accept: application/vnd.beeets.events+json
    {"page":1,"per_page":10}
    -----------------------------------------
    HTTP/1.1 200 OK
    Date: Tue, 01 Dec 2009 04:12:48 GMT
    Content-Length: 1430
    Content-Type: application/vnd.beeets.events+json
    {
    	"total":81,
    	"events":
    	[
    		{
    			"links":
    			[
    				{
    					"uri":"/events/6",
    					"rel":"/rel/event self edit",
    					"type":"application/vnd.beeets.event"
    				},
    				{
    					"uri":"/locations/121",
    					"rel":"/rel/location",
    					"type":"application/vnd.beeets.location"
    				}
    			],
    			"id":6,
    			"title":"Paris Hilton naked onstage",
    			...
    		},
    		...
    	]
    }

    What do we have? A list of events, with links to the resource representations of those events. Notice we also have links to another resource: the location. We can leave that for now, but let's pull up an event:

    GET /events/6
    Host: api.beeets.com
    Accept: application/vnd.beeets.event+json
    -----------------------------------------
    HTTP/1.1 200 OK
    Date: Tue, 01 Dec 2009 04:12:48 GMT
    Content-Length: 666
    Content-Type: application/vnd.beeets.event+json
    {
    	"links":
    	[
    		{
    			"uri":"/events/6",
    			"rel":"/rel/event self edit",
    			"type":"application/vnd.beeets.event"
    		},
    		{
    			"uri":"/locations/121",
    			"rel":"/rel/location",
    			"type":"application/vnd.beeets.location"
    		}
    	],
    	"id":6,
    	"title":"Paris Hilton naked onstage",
    	"date":"2009-12-05T04:00:00Z"
    }

    Using the link provided in the event listing, we managed to pull up an individual event, which we know how to parse because we know the media type...but wait, what's this? OMG, someone is trying to smear Paris!! She's on at 8:30!!! NOT 8!!! Let's edit...if we do a PUT with new information, we'll be able to save Paris' good name:

    PUT /events/6
    Host: api.beeets.com
    Accept: application/vnd.beeets.event+json
    Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
    {"title":"Paris Hilton naked onstage (yuck)","date":"2009-12-05T04:30:00Z"}
    -----------------------------------------
    HTTP/1.1 200 OK
    Date: Tue, 01 Dec 2009 04:12:48 GMT
    Content-Length: 666
    Content-Type: application/vnd.beeets.event+json
    {
    	"links":
    	[
    		{
    			"uri":"/events/6",
    			"rel":"/rel/event self edit",
    			"type":"application/vnd.beeets.event"
    		},
    		{
    			"uri":"/locations/121",
    			"rel":"/rel/location",
    			"type":"application/vnd.beeets.location"
    		}
    	],
    	"id":6,
    	"title":"Paris Hilton naked onstage (yuck)",
    	"date":"2009-12-05T04:30:00Z"
    }

    What have we learned? Given one URL (/events), we have discovered two more (/locations/[id] and /events/[id]). We've also seen the media types in the responses that allow the client to know what kind of resource it's dealing with and how to consume it.

    Hopefully this pounds two really important points in: media types and HATEOAS. Without them, it's not REST. You can't just pass application/xml or application/json for every response. Sure, maybe the client can decode it, but they don't know what it is, and without linking to other resources, they don't know how to find anything...unless you want to document everything and never change your service.

    Some other tips/points:

    • Give yourself a few initial entry points to your REST service. You should be able to discover all of the resources in it just by crawling. If you can't, you haven't done HATEOAS correctly. This is a lot harder than it sounds, but it's more than useful later on. Think of your REST service like a website with good navigation.
    • Remember to implement the OPTIONS verb for your resources. It will tell the client what verbs can be used on what resources. With some decent routing built into your application, this should be a cakewalk.
    • As mentioned, you can use HTTP basic authentication for your requests. If the client is anything but a web browser, you won't have to serve up an ugly popup login box, you can just do all that shit transparently. If you don't want to send a cleartext password (please don't!) you can salt the password on the client side and send it over. Hash the password again with the client's secret for added security. Crackers will be amazed at your 1337 computer hacking skillz. You can then verify the hashed salted value on the server side. Add client-secret request signing with a timestamp for uber security.
    • Read a lot more info on REST. It seems that SO many "RESTful" services out there are half-baked and made by people who researched the topic for half a day. Some good ones to take points from are the Sun Cloud API and the Netflix API. Notice the documentation of media types and LACK of documentation on every single URL you can request. This is that loose-coupling stuff I was talking about.

    That's it for now! I wrote this as a culmination of knowledge for the last week or so of research I've done...please let me know if any information is missing or incorrect and I can make updates. Hope it was helpful!

    Comments
  • 200911.27

    Arrays: Some PHP tricks I never knew

    This will be a short post, but pretty cool.

    You can add arrays together:

    	$test1	=	array('name' => 'andrew');
    	$test2	=	array('status' => 'totally gnar, dude');
    	print_r($test1 + $test2);
    	---------------------------
    	Array
    	(
    	    [name] => andrew
    	    [status] => totally gnar, dude
    	)

    Wow...who would have thought. And my most recent favorite, converting objects to events. It's a simple foreach($object as $key => $val) and putting each element into a separate array right? WRONG:

    	$array	=	(array)$object;

    No fucking way. Casting actually works in this case. Why does nobody tell me anything?! This is great for parsing XML because any parser normally returns an object, and quite honestly, I hate dealing with objects. All database data is by default returned as an array usually,  and it's a pain having some data sources being objects while others are arrays. Now it doesn't matter...if you like objects, cast an associative array as an (object), if you like arrays cast with (array). I love PHP...

    Comments
  • 200911.05

    Compared: jQuery and Mootools

    So after reading a very good comparison between the two frameworks, I have to say I feel good about my decision to use Mootools in pretty much all of the sites I build. This isn't because of some nebulous reasoning about Mootools being better than jQuery, but the facts are

    • They both do different things, and do them very well
    • They intersect in some places (mainly DOM parsing)
    • They both have their uses, pros, and cons

    I was considering looking into switching beeets.com to use jQuery, but wanted to do some research beforehand. I'm glad I did.

    It seems that jQuery is popular because it removes the hassle of doing everyday Javascript chores. Quite frankly, I've known Javascript for quite some time, and don't mind getting my hands dirty in it. So using a framework that abstracts that out and creates what seems like (from reading the syntax) a whole new language makes me groan.

    Mootools seems to better extend Javascript itself, and provides the tools to extend it even more. So if you already know JS fairly well, you can look at Mootools code and still tell what's going on even if you only have an extremely limited knowledge of Mootools. It also implements some great features that allow you to reuse code extremely intelligently. So intelligently, in fact, that in much of the code on beeets.com (JS heavy), we're actually not tapping into the full power of Mootools. Whoops.

    That is another point I wanted to bring up, though. When Mootools 1.11 and earlier was around, things were great. The framework was good, the docs were good, the examples were good. Come 1.2, they changed their site (much uglier), castrated the examples, and the documentation is, in my opinion, pretty jenky. There are no good tutorials on their site, and it seems like there are many features I've never tapped into because, well, I just never knew about them.

    This is half my fault, half Mootools'. I should be doing my research, but educating those using your framework is a must as well. Let's hope they work on it, and in the meantime I've got some reading to do. It doesn't help that the update from 1.11 to 1.2 changed an assload of conventions, classes, and method names.

    All in all, it seems like Mootools is the way to go if you are already great at Javascript...and I am. That being said, it may be worth me learning jQuery to do simpler DOM parsing and AJAX. For larger projects that actually need to reuse big pieces of code and do more than parse the DOM, I'll gladly stick to Mootools.

    Let the flames begin...

    Comments
  • 200911.04

    How to convert HTML named entities to numbered entities in PHP

    I recently (read: today) had an obnoxious problem: I'm writing some code for creating an ATOM feed, and kept getting errors about entity-escaped values. Namely, things like ’, •, etc. Even written as entities, Opera and IE7 did not recognize them. I read somewhere that it was necessary to convert the named entities to numbered entities. Great.

    Well, PHP doesn't have a native function for this. Why, I do not know...there seems to be functions for many other things, and adding an argument to htmlentities that returns numbered entities would seem easy enough. Either way, I wrote a quick function that takes the htmlentities translation table, adds any missing values that are not in the translation table, and runs the conversion to numbered entities. Check it:

    function htmlentities_numbered($string)
    {
    	$table	=	get_html_translation_table(HTML_ENTITIES);
    	$trans	=	array();
    	foreach($table as $char => $ent)
    	{
    		$trans[$ent]	=	'&#'. ord($char) .';';
    	}
    	$trans['€']	=	'€';
    	$trans['‚']	=	'‚';
    	$trans['ƒ']	=	'ƒ';
    	$trans['„']	=	'„';
    	$trans['…']	=	'…';
    	$trans['†']	=	'†';
    	$trans['‡']	=	'‡';
    	$trans['ˆ']	=	'ˆ';
    	$trans['‰']	=	'‰';
    	$trans['Š']	=	'Š';
    	$trans['‹']	=	'‹';
    	$trans['Œ']	=	'Œ';
    	$trans['‘']	=	'‘';
    	$trans['’']	=	'’';
    	$trans['“']	=	'“';
    	$trans['”']	=	'”';
    	$trans['•']	=	'•';
    	$trans['–']	=	'–';
    	$trans['—']	=	'—';
    	$trans['˜']	=	'˜';
    	$trans['™']	=	'™';
    	$trans['š']	=	'š';
    	$trans['›']	=	'›';
    	$trans['œ']	=	'œ';
    	$trans['Ÿ']	=	'Ÿ';
    	$string	=	strtr($string, $trans);
    	return $string;
    }
    

    Hope it's helpful.

    UPDATE - apparently, even the numbered entities are not valid XML. Fair enough, I've converted them all to unicode (0x80 - 0x9F). All my ATOM feeds validate now (through feedvalidator.org).

    Comments
  • 200910.28

    How to shrink an LVM volume

    So maybe you're like me and wanted to play with LVM to speed up MySQL backups. Maybe you didn't realize that to take LVM snapshots, you can't use the entire volume when you format it. Fret not, here's a simple way to reduce the size of an LV, giving you some breathing room for your backups:

    	# umount /dev/db/data
    	# e2fsck -f /dev/db/data
    	# resize2fs /dev/db/data 200M
    	# lvreduce -L 200M /dev/db/data

    You cannot reduce the volume or filesystem size to less than the amount of space the data takes up (without losing data). But if you figure out how, you'll be pretty rich. And never do this to anything you cherish without taking a backup.

    There it is. Now check out mylvmbackup if you haven't already.

    Comments
  • 200910.27

    PHP culture - a scourge on good programming

    Having taken my programming roots in QBASIC (shut up), C, C++, and a very healthy self-administered dose of x86 assembly, I can say that for the most part I have a good sense of what programming is. All of what I've learned up until now has helped me develop my sense for good code, and helped me to write programs and applications that I can sit back and be proud of. I've been working with PHP for over 4 years now, and I have to say it's the most ugly language I've ever used.

    Let me explain. PHP itself is wonderfully loosely-typed, C-like syntactically, and all around easy to write code for. The syntax is familiar because of my background. The integration with web is apparent down to its core, and it's a hell of a lot easier than assembly to write. When perusing through a project filled to the brim with C source code, I'm usually left thinking about how it works, why the developer did what they did, and why that makes sense for that particular application. I'm usually able to figure out these questions and there's one main reason: the code isn't shit. With PHP, I'm usually left wondering what the developer was thinking, the 100s of ways I could have done it more efficiently, and why this person is actually making money doing this.

    With roughly 90% of open-source PHP projects, everything works great. I love it, clients love it, everyone kisses eachother's ass. But then one day you get that inevitable change request...I want it to do THIS. A quick look at the source code reveals that, omg, it's been written by a team of highly trained ape-like creatures! It surprises me that Wordpress plugins that get 100s of downloads a day throw errors (unless you disable error output, which I never do on my dev machines). Whole architectures are written with random indentation, or indentation with spaces (sorry Rubyers, but space-indentation is an evil scourge on humanity). No effort is put into separating pieces of code that could so easily be modularized if only they were given a second thought.

    Do I hate PHP? No, I love PHP. I think it's a well-written, high-level web development language. It's fast, portable, and scalable. It allows me to focus on the problems I face, not the syntax of what I'm trying to do. Paired with an excellent editor like Eclipse (w/ PHPeclipse) I'm unstoppable. But why can't any other PHP developers share my love of well-written code? It's the #1 critique of PHP, and rightly so. I'm pretty sure that all programming languages, save Python, allow you to write awful, unreadable code...but PHP's culture seems to be built around shitty code, amateurish hacks, and lack of elegance. PHP isn't the problem, it's the people writing it who suck!

    So I do love the language, but hate most of the implementations. I have to say though, nothing is worse than Coldfusion.

    Comments
  • 200910.27

    VirtualBox: how to "clone" your VMs

    Notice the "clone" in quotes. Why? You can't actually clone a VM technically. We can work around that, though. Keep in mind, this guide is for VirtualBox <= 3.0.8 (later versions may have a clone button or something).

    One thing you CAN do is export to OVF and re-import, but I've found that OVF loses many settings (like video ram, network settings, whether you use SATA or not, etc). I prefer not to even bother with this method.

    The next thing you can do is just clone your VM's hard disk(s):

    1. Go into the ~/.VirtualBox/HardDisks/ folder. Copy and paste (windows) or cp (linux/unix) from db_master1.vdi to db_master2.vdi. If you try to import this into the Virtual Media Manager, it will piss and moan about the UUID being duplicate or some shit.
    2. VBoxManage internalcommands setvdiuuid db_master2.vdi - this is the magic command that allows you to import that new HD.
    3. Create a new VM, and set db_master2.vdi as the primary drive.
    4. Configure your new VM to have the same settings. (this is a pain, but there really aren't that many settings).

    There are a few things you'll have to dick with once you have your VM cloned. If you're into networking/cluster/HA crap like me, you'll probably have a static IP. This obviously needs to be changed. It's different for every distro, but it's in /etc/rc.d/rc.inet1.conf for Slackware, and /etc/networking/interfaces for Debian (any other distro can go to hell).

    Your old network interfaces, eth[0...n] will now be eth[(n+1)...(n*2)]: eg, if you had eth0 and eth1 before, they will now be eth2 and eth3. To reset this, (in Slackware):

    1. Open/etc/udev/rules.d/75-network-devices.rules in your favorite editor
    2. Remove all the entries.
    3. Restart. (note - someone please correct me if you don't need a restart... perhaps /sbin/udevtrigger will fix this?)
    4. You will now have eth0 and eth1 again. Hoo-fucking-ray.

    The process is the same for Debian, but the 75-network-devices.rules will most likely have a different name.

    Good luck.

    Comments
  • 200910.27

    The GoDaddy nightmare

    </p>

    We've all heard of howtobepunk.com, the world's best guide on the punk subculture. Weighing in at over 15-billion page views per day, it's one of those sites people just expect to see up...and every person on earth checks it on average 2.3 times per day. The domain recently expired, and oddly enough, I wasn't warned.

    I'm not too bent out of shape about that, it's happened before (and many times it has been my fault). What really chaps my caboose is the transfer process. See, I hate GoDaddy with a passion. Always have. Since NFS.net started doing domain registration, I've been pretty gung-ho about using them. I decided to transfer HTBP.com to Nearly Free Speech.

    GoDaddy, to the full extent the ICANN let's them, makes this the most difficult and tedious process you can possibly imagine. Every guide you find on their site about transfer domains assumes that you want to transfer the domain TO them. Why would anyone, after all, want to transfer a domain away from the best registrar/host/whatever else the fuck they do in the world? You'd have to be crazy.

    Call me a fruitcake. Anyway, I finally got through the whole process, activated the transfer, blah blah. GoDaddy sends me an email saying it's all successful. Great, I can sit back now.

    NO!!!!! I can't. There's some sort of domain transfer "pending" system that holds on to the domain for a week (or until you approve it AGAIN). GoDaddy decided to hide this at the bottom of the email they sent telling me everything is fine.

    Anyway, dealing with those guys is a nightmare. Only one domain left on there, and once it comes up for renewal I'll never host another domain on GoDaddy again. Their system itself works fine, but even a highly skilled web developer has trouble using their shitty interface. I can't imagine how some average douche who wants to register mydogsparkyiscool.com would make heads or tails of it.

    </rant>

    Comments
  • 200910.15

    Really good article on OS scalability

    Compared are Linux 2.4, 2.6, FreeBSD, NetBSD, and OpenBSD. Really well-performed benchmarks, with graphs.

    http://bulk.fefe.de/scalability

    Linux 2.6 was hands down the winner, which makes me feel good about Slackware (2.6 linux but actually stable) as a server. I'm sure Windows would have won if only it was benchmarked. One thing to keep in mind - from what I gathered, the machine tested was a single-processor, single-core machine...this means that SMP scalability was not tested, a HUGE consideration for more modern servers (what server now doesn't have multiple cores?) and may skew the modern-day results, especially between the two leads, FreeBSD and Linux 2.6.

    Comments
  • 200909.30

    Radio controlled insects

    As much as I love science and the idea of a using science to create a cloud of swarming insects that replaces the sky with eternal darkness, I have to protest. I was browsing through the articles on one of my favorite sites hackaday.com when I happened across a post on controlling beetle flight remotely. Well, that's cool. Someone built a robot beetle that can fly, like in the movies when you see a spy fly that buzzes deep into enemy territory and sniffs out where the terrorist nukes are.

    But no, these ain't no robots. An group of engineers from UC Berkeley "restrained" a beetle, implanted electrodes into its brain, and used a remote to force the creature into controlled flight. I have to say this is a pretty disgusting act. As humans, we've now taken another life form, a being with its own free will and consciousness, and stripped it of just about all that makes it alive, and made it dance a jig for us. It still breathes and exists (for how long I wonder) but its very actions are now controlled by some group of people who did it just to see if they could. Congratulations on making the human race as a whole a just bit more repulsive than it was before.

    Also, I don't buy the "relax, it's just a beetle" bullshit. Torture is torture, it doesn't matter who it's happening to. None of us can imagine what it's like to have electrodes implanted in our brain administering continuous electrical shocks...and to justify a wrong by saying it happened to something small in size, or happened to something with an exoskeleton is no excuse. What makes it so separate from us? It's a living, breathing, procreating biological machine that feels and responds to its world...just like us. The only real difference between a beetle and a human is that the human falsely thinks there is a difference between the two.

    First article from Feb - insect control Article on flight control - flight control

    It is my firm belief that everyone who participated should be subject to remote control neural implants for a day, with a retarded 6 year old behind the controls.

    Comments
  • 200909.27

    Fix: Slow flash in Ubuntu

    So my girlfriend got fed up with Windows. The constant exploits, viruses, slow degeneration of the registry into an slimy ooze of nebulous information. In fact, her windows machine decided to blue screen on every boot, even in safe mode.

    I'm not writing to bitch about windows though. I'm writing because she decided to go with Linux, and the first thing that came to mind for a beginner is Ubuntu. Keep in mind, I'm a slackware guy and generally turn my nose up at such things, but this isn't for me. Plus I wanted to see what Ubuntu is all about. The install was easy, the configuration was easy, I now have good old XP running in a VirtualBox, etc. Things are going great.

    Two problems. First, it's a bit laggy. Some of the screen savers make it seem like the computer was decrypting an NSA information stream...it's like watching a slideshow. That's fine, it's a fucking screen saver. I just went with a simple one.

    Second, flash player in Firefox on Ubuntu 9.04 is fucking slow in full-screen. After beating the forums and google to death, I finally found something that works:

    sudo mkdir /etc/adobe
    sudo echo "OverrideGPUValidation = 1" >> /etc/adobe/mms.cfg

    Why does it work? How the f should I know? Ask Adobe. It worked for me and if you're have problems with flash in fullscreen on Ubuntu, give it a shot. I've also noticed that many people suggest disabling hardware acceleration for a performance gain. In order for the above trick to work, you must RE-enable hardware acceleration in flash: right click on any flash video, go to "Settings" and check "Enable Hardware Acceleration."

    Voilà.

    PS. Try slackware...never had flash problems =D

    Comments
  • 200909.21

    Why I hate smarty

    Smarty is everyone's favorite templating language for PHP. It's great in many ways, one of the main features being that it can display things on a website. It also promotes separation of display code and logic, which many PHP programmers seem to have trouble with: oscommerce, PHPList, etc etc.

    So why do I hate it?

    </em> There's no fucking point! All bad programmers write bad code. Why create a language within a language just to force bad programmers to do one thing right? I realize that Smarty does enforce separation of logic from display very well. I've used it in several projects. But if its capabilities are so strikingly similar to PHP that for most things there is a 1-1 reference, why bother? Why not just use PHP code?</p>

    Also, the plugins (and {php} tag) allow you to make logical decisions, run mysql queries, send rockets to the moon...there's nothing you can do in PHP that you cannot do in Smarty...which makes Smarty completely worthless for what it's trying to do.

    If you want to promote good programming, you don't need Smarty. You can rewrite Smarty as a PHP object that sets variables and includes a template. I've written this a dozen times over...and it does the exact same thing, except templates are in PHP so everyone can understand them, there is no caching trickery going on, and best of all you don't need to reference some stupid guide on how to display something in a strange language which you already know how to do in PHP. </rant>

    So, in summation, please don't stop using Smarty. It's a good piece of code for people who don't understand the basics of separation of logic from display...but realize that Smarty is a hack, a patch, a band-aid. The REAL problem is bad programming, not something inherently wrong with PHP that needs to be rewritten.

    Comments
  • 200909.07

    How to reduce your carbon emissions

    Here I will outline some wonderful techniques I've developed for saving the planet. A lot of these may come off as common sense but, as we all know, most people don't have it so I'll go over them anyway.

    1. Driving. This is the obvious and hard one. Although I realize you can't stop driving altogether, there are ways to drive the same distance without using as much gas.
      • Accellerate slowly. You are driving a 2 ton object. Although it feels slow, generating the amount of power to get that object from 0 to 30 is enormous, and a lot of fuel is used to get started. I can't stress how important this is going uphill...take it slow.
      • Don't stop for anything. Once you stop, you have to accelerate again. If you are coming up on a red light, decrease your speed a few hundred feet before you reach it. Then, you'll be traveling a constant slow(er) speed and by the time you get there, the light will be green. If you get good at timing, you'll be able to keep up a good speed and never have to stop for a red. Don't mind the asshole tailgating you, they'd have to wait at the light anyway. With stop signs, obey the "no cop, no stop" philosophy.
      • Keep your tires filled and your car in tune.
      • Get a better car. If you actually go offroad a lot, you constantly haul stuff around, or have to deal with 3 feet of snow, you can skip this step. If you live in California like me, you can ditch your stupid SUV and get a real car. Remember, the size of your dick is inversely proportional to the size of your car. The bigger your car, the tinier your penis.
      • Get off your fat McDonalds ass and walk or ride your bike once in a while.
    2. Lights. Get compact fluorescents. The initial cost is worth the eventual energy savings. They last forever and are much brighter than incandescents. Also, with any type of light, it's better to leave it on for a few minutes than to incessantly turn it on and off. Note - with compact fluorescents, they are not disposable...they need to be properly recycled!
    3. Heating/cooling. Heating a house or apartment is a big deal, so do it only when you need to. Wear a coat or put on some shorts and open the windows. Yes, you may be uncomfortable, but don't be such a fuckin' wuss. Some people are cold all the time and have no food. Bein uncomfortable builds character. Get over yourself, asswipe.
    4. Food. I'm not going to shove the organic thing down your throat. It is better, however, to buy foods from your area. If you live in Siberia, skip this step. If not, supporting foods that haven't been trucked across the globe saves energy because they haven't been trucked across the globe.
    5. If it's yellow let it mellow, if it's brow... You get it. Flushing doesn't waste water. Water just goes back into the water cycle. Flashing wastes electricity. Huh? Toilets don't use electricity, stupid! Oh yes they do. In order for the water to come out your sink or toilet, it has to be pressurized. This takes a lot of energy. Imagine, if you will, trying to pressurize an entire city with a hand pump. A lot of work, right? Right. Well, pumps use electricity, and a lot of it. The less water you use, the less electricity used to pressurize the water system.
    6. Don't die. As your body decomposes, it releases harmful carbon into the atmosphere.

    I hope you've enjoyed my energy-saving tips. Be sure to stay tuned for more in the future.

    Comments
  • 200909.07

    Gay marriage - and you!

    We've all heard of proposition 8 in California...the ban on gay marriage. It was a dark, bloody political battle that ended in tears, anger, but also joy and a feeling of sanctity for those that won. Let me say that I do not support prop 8. Not because of the rule itself so much as it being a constitutional amendment, not a law. The very document that lists the rights of the residents of the state of California was amended to tell a specific subset of people that they cannot partake in a religious ceremony that binds them for life.

    I don't support state-sanctioned gay marriage. Not in any way shape or form. I don't think the state (political state, not geographic state) has the right to marry two men or two women. Neither does it have the right to marry a straight couple though. Marriage, although deeply ingrained in our society, is a religious ceremony. It's a dance two people do to signify their unending commitment.

    The state has absolutely no business supporting this ritual. I believe separation of church and state has been defiled by the state taking it upon itself to say who can marry and who cannot. Is that not up to the specific religion the couple in question are marrying under? What moral right does the state have to support a religious ritual and then only for a specific set of people?

    I believe the state has overstepped its bounds. I believe the state, as it already does, should allow civil unions between partners, giving them the applicable tax breaks they would receive as a married couple, but not marry people. Marriage is a religious institution and as such should be completely unrecognized by the state.

    Note that this would solve all conflicts surrounding marriage. Two gay men can get married at the devil-worshiping, blood-drinking, child-molesting church down the street, and Mr. Conservative who goes to the bread-eating, jesus-praising, child-molesting church up the street doesn't have to recognize the two gay men's marriage. It didn't happen at his church or under his rules, so in his mind, the marriage can be null and void... but the state gives the two gay men their civil union, and then politely bows out of the conflict, letting the upstanding Christian and the society-destroying gays fight it out between themselves.

    Everyone wins, and the state can wash its hands clean of all moral conflict surrounding a religous institution.

    Comments
  • 200908.13

    Perfect answer to a dumb question

    I can't tell what's better: the actual text art or the jubilant avatar next to it. Either way I cracked up when I saw it. Great ad, too. Here's the original post. Update - as I predicted, the phallic text art was removed =(

    penis

    Comments
  • 200903.09

    beeets live!!

    beeets.com has been launched into open beta!! I know you've all been waiting for this, so lucky you. Users can find events based on their interests.

    Some planned features include integration with social networks (a must these days) AND a super SECRET feature that has yet to be announced but will spring us to #1 in a matter of hours. It has yet to be unleashed though.

    Anyway, check it out. Jeff and I put a ton of work into getting this ready for John Q Public, and you must swear on the eyes of your children that you will sign up for an account and post events and tell everyone you know RIGHT NOW. Thx lol.

    Comments

 |