Thursday, October 29, 2009

Moronic Means of Managing IT

I'm sorry, but when you're administering the serving of a database for students to access in a group project, it is absolutely ass-backwards to only allow them to access it from a wired connection, on campus. Every other resource in the department is available through the appropriate use of usernames and passwords, including an svn repo that I have been using without any problems, whatsoever. But for some reason, databases should not be accessible from the web, and should be restricted to specific IP addresses.

Are you kidding me? Is it really so hard to expect even just some amount of parallelism between policies? To have completely different philosophies on what is accessible from off campus and what is not, baffles me.

Monday, October 26, 2009

Minor JavaScript Sucess

I got JavaScript to remove the previous content of a page and create a whole new form area! That is all.

Java API FTW

I'm no big fan of software engineering in general, and if you're not, you might as well just scroll on by here, but if you're looking to implement the Factory pattern, did you know that Java has a built in generic class called Class? All you've got to do is
  1. define an abstract parent class for your objects, (called PARENT here)
  2. with an abstract method that returns an object of its type, (called CREATE here) and then
  3. define the class that's going to generate your objects (called FACTORY here),
  4. with a method that looks something like:
You need childClass.newInstance() because you can't initialize a generic class (which makes sense since, if you could, in this case you can't guarantee that the child even implements a constructor, since the abstract PARENT class doesn't have to).

As well, this actually throws an unchecked casting warning, so it probably needs a little tweaking. But everything else seems to upgrade the issues from a class cast warning (that you know of course won't happen, since C extend PARENT, and PARENT is abstract, and has abstract method CREATE that returns an object of class C)--from a class cast warning to a full-blown compiler error with the generics, so...

Sunday, October 25, 2009

JavaScript tutorials

Here are the Javascript tutorials I've been slowly going through today.

Twitter and Javascript

So, here's some code for displaying your twitter feed in text. Yes, a bunch of it's just referring to someone else's googledocs project. ... Whatever.

AJAX

So here I was, thinking AJAX was some magical combination of various elements. Apparently not. At least, not on the client side. You just have an "XMLHTTPRequest" object that you
  1. define a field called onreadystatechange as a lambda function for what to do when the server hits you back,
  2. open() with options to
    • read or write, like a file,
    • locate the script running the server, and
    • whether or not to run asynchronously
  3. send() after you've opened.
There. Ignoring IE 5 and 6 (which every sane person should do), there's your API for a client side AJAX script.

svn import src/

A documentation of my coding successes and woes.