Saturday, September 09, 2006

From the depths of the grave...

Now, I know what you're thinking...
"Where the heck has this guy been!??!?"
...Sigh... I've neglected yet another special someone. My online fanbase. ;-)

So, to my two readers (mom and dad), I send you this:
I installed Vista RC1! And it plays games (kinda) and it runs faster (kinda) and it's very user friendly (kinda) and AMD64's now have a reason to brag about their processors! (ok, that was just a lie).

Gaming
the reason we use windows to begin with!
Vista is amazing when it comes to gaming! If you can get your game installed (many games do install properly) they run just like in XP! For a while I was very worried that I would have to rebuy (ok, ok, I'd really just re-torrent) my favorite games to run on vista. It wasn't a worry that was misplaced, either. As the Apple community knows far too well, when the big "9 - X switch" happened, TONS of legacy software had to be ported over OR users were required to emulate OS9 in their knew OS. This was something they tended to not talk about when they were pushing their propaganda... now, on with my Microsoft propaganda... I mean, review.

Most of my games installed successfully on the RC1. I've installed Doom3, Halo, UT2004 (the CD version installs, but the dvd one freaks out, oddly), Steam (HL, HL2, CS), Soldat, and Worms Armageddon.

Interesting note: Windows currently keeps an index of all your files (essentially turning your entire computer into a database) to allow for instantaneous file searching. While you Apple users say that Microsoft stole that from you, please educate yourself on the Longhorn (vista's original codename) keynotes and you will find that this feature was clearly stated before 10.4 (the first version of OSX to have spotlight) features were announced. So, it would be pretty silly to say that.


A nice feature (or maybe slightly unnerving depending on how you feel) is that Vista checks for games that you install and places links of them in the "Games" smart folder. I then pulls information from the internet like the box art, the rating, and the developer website. Originally, I thought that it just did a quick search through the registry, but I copied the "Worms Armageddon" folder from my friend's computer and placed it on my machine. Almost immediately, vista placed the game in my Games folder with the art and rating!
You can turn off indexing, but I haven't noticed any serious CPU delays.

The only games I have yet to get working are Unreal 2 (UT2004 works, oddly) and Operation Flashpoint.

Thursday, March 16, 2006

Moo.Ajax

Moo.ajax Tutorial
Download Source Preview Example
Hi all, I know how everyone wants a moo.ajax tutorial and since I just finished redoing an old ajax website to use the moo libraries, I figure I can type it up really quick.

First of all, Ajax.
As you’ve heard a million times, ajax is simply the ability to communicate with your webserver without your user being required to wait for the response or be redirected (you can have dynamic page updates).

Moo.fx recently released a new library for making ajax calls very simply. The problem is that the documentation is lacking.

Since I was redoing an older ajax website, I went through the moo.ajax library code (it’s very small, took about 5 minutes) and discovered how they were making the calls.

This tutorial should simply explain how to use moo.ajax with php and also use it in correlation with the other moo.fx libraries for some pretty cool transitions for your ajax applications.

Starting off…
Let’s start with a simple application that will allow the user to replace a div with server information (much like the scoreboard example done over at deckerD).

(let me fir
st off appologize for the images instead of code, blogger won't allow me to post code with tags like "head". You can download the complete source here).

HTML:

Let’s take some time to see what’s going on here.





First off, the moo.fx libraries are added (including moo.ajax).






Next, a simple function is made for executing the moo.ajax.
it’s first parameter is the server side script (fileFinder.php).

Next comes the options
, as with all the moo libraries.

  • postBody: the default method for moo.ajax is post, so postBody allows you to send arguments to your serverside script (we’ll see how to extract them later).
  • update: sends the server’s response to a specified div
  • onComplete: allows you to execute a function after the response has been received.









This snippet of code handles the transition after the ajax command is received. The first action is that the current div’s contents are copied over to the “switch” div (luckily this script is run before the update argument!).
Next, two instances of effects are created for switch (one with a time value of “0” for instant changing) and an instance is also created for the content div.
The content is initialized collapsed “myResize.hide();” and toggled to expand after 20milliseconds.

The switch div is first hidden, then toggled, both instantly (this is done to clear any previous state the div was in before, also to reset the size since the content copied over may be larger than the previous data). Then the switch is collapsed after 15milliseconds (hopefully along with the content layer for a neat transition).










In the body there are the two divs and a link inside “content” that runs the moo.ajax script on interaction.


PHP (fileFinder.php):






This php file just processes the arguments sent to it ($_REQUEST[‘action’]) and goes through the switch loading the other php files (identical to the scoreboard example).


TIP: If, though you want(or need) to send multiple arguments, separate them with some character and “explode” them into an array (example below).








PHP (info1.php):









This php file just prints out some html text, and also adds a link for going to the next file.

NOTE: In all honesty, the link doesn't have to be written in php. I did that so that I could easily break it apart for adding dynamic links (aka: I could use the multi-argument example above to make the link go somewhere else from the first command (control the post-flow of content).

See it all in action
Now that all the code is out on the table, let’s see it working!
Click Here

Some other tricks:
A new problem I’ve encountered since I started working in ajax is that I am beginning to miss my “onload” commands I knew and loved so much. You can only place an “onload” in three situations,
  1. iframes
  2. Body
  3. Images
I found a quick (and dirty) way of getting my onloads back for ajax. Simply place an image in your code with a height and width of “0px”. While this looks really nasty in the code, it is unseen by the users and allows you to execute functions that would take time to program around (simply good for people who are upgrading their websites to ajax).
Note: if you know any other way to do this that isn’t as dirty, please comment!, lol.

Well, I hope that helps yall.
~follower