jamesoff.net




11
Apr
2008
0

Delphi documentation

While writing some Delphi code at work, I spotted this in the documentation. Not sure if I want to call that function or not now…


Permalink | Posted in Coding Work and tagged  



10
Apr
2008
0

Irssi typing speed script

I have written an irssi script which measures how fast you type on IRC and reports both words per minute and characters per minute.

More details and download: WPM script.


Permalink | Posted in Coding my stuff and tagged  



1
Apr
2008
0

BBC News Stylish script

The new BBC News layout seems to be causing some people to stress out a bit - but then all new redesigns do until they get used to them. I quite like it, but for a friend I knocked this up quickly to get rid of the two banners across the top of the page.

You’ll need Stylish and then stick this in a userscript for it. You may need to adjust the domain (2nd line) if you don’t use news.bbc.co.uk to access the site.

(more…)


Permalink | Posted in Coding internets and tagged  



17
Feb
2008
0

GuardChan now bans

After a user request on IRC, my guardchan script can now actually ban as well as kicking when it detects an unauthorised user joining the channel.

(The page for the script incorrectly said that it kickbanned already, but that was an error due to me writing the script about a thousand years ago.)

Hope it’s of some use :)


Permalink | Posted in Coding and tagged  



28
Oct
2007
0

A productive day

What a productive day (for a Sunday):

  1. Released bMotion 0.1.0 - only about 3 years after I planned on it originally. 0.1.0 is greatly improved over the previous version, and a few weeks ago I finally decided I should stop pointless tinkering with it and get a stable releasable version :)

  2. Finished Zelda: Phantom Hourglass on the DS - mainly in celebration of releasing bMotion.

  3. Started using my Simple Monitor project at home and on my colo, and it’s working well so far. The only problem was that both machines needed Python updating to support the native sqlite class. Once that was fixed, both worked fine and are now monitoring their services. Once I get some other features I’m planning on written in, I’ll release it for other people to try.





23
Oct
2007
0

Checking for another process before starting JKDefrag

A user on the JKDefrag forum was asking about not running JKDefrag if another process is running (as they don’t play nice together), so I whipped this up.

You’ll need PsList from SysInternals in your path somewhere.

Change the three SET lines to point to jkdefrag, give the parameters you want to use, and the name of the program to avoid. (Get the name of the program from PsList.)

The “>2 NUL” sends stderr to NUL to avoid printing the PsList banner. It works on Vista, not sure about XP/2003. If it doesn’t just remove it and live with the PsList banner showing up.

Making this check for more than one process is an exercise for the reader. Also, you could use this with PsExec to check for the process on a remote host and then launch JKDefrag over there.

@echo off
 
REM Only run jkdefrag if another process is not running
 
REM Path to jkdefrag
SET JKDEFRAG=c:\jkdefrag\jkdefrag.exe
 
REM Options for jkdefrag
SET JKDEFRAGOPTS=-a 3
 
REM Process we don't want running
SET AVOID=explorer
 
 
REM Here we go!
 
pslist %AVOID% > NUL 2> NUL
if %ERRORLEVEL% == 0 goto skip
 
REM If we made it here, pslist didn't find the process
echo Couldn't find %AVOID% running, starting jkdefrag...
%JKDEFRAG% %JKDEFRAGOPTS%
goto end
 
:skip
echo %AVOID% is running, not running jkdefrag
 
:end




21
Jul
2007
4

TASK: Shoot yourself in the foot

I found this online somewhere while I was working at Grey Matter, and I’ve had it printed out ever since. So I can recycle the hardcopy, I’m reproducing it here. Feel free to add your own contributions in the comments :)

TASK: Shoot yourself in the foot

  • C: You shoot yourself in the foot

  • C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can’t tell which are bitwise copies and which are just pointing at others and saying, “That’s me, over there.”

  • FORTRAN: You shoot yourself in each toe iteratively until you run out toes, then you read in the next foot and repeat. If you run out of bullets, you continue with the attempts to shoot yourself anyway because you have no exception-handling capability.

  • Pascal: The compiler won’t let you shoot yourself in the foot.

  • Ada: After correctly packing your foot, you attempt to concurrently load the gun, pull the trigger, scream, and shoot yourself in the foot. When you try, however, you discover you can’t because your foot is of the wrong type.

  • COBOL: Using a COLT 45 HANDGUN, AIM gun at LEG, THEN place ARM.HAND.FINGER on HANDGUN.TRIGGER and SQUEEZE. THEN return HANDGUN to HOLSTER. CHECK whether SHOELACE needs to be RE-TIED.

  • LISP: You shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which …

  • FORTH: Foot in yourself shoot.

  • Prolog: You tell your program that you want to be shot in the foot. The program figures out how to do it, but the syntax doesn’t permit it to explain it to you.

  • BASIC: Shoot yourself in the foot with a water pistol. On large systems, continue until entire lower body is waterlogged.

  • Visual Basic: You’ll only appear to have shot yourself in the foot, but you’ll have had so much fun doing it that you won’t care.

  • HyperTalk: Put the first bullet of the gun into foot left of log of you. Answer the result.

  • Motif: You spend days writing a UIL description of your foot, the bullet, its trajectory, and the intricate scrollwork on the ivory handles of the gun. When you finally get around to pulling the trigger, the gun jams.

  • APL: You shoot yourself in the foot, then spend all day figuring out how to do it in fewer characters.

  • SNOBOL: If you succeed, shoot yourself in the left foot. If you fail, shoot yourself in the right foot.

  • Concurrent Euclid: You shoot yourself in somebody else’s foot.

  • 370 JCL: You send your foot down to MIS and include a 400-page document explaining exactly how you want it to be shot. Three years later, your foot comes back deep fried.

  • Paradox: Not only can you shoot yourself in the foot, but your users can too.

  • Access: You try to point the gun at your foot, but it shoots holes in all your Borland distributions diskettes instead.

  • Revelation: You’re sure you’re going to be able to shoot yourself in the foot, just as soon as you figure out what all these nifty little bullet thingies are for.

  • Assembler: You try to shoot yourself in the foot, only to discover you must first invent the gun, the bullet, the trigger, and your foot.

  • Modula2: After realising that you can’t actually accomplish anything in this language, you shoot yourself in the head.


Permalink | Posted in Coding Fun 



16
Jul
2007
2

Testing posting from Vimpress

Is this thing on?

It looks like I can post from vim, but there’s something in one of my posts that makes Python’s xmlrpc library burst into tears and I can’t view a list of my posts :(





26
Apr
2007
0

windowtidy for irssi

Finally got around to writing a script for irssi which closes all empty windows.

It’s over here


Permalink | Posted in Coding internets 



24
Feb
2007
0

Reformatting SomethingAwful forums

I’ve just found the Stylish extension for Firefox, which is to CSS what Greasemonkey is to JavaScript, or something. It lets you define CSS snippets for pages. Admitted what can be done with this can be done by hacking up your userContent.css file but this makes it so much easier.

Go see userstyles.org for an index of snippets you can download. Meanwhile, I present my own one for the SomethingAwful forums. It does the following:

  • Highlights the thread row under the mouse on a forum page
  • Moves the “somenick fucked around with this page” text off to the right and makes it less intrusive
  • Moves the paginator from the bottom of the page to be hovering bottom right at all times; semi-transparent mostly but opaque when moused over. This works on both forum views and reading a thread.
  • Hides the post buttons (edit/quote/report) except for the post your mouse is over.

BEHOLD!

snapshot8.png

snapshot9.png

To install, create a new blank style in Stylish and dump this into it:

@namespace url(http://www.w3.org/1999/xhtml);
 
@-moz-document domain("forums.somethingawful.com") {
 
	tr.thread:hover td {
		background-color: #fff7df !important;
	}
 
	.postbody .mainbodytextsmall {
		text-align: right !important;
		color: #555;
	}
 
	div[class="pages bottom"] {
		position: fixed;
		top: auto;
		left: auto;
		right: 5px;
		bottom: 0;
		background-color: #fff7df;
		border: 1px solid black;
		padding: 3px;
		font-size: 12px;
		-moz-opacity: .50;
	}
 
	div[class="pages bottom"]:hover {
		-moz-opacity: 1;
	}
 
	table[class~="post"] .postbuttons {
		-moz-opacity: 0.2;
	}
 
	table[class~="post"]:hover .postbuttons {
		-moz-opacity: 1;
	}
 
}

Permalink | Posted in Coding internets