Sep
10
2005
If you want to use a greater than sign (>) in an XML document you need to escape it. I once had to meticulously look over a 120 MB xml file that was generating a parsing exception, the cause of the exception, a greater than sign. Escape the following characters they are intended as xml/html content.
< <
> >
& &
Let me also mention some common characters that I escape when working with HTML.
© © Copyright
  Space
< < <
> > >
& & &
no comments | posted in HTML/XML, TechKnow
Sep
8
2005
This piece of code, simple as it is, took me a long while to develop. I am not well versed in Visual Basic and yet needed to find the default printer. I searched in a 1000+ page book, all over the internet, and after a lot of trial and error got it working. This Visual Basic script code block returns the default printer:
' Returns the default printer
Function GetDefaultPrinter()
Set WshShell = WSCript.CreateObject("WScript.Shell")
sRegVal = "HKCU\Software\Microsoft\Windows "
sRegVal = sRegVal & "NT\CurrentVersion\Windows\Device"
sDefault = ""
sDefault = WshShell.RegRead(sRegVal)
sDefault = Left(sDefault, InStr(sDefault, ",") - 1)
GetDefaultPrinter = sDefault
End Function
no comments | posted in TechKnow, Visual Basic
Sep
4
2005
Currently my favorite IDE is Eclipse 3.1.0. For this inaugural Eclipse Tool Tip, I will just mention a time saver of a feature. When creating a new JavaBean, start by defining the attributes. Once this is done, go to Source > Generate setters and getters. This will open a wizard to allow you to select the attributes which you will generate setter and getter methods. This feature will save you minutes of repetitive ‘cut and paste’ programming.
no comments | posted in IDE, TechKnow
Aug
25
2005
Technology is ever changing. At least every decade there is a new paradigm shift, every five years a new programming language, every year a new framework, and every day a new Open Source project, design pattern, and/or new jargon. It seems that as a Software Engineer you must have the memory of an elephant. Because my iPod has more memory than me I am using the blog to remember code that I have written just as a one-shot. This space will collect code snippets that I find useful, yet not important enough for me to spare precious brain cells.
no comments | posted in TechKnow