Archive for November, 2008

* A Poor Man’s Migration

Posted on November 28th, 2008 by Dave Johnson. Filed under programming.


Working on a project with multiple people, multiple databases and many tests for each of those people and databases makes managing schemas a pretty big nightmare as many of you can probably atest to even more than I. If you are all working on a single rails app rails migrations make things much better but even then there are still cases that make it painful like when schema changes break all your tests. Since half of the application that I am currently working on is not even a rails app it means that we need some other way of managing that other database schema. To make things worse our test cases are rather specific and it may end up that a lof the tests have very different test data sets so using one set of rails fixtures also doesn’t cut it.

I looked around a bit for other migration tools and did find Migrate4j which looked OK but the idea of learning another abstraction ontop of SQL did not really sit well with me. I like writing migrations in SQL since you know exactly what you are getting and there are no problems with things like setting a field as MEDIUMTEXT type that doesn’t exist in your abstraction language.

Anyhow, I cobbled something together in the form of an ANT script in a few hours that resembles a generic migration system that will take a SQL file containing your migration (add_column_to_table.up.sql and corresponding down file) and then apply it to schema SQL file as well as data SQL files that are used for any tests.


<target name="db.dump.schema">
<exec executable="cmd" os="Windows XP,Windows Vista>
<arg value="/c" />
<arg value="mysqldump -u ${db.user} --password="${db.password}"
--databases ${db.name} --add-drop-database -R --no-data
--skip-set-charset --default-character-set=utf8 > ${sql.name}" />
</exec>
</target>

Tags: , , , .



* Cloud Computing + Smart Grids = Smart Clouds

Posted on November 25th, 2008 by Dave Johnson. Filed under cloud, smart grid.


The discussion about what cloud computing is over at James’ blog is still raging.

While cloud computing is fascinating and a great opportunity for making IT more efficient in it’s own right. However, I have been thinking about smart grids a lot (and so have a lot of others like the better half of RedMonk and even The Google), which in short are electricity grids that have the ability to both provide and accept both electricity and information about the prices of said electricity all over the same wires making it possible for companies, government and people to choose to use electricity when it is cheap and generate it when it is expensive, thus, helping to reduce the amount of generation infrastructure required in a network to cover load peaks.

A classic example of this is when everyone in England gets home from work (or when the East Enders comes on the television) they turn on the kettle to make a cup of tea, the issue of only rich people being able to drink tea aside, resulting in a large spike in consumption that would (hopefully) be reduced by higher instantaneous pricing.

Today, users are charged for cloud computing in a predictable way at a rate of about $0.05 to $0.10 per hour depending on the provider. However, as we move to smart grids (and we already are with companies like Trilliant and GridPoint leading the way) we are going to see changes to the way cloud computing and most other service are billed for.

In the cloud all your data needs to be backed up and sitting on hard drives somewhere that likely need constant power (like Amazon S3) while other parts of the cloud are more temporal in nature like the load on a CPU (Amazone EC2). All this adds up to a more complex cost structure for the cloud provider.

At any rate, this post is not about smart grids but instead about smart clouds and the eventual reality where computing power has a temporal cost associated with. This will create a new niche for software that manager can manage CPU and storage load according to electricity price as well as new developer skill sets with a bigger focus on batch processing rather than real-time processing. I am just sort of thinking out loud here but think that the rules of the cloud (and development in general) will have to change if we move to a low carbon economy.

As I write this I can’t help but think about applying the real-time pricing concept of smart grids (and maybe smart clouds) to other areas of IT as well. For example, why not have dynamic pricing on bandwidth? When there is plenty of bandwidth in the middle of the night let me have 100Mbs and charge me the same price!

Not exactly sure where I am going with this but just formulating some ideas …

Tags: , , .



* Woods Travel Tips

Posted on November 24th, 2008 by Dave Johnson. Filed under Uncategorized.


Found this in the office today…

.



* 13 Tips For A More Accessible Web

Posted on November 17th, 2008 by Dave Johnson. Filed under AJAX, Accessibility, JavaScript.


There are few web projects that I have worked on of late where accessibility has been a high priority. Of course having worked on the Complete UI Ajax framework that is generally used to build internal web applications we were always trying to make our components as accessible as possible, particularly through the use of the keyboard.

In general through there are a few simple things that you can do to make you web applications far more accessible to your users that may use screen readers like JAWS or have to divert from normal computer settings like just using larger than normal fonts or even using high contrast mode.

  1. Remember if something can get focus through the tab key, users with screen readers will find it and the screen reader will describe it to them.
  2. The first is something that I am sure you have heard a thousand times and may or may not have listened. Don’t use tables for layout. I think that I saw this great site about it through Dion. Amongst the many arguments against using tables for your layout is that they have semantic meaning for
    screen readers - that meaning is course that there is some tabular data to follow. So you can imagine it can be confusing when tables are found without any tabular data!

  3. When a screen reader finds a table, users generally assume that is has a header row with column headings - so use the <th> tag to specify the column headers and maybe even put that entire row in a <thead> element.
  4. Use the unordered (<ul>) and ordered lists (<ol>) when appropriate. Unordered lists should even be used for things like menus by setting the display to inline and the list-style-image to something to get rid of the normal bullet.
  5. Always set the alt attribute on <img> tags. When the image is inside of an anchor this attribute should describe the image as the anchor will bring focus to that HTML. If it is just an ornamental image then leave the value of the alt attribute empty rather than ignoring it (this was demanded by a client due to bugs in certain browsers / screen readers).
  6. Use CSS for all images. The previous issue with image tags that are purely ornamental should not happen since you should be using CSS to set background images on your HTML elements. Not to mention the fact that those images should be sprited using something like SmartSprite and so you have to use CSS.
  7. Form elements should always have an associated <label> element with the for attribute pointing to the element that the label is for.
  8. Try to put dynamic HTML (drop down menus etc) into the HTML tree where they appear
    visually such that tab index for focusable elements is maintained. If you generate a drop down but append it to the bottom of the HTML page and position so that it appears visually at the top of the page, you would have to set the tabIndex attribute on anchors in the menu to get the correct tabbing effect.

  9. Don’t use tabIndex.
  10. Any element that has an onclick event on it should be an <a> tag (or at least enclosed in one). This will ensure that it is focusable and the user can then use the enter key to activate the click event. This is also a good reason not to use onmousedown or onmouseup events since those will not be captured by the keyboard. Similarly, if you use onmouseover and onmouseout to do anything that is not visual then you may consider having onfocus and onblur to do the same thing.
  11. If you have headings then use the heading tags! Semantics, semantics, semantics.
  12. Use relative sizings like em for your fonts and other dimensions and check out how the site looks as you change the font size.
  13. Put in a hidden anchor (position absolute, x,y -5000px) near the top of the HTML that contains a message like “Skip navigation” with an href pointing to an another anchor that will skip down to the actual contents of the page such that screen reader users can skip any redundant links and header information.

If you follow that simple list you should make your web sites and applications much more accessible.

For Firefox users I recommend the Firefox Accessibility Extension, which makes testing your pages pretty easy.

Anything to add? Please leave a comment below!

Tags: , , , .



* How I Use My Dell

Posted on November 14th, 2008 by Dave Johnson. Filed under Uncategorized.


I recently got a Dell Latitude E6400 so figured that I would try to get on Hacker News like Tim did about his Mac workflow. Something tells me this might be a difficult thing :)

I have made the switch back to PC from Mac. I switched to Mac in the first place since I had my old IBM T41 stolen and at the time the MacBook actually seemed like good value. Some of the main reasons for switching back include the fact that I needed a new laptop and didn’t want to have to buy *another* special connector from Apple to connect to an external monitor, nor could my Mac handle Eclipse even at 2.4GHz with 2GB of RAM (well OS X couldn’t but VMWare could … sort of. Maybe I was doing something wrong!). Oh and did I mention that my new Dell is 25% cheaper than the equivalent MacBook Pro and that includes a Dell 3 year onsite next business day support package? Next business day! I never want to have to talk to an Apple Genius ever again just to have them tell me that they have to send off my computer to get anything fixed.

Ok, in with how (and why) I use my Dell.

Operating System

While it comes at a premium, increase of $50 or something, I had no choice but to go with the “downgrade” to Windows XP Business. I really appreciate that Dell gives users that option cause if I had to get Vista I would have probably gotten a Mac instead. XP is totally fine and I see far fewer slow downs or crashes than I did on the MacBook - YMMV. All the Dell Control stuff is pretty annoying for changing mouse, wireless and most other settings, I much prefer the native Windows or OS X feeling of those.

Hardware

I use the great “nipple” mouse pointer that is a nice reminder of my old ThinkPad and turn the touch pad off completely. The E6400 has a light monitor and adjusts the LED screen and keyboard backlight appropriately - it’s nice that they are on par with Macs on that feature. It has a SmartCard reader, VGA and HDMI (or at least some sort of digital video thingy) along with all the standard USB etc ports and DVD.

Disks and Backup

Holy shit do I ever love Windows Exploring! I don’t think that I have ever seen a more annoying piece of software than Finder. What is amazing is that most Apple users even agree with me that it is completely terrible. Good thing that they added stacks in the dock in Leopard and left Finder as is …

Everything for me is in the cloud (Flickr, YouTube, Delicious, Wordpress, Google) so I don’t really backup much. However, just for save keeping I do put a few things on an external hard drive and my music is all on my iPod - though most of my music I couldn’t care less if it all got lost.

Taskbar

I don’t really use the taskbar too much. Alt+tab and Windows+e/r/m get do pretty much everything you need. Of course for everything else there is Launchy (Alt+space) that is just like QuickSilver or Spotlight and it is open source to boot (as if I am really going to go in there and try to change it or something!). I tried Dash Command but it didn’t even find Firefox. The one thing that I used to use a lot was the address bar, however, Microsoft had to get rid of it in SP 3 for some reason *facepalm*.

I use the quick launch tray a little bit - mostly just for my different browsers that I need for testing. and of course the tasktray is filled a whole pile of shit. With the address bar gone I am thinking that I might just try hidding the taskbar all together.

Screen

I use an external monitor most of the time aside from when I work at home and lounge around on the couch. The screen is a bit more compact than a MacBook Pro at 14″ but with the same lovely 1440*900 resolution. I was really fealing squished on that MacBook 1280 resolution. I never used spaces on the Mac so no love lost there, however, expose did come in handy once in a while and I am searching for a good alternative on Windows - most I have found only respond to key presses (F9-11) but maybe that will be ok.

Terminal

I use terminal a lot for building, ssh, mysql etc and Command Prompt works just fine for me (Update: as long as it is augmented with Cygwin). I increase the default settings of course so that I can actually see it and definitely increase the buffer size to something reasonable. Thinking of tricking out the colors from just basic black and white but haven’t yet. I did like the semi transparent Terminal.app but that is just superfluous really.

Mail

Google. Google mail is great. I can’t imagine using something like Outlook or *shudder* Thunderbird.

Calendar

Ditto.

Browsers

I use Firefox 3 for most of my browser since I love the address bar search feature - it is amazing - as well as the saving / restoring of open tabs. I usually have a lot of tabs open and once in a while Firebug will cause Firefox to crash so being able to load up those old tabs is a god send. Oh yah I use Firebug, all the time. Love it. I need to use IE6-8 for testing as well as Firefox 2, Safari 3 and Opera 9. I might consider trying Safari 3.2 as my default browser but will see.

Coding

I use Eclipse Europa for most of my coding needs. I never really got into TextMate on the Mac but tried some alternatives on Windows like E-Editor and Intype but neither of them even had a “search in project” feature so both were quickly trashed. E-Editor didn’t even support my mouse wheel for scrolling. In addition to Eclipse I have a few important plugins like Flex Builder (which of course now includes JSEclipse for some inane reason) and I use Aptana for HTML and CSS editing as well as Rad Rails for RoR and their Adobe AIR plugin. Eclipse also has Git and Subversion plugins which really rounds out the needs for writing code. I occasionally use Visual Studio - which is a great IDE - and use MySQL for most of my database needs.

Other Clients

I am finally getting back onto IRC with mIRC, while I use Twhirl for Twitter and GTalk for chat. I am very happy to no longer be using Adium. I have Office installed but use Google Docs just as much probably since most things need to be written collaboratively. I might try OpenOffice 3. Of course I use iTunes for music and, come to think of it, maybe my Dell will actually be able to play to my AirTunes which my MacBook has not been able to do for the past several months. I also use Tortoise and Subversion of course and these days Git too with msysgit which is not all that bad.

Security

What’s that? I leave my Windows firewall off cause it’s annoying. I haven’t had security problems in a long time unless you consider having your laptop stolen from your office a security problem - I can only assume it went to a good cause (Vancouver DTES).

One last thing, did you know that when you click on the maximize button in Windows XP the window will actually fill the entire screen. True story. ;)

This is just my exerpience over the last year. YMMV. Let the flaming begin!

Tags: , , , , .



* Blackberry Storm Simulator/API Available

Posted on November 13th, 2008 by Dave Johnson. Filed under mobile, phonegap.


For those interested in Blackberry development the simulator is now Available from RIM.

In the summary of changes to the API there were a few things of note including new classes for the touch screen, virtual keyboard, orientation and rotation, and accelerometer. Oh and how could I forget that Storm owners will also have the ability to set the theme wallpaper!

The JavaDocs for the 4.7 API (the OS version of the Storm) can be found here for reference.

The one good thing is that it should not mean I will need to make any changes to the Blackberry version of PhoneGap! However, unluckily it means that Storm is still using the same shitty old browser and not WebKit.

Tags: , , , , , .