Birnam Designs is a quality web design and development agency in Virginia

Archive for the 'development' Category

Dreamweaver 8.0.2 update in Vista 64bit

Monday, April 2nd, 2007

I don’t have a Vista horror story, everything has worked remarkably smoothly. That’s not to say there haven’t been any glitches, just that my overall experience has been very positive.

One minor problem that I’ve had is with Dreamweaver — the 8.0.2 update didn’t install. It turns out this problem is only with 64bit version of Vista, and is actually a problem with the InstallShield wrapper around the update file. Fortunately the fix is simple enough — even though it is fairly difficult to locate!

Adobe outlines the problem here, and provides the update file without the wrapper.

That’s not the end of the story, though. Unless you run the file with administrator privilege, you will get an error as soon as you run it. It’s a little difficult to run it with administrator privileges, though, because it’s an .msp file and “Run as Administrator” doesn’t appear in its right-click menu or properties dialog. To get around this, you need to open a PowerShell or command shell with administrator privileges, and then run the file from there.

Testing Dreamweaver templates

Sunday, February 25th, 2007

I don’t know why I didn’t think of this before.

Dreamweaver templates use the .dwt extension, which means that if you try viewing them through a browser you just see it as text, or it will try to download the file. This means that developing Dreamweaver projects means either creating the original file as a .html file and converting that to a dwt down the road, or creating an .html file that uses the template, and keep updating it. Both options are just a little more work than I think should be required.

I’m running apache, but the principle is the same (albeit slightly different steps) in IIS. I’m also running this on my local computer so I have quick access to httpd.conf, which is apache’s configuration file. On a shared server, I believe this would also work by adding it to a .htaccess file.

It’s easy, just add this line to your apache config file — httpd.conf

AddType text/html .dwt

And that’s it! Restart apache and reload the page. Apache will now describe the file as a text/html file in the header, and your browser will render it as such.

Setting up Full Text Search with SQL Express 2005 and Management Studio Express

Friday, December 15th, 2006

Here’s one for the .NET/MSSQL/SQL Express crowd.

Management Studio Express is a nice interface for managing SQL Express databases. While I prefer Visual Studio for working with the data and stored procedures, MSE is essential for the more high level maintenance like database creation and attaching, managing users, and setting up Full Text Search indexes.

First, a brief primer on FTS. It’s a brilliant tool that will take a lot of the effort out of writing search queries. It allows for much more than just boolean searches. It can also search for inflectional variations. For instance, if you searched for “apply” it will also return results for “applying,” “applies,” and “applied.” It can also return search score information to help you rank results — to which you can also apply custom weighting. The first thing to know, though, is that it doesn’t come with the default SQL Express 2005 installation! You need to install SQL Express 2005 with Advanced Services in order to have access to FTS at all.

Once you’ve got it installed in order to get it working you need to:

  1. enable FTS on the database you want to use
  2. create a folder to store the FTS index (optional: it will use the default folder if you don’t specify a location, but if you do specify a location the folder has to already exist)
  3. create a fulltext catalog with a unique ID, optionally set to the path created in the previous step
  4. add the catalog to each table in the database that will utilize it
  5. specify the columns in the tables that will use the FTS data
  6. specify the language of each column (optional, but if you don’t set this inflectional won’t work)

The first two steps are easy. In MSE, just right click on the database you want to add FTS to and open the Properties dialog. Open the Files page, and check the box next to “Use full-text indexing.” Save that and you’re ready to go. If you’re going to specify the location for the index, create the folder using whatever tool you fancy.

The first problem you’re going to run into, though is actually creating the FTS catalog in the first place. This is something that you can’t do in MSE. At least, I’ve never been able to find out how! Fortunately there’s a handy command line tool called SSEUtil (from Microsoft). It’s a bit more user friendly than the standard sqlcmd utility, which you could also use.

When starting sseutil from the command line, give it the “-c” (console) and “-m” (main) arguments. That gives you a command line into the same databases you see listed in MSE. Don’t omit the “-m” or you are actually starting sseutil as a secondary process and you will probably not have access the database you’re trying to edit. Don’t ask me why, I have no idea what the mechanics are here. All I know is that it usually takes me four hours of banging my head on the desk before I remember that little “-m” and then suddenly everything works. If you can access your database with Windows Security, that’s all you need.

sseutil -c -m

Once in sseutil, you just run two very simple commands. Don’t forget you have to say “go” to commit each command before processing. (I’m sure you could run them both and say “go” once, but it’s nice to get confirmation at each point.)


This selects the database you are managing, so replace “db_name” with the right name. To list the databases available use the sp_databases command. (Don’t forget the “go.”) Once you have confirmation “Command completed successfully” you just need to run the sp_fulltext_catalog stored procedure. This is where you give the catalog a unique ID and the optional path. You also need to tell it that you’re wanting to create a catalog (the same sp is used for deleting or re-indexing a catalog).


Again this is using sample names so replace “dbname_fulltext” and “c:\fts\dbname” with whatever works for you.

After you get confirmation on this, you’re finished with the command line. Close sseutil and get back to MSE. Open the drop down list for the database you’re managing, and open Tables. Find the table you want to add FTS to, right click and select Modify. This will open the column editing page.

In order for FTS to work, the table has to have a unique primary key. If the table doesn’t have one yet, create one. Now right click on the key icon in the margin next to the primary key, and select “Full-text Index”. The first step is to add this table to the FTS catalog you just created. This is as easy as clicking on the “Add” button (which isn’t available if you haven’t successfully created a catalog on this database!), which will add the table using the default name of FullText_for_tablename.

Now you will see the properties box on the right fill up. The only properties that you need to worry about right now is the very top one, under General. Click on that, and you’ll notice an […] button appear on the far right of that field. Click this button to add the columns of the table to the index.

This interface is very easy, just select from the available columns in the dropdown box on the first cell. The datatype will automatically be added. The “Typed by Column” box can be ignored, but I recommend selecting the language from the Language cell. This will allow you to do inflectional searches — without knowing the language SQL can’t apply the inflectional variations.

And that’s it! Add each column that you want, and do this for every table that you want. The index itself will be created and updated automatically.

For further reference, here is Microsoft’s page detailing Full-Text Search concepts. I recommend starting with Simple Term searches, and then looking into the inflectional searches. The primary SQL commands (technically, two ‘predicates’ and two ‘functions’) that are used in FTS queries are CONTAINS, FREETEXT, CONTAINSTABLE, and FREETEXTTABLE. Good luck!

Update: new version of DebugBar

Friday, November 17th, 2006

A few weeks ago I wrote about an exciting AddOn for Internet Explorer that gave IE a lot of the developer tools we have become used to in Firefox. It’s called DebugBar, and is published by Core Services. At the time, I was able to test it out with a Virtual PC using IE6 but had stability problems in IE7 on my native Windows XP box.

The problem turned out not to be with use in IE7, but a compatibility issue with the Google Desktop addon I also have installed (it records your browsing history to be searchable with a Google Desktop search). I’m very happy to report that Core Services was eager to get this fixed, and they have already released a 4.01 version that solves the issue!

After having worked with the AddOn some more, my opinion has only strengthed, and not just in regards to the new stability. DebugBar has become a very useful addition to my toolbox. It’s free for personal use, and professionals have a 30-day trial period before having to decide on the ~$75 pricetag. If you find yourself banging your head over IE development, this could be what you’re looking for and well worth the cost.

Plus, if you’re looking for a good IE tool for working with Javascript, the same developers have also released an early version of Companion.JS, a new tool for debugging Javascript. It might be an early version, but it’s already looking good.

CSS border-collapse applied to inline lists

Thursday, November 16th, 2006

One good trick using CSS is making wrapping blocks of elements. Grouping elements together used to be something developers used table cells for, but when CSS started to be used more regularly, alternate methods were invented. A common use is converting <ul> lists (which are typically vertical structures) into horizontal menus. The really good thing about the CSS-based solution is its flexibility when wrapping is involved.

For table-based designs, the number of rows and columns had to be preset. With a CSS-based wrapping solution the size of the container can dictate the wrapping. For instance:

  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
 

Can be produced like this:

The “block” and “caption” groups are kept together, and sequentially listed in the HTML. They are all floated, and therefore ’stacked’ horizontally, wrapping at the edge of the container. An arbitrary number of these groups can be placed using the same code, and the wrapping is taken care of by the rendering. Here is the same code with ten blocks:

  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
 

To get an even better demonstration, this link will open a new window that you can resize and watch how the wrapping takes place.

At first one of the drawbacks of doing this with CSS as opposed to table is the lack of a border-collapse style! As you can see from the examples above, the bordering edges are doubled. Uh-oh! Border-Collapse only applies to tables!

No problem, just reduce the right and bottom margins by -1. If you want thicker borders, just change these margins to the negative border thickness.

  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
  • block
    caption
 


PowerShell 1.0 (final) released!

Tuesday, November 14th, 2006

My new favorite tool has finally been fully released for Windows XP SP2 and Windows 2003 SP1! The Powershell blog gives the details. If you’re at all a fan of command line scripting, you’ll love PowerShell.

If you’re new to PowerShell, my first recommendation is the ArsTechnica guide to Microsoft Command Shell (one of the codenames, along with Monad and MSH, that was used to describe PowerShell before it’s wider release). Other good resources are the Channel9 Wiki Windows PowerShell QuickStart, the PowerShell blog itself, and the PowerShell for Fun blog.

DebugBar for IE7: IE grows more developer friendly

Monday, October 30th, 2006

As most Firefox-savvy web developers know, nothing quite beats the Web Developer Toolbar (WDT) extension. As if you didn’t already have enough good reasons to develop in Firefox instead of IE, the WDT gives you so much control that after using it, development in IE feels like building a house of cards in the dark. Even Microsoft recognized the advantage that WDT gave Firefox over IE, and developed their own version, called Developer Toolbar (DevToolbar). Isn’t that a clever name? DevToolbar, currently in beta 2, shares many of the same features of WDT but lacks overall polish and really feels like a beta. And Microsoft doesn’t seem to be in any hurry to finish it, either. It’s been in beta for a long time.

Recently I was pointed towards DebugBar, an IE addon that is the closest I’ve seen to providing developers a real impetus for using IE for development again. It combines features from three of my favorite Firefox extensions: Web Developer Toolbar, Firebug, and ColorZilla, as well as a few others like ScreenGrab, Live HTTP Headers, cookie viewers, source code viewers, and a couple of bookmarklets I use frequently such as Javascript Shell and RenderMode. It’s quite the toolbox.

Read on for more about DebugBar »

Joomla changes templating system

Friday, October 27th, 2006

Don’t snuggle up too closely with the current Joomla 1.5 beta, a new templating system is coming down the pipe (currently in the nightly builds) that replaces the patTemplate system that had been in development. Amy Stephen brings us the news. I trust the Joomla developers, so I’m sure this will only lead to a more flexible, more extensible system.

So now here I am, developing a site based on a version of Joomla that will now have a radically different templating system from the launch version. Am I worried? Not a bit. I am developing with fully semantic code, so the bit that involves the template is purely structure, not design. All I need to do is move my CSS file, and the transition will be very easy.

I just never thought I’d be reaping the benefits of semantic code so quickly!

How to set a Joomla template variable depending on a module’s existence

Thursday, October 26th, 2006

As ye faithful readers out there (all three of you) will hopefully see in the next week or two, I am currently redeveloping the main Birnam Designs website. I am creating new branding, new content, and will be using the new Joomla 1.5 CMS for development. Joomla 1.5 is a terrific (and free!) CMS, if you haven’t used it before, and this is just one example of how easy the templating system is.

My goal was to set the CSS class of a <div> to a particular value depending on whether or not a separate module (that was specified outside of this div) existed or not — in my case I was trying to alter the margin of my main column depending on whether or not the right column existed.

I could have probably done the whole maincolumn <div> in a conditional template, but it’s a largish section of code and I really didn’t want to maintain such a chunk in two places. Fortunately the patTemplate system that the Joomla templates are based on has a var tag, and it can handle boolean expressions that are evaluated as PHP code. Here’s how to use it:

<jdoc:var name=”CLASS_RIGHTMARGIN” hidden=”true” default=”right” modifier=”expression” expression=”count(JModuleHelper::getModules($self))>0″ false=”normal” true=”rmargin” />

Replace the “default” attribute value with the template module you want to check for, and the “false” value with the value you want if it doesn’t exist, and the “true” value to what you want if it does. The expression evaluator automatically replaces the “$self” variable in the code with the value you specify in the “default” attribute, so you don’t need to modify the expression code unless you want to extend it.

This is all I needed to use the variable now:

<div id=”maincolumn” class=”{CLASS_RIGHTMARGIN}”>

It gives me a class of “normal” if I don’t have a right margin, and “rmargin” if I do.

(note: this is using Joomla 1.5 beta, I haven’t tested this in anything else)

WordPress contact form plugin modification

Wednesday, October 18th, 2006

Douglas Karr has been kind enough to provide a modified version of the WP-ContactForm plugin that I’ve been using to manage my contact form. It’s a simple change to implement, and if you get any spam through your WP-ContactForm, this will save you a lot of headache. It’s a much simpler concept than a CAPTCHA image — it verifies humanitity through a simple challenge question. By default, this is “2 + 2 =” (4). Easy enough for anyone to answer — except for bots! Recommended.

9 javascript tips

Tuesday, October 17th, 2006

A few more great examples for using javascript to its fullest: 9 Javascript Tips You May Not Know

Are you more of a javascript beginner? I always recommend W3Schools, they’ve got a good reference for javascript. If you need to look up something quickly, GotAPI is a language reference tool built with Ajax that acts as a front-end to the W3Schools library.

While you’re at it, don’t forget to look and see what’s new in Javascript 1.7, which will be included in Firefox 2.0. (update: Firefox 2.0 final release is available!) Don’t get too excited, though, because other browsers aren’t quite there yet. Opera’s specs page says, “Opera supports the entire ECMA-262 2ed and 3ed standards, with no exceptions. They are more or less aligned with JavaScript 1.3/1.5 Core.” I’m having trouble nailing down IE7’s support.

Windows Powershell

Wednesday, October 11th, 2006

I’ve been experimenting with Windows Powershell (formerly known as Monad or MSH) recently. It’s currently in version 1.0, Release Candidate 2 (RC2), so it’s pretty much ready. Download it here to give it a try. I’ve struggled with a few aspects of it, but it’s very powerful and I’ve already started customizing it to help out with my day-to-day work.

If you’re like me, you’ve heard of how great the Linux/Unix shells (like Bash) are, but are pretty much just familiar with the old DOS command prompt. This will blow your socks off. There was just a *pop* and a realization that, ohhhh, so this is what a Shell is.

There’s a great introduction to Powershell (then MSH) at ArsTechnica that I highly recommend. But just to give you a tease, here is a one-line bit of code that will tell you how many pages Google has indexed for a specific site (I’ve used ArsTechnica again, you can see the reference in the url bit):

$q = “site%3Aarstechnica%2Ecom”; $m = ([regex] “<[^>]*>”).replace(((new-object Net.WebClient).DownloadString( “http://www.google.com/search?q=”+$q)), “”) -match “Results\s+(\d+)(\s+-\s+(\d+))\s+of\s+about\s+([\d,.]+)”; $matches[4]

 
That’s really sweet.

asfunction — calling actionscript from a flash HTML textbox

Wednesday, October 4th, 2006

asfunction: is one of those neat little tricks that I almost never use, so I usually end up having to look up the exact terminology every time. If you already know about asfunction:, maybe you’re like me and are looking it up again for the zillionth time, but now maybe you’ll be able to remember where to find it. If you don’t know about asfunction:, it can really come in handy sometimes, so check it out:

asfunction: is the Actionscript equivalent to calling javascript: from a link in a standard HTML page.

Read about use and syntax »

flash embedded fonts not showing up

Wednesday, October 4th, 2006

Here’s a quick tip — even though it was far from quick to figure out in the first place. In fact, I’ve been banging my head on the desk over this one for days.

Ever have a dynamic text box in flash that will show text when it uses device fonts, but not if you do embed any of the font? I couldn’t even get Arial to show up! Only if I switched it to static text, or dropped the embedded characters would anything show up. At first I thought it a problem with the font — it’s one of the few OpenType fonts I use and I couldn’t remember if I’d ever tried embedding OpenType in flash before. So I even went so far as to convert the font (via VirualPC -> Ubuntu -> FontForge). Nothing. I tried converting to PostScript and TTF.

The solution? It turns out the text box was set to a left-margin of a negative amount. I changed this to zero, and viola. Everything works — OpenType and all.

Check your margins!

The Flash Button One-Click Wonder

Thursday, May 11th, 2006

I recently ran into a really puzzling problem. I was creating an administrative interface in Flash, which included a few form elements (flash components) and some custom buttons. One of the buttons was a toggle switch, with a funny behavior! I could only click the button once! Subsequent clicks were ignored until I moved the cursor. Just a single pixel would suffice, but for some reason it needed to reactive the onrollover event for the button.

After hours of searching for clues online, I found some clues...

Better Web Development, part 5: Business

Wednesday, March 1st, 2006

In the last eight years, I have made lots of advances with my web development. I am always learning new methods, new tools, and new strategies on the path to intelligent web development. These are tips I’ve learned from my progress so far.

(Inspired by the Graphic Push article “The Path to Intelligent HTML“)

Jump to section:
Part II:Tools
Part IV:Flash
Part V:Business

Business

(This are tips I’ve learned as a home office-located, solo-operating, contract-based worker. These may or may not apply to your own unique situation.)

Hourly Tracking - NO

I hate keeping track of my hours, so I might be slightly biased on this one. But, biased perception aside, I believe using a fixed estimate is much better alternative than tracking my hours. Granted, you need plenty of experience before you can build an accurate fixed estimate. It also takes more up-front, unpaid time to generate your estimates, which aren’t guaranteed to turn into a paying project. But I find it is almost always worth it in the long run.

Most importantly, you’re getting everything out up front. No surprise costs for your clients! I make my estimates extremely detailed. This way, they serve as scope documentation, pricelist, and checklist. Focusing on so much detail at the start of the project means that both parties are aware of exactly what they’re getting themselves into, cost-wise and time-wise. A detailed list with individual costs for each task allows a client to see which items cost the most, allowing them to refocus their project to fit their budget. In the development phase, the estimate becomes a detailed todo list!

In most projects, a request or two will surface after the initial esimate is approved and the project gets going. This is 100% normal - developers shouldn’t be surprised, and client’s shouldn’t be reluctant to ask! But armed with a detailed estimate, both parties can easily see what was or wasn’t in the original scope, and can determine if the new request will be an additional cost or not. Again, the goal is to eliminate surprise costs. Clients are more comfortable working with you if they know the exact cost of the project from the beginning, and your cash flow is more reliable because you know exactly how much a particular project is going to bring in! (Note: there are certain projects where getting paid hourly is the better alternative, but I use fixed estimates by default.)

Time Awareness - YES

I’ve talked a little about this already in the Tools section, but let me repeat a piece of advice you’ve heard before: time is money. Especially if you’re a freelance or contract worker and work by yourself. There’s no one to distribute the work to! Good time management doesn’t just keep you organized, it also a free way to increase the value of your time. Being able to squeeze more billable hours into your day means that your days are worth more.

There are also ways to increase the value of your time that aren’t free. Another phrase you’ve heard before is: it takes money to make money. Sometimes it takes an investment to save some time down the road. For instance, if you know that a new tool will save you time, consider buying it. If part of a project is outside your comfort zone, and you don’t think learning to do it is worth the time it would take, consider outsourcing that part of the project. Sometimes learning new tricks and techniques will save you time down the road, which would mean the time spent learning it would be paid off later.

Predict Updates - YES

If you’re like me, the single most important assest to your business is your time. The more time you spend making in-scope tweaks and modifications to a fixed-estimate project, the less you are effectively getting paid for your time, and the less time you’ll have to work on other projects. You can’t eliminate the tweaks - they’re an important step towards the goal of developing something your client is ecstatic with - but you can make the tweaking process smoother for both of you. Smoother tweaking not only means spending less time on updates, but it also means being more responsive to your client and being more flexible with their needs. Sometimes this means doing extra work in the initial development.

It takes experience to recognize the most likely targets for modification - sometimes it takes experience with a particular client to know their unique trends. But once you know what to look out for, you can start simplifying those adjustments. For instance, take the XML-based link definitions I referred to in the Methods and Techniques section. I adopted that method when I noticed a tendency of my clients to edit the external links embedded in a flash movie towards the end of the project. By moving the link definitions into an XML file, I not only helped make these edits smoother for myself and my client, but I also opened up the possibility of my client being able to edit these links themselves after I had completed the project, using just a text editor!

These are a few of the tricks I’ve learned in my eight years of web development. They help improve my workflow, my efficiency, the value of my time, and my responsiveness to my client’s needs. If you’re a developer, perhaps they will help you out as well! If you have other tips, or if you disagree with anything I’ve said, please share!