Xyster Build 6
Posted by Double Compile on Monday, May 19. 2008 in Xyster
Build 6 of the Xyster Framework has been released. Tons of new features both in core and in incubator.
Please head over to the Xyster site and grab yourself a copy.
Oracle 10g XE and OpenVZ
Posted by Double Compile on Tuesday, May 6. 2008 in Databases
Last night I tried to install Oracle 10g XE on my Debian-based database server for testing purposes. Tried is the key word here.
Interestingly enough, Oracle offers a deb repository for this purpose. Add the following line to your /etc/apt/sources.list:
deb http://oss.oracle.com/debian unstable main non-free
Then execute the following commands as root (or with sudo) to add Oracle's public signing key and then install Oracle XE:
# wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
# apt-get update
# apt-get install oracle-xe
Here's the catch: my database server is an OpenVZ VPS. The Oracle installer checks for a sufficiently large swap partition and will bomb out if one of a sufficient size is not found. OpenVZ VPSs do not have a swap partition.
OpenVZ does support swap space, and that swap space can be set with barriers and limits, but the swap space is as a whole meaning that there is one swap space for the entire system, not a user-configurable swap space per-VPS.
So now comes the task of tricking the installer to think I the VPS has a swap partition, or trying to get it on there some other way. Stay tuned for the nuttiness.
Oracle is stupid.
Shutdown Day
Posted by Double Compile on Thursday, May 1. 2008
Hey, this is a quick reminder. Don't forget about Shutdown Day on May 3rd.
Be part of one of the biggest global experiments ever to take place on the Internet. The idea behind Shutdown Day is to find out how many people can go without a computer for one whole day, and what will happen if we all participate!
Open Screen say what?
Posted by Double Compile on Thursday, May 1. 2008
You might know by now that Adobe makes my blood boil sometimes. Their needlessly expensive graphics and publishing package represents all that open source is not. When I read news blips this morning about Open Screen, I was pleasantly surprised.
This blurb taken from a CNet article:
Wadhwani said the Open Screen project has five basic elements. Adobe will remove license restriction on the .swf file format. "It is published already, but in order to view it you have to say you will not create a competing player," said Wadhwani. "We're lifting that restriction. People have been worried about vendor lock-in. This will remove that obstacle, and concern."
Adobe will also remove licensing fees for embedding Flash Player on devices. The software has always been a free download for PC users. But Adobe has charged for embedding on devices. Those charges will disappear with the next release of the software.
Even though Adobe still rubs me the wrong way, this move is entirely in the right direction. Maybe this means I can finally get a working Flash player on my x84_64 notebook.
Ubuntu Hardy Heron Install Live Blog
Posted by Double Compile on Friday, April 25. 2008 in GNU/Linux
Ubuntu 8.04 Hardy Heron came out yesterday. I meant to upgrade yesterday but, on a whim, I thought I'd install from scratch and live blog it. What follows is the result of that effort.
Did I mention I ordered the limited edition Hardy Heron t-shirt from the Canonical store? Because I did.
Another log on the fire
Posted by Double Compile on Tuesday, April 22. 2008 in Databases
If you want foreign key support in MySQL, you need to use the InnoDB storage engine. If you want fulltext index support, you need to use the MyISAM storage engine. Ain't that a bitch?
Just for the record: PostgreSQL supports them both well.
To be fair, the syntax for fulltext searching in MySQL is more simple than that of fulltext searching in PostgreSQL. Here's an example:
MySQL:
SELECT title
FROM example
WHERE MATCH (title, body) AGAINST ('foobar')
PostgreSQL:
SELECT title
FROM example
WHERE to_tsvector(title || body) @@ to_tsquery('foobar');
So while the syntax is easier, you can't use fulltext and foreign keys simultaneously in MySQL. PostgreSQL wins this battle.
Xyster Build 5
Posted by Double Compile on Thursday, March 6. 2008 in Xyster
Build 5 of the Xyster Framework has been released. This version includes more features in Xyster_Container
and various other slight modifications. You'll also find a bit more user documentation.
Please head over to the Xyster site and grab yourself a copy.
Note that this version of the framework uses features in Zend Framework 1.5 which hasn't been released yet. You can get a snapshot of ZF from their download page.
Drupal 6.0 Released
Posted by Double Compile on Wednesday, February 13. 2008
Congratulations to the Drupal team on their release of Drupal 6.0! There are many changes under the hood, but perhaps the most instantly useful of which is their native support for OpenID.
No More PHP 4, Pt 3: Play Nice with Authentication
Posted by Double Compile on Tuesday, January 22. 2008 in PHP
PHP 4 is end-of-life very soon. In addition to offering projects the chance to refactor and improve their application design, PHP 5 offers many things PHP 4 just doesn't. This series of posts will deal with things projects can get their fingers into that will benefit everyone.
The third: play nice with authentication.
Your application isn't the only kid on the block, especially if it's a single-purpose application like a forum or an issue tracker. Nothing is more frustrating than having to hack your application so my users don't have to login to different parts of my Web site.
Clay Loveless made a post in June of '06 stressing the stupidity of "loner applications".
You can remedy your application's isolation using one of two things: OpenID authentication or some kind of authentication plugin API or adapter.
Implementing OpenID is perhaps the lesser solution. Users would still have to put their OpenID address into each application on a site to login; it's not nearly as bad as having separate passwords, but still less convenient than a unified sign-on.
The preferred solution to this mess is to provide an API for others to write pluggable authentication modules and then pick which one is being used in a configuration somewhere. I applaud DokuWiki for their very simple and effective implementation of such an adapter. I also have experience with MediaWiki's plugin system, but don't get me started on the MediaWiki source code. Mantis has a decent start on an authentication plugin, but it still leaves much to be desired.
If you're going to start an authentication adapter system from scratch, may I suggest Zend_Auth? Adapters are a breeze to implement and Zend_Auth takes care of persisting a user's session. If you're using the Zend_Controller MVC, may I also suggest Xyster_Controller_Plugin_Auth? It gives you the ability to specify the MVC dispatch locations for login prompting, success, and failure.
Actually, adapters and plugins are a good idea for any software. If I have to edit a single source file for your application, you're doing a poor job at keeping extensibility in mind.
Xyster Build 4
Posted by Double Compile on Sunday, January 20. 2008 in Xyster
Build 4 of the Xyster Framework has been released. Most notable new feature: Xyster_Container, the dependency injection package.
Please head over to the Xyster site and grab yourself a copy.
Note that this version of the framework uses features in Zend Framework 1.5 which hasn't been released yet. You can get a snapshot of ZF from their download page.
I Miss Actual Video
Posted by Double Compile on Thursday, January 3. 2008
Remember the days where a video would be embedded in a web page? You could stream different kinds of actual video right to your favorite video plugin! I remember a choice between RealPlayer, Windows Media, and QuickTime.
Nowadays, it seems like you only have one choice: Flash. If, however, you're on a 64-bit operating system, you don't have a choice at all. Hey, Flash developers: read that line again. People who run 64-bit Linux, for example, do not have a Flash plugin. Don't blame Linux; it's Adobe's fault.
(Yes, I know there are hacks to emulate a 32-bit browser in a 64-bit operating system, but they're hacks and not solutions or acceptable in any way. Silence.)
Thank you, Google Video, for allowing me to download the videos as actual video, yes, an MPEG-4 file so I can watch it as video should be watched. Thank you, Stage6, for using actual video implicitly. Meanwhile, I hope and pray that YouTube and its kin will stop wrapping perfectly good video with a Flash plugin that not all of its clients have or want.
Still don't understand? Turn off your Flash plugin and try watching some Internet videos. You'll end up spending a lot of time at Apple Movie Trailers.
Focus Your Login Forms On Me!
Posted by Andy Stratton on Thursday, December 13. 2007
All the new blog-tastic, niche, social media, networking, web 2.0, buzz-word worthy abstract made-up name websites have one thing in common: Login Forms. Assuming I'm remotely similar to other productivity-minded developers, most of you are like me: you know your OS, your keyboard, and most keyboard shortcuts and use your mouse as a last resort.
Stop forcing me to use my mouse when I don't have to!
Most login forms require a minimum an email address (or username) and a password to login. What many of the fore mentioned sites, as well as many other web applications, like online banking, and even State Government/Organization websites lack, are a few simple lines of Javascript to enhance the user experience during a login failure and save neurotic people like me from being forced to use the mouse in lieu of the keyboard.
We'd like the input field for the email address/username to have the cursor's focus on page load, since we're ready to login. Ideally, if we've tried and failed to login, set the cursor the most logical field causing the failure:
- Empty email/username field → focus on email/username field
- No password entered → focus on password field
- Incorrect password entered → focus on password field
Let's say this is our markup for a login form:
<form id="login" method="post" action="/login">
<p><label for="email">Email: <input type="text" name="email" id="email" /></label></p>
<p><label for="passwd">Password: <input type="password" name="passwd" id="passwd" /></label></p>
<p><input type="submit" value="Login" /></p>
</form>
If we add a few lines of simple Javascript below it:
<script type="text/javascript">
if ( document.getElementById("email").value == '' ) {
document.getElementById("email").focus();
} else {
document.getElementById("passwd").focus();
}
</script>
You get a very convenient and usable, yet functional without Javascript, login form that sets your cursor at a logical position within +/- one tab keypress of where you need to be. Might sound picky, but sure does stop from slowing me down, which is a big point in getting keeping my attention.
Stop breaking the enter key for submitting!
We all love to add nifty client-side validation. It's fun to code some front-end applications in Javascript, and it helps as a initial scrub of data – just make sure that your hax0ring isn't destroying the expected behavior of your forms.
Here's more some guidelines to keep in mind:
- Never break the enter key as a method of submitting your forms.
If you're handling the event of a user pressing a key, and failing on invalid characters, be sure to throw a handler in there for character code 13 (the enter key). - Always have a submit button.
Feel free to tag it with an id and hide it with CSS/Javascript, but make it easy for people to use if they don't have CSS, Javascript, or images. Sometimes form images act funny in browsers. - Use labels on all form input elements!
It's extremely frustrating to try to select a radio button or a checkbox and having to hit the 10px by 10px circle or box. Make it easier for your users and more accessible for those who need it to be. As a best practice, use them on anything taking in data in your form. - Get on the Bus with Fieldsets and Legends
These will help you organize your data fields logically as well as increase your markup's semantic-ness. Plus, since they aren't used often, they can tend to look pretty cool.
Happy Programm0ring.
Commodore 64 Nostalgia
Posted by Double Compile on Wednesday, December 12. 2007 in Hardware
The Commodore 64 turned 25 this week!
I was 10 when my brother Ryan gave me his (this would be winter '91-'92). His C64 had a Warp Speed cartridge and a 1200 baud modem! It was hooked up to my black-and-white GoldStar 13" TV (the same one I used to play his Atari 2600).
At 10, I was using the C64 to (among other things)
- visit my first BBS
- program stupid choose-your-own-adventure games in BASIC
- play great games like California Games and Operation: Wolf
- do reports for school using Paperclip III.
You should have seen my face the first time I wrote a BASIC script that wrote to the dot-matrix printer.
I found out that a Sega Genesis controller worked great as a joystick for the C64.
The next computer I got was an IBM-compatible 486 DX2/66 that ran Windows 3.1. Quite an upgrade, but I still look back with a smile on my Commodore 64 days.
LOAD "nostalgia",8,1
RUN
Dependency Injection in Xyster
Posted by Double Compile on Monday, December 10. 2007 in Xyster
Inversion of Control is one of those design patterns that once you "get it", you'll start seeing that it can be applied basically all over the place. It's the lesson of "tell; don't ask".
I've spent a good deal of time this weekend with the Xyster incubator; creating a Dependency Injection package called Xyster_Container
based almost entirely on PicoContainer. The good: PHP method signatures are much more simple than Java's; only one constructor per class. The bad: PHP scalar method parameters are not typed, so you cannot use ReflectionParameter::getClass()
on them. This first release won't support the LifeCycle capabilities or annotations, but at least annotations support is planned (remember, it's still in the incubator).
This Dependency Injection package will be used to replace/redo the Xyster_Application
package. You'll read in Fowler's article (linked above) about the Service Locater concept, which was what Xyster_Application was intended to be. While the Locater might still be done, I think it's more important that application services can be injected into the classes that use them.
For now, read up on Dependency Injection. You'll wonder where it's been all your life.
Xyster Build 3
Posted by Double Compile on Monday, November 5. 2007 in Xyster
The third build of the Xyster Framework is available for immediate (ab)use.
Please head over to the Xyster site to grab yourself a copy.