Programming : Geekin in the 7 cities

OpenSearch Plugin

I added OpenSearch to a customers intranet application a few weeks ago. It was so simple it’s almost embarrassing to blog a about it. Then, tonight, I found myself trying to remember what exactly I did to enable the OpenSearch plugins for IE7 and Firefox 2? It was so easy that it didn’t really sink into my memory very well. So I decided to add the OpenSearch plugin to my site and document it on my wiki. Maybe now it’ll stick. If not, I know were to find it! Keep in mind the OpenSearch is much deeper than a cool plugin in your browsers search box. OpenSearch is the beginning of standardized searching where the search server can describe how it’s to be searched to the client and then return the results to the client in an XML format.

Simple Tid Bit

If you’re using Access as a front-end for a Sql Server database and you decide to use the Sql Server bit data type for say, a yes no field. Do remember to give your field definitions a default value first or you will run into problems on the Access side. Access will notify you that …this record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes… every time you attempt to edit an existing record. In my case the option to save the record was disabled. I simply changed the default value for all my bit fields to 0 and everything worked fine. NULL strikes again!

Read more

PODS

Plain Old Data Structures. A couple years ago, when I first tried my hand at C#, Every project I did used custom collection classes. It seems I was always implementing the ICollection Interface, dealing with enumeration as such. So much scaffolding just so that I could write foreach thing in things. My opinion is that I’ve been wasting my time. The System.Collections and System.Collections.Generic namespaces contain enough data structures to help you accomplish any task you will normally be confronted with. These data structures help you loosen the coupling between your assemblies and leverage a long history of tried and true algorithms. Combine that with generics for type safety and I’m not sure what more you could ask for. Maybe I’m being influenced by Python, Ruby, Lua et al. Their liberal use of a few (in Lua’s case One) data structure(s) make applications more readable and in my opinion more reliable. What ever the reason, I’m all for Plain Old Data Structures.

Embedding Lua in C#

About a year ago I played around with Lua. I had a good bit of fun but it never really took off for me. As is the case so many times, I pretty much forgot about Lua. I’ve got one of those attention spans that supports moving on quickly. Recently though, Lua came back into focus. This time as an embedded scripting component in a C#/AutoCAD.NET API application that I’m working on. Extending the extension sounds crazy but there was a need for it, and LuaInterface made the job uber simple. LuaInterface allows you expose your C# methods and classes to Lua. You can also use Lua tables within C#. For the methods I want Lua to have access to, I attribute them with a custom attribute class. I use a method (got the idea here) that performs some reflection tricks and handles the Lua registration automatically. As an old friend of mine used to say, it’s killer diller.

Flickr badge vs XHTML 1.0

My website has been XHTML 1.0 Transitional for a while now. I decided to take the next step in XHTML and start serving the mime type application/xhtml+xml to user agents that accept it and serve text/html to those agents that are slipping behind the times (read IE-7). First thing I did was include this PHP code in my files.

<?php
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
     header("Content-type: application/xhtml+xml");
}
else {
     header("Content-type: text/html");
}
?>

Read more

Mindstorm Robots

A gift from Lora. Add some open source software and some determination and you get hours and hours of geek fun. I just couldn’t have any fun with the RCX if I used the original operating system. Lucky for me the brickOS team make a wonder alternative OS that enables you to write your programs in C or C++. Make sure you follow the installation instructions for a good clean setup.

Read more

Programming is not about programming

I was reminded today of what should be ever obvious. You can not program the solution to any problem properly until you have fully bound the problem itself. With all the hullabaloo over this feature or that feature of a particular language, it’s easy to forget why your even programming in the first place. The obvious answer… to solve problems. While writing a script or an application you always create a form of mental inertia. The language you’re using tends to call out solutions to problems you’ve hardly begun to understand. This is a good thing, to a point. I think this inertia stems from the collective input of the creators of your language. The shape of the language drives you in certain directions. The same can be said about design patterns. You’re gaining production time by not reinventing the wheel every time you code. It is important to remember that this inertia, like the skier flying down hill, has to be controlled. But that was a lesson I learned on a different day. Today I had to solve a large problem twice because I let the language and patterns get out in front of me. Programming is not about programming. It is about problem solving. As obvious as this is, I really felt the need to remind myself.

eXist xml database

I’ve been using eXist for a little while now on a project that I’m doing for ATS. I have to say that I like it so far. It runs out of the box with no problems. I’ve installed it on a windows server running Tomcat. ANT has tasks specifically for eXist.

Read more