Monday, July 20, 2009

BitRac

I've recently started working on a project called the "BitRac Client Utility" as well as the enterprise services behind it. I wanted to create a console mode to test and debug the client but I wanted a nice prompt for entering commands and it seems rather difficult to get this information from Google.
Google, of course, is my number one source for anything IT-related. I can usually find any sort of information within several seconds using a cleverly crafted query.

Well, it turns out all you have to do to is something similar to this:

Console.Write("Enter Command>");
Console.Read();

I figured as much. :)

BitRac offers some really cool services -- and even if I am biased, you should check it out at http://www.bitrac.com/

Thursday, July 9, 2009

AstroEmpires Database

Ever play "AstroEmpires"? AstroEmpires is a browser-based video game where players gather into large groups called "guilds". The more successful guilds usually have databases cataloging explored galaxies, planets and moons. I invented a "new" method of getting this information to a database hosted on the web so that everyone could share information in near-realtime.
I'll be taking it down soon but I thought I'd describe its implementation here.

First, I used a JavaScript running in GreaseMonkey (I made versions for Internet Explorer and Firefox) to scrape the data a given user could see while he clicked on different pages.
GreaseMonkey is a browser plugin that allows you to run scripts on top of any webpage you like after it has been loaded into the browser.
If the current galaxy being viewed was "unknown", a URI would be created with parameters and then a new "script" element would be added to the page with the "src" element pointing to my server.
Like so: src="http://mywebserver/script.js?update=true&sector=55:43:55:11..."

Of course, a server-side JavaScript isn't processed on the server. I had a Windows server on the other side running IIS and changed the .js extension to be treated like an asp.net 2.0 web page.
C# code generated JavaScript to be added back as the element on the fly based on what parameters where given. In this way, a SQL database also running on the server could be updated or queried.

I expanded the application to create reports of the "explored universe" on the same server that users could login to, and added "username" and "password" parameters so that only those authorized could use the site and the same authorization could be revoked if I so desired.

I eventually turned over most of the administration to a close friend and allowed him to change the database to Oracle. I allowed him to login to my server via RDP.
I considered writing an AJAX realtime chatroom application as well, but discovered this would be a significant challenge for a "spare-time" project related to a browser-based video game. :)

Wednesday, July 8, 2009

Introduction and the Ultimate Delete Command

Hello, world! :) This is sort of a technology/programming blog that I've started partly for my own amusement, partly to catalogue and share information and partly just because I want one.
I am a professional developer with lots of scripting and administration experience. My language of choice is C# but I can program in Java, VB.net, VB6, VBA, VBScript, PowerShell, Perl, JavaScript and of course batch. I have written my fair share of SQL sprocs. I also have experience with web server/related technologies (IIS, Apache, asp, asp.net, CGI/Perl...). This is hardly a resume, but if you want mine feel free to ask for it.

I'm still laid-off for now, looking for a new job. I have two prospects - one is a developer position and the other sounds a lot more like scripting with some development. Since one of the requirements for the latter is Perl and in an environment I've worked in before, I thought I'd go look through some of the scripts I've written in the past.

I came across a batch "one-liner" I titled, "The Ultimate Delete Command". I came up with this because when trying to free up space on "special" servers, Windows Explorer would stop on files in use or ask you to confirm over and over, etc. etc. This command removes read-only, hidden and system attributes and deletes files and folders starting from the current directory in CMD. I wrote this before PowerShell was popular among the Windows crowd. :)
Use with caution.

FOR /f "tokens=1 delims=:" %f in ('ECHO %CD%') do for /f "tokens=2 delims=:" %g in ('attrib /s') do ( attrib -s -h -r "%f:%g"&del "%f:%g"&rd /s "%f:%g" /q )