Google
 

Thursday, January 29, 2009

ASCII Math is sweet!

In my work redesigning the lab webpages for the Comp 160 class I was TA for last semester, I ran across a really cool JavaScript for displaying math on webpages: ASCIIMathML. This makes all those equations super easy to read on the webpage (may take some time to render):

CodeOutput
\`x^2+y_1+z_12^34\` `x^2+y_1+z_12^34`
\`sin^-1(x)\` `sin^-1(x)`
\`\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\` `\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}`
\`f(x)=\sum_{n=0}^\infty\frac{f^{(n)}(a)}{n!}(x-a)^n\` `f(x)=\sum_{n=0}^\infty\frac{f^{(n)}(a)}{n!}(x-a)^n`
\`\int_0^1{f(x)\,dx}\` `\int_0^1{f(x)\,dx}`

Tuesday, January 13, 2009

Audition Passed!

As you might have figured out from my Journal Entry 01.13.09 post, I passed the audition for the creative writing class, and will remain in it, submitting journal entries here. As for the rest of the class aside from the journal, I've got a nonfiction workshop on January 27 (and I need to have it finished on the 20th), a fiction workshop February 17 (and it needs to be finished on the 10th), and a poetry collection workshop March 31 (again, finished a week earlier on the 24th). I'll be posting the results here, as well. Possibly with markups, possibly not. We'll see.

Journal Entry 01.13.09

I see the milestones dwindling toward the horizon
  • I see each day stetching out before me
  • I can see new friends waiting for me to arrive

These lines are possible divergences from a line in the poem The Layers by Stanley Kunitz

Topics

6 titles you might want to write about:

  1. On Snowstorms & Suburbs
  2. On Roleplaying Games
  3. On Game Development
  4. On Where You Want Your Life to Go
  5. On Space
  6. Pn Equestrianism

6 titles you don't want to write about:

  1. On Girlfriends
  2. On Vegetables
  3. On

6 titles where "On" is a pun:

  1. On Lightbulbs
  2. On Vacuums
  3. On Computing
  4. On Game Consoles *
  5. On Air
  6. On Route 66

6 titles you don't know anything about:

  1. On Skydiving
  2. On Medicine
  3. On Artistry
  4. On Geology
  5. On Manufactory
  6. On Religion

On Game Consoles: Free Writing

Game consoles have an intersting history in the world of games, as an alternative to the PC or board games. When the first consoles were made, such as the Atari or the Amiga, they were much cheaper than any PC you could buy. So, if you wanted to play video games, they were the obvious choice. Today, consoles such as the Xbox 360, Play Station 3, and Wii are still cheaper than the powerful "gaming rigs" that some players of PC games boast of having.

The console is also more reliable avenue for the developer, with one single hardware configuration to build for. Though a PC may be more powerful than an Xbox, other PCs will be much less so, and PC developers must build for as many PC configurations as feasible.

However, most consoles are very difficult to get permission to build for. The Xbox 360, for example, requires that a developer purchase a $10,000 Xbox Development Kit from Microsoft. Additionally, in order to actially publish a game on a console, the developer must pass their game on an exhaustive list of rules, call the Technical Certification Requirements for Xbox, Technical Requirements Checklist for Play Station, and I don't know what Nintendo call their version of the same, only that they have one.

The other disadvantage of consoles is also their ficed hardware. A PC user can just upgrade bits of hardware as they need, while a console player must buy an entirely new console to play the new games at all - a PC that isn't upgraded can probably still play the game at a lower resolution or framerate.

Tuesday, January 6, 2009

The Gambler

It was the big day.
The race.
Tort was a fool
to think he could beat Jack.
Jack is the fastest around.

Even so, it was a
race nonetheless.
The broker gave me 10-to-1.
Gambling is in my blood,
but I refused to put
money on Tort.

Tort was a fool’s bet.
Wait, the race is starting.
And Tort is left in
Jack’s dust.
I’ll make money,
for sure.

I wait at the finish
to confirm my victory.
Tort appears on the horizon.
Where is Jack?
He is sleeping.
Overconfidence is the true fool.

Part of my creative writing class this semester requires that I write a journal. I figured I'd like to post my journal entries up here, though I don't know if my professor will accept them in this format. No matter.

This poem was part of my "audition" for the class - 15 minutes to write a poem, 20 minutes to write a short piece of fiction, and a submission of previous work to the professor by Thursday, along with reason for wanting to be in the class. Here's to hping that I get to stay in. The prompt for this poem was to re-imagine a well-known story. For those who haven't yet figured it out, this is the story of the tortoise ("Tort") and the hare ("Jack" Rabbit), as told from the perspective of a gambler betting that the hare will win.

Sunday, January 4, 2009

Source Code Sucks

By which I mean, looking at source code on most websites sucks. The formatting is often broken, and there's rarely syntax highlighting. This post was prompted by a comment from an author of another blog that Blogger screws up source code. That's not the problem; the problem is that a lot of time and money has been poured into <insert favorite IDE>, while the same effort is not warranted to web browers and most websites.

However, with a little finesse, there is a solution that's easy to implement. You need:

  1. CSS for the code box and syntax highlighting
  2. A good find/replace JavaScript
  3. Code samples
Alex Gorbatchev of dreamprojections.com has created an excellent Syntax Highlighter script. (download link)

An Example

<html> <head> <link rel="stylesheet" type="text/css" href="dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css" /> <script type="text/javascript" src="dp.SyntaxHighlighter/Scripts/shCore.js"></script> <script type="text/javascript" src="dp.SyntaxHighlighter/Scripts/shBrushCSharp.js"></script> <script type="text/javascript"> <!-- window.onload = function() { var codeBlocks = document.getElementsByName('csharp'); for(var i = 0; i < codeBlocks.length; i++) { codeBlocks[i].className = 'csharp'; } dp.SyntaxHighlighter.ClipboardSwf = 'dp.SyntaxHighlighter/Scripts/clipboard.swf'; dp.SyntaxHighlighter.HighlightAll('csharp',false,false,false,1,false); } //--> </script> </head> <body> <code name="csharp">using System; using System.Collections.Generic; using System.Text; namespace HelloWorld { class Program { static void Main(string[] args) { } } }</code> </body> </html>

This would produce:using System; using System.Collections.Generic; using System.Text; namespace HelloWorld { class Program { static void Main(string[] args) { } } }

The Google Code wiki for the JavaScript Syntax Highlighter shows how to modify settings of the code block through the class attribute. The same configuration can be done with the HighlightAll call, using the following parameters:HighlightAll(name, showGutter /* optional */, showControls /* optional */, collapseAll /* optional */, firstLine /* optional */, showColumns /* optional */)