Posted on 28th of August 2009
Vim is a nice editor, but I never liked the way it handles files. Thankfully I recently found a great script, which adds great quick browsing capabilities to Vim, called lusty-explorer.vim. Since 7, Vim has supported not just it’s own homegrown (and honestly fairly bastardized language) called VimScript, but also it has included bindindgs for popoular scripting languages such as Ruby and Python, so extending this script with some extra functionality was a great way to see how Vims extensibility works. And with lusty-explorer written in Ruby, this was a nice chance to learn these new aspects of Vim.
Read the rest of this entry »
Tags: editor, remotedesktop, vim
Posted in Other | 3 Comments »
Posted on 22nd of July 2009
Recently, I tried to use jQuery, as a way of dynamically loading all the scripts that a certain page requires. Instead of utilizing script tags in the header section, using a simple $.getScript("script.js"); loads the same code, what’s more, this code is loaded asynchronously, which helps improve loading performance. The only problem is that loading scripts this way, makes them unavailable for debugging.
Debugging dynamically included script files presents some special challenges on it’s own. The primary being that that the web is basicly not a structured enviroment, like a folder on disk, and references to files and/or code is can be very intermittent.
Read the rest of this entry »
Tags: ajax, debugger, JavaScript
Posted in JavaScript | 4 Comments »
Posted on 5th of June 2009
Recently, I was compelled by a friend to download GNU Privacy Guard, GPG in short, in order to do things “properly”, when we were gonna exchange some possibly sensitive data. Now, GPG is a open-source re-implentation of the venerable PGP, Pretty Good Privacy, which was one of the first widely used programs using the public-key cryptography. Public-key crypto is socalled asymmetric-key system, since the sender and receiver of a messege do not share a key before hand. It allows total strangers to communicate securely over in-secure lines. The internet’s SSL (which is usually what’s used when you see https in the address bar of your browser) is built on this technology. So what we’re dealing with here is a serious attempt at a full blown cryptographic system, used by people across the globe, wishing to communicate securely. With all this in mind, the experience I had when reading the following snippet in the Windows readme was even more jarring
The term “W32″ is used to describe the API used by current Microsoft Windows versions. We don’t use the Microsft terminology here; in hacker terminology, calling something a “win” is a form of praise. Keep in mind that Windows ist just a temporary workaround until you can switch to a complete Free Software system. Be the source always with you.
The Windows API is normally referred to as “win32″ (the 32 is a reference to the fact that it’s a 32 bit machine API). So by refusing to refer to the term “win32″, and instead use “W32″, it merely comes across as a totally juveline display of non-professionalism. Being termed a “hacker” is an honorary term in the programmer community, and as with all such things, you don’t get to name yourself a hacker. So it’s not only slightly buffoonish with the allusion to the hacker term “win”, it’s also quite campy with it’s Star Wars reference.
I’m all for the Unix philosophy and open source. In fact, I think it’s healthy for the IT world, that some people think in terms of more then just money. But when dogmatic advocacy gives trumps real world pragmatism, I’m off the train.
Tags: gpg, morons
Posted in Geek angst | 3 Comments »
Posted on 30th of March 2009
This is a problem I’ve been thinking a good deal about lately, without really coming to any conclusion, maybe because there is no right way. The issue can be summed up fairly easily, but it does betray the multitude of issue that lie beneath.
How do you handle non-english terms in your code?
Read the rest of this entry »
Tags: encoding, language, meaning
Posted in Other | 2 Comments »
Posted on 9th of March 2009
Every time I need to work with SQL, it never ceases to amaze. The language is simply such an abortion in terms of development enviroments and simple programmer usability. Naturally, alot of this stems from my inexperience with the language. Mostly this post is just my own personal gripes with about SQL.
So, at work I find that I need a function which takes a variable number of GUIDs, and presents me with a compounded status integer, pulling status indicators for each GUID, and producing a single status. Should be simple right?
Read the rest of this entry »
Tags: language, sql, sql server
Posted in Geek angst | 1 Comment »
Posted on 18th of February 2009
My site has been down for quite some time, while I both arranged some new hosting, and tried to save the contents of the old site. I want to once more, thank my buddy and old coworker, Lasse, for hosting this site for near on 9 years. Thankfully, seems that restoring WordPress is a simply matter of re-importing the SQL tables, and then uploading the whole thing to my new host.
Let me know if there’s any bumps on the site!
Posted in Uncategorized | 2 Comments »
Posted on 14th of November 2008
I’ve never been much of a C# maven or anything, but I’ve really fallen in love with this construct in the language. One thing which I guess almost anyone does alot of is building a string, from a list of business objects. Let’s say you have a list of GUIDs, and you either want to display them, or build an SQL string from them for use in a query.
List<Guid> gs;
string s;
foreach (Guid g in gs) {
s += "Id='" + g.ToString() + "' OR ";
}
if (result.Length > 0) {
s = s.Substring(0, s.Length-3);
}
That’s some good ole fashioned string fucking, and since I’ve come over from HTML/JavaScript/(Classic) ASP/PHP, that’s bussiness as usual by all standards. But I’ve never liked several aspects of it.
Read the rest of this entry »
Tags: anonymous-methods, CSharp, generics, list-comprehension
Posted in CSharp | 2 Comments »
Posted on 12th of August 2008
pngstrip (32bit, Windows Executable at 59 kb) is a small program I’ve written to strip out the various kinds of gamma and chromacity information from PNG files. It’s written in standard ANSI C, so should compile on anything reasonable, though it has only been tested on Windows XP. The source code is also freely available. It’s console program, just type out pngstrip filename.png, and filename.png will be stripped.
We spent years agonizing over the lack of 8-bit alpha channel in PNG in IE, and when we filly get it natively/nicely supported in IE they go and botch is so horribly.
Most of us have heard about gamma. But unless you do something in the graphics/print field, it mostly remains a button on our screen, where we tweak the luminocity of the screen. But of course, when an artist makes a snazzy PNG picture, making sure that it appears at the same display intensity as it did on his screen is understandably an laudarble goal. So PNG embeds gamma information, saying that this and that color, should be show at this and that intensity. The problem occurs when the BOG STANDARD (for 15 years and counting) HTML and CSS colors are NOT processed through the same system and thus don’t get the same gamma correction applied. The problem is easy to spot (need to be viewed in IE). The PNG files, once stripped, appears correctly.
I won’t really bother explaining this problem more, since it goes beyond stupid, I’ll just link further reading materials if you don’t know why you may wish to strip your PNG files for gamma information. Henri Sivonen has the best treatment on the topic.
Tags: gamma, internet explorer, png, pngstrip
Posted in Web | 2 Comments »
Posted on 23rd of July 2008
I’ve spent several long hours over the last week, trying to get Hibernate for .NET to even just work in Visual Studio. The changed configuration format has been, since I’m not seeing any real examples of how to setup NHibernate 2.0 (Beta 2, which will probably be going release later this month) on the net, I’m just putting it out there now, since I’m trying to learn the whole framework, and so far this was my biggest stumbling point.
Important to note that this isn’t a true example by any measure. It merely shows what to put in your App.config (especially since the official documentation mostly covers the Java version, which naturally has no idea what App.config is. And what little there is for NHibernate, is for the last release.
Read the rest of this entry »
Tags: hibernate, nhibernate, or mapping, Visual Studio
Posted in Serverside | 14 Comments »
Posted on 20th of July 2008
I’ve been using Visual Studio for quite some time now, but I’ve never really bothered to investigate this important tool too much. I’ve finally gotten around to check things out, and am I’m gonna try to learn some techniques to increase effieincy a little bit (almost seems like heresy). First round, I’ll focus on keyboard shortcuts. I’ve grouped them into 4 categories, navigation, debugging, editing and others, hopefully they are fairly explanatory. Now mind you that these are the default short cuts for Visual Studio for C#, for C++ and VB they may not work (you’ll have to customize the binding yourself).
Read the rest of this entry »
Tags: customize, keyboard, Visual Studio
Posted in Visual Studio | 1 Comment »