Archive for July, 2003

Generating Code

Wednesday, July 30th, 2003

There is an excellent article on code generation at Frans Bouma’s blog

One potential disadvantage he mentions is that the generated code is not up to par with the functionality requirements you have.

I have a similar concern. That is, they can get big, complicated and become the centre of attention. This can detract from the application being built. At the end of the day, we are building a system or application for a client. It is those requirements and that application which should have our primary focus.

Finally, for me the ultimate code generator is a powerful scripting language such as Perl, Python or Ruby. Using these, you can build and maintain custom code generators quickly.

Woohoo!!

Wednesday, July 30th, 2003

Fixing the MT bookmarklet for Safari :: The Daily Journey :: JayAllen.org

Dance and sing for the world is now a brighter place

I can post using Bookmarklets from Safari. One keystroke, cmd-1, and I am posting…

Of course to do this, means that the Bookmarklet must be the first item in the Safari address bar and that I must have some text selected.

Nifty Tool for Web Editing

Tuesday, July 29th, 2003

Surfed upon this nifty little tool that lets you key in some text, press a button and hey presto, you have some formatted HTML.

The link is now sitting on my Address Bar

Code Completion

Tuesday, July 29th, 2003

Code completion comes in a number of flavours. One way is syntax expansion. Another way is recognizing code symbols (such as procedure and variable names). A third is to match strings in the current file.

<p>Syntax expansion is like providing a template and you fill in the blanks. For example, while coding Perl, if you type <code>if</code>, the editor will recognize <code>if</code> as a keyword and then expand it to <code>if (){ }</code> to suit your favourite brace style.</p>

<p>The second way is by understanding the program code. By recognizing the procedure names as you key them in, the editor can supply parameter information and prompt for parameter values. This is a real boon. But, the real kicker is when it starts recognizing procedure names from other project files or even standard code libraries.</p>

<p>The third category of code completion, works with arbitrary strings. Instead of retyping long strings, you type the first few characters and then get the editor to look for a matching string. Sort of like an incremental search. Except that you have the option of using the string that is found.</p>

<p>For example in <a href="http://www.slickedit.com">Visual Slickedit</a>, as you key in some text, you hit <code>ctrl-shift-<</code> and the editor will search backwards in the file to find the first matching text. If this is not the text you are looking for, hit <code>ctrl-shift-<</code> again to find the next match. Once you have found the right piece of text, you can either hit enter to use it or you can pick up more of the surrounding text by pressing <code>ctrl-spacebar</code>.</p>

<p>All three of these techniques are provided by <a href="http://www.slickedit.com">Visual Slickedit</a> and <a href="http://www.vim.org"><span class="caps">VIM</span></a>.</p>

Jump to Definition (and back)

Tuesday, July 22nd, 2003

Another feature that I can’t live without in an editor is “Go to Definition”. Basically, if you are examining a variable or procedure and you want to get to the definition, just press a hotkey and the editor will position you at the definition. If the definition is in another file, the editor will open and load the file and position you at the right place. You can get back to the place you came from by pressing another hotkey.

This feature is reasonably common and is found in Visual Slickedit, VIM, the Visual Basic Application editors (Excel, Word and Access) and even the Visual Studio .Net IDE (although this took some digging to find). Again, I haven’t found a way of doing this in BBEdit.

Selective Display (aka folding)

Tuesday, July 22nd, 2003

I am a simple guy. I can’t keep reams of detail in my head at one time. I like to see an overview of what is happening and when I need the detail, I want to get to the relevant bit quickly. When finished dealing with the detail, I want to return to the overview.

And I want to do this fast!

Any editor that supports this is a real saviour. Of the editors I currently use, Visual SlickEdit provides Selective Display and VIM provides Folding. Unfortunately I have not discovered this feature in the doyen of Mac editors BBEdit

I use it in a couple of ways. The first is to see the structure of the code i.e. what can be called and what calls it. The second is to place the cursor on word, hit a hotkey and have all occurrences of the word displayed. Hit another hotkey and the entire file is displayed again.

So what you say. A grep or find all occurrences does this already. But the difference is that selective display shows the results in the same window. From a coder’s perspective, it looks as though all lines that don’t contain the word have been hidden and the ones that do remain visible. You can now use normal cursor navigation to get to the line you want. Once there you can edit or even make changes.

To try out selective display in Visual Slickedit, look at the View Menu and bring up the selective display dialog. To learn about folding in VIM take a look at the VIM online documentation.

Starting Again

Sunday, July 20th, 2003

Finally got around to setting up a blog using movabletype on a Linux hosting service.

Decided on movabletype because it is relatively open, it is done in Perl (with which I am familiar) and it also sits on top of a database. The real clincher was the user interface and the way that it handles mulitple weblogs and authors.

For the hosting services, I settled on mtvhosting to do the hosting as they offer great facilities at a reasonable price.