Showing posts with label software development. Show all posts
Showing posts with label software development. Show all posts

July 20, 2007

Social, But Not So Much

Twitter drops the confusing distinction between “friend” and “follow”—now it’s just “follow”. The less sites that demand I reduce friendship to a binary decision the better. -- Simon Willison


I hope Pownce takes note of this too; i felt like i needed to go home and confess to my wife when i had to "friend" Leah Culver just to "follow" her updates.

September 12, 2006

Rails by Fire

Coded up some and tested some Ruby on Rails code for the first time last night. Yeah. It’s all they say it is. Locomotive, the Rails environment for Mac, is awesome. Combine with MAMP. Toss with some Windoze XP covered Parallels. Bake with TextMate for good measure. Stir. And you have a really nice development environment.


Started from scratch at 8pm and committed some patches by 11pm. A few things i learned…


To install Locomotive, just drop the top-level folder in the disk image into Applications. The ‘Bundles’ subdirectory goes right beside the app in the same folder. This simple little nugget of information was not abundantly clear from the locomotive page. I did the typical drop the app into /Applications and proceeded to wonder where the Bundles went.


The MVC paradigm is the foundation of the Rails framework; just be sure to look to config/routes.rb to determine the entry-point of things.


Capistrano is a great idea poorly implemented. Each of our staff members has to remember to change the script to work for our environment. And why it does a ’svn checkout’ instead of an ’svn export’ is unclear as well.


You can tell that a lot of Rails developers work in a shared hosting environment. Those same constraints do not apply to enterprise type roll-outs.


Significant energy has to be invested into keeping up with the Rails framework. We have code that uses deprecated methods already. The bleeding edge is fun, but can be messy.


July 21, 2006

The Painful Joy of Caching

Caching is:


A collection of data duplicating original values stored elsewhere or computed earlier. — Wikipedia


Not to be confused with geocaching, caching provides performance improvements in many facets of your computing experience.



  1. Your computer may have one, two or even three caches built-in for main memory.

  2. Your hard drive has a cache.

  3. Your video card has a cache.

  4. Your web browser has a cache to keep from requesting the same information over and over again as you click those forward and back buttons.

  5. That Wikipedia page may have been cached by your ISP.

  6. That Wikipedia page was also served from a cache on the server. It tries to keep parsing the wiki mark-up into HTML for each page to a minimum.


Like i said, all this caching is goodness; except when its not. :-( Trying to debug applications in the presence of 5 different caches is very hit or miss. Here are some rules of thumb to follow when developing applications that utilize caches.



  1. Provide a mechanism to disable caching.

  2. When caching is disabled, make sure that includes both cache reads and cache writes; or provide separate config options

  3. Provide a mechanism to flush the cache.

  4. Provide a mechanism to set cache size.

  5. When it makes sense, let the user specify the cache timeout.


Yeah, creating a user configurable cache may seem silly at first, however, allowing an administrator that understands the application and usage to tweak parameters could provide a significant increase in performance and/or usability.


My troubles today are a result of a cache where you can disable writes, but not reads. To disable reads, one must turn off the write cache and then flush. Which leads to problem number two, the only flush mechanism that is provided is on a per object basis <sigh>. Remember the “The Great Toilet Bowl Flush” back in 1984? I need that one.


July 17, 2006

The One Notebook

After seven years of classes to earn the BS and MS, not to mention find the Mrs., i have kept only a single notebook. That notebook sits beside a few books that i consider helpful, though not necessarily used (eg. K & R, Stroustrup, etc.).


The notebook was for CSC 542, Database Management. The concepts included: relational systems, relational algebra and calculus, SQL, transaction processing, concurrency and DB application design algorithms. The instructor, a SAS employee, was a hardcore DB applications developer.


I *almost* pulled out the notebook this week. Had i been at work when i encountered the problem, i would have. As it turned out, i remembered enough to eventually google the solution to the problem.


Why keep this notebook? I’m a very practical person. The information presented in that class, while very heavy in theory, was also the most practical in my academic career — using and writing applications for a RDBMS.


Almost all applications are written to deal with data. Knowing when you need a relational database and how to use it are fundamental to software engineering.


June 20, 2006

Spelling, Web Apps, Google and Glue

Awhile back i wrote a MediaWiki extension, called WikiSpeller, that adds a spell-check feature to the wiki text entry box. It was merely a wrapper around a nice bit of JavaScript called GoogieSpell.


GoogieSpell mimics Google’s spell-check feature in GMail. Using Google as your spell-check service has a couple of issues though. First, they only spell-check documents up to 60000 characters. Secondly, you can’t add words to their dictionary.


To address those issues, i present you with GSpellerServer. A spell-check service you can run for all your own apps and your friends too. It was a weekend project, but i’m pretty happy with the results. I need to add an interface for adding words, but there’s always features to add.


It does have a couple of requirements that may be show-stoppers for some folks. It requires PHP5 compiled ‘-with-pspell’ and should be run on a SSL capable server to be compatible with Google’s interface. Self-signed certs should work just fine.


Have fun.


May 30, 2006

PHP XML Fun, 2006 Style

I have been longing for XML parsing tools that are just as convenient as their regular expression counterparts. I’ve had a few XML processing tasks to work on the last couple of months. I’ve been pleasantly surprised with the newest XML functions available in PHP5. The SimpleXML extension is indeed, simple; and it works too (though i did find a bug…which was reported). The DOM tools are okay, but feel so clunky. The unfortunate thing is that i’m probably six months out from being able to go PHP5 everywhere…


April 1, 2006

Software, Requirements, Needs and Wants

As an adjunct teaching C++, one of my favorite extra credit questions was this:


What is the limiting factor for what your software can do?


The answer? hardware. Time? Money? Those limitations are arbitrary. A programmer can neither make more hardware nor instruct hardware to do something it can’t.


I found out a long time ago that you don’t code things that people want, even if you can. They won’t use it. The real problem is that they don’t know what they need.


Some of the more popular applications (web or no) fulfill needs, not wants. Basecamp doesn’t offer boatloads of features. The same can be said of Gmail. Both meet the basic needs. Feature bloat will certainly make a handful of users very happy, but may run some users off if they perceive increased complexity.


Figuring out where to draw this line in the sand is not easy, but it makes all the difference between creating a useful tool that meets the needs versus a picture of someone’s wants that will only hang on the wall.


How do you do that? I’m still figuring it out.


March 12, 2006

JustCode

At my former employer, 99.23% of the software projects i worked on were either custom, one-off, type apps or were tied to company trade secrets. Many were both. This job, a little different. Every bit of our code is open source; code even shows up in the online subversion repository before its announced in some cases.


Our mission revolves around providing a place for experts from academia, and even from private sector thru engagement activities, to collaboratively create, edit and peer-review content. Content takes many forms: Q & A, published articles, learning modules and even an interface for the public to ask questions of these experts. We’re writing some apps from scratch (using Ruby on Rails), but we’re utilizing MediaWiki for general document/content collaboration.


To that end we’ve started creating some MediaWiki extensions to facilitate this collaboration. If your’re a MW user, go check’em out.


November 18, 2005

Language of Love

Why Ruby Shouldn’t Be Your Next Programming Language (Maybe)? Good stuff to chew on there. I started writing a similar entry last week but it got canned as i’m running short on time at the moment.


Sometimes you have choices, sometimes you don’t. Choosing a language for a project shouldn’t be based on popularity or mindshare, but should be based upon the needs of the project. Lots of projects are being cranked up with Ruby and Rails when using something like PHP actually makes more sense: it has known attributes, it can scale, and experienced programmers are available.


I’m not saying Ruby is bad, or Rails is bad; but it is not sliced bread. Neither is PHP. You can create small, powerful, applications and utilities with interpretive languages today; however, you’d be insane to deploy those tools in a public/web-service world as the security holes would be large enough to drive a truck thru.


October 19, 2005

Wordpress Google I’m Feeling Lucky Plugin

Do you spend sleepless nights wondering how to be a lazy-linker? Are you sick and tired, and sick, and tired, of typing (or cut-n-pasting) in those long URLs to help readers find the referenced content to which you refer? Some folks have taken to no longer linking to anything in their content; while certainly novel (i think a web with no links is actually called a dead spider on the sidewalk), this is my solution.


Eh?


Instead of typing out this: <a href=”" title=”">blah</a>. You can simply do this: <go>blah</go>.


The plugin swaps out the go tags for a link to Google. When a reader clicks the link, they are taken to the Google’s I’m Feeling Lucky search result page.


An example: In my previous blog entry all links are googit created links.


Installation



  1. Download to wordpress/wp-content/plugins

  2. Enable from the Admin->Plugins menu

  3. Start googin’ it.


Usage


After the plugin has been installed, you can start creating links by simply using the tags <go> [go] and </go> [/go] around the word(s)/phrase you wish to link.


Caveats


Be sure the word(s)/phrase you put in the tags are specific enough to guarantee that the resulting page is at least in the neighborhood of where the reader should land.


Is this a solution for all links in your blog? The next sliced bread with squeezy butter? Probably not. Its for a little convenience.


ToDo


Perhaps add a quicktag? Since i’m not a quicktag kinda user, low on priority list.


[tags]googit, wordpress[/tags]


September 22, 2005

WordPress Yahoo! Search Plugin

Do you spend sleepless nights thinking about an integrated search interface to your blog and additional content (text files eg. source code, PDF files, etc.) that you have published? Didn’t think so, but now that you have thought about it some, you probably think it would be useful. Yeah, it is.


Requirements



  1. A Yahoo! userid, or willingness to sell your soul to get one

  2. A working WordPress installation (currently 1.5.2)


Getting Started



  • Step 1: download plugin to wordpress/wp-content/plugins

  • Step 2: from the admin interface, enable the Yahoo! Search Plugin

  • Step 3: there is no step 3

  • Step 4: go to the Yahoo! Search Options page, get an Application ID

  • Step 5: create a new search page

  • Step 6: there is no step 6

  • Step 7: add call to yahooSearchForm()

  • Step 8: get a cup of coffee

  • Step 9: there is no step 9


The Long Version


Download the file yahoo-search-plugin.php. Copy the file to wordpress/wp-content/plugins. Login to the admin page and enable it on the Plugins page.


Next, go to the Options page where a new tab, Yahoo! Search, will show up. The only thing that must be changed is the application id. Click the link provided to go get your very own appid. You must either register with Yahoo! or already be a card-carrying member. Read and understand the TOS.


Once you have entered your very own appid and clicked “Update Options”, your ready to begin searching. You just need a search form…


If your comfortable editing the theme templates just jump right in. It is a single function call that presents the search form and prints out the search results if a query is present.


<?php yahooSearchForm(); ?>


If you are using the default template, for example, you want can create a new WordPress Page for searching (call it Search), you can install the PHP-Exec Plugin and insert the same code as above. Voila, it’ll show up in the list of Pages on each page.


[tags]yahoo-search-plugin, yahoo!, plugin, wordpress[/tags]


August 26, 2005

WordPress Updates and the Like

I’m a bit late commenting on this, but i feel the need. It is simply irresponsible to replace a software download with a different one of the same name. What’s even goofier is to hide behind the statement that it “was not officially announced yet”. Good grief, you’re playing on the internet people. I doubt many folks find out about a release from some official announcement. I read it on someone else’s blog, went to the WP download page and clicked. The page told me 1.5.2 was available and i downloaded wordpress-1.5.2.tar.gz.


Two days later i find out that i got the wrong one, because apparently that one was not the “official” one, even though i downloaded it straight from the WP download page.


So i go back to the WP download page and download wordpress-1.5.2.tar.gz, again.


Good grief.


June 8, 2005

New Bookmarks Posting

I finished setting up scuttle for my bookmarking needs and wrote a little PHP script to post the updates to WordPress. The script runs on a daily basis but only posts the links if there are four or more new links. The output is identical to that output by del.icio.us blog posting engine (so i didn’t have to mess with my CSS). The PHP just collects and formats the links, i made use of Scott Yang’s mtsend python script to actually do the posting using XML-RPC.


May 20, 2005

Automator Madness

I thought, and still think, Apple’s Automator is a great idea whose implementation has fell a little short in the Tiger (10.4) release of OS X. I have been dissapointed twice with both failures stemming from the same problem: object type mis-matches between desired actions.


My latest effort was simple enough: get the selected mail messages, grab a specific header out of each one and pass it to a shell script. Cranking up Automator it doesn’t take long to identify three seemingly useful actions:



  • Get Selected Mail Items

  • Combine Mail Messages

  • Run Shell Script


So, click, click, click and then type in a short shell script. Voila…or so me thinks. Run Boom. Unable to convert mail item object to mail message object. Good Grief. Using the View Results action led me to believe i could take the Mail Items output and convert it to Mail Messages by inserting a Run AppleScript action.


Several lines of AppleScript later, the light-bulb popped. I can accomplish this task using only several lines of AppleScript. Furthermore, Automator isn’t needed to do that. <sigh>


Ten lines of AppleScript was all that was needed. While that speaks highly of AppleScript and the application scripting interface, it makes Automator look pretty dumb.


February 24, 2005

Subverted Converted

Looks like Subversion is the next evolution of CVS. Many of the CVS limitations have been addressed, except for communicating the need for such software to the average Comp Sci grad.


WordPress made the switch.


January 22, 2005

More Better Development

The ONLamp.com article Rolling With Ruby On Rails, as seen on slashdot.org, is a good example of where software development should be headed; however, the devil is still very much in the details.


Abstracting away the SQL statements and even the db schema provides an excellent framework for rapid application prototyping. A very similar advancement came with TCL and the Tk Toolkit as developers no longer had to worry with all the behind-the-scenes GUI gunk (dispatching events, multiple threads, window painting, etc.). TCL had its on skeletons in the closet: human readable source and speed to name a couple. Over time the former was mitigated with tools and libraries to load byte-compiled code, while the latter still generally would require performance critical code to be implemented in C as a TCL binary package.


The Rails framework would seem to provide an express train to disaster when you begin desiring things like data validation, parameter checking, data scrubbing, security. You know, the little things.


Bottom line: there is no free ride; however, I would gladly look at the Rails framework for prototyping or a short-term internal or personal use application. It would provide a quick way to test an idea.


December 10, 2004

Response Code Delta

I was pleasantly suprised when a bugzilla notice from the Apache httpd-2.0 developers showed that the 226 HTTP response code was merged into the 2.1.3 release. The 226 response code is needed for implementing RFC3229 (Delta Encoding for HTTP/1.1).


Then a few hours later, a new bugzilla notice:


per veto from roy, this change was backed out of 2.1.3.


With a resolution of WONTFIX. <sigh>


There was some discussion that went on, but ultimately the power of the golden veto was levied.


This is one of those issues that plagues developers everywhere. There are two trains of thought: don’t let folks shoot themselves in the foot and here’s the gun, careful, its loaded.


Obviously, the initial Apache httpd implementation falls into category one. The code will rewrite any unknown HTTP Response Code. Even though the HTTP 1.1 spec says:


HTTP status codes are extensible. HTTP applications are not required to understand the meaning of all registered status codes, though such understanding is obviously desirable. However, applications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class, with the exception that an unrecognized response MUST NOT be cached.


So the clients and proxies know what to do with a 226 code; treat it like a 200 minus any caching. But the server won’t let me send it.


In the next few weeks i will write an Apache httpd module: mod_please_dont_screw_with_my_HTTP_response_code_header


The sole function of the module will be to ensure the HTTP Response Code returned from the request isn’t rewritten by the core.


Source and docs will be available here. Its kinda sad that i’ll need a hundred line C file (and appropriate support files and documentation) to enable 15 lines of PHP code to work properly. The bright side? At least i can.


Some would argue that the module system is like providing the loaded gun. In general, yes, but not in this case; modules allow developers to extend the existing functionality (ie. mod_auth_kerb). A module shouldn’t be needed to remove functionality.


November 24, 2004

Bloglines to MBOX Aggregator

With the advent of the Bloglines API, i proceeded to migrate all my subscriptions from my own aggregator/link manager to Bloglines. I don’t mind writing apps and tools for my own use, but, as with all software projects, they require maintenance. Which means time … which i have little of.


SynGen served me well. This new code is a direct descendant from it; i’m calling it BLuMBOX. It’s all python(2.3) and requires the Universal Feed Parser (3.3). Blumbox grabs the RSS feed for your subscribed sites which have unread items and sticks them into an MBOX format file.


The output filename is based on folder name.


in_<lowercase(foldername)>


The top level folder is “Subscriptions”. If you do not organize your feeds into folders, then by default your MBOX file would be called: in_subscriptions.


Read/edit the blumbox.py file to tell it where the files should go, in addition to specifying your Bloglines userid and password. Have fun.


One Bloglines buglet: if you use the web interface to mark an entry “Keep New”, Bloglines will report that the feed has new items, but, when requested, will not return that item. There appears to be a logic bug between “UnRead” versus “New” entries.


One last thing… As with all free online services, Bloglines could:



  • Dissapear

  • Become a fee service

  • Become an evil service

  • Be sold to an evil company

  • Begin rendering RSS feed data in Swedish Chef or Klingon


So, having said that, you can simply protect yourself by backing up your subscriptions. I backup mine daily, which is probably overkill; however, if Bloglines dissapeared today (or turned into Mr. Hyde) i could be up and running in a new aggregator within minutes.


If you’ve setup a userid and have your subscriptions marked public, you can download your subscriptions in OPML format by entering a URL like:


http://www.bloglines.com/export?id=<userid>


Substitute your userid. In my case, it looks like this:


http://www.bloglines.com/export?id=jerobins


Save that data as subs.opml and your ready for anything. Any decent aggregator supports OPML import and export.


Finally: Download.


Todo: Update to use the getitems method to bulk fetch the articles from all the subscriptions within a folder.


November 22, 2004

AppleScript Folder-Action Fun

Well, Jay did something similar, but Google didn’t find it, so i wrote my own: renamer.scpt (download and open in Script Editor)


It is a folder action script that works as follows:


When a file is added to a folder with Folder Actions enabled and this script enabled, it will rename the file from:
filename.ext to filename-year-month-day.ext
ex. graphic.jpg to graphic-2004-11-22.jpg


Enjoy, oh, and Jay does offer this bit of wisdom:


you might get some odd behavior from the “downloading” part in the browser if the finder renames the file while safari is still dealing with it

September 17, 2004

Updates on RFC3229 with WordPress

Bob Wyman has summary of RFC3229 events of late, and Sam Ruby comments on Garrett Rooney’s mod_speedyfeed.


Anthony Yager had a great Suggestion for RFC3229 with Feeds for WordPress which removes an assumption i had made. Thanks.


Latest source.