Home >> Blog

iHwy Development Blog

The iHwy team shares their musings about their development experiences.

We've released a new version of our jQuery Validation plugin credit card extension. Changes include:

  1. updated card prefixes (including latest Discover Card changes)
  2. support for LaserCard

More info here:

http://www.ihwy.com/labs/jquery-validate-credit-card-extension.aspx

We have other lab stuff here, too:

http://www.ihwy.com/labs/


We've released a new version of our jQuery Validation plugin credit card extension. Changes include:

  1. updated card prefixes (including latest Discover Card changes)
  2. support for LaserCard

More info here:

http://www.ihwy.com/labs/jquery-validate-credit-card-extension.aspx

We have other lab stuff here, too:

http://www.ihwy.com/labs/


We've released a new version of our jQuery Validation plugin credit card extension. Changes include:

  1. updated card prefixes (including latest Discover Card changes)
  2. support for LaserCard

More info here:

http://www.ihwy.com/labs/jquery-validate-credit-card-extension.aspx

We have other lab stuff here, too:

http://www.ihwy.com/labs/


New versions of our jQuery listnav and listmenu plugins are now available:

http://www.ihwy.com/labs/jquery-listnav-plugin.aspx
http://www.ihwy.com/labs/jquery-listmenu-plugin.aspx

What's new:

ListNav plugin

1. added an includeOther option to provide a top level '...' nav link to access items that start with chars other than A-Z and 0-9. For example, chars like Ä and Ü.

2. added a prefixes option to provide a way to show "The New York Times" under T and N. Pass in your own prefix array.

See the new demo 6 here for examples of both:

    http://www.ihwy.com/labs/Demos/Current/jquery-listnav-plugin.aspx

ListMenu plugin

1. added an includeOther option, just like the one for the ListNav plugin.

2. added an onClick option that simplifies handling clicks in the dropdown menu (for things like pulling an href out of the clicked link to use it for an ajax call). The onClick uses event delegation, so is low overhead and the clicked object is available as a jquery object in your onClick function.

See demo 3 here for includeOther example and demo 6 for onClick example:

    http://www.ihwy.com/labs/demos/current/jquery-listmenu-plugin.aspx

Some of these features were based on user requests from the jQuery community. Thanks to everyone for the feedback!


New jQuery ListMenu 1.0 plugin released!

Posted on March 2, 2009 12:55 by Jack
Today we released the iHwy listmenu plugin, which allows a web developer or designer to convert a basic 'list' of HTML elements (UL, OL or any set of child elements) into a snazzy dropdown menu with letter-based navigation (ie: A | B | C | etc).

The plugin is very easy to use. In most cases all a web developer will have to do is create the list of elements and then use one line of jQuery code to convert the list into the navigation menu. When a user hovers over a navigation letter in the menu a submenu appears containing all of the items from the list that start with that letter.

The items in the submenu are arranged in nicely balanced columns. If the list was an ordered (OL) list, numbering starts at 1 for each letter and is maintained across the columns (top to bottom, left to right) for that letter. There are options to control the number of columns and the 'gutter' space between them, among other things.

The HTML generated by the plugin is designed with CSS styling in mind and a starter css file is included to help implement the plugin.

We tuned this plugin for speed and tested it in FF 3.x (Win/Mac), IE 6/7/8rc, Opera (latest), Safari (Mac 3.2.1, Win 4beta) and Google Chrome (Win) using jQuery 1.3.2 and 1.2.6 (1.3.2 is faster, probably because of sizzle).

This is great plugin for big product lists, address books, contact lists, etc. It makes a hard to navigate plain old list into something really compact and very easy to visually skim that's only visible when you need it.

Full documentation:

    http://www.ihwy.com/Labs/jquery-listmenu-plugin.aspx

Multiple demos:

    http://www.ihwy.com/Labs/demos/current/jquery-listmenu-plugin.aspx


This project grew out of the jquery listnav plugin that we released in late 2008 (and released a new version of today). It's been exciting to work on these contributions to the open source world. We hope you enjoy them!



iHwy jQuery ListNav plugin 2.0 released

Posted on March 2, 2009 12:45 by Jack
Today we've released a new version of the jQuery ListNav plugin that we released in late 2008. This plugin creates a letter-based navigation bar (ie: A | B | C | etc.) for any UL or OL list. Clicking a letter in the navigation bar filters the list to show only items that start with the letter. When a user hovers over a navigation letter, an optional 'count' appears above the letter, signifying how many items are under that letter. Letters that have no items under them appear as "disabled" (via a CSS class you can set).

Full info is here:

    http://www.ihwy.com/Labs/jquery-listnav-plugin.aspx

And here's a direct link to the demos:

    http://www.ihwy.com/Labs/demos/current/jquery-listnav-plugin.aspx

New features in this version:

1. By default, the nav bar now includes a [0-9] navigation button to show items that start with numbers. There's an option to hide that if you don't need it.

2. If you include the jquery.cookie plugin in your page, you can use the new ListNav cookieName option to have the listnav control remember the last letter your user clicked, then reload the list automatically to that letter when they return to the page.

3. Added optional onClick handler: you can fire a custom function after a navigation letter is clicked. The letter that was clicked is available as an arg for your custom function.

4. Dropped a few options that had to do with forcing CSS class names on the list: all styling is now handled purely via CSS.

5. Modified some class names used in the HTML that the plugin generates, to provide more a more unique naming convention and additional handles to style elements.

We enjoyed creating this new rev. There are still a few requests on our plate, including handling of DL lists and the ability to work with any 'list' of child elements. We've got those things on our radar for future releases.

Happy navving!




Super simple SQL database restore script

Posted on January 14, 2009 18:00 by Jack
The database restore wizard in SQL Studio has always been kind of a pain to wade through and get right. Usually the hassle part comes from having to modify the directory path that the backup will be restored to, because the path it was backed up to is different than the one it will be restored to.

Here's a simple two step script that we use to restore backups, regardless of what path they were originally backed up to. First, run this to basically "introspect" the backup that you want to restore. Modify the path so it points to the actual path where your backup file is:

RESTORE FILELISTONLY FROM  DISK = N'C:\somewhere\mydb_backup.bak'
GO

That will give you back some results that show you the LogicalName and PhysicalName of the data and log backup files. For the next step, you just need the LogicalName(s). I usually just copy them out of the results and paste them into this script where necessary:

RESTORE DATABASE [mydb] -- name of your newly restored db
FROM  DISK = N'C:\somewhere\mydb_backup.bak' -- same as step 1
WITH  FILE = 1, 
MOVE N'mydb_Data' TO N'C:\somewherenew\mydb.mdf',  -- db LogicalName and new db file path/name
MOVE N'mydb_Log' TO N'C:\somewherenew\mydb_1.ldf',  -- log LogicalName and new db log path/name
NOUNLOAD, 
STATS = 10
GO

That's it. This should cover the most common restore, where you have a backup file that you want to restore and create a new db at the same time.

We have a copy of this script in our team utils directory and just modify the file and db names in it whenever we need to do a restore. No more hunt and pecking through the wizard.

Kiosk mode in Firefox using the Fullscreen plugin

Posted on December 31, 2008 14:48 by Jack
We have a client who wanted their point-of-sale web application to launch and run in Firefox in 'kiosk' mode, so that it took up the full screen and no browser menus, tabs, etc. showed up on the screen. Internet Explorer has a kiosk mode built in, but Firefox doesn't (the closest it gets is 'full-screen', but some parts of the browser are still visible, although slid partially out of view). I found a Firefox kiosk plugin that looked like it would do what we needed. Ran it through some tests and it looked good:

https://addons.mozilla.org/en-US/firefox/addon/1568

To use it: install the plugin, then restart FF, then go to Tools > Add Ons and find the Full Fullscreen plugin in the Extensions list, click Options, then check 'Fullscreen on startup', check 'Prevent navbar auto-popup' and check 'Hide tab bar', then close the Add Ons dialog. Set your default page to the page you want the browser to launch with, close all pages/tabs and restart the browser. Your default page should load and take up the entire screen.

Our client asked about cookies, since their application uses them to remember a terminalID for the point-of-sale terminal to load. Cookies work normally, since things are just running in the browser, so no problems there.

Note: this doesn't do a lockdown that prevents a user from hitting F11 to toggle between full and regular screen views. Users can hit alt-F4 to close the browser, too. If they do, when they relaunch the browser it will load up in kiosk mode again.

It'd be nice if Firefox had this built-in, but since it's a pretty rare requirement, I can see why it wouldn't be. This plugin filled the gap nicely.



I had a case recently where I had to query some data from a Microsoft SQL Server 2005 database and insert a row in the results before the result set. Here's a spiffy little example of how I did it. Neat little trick that can come in handy for cases like this.

-- First you create a var that's a table with cols that match you desired resultset:

declare @tbl table (
  categoryID int, categoryName nvarchar(100)
)

-- Then insert the data you need in the first row:

insert into @tbl (categoryID, categoryName)
 values (-1, 'Unknown')

-- Then select and insert the rest of the data:

insert into @tbl (categoryID, categoryName)
select categoryID, categoryName
from category
order by categoryName

-- Check the results:

select * from @tbl

This was very handy recently inside of a Cold Fusion cfquery tag for adding a "dummy" category to a list of categories. The dummy category got the "Unknown" category name and then the rest of the categories were added to the table. Then in some other code some sets of products got related back to the categories in the table. Products that didn't have a categoryID assigned to them fell into the "Unknown" category for display in an heirarchical tree we did with some jQuery.

Creating delimited list using TSQL

Posted on November 24, 2008 10:56 by Jack
This is a neat little trick I picked up. If you've ever needed to create a delimited list from a single column of data stored in SQL Server and felt like it required unnecessary arm wrestling due to SQL syntax limitations, this could be handy for you next time, too:

Let's say you have a column called "lastName" and want to get a comma-delimited list of last names. Here's a way:

-- set up a var for the list

declare @list varchar(1000)
set @list = ''


-- create the delimited list using a query

select @list = @list + lastName + ', ' from person

-- trim off the trailing comma and space if necessary

if @list <> '' set @list = left(@list, len(@list) - 1)

-- take a look at the results

print @list

Here are some example results:

Rubble, Flintstone, Jetson, Munster

Neat trick.