hr

Vertical Selecting

Friday, August 31st, 2007

Here’s a helpful little mouse-wielding tip for all you Windows users out there (Oops, “mouse” and “Windows” - there goes my geek cred.)… Did you know that you can vertically select text in some programs? Well you can, with the power of ALT + mouse!

Selecting text with a mouse is a very important computer-user skill, that enables you to capture parts of a paragraph or sentence for use in other applications.

But what if, right, you wanted to extract just the messages from the text below, and paste them somewhere else:
(more…)

Javascript Hexadecimal Helpers

Thursday, November 23rd, 2006

Oboe ShoesHexadecimal sure comes in handy sometimes. Like, say, um, if you wanted to know why there was some of the alphabet on your scientific calculator for example. There’s been a few times I’ve needed the following functions to convert decimal bytes to hex in javascript: converting decimal RGB values to those #FF00FF looking ones, or far more commonly, creating XBM images by hand. You do create your XBM images by hand don’t you?

First up, here’s a javascript object I use to convert bytes (0-255) between the two numbering systems. I can’t remember where I got the guts of the dec2hex function. But I do like it:
(more…)

Binary on your digits

Monday, May 9th, 2005

16 1
18
Us humans are pretty handy with our beloved decimal systems, but computers just don’t dig it. It doesn’t compute. They love that ever-so-wacky binary system. They’ve got good reasons too - Why be a normal human, only able to count to five on one hand, when you can become a faux-cyborg with the ability to count to 31 with only your measly earthling fingers.

(more…)

Getting a reference to cdoex.dll

Monday, May 2nd, 2005

monkey boy13 work-hours ago I needed to switch development machines, on which I had been developing a custom .net application for a remote Exchange server.

Reloading the project on the new machine broke references to the CDO for Exchange dll. I went to add it again, but this computer only had CDO for Windows (cdo.dll, or cdosys.dll) - no cdoex.dll. I embarked on a mission to find it…

(more…)

What’s that VBScript Object?

Thursday, December 23rd, 2004

I recently needed to check for the existance and type of a VBScript object returned from a function. Perhaps you need to too.

I thought there must be a standard property of all objects, like, maybe, object.type or object.size or object.id or something. But I couldn’t dig up such a thing. I needed to check what kind of object was being returned - a Microsoft.xmlhttp XML object, or a “Nothing” object….

My “GetXMLObjectViaHTTP” function it was grabbing some xml and looking for errors like so:

If Err.number = 0 Then
    Set GetXMLObjectViaHTTP = objXMLDocument
Else
    Set GetXMLObjectViaHTTP = nothing
End If

If an error occurred in the function I had to set the return type to “nothing” which is an object (apparently). I originally set the return value as an error number, then just “”, but both wont work because of how I’m using the object returned:

Set objXML = GetXMLObjectViaHTTP( strXMLUrl )

You end up with Set objXML = “-1″, giving the error “Object required: '[number: -1]‘”

I was going to make a customer “error” class to handle it (which I ended up doing anyway…), but first I had a look around for other’s solutions. I couldn’t find anything, though eventually came across a VBScript function “TypeName()”. Running “Response.write( TypeName( objXML ) )” gives:
“DOMDocument” if it was okay, and “Nothing” if it something broke. Which is like, totally testable.

I’m too lazy to look up when TypeName was introduced to VBScript (maybe since forever), but the server I’m testing on is version 5.7426.

UPDATE: I found a couple-a more cool things: VarType() returns a type code, rather than a name. Google for the type codes, they’re everywhere unlike this function name.

Also, I never realised that you could do If objMyObject Is Null. I thought “Is Null” was only a VB construct. Anyhoo, thats useful in object detecter-ing too.

What’s that port?

Monday, August 30th, 2004

Looking through your firewall logs, or the output of a “netstat -a” and notice a connection to a port you are not familar with? And want to impress your friends? Use this cool nerdy trick provided by portsdb.org and trusty ol’ nslookup to find port names…

nslookup -q=txt port.protocol.portsdb.org

Where port is the port number you’re interested in, and protocol is tcp, or udp. For example, say you spot the following line in your firewall log:

DATE		IP		TYPE	PORT
30/08/04	234.234.234.234	UDP	1433

After you are finished being impressed by the groovy IP address, whack the following down on the command line:

nslookup -q=txt 1433.udp.portsdb.org

Non-authoritative answer:
1433.udp.portsdb.org    text =
	
        \"ms-sql-s\"

There you go. Someone trying to send a UDP packet to your SQL server. Hope you’re patched up, ‘cause it’s most likely a Slammer packet.