random page 2 - Dave's Blog

Search
My timeline on Mastodon

Earplug Alarm Clock

2008 Jul 9, 1:37

Dirt PileIn my previous home, just after I moved in, my neighbor which was the city of Redmond's various city government buildings, decided to build a parking structure. This was maybe 30 feet from my window, lasted for at least a year and would regularly wake me up at seven or eight in the morning. Determined to not be so punctual for work, I got earplugs which meant in addition to not hearing the construction outside, I couldn't hear my alarm. I had an idea for a combination ear plug, headphone, alarm clock that I never did anything with, except to write down the phrase "earplug / headphone / alarm clock" on a list that I just now found. In retrospect, I think this problem might be too specific to result in my earplug alarm clock selling well.

PermalinkCommentsidea earplug headphone alarm clock random nontechnical

Generating N-D Tetris Pieces

2008 Jun 1, 7:27

When I woke up this morning for some reason I was thinking about Polytope Tetris, my N-D Tetris game, and specifically generating Tetris pieces in various number of dimensions. When I first wrote PTT I thought that as the number of dimensions increased you could end up with an infinite number of non-equivalent crazy Tetris pieces. However this morning I realized that because you only get four blocks per piece there are only a possible three joints in a single Tetris piece which means that you only need three dimensions to represent all possible distinct N-D Tetris pieces.

Below is the table of the various possible pieces per number of dimensions and sorted by the number of joints in the piece. Notice that the 'J' and 'L' become equivalent in 3D because you can rotate the 'J' through the third dimension to make it an 'L'. The same happens for 'S' and 'Z' in 3D, and 'S+' and 'Z+' in 4D.

Joints Name 1D 2D 3D +
1 I I I I I
2 J J J J
L L
3 O O O O
T T T T
S S S S
Z Z
T+ T+ T+
S+ S+ S+
Z+ Z+
Total 1 7 8 7

As a consequence of not realizing there's a finite and small number of N-D Tetris pieces, I wrote code that would randomly generate pieces for a specified number of dimensions by wandering through Tetris space. This consists of first marking the current spot, then randomly picking a direction (a dimension and either forward or backward), going in that direction until hitting a previously unvisited spot and repeating until four spots are marked, forming a Tetris piece. However this morning I realized that continuing in the same direction until reaching am unvisited spot means I can't generate the 'T+' piece. I think the better way to go is keep the list of all possible pieces, pick one randomly, and rotate it randomly through the available dimensions. Doing this will also allow me to give distinct pieces their own specific color (like the classic Tetris games do) rather than picking the color randomly like I do now.

PermalinkCommentspolytope tetris tetris

Cory Doctorow's craphound.com - Podcast

2008 Mar 28, 1:37Cory Doctorow regularly reads from his books and irregularly includes random other stuff. Currently reading the novella he co-wrote with Ben Rosenbaum, 'True Names'.PermalinkCommentscory-doctorow creativecommons boingboing book fiction podcast scifi

DeleteThis.net on NearlyFreeSpeech.NET Update

2008 Mar 23, 12:38

The move of my website to NearlyFreeSpeech.NET is mostly complete except for a few server side things not working yet: RandomGrammar and parts of Vizicious. I'm still very happy with the NearlyFreeSpeech.NET hosting and so far I've only spent a few cents on hosting. At this rate I'll only spend a few dollars a year.

I've moved all my pages to use the same CSS and hooked it up with cookies to my Kuler color options so now changes to the color theme will stick and apply to all my pages. I haven't figured out the caching for this yet so you may have to refresh to see changes to color applied.

PermalinkCommentsnearlyfreespeech.net technical webhosting kuler homepage

Identifying Vegetables with 20q Pocket Mind Reader

2008 Feb 26, 2:24

A shallot sliced in two.At the grocery store the other day Sarah and I attempted to find shallot for a recipe, but I can't tell the difference between shallot, sweet onions, yellow onions, etc. etc. We found something that we decided was the closest we'd find in the store and I believe we picked correctly because at checkout the cashier rang it up as shallot.

I think this could be a practical problem that the 20q Pocket Mind Reader should be able to solve: obtain the name of an unidentified object. When we got home I decided to test the 20q Pocket Mind Reader on shallot. Unfortunately, it told me I had an onion, but I think if these were designed for identifying unknown objects based solely on information you can obtain by looking at it, rather than requiring knowledge of seeds, where it grows, etc. it would do better. Or I could just ask someone who works at the grocery store.

PermalinkCommentsonion shallot toy 20q random

Theme Options

2007 Dec 24, 12:41These days it seems like there's a social sharing website for everything representable as bits. Like Scribd for (mostly legal) documents, SciVee for scientific research videos, Wordie for words, and Kuler for color themes. Kuler seems like a ridiculous website (overkill) but I had been meaning to update my homepage's color design and Kuler has an RSS based REST API. The API lets you obtain things like the most recently added color themes or the most popular or all themes containing the color dark red, etc... So of course rather than update my website's design I hooked up my css to the color themes coming out of Kuler. Select my main page's color theme from a list of random Kuler themes. As I'm sure the regular readers can guess I use an xslt and blah blah blah... It looks OK with Silver Surfer and Happy Hipo but in general changing the colors this way doesn't produce something pretty.

When reading about Kuler I found that they may have stolen the whole idea wholeslae from ColourLovers. They discuss the thievery in an article on their blog. I would have switched over to ColourLovers out of principle but they don't have an easily accessible API.PermalinkCommentscolourlovers color xslt theme homepage technical kuler design

Second Life Translator

2007 Jul 4, 10:58Hackdiary
I really enjoy reading Matt Biddulph's blog hackdiary. An entry some time ago talked about his Second Life flickr screen which is a screen in Second Life that displays images from flickr.com based on viewers suggested tags. I'm a novice to the Second Life scripting API and so it was from this blog post I became aware of the llHTTPRequest. This is like the XMLHttpRequest for Second Life code in that it lets you make HTTP requests. I decided that I too could do something cool with this.

Translator
I decided to make a translator object that a Second Life user would wear that would translate anything said near them. The details aren't too surprising: The translator object keeps an owner modifiable list of translation instructions each consisting of who to listen to, the language they speak, who to tell the translation to, and into what language to translate. When the translator hears someone, it runs through its list of translation instructions and when it finds a match for the speaker uses the llHTTPRequest to send off what was said to Google translate. When the result comes back the translator simply says the response.

Issues
Unfortunately, the llHTTPRequest limits the response size to 2K and no translation site I can find has the translated text in the first 2K. There's a flag HTTP_BODY_MAXLENGTH provided but it defaults to 2K and you can't change its value. So I decided to setup a PHP script on my site to act as a translating proxy and parse the translated text out of the HTML response from Google translate. Through experimentation I found that their site can take parameters text and langpair queries in the query like so: http://translate.google.com/translate_t?text=car%20moi%20m%C3%AAme%20j%27en%20rit&langpair=fr|en. On the topic of non US-ASCII characters (which is important for a translator) I found that llHTTPRequest encodes non US-ASCII characters as percent-encoded UTF-8 when constructing the request URI. However, when Google translate takes parameters off the URI it only seems to interpret it as percent-encoded UTF-8 when the user-agent is IE's. So after changing my PHP script to use IE7's user-agent non US-ASCII character input worked.

In Use
Actually using it in practice is rather difficult. Between typos, slang, abbreviations, and the current state of the free online translators its very difficult to carry on a conversation. Additionally, I don't really like talking to random people on Second Life anyway. So... not too useful.PermalinkCommentspersonal translate second-life technical translator sl code google php llhttprequest

Ozzie

2007 Jun 25, 3:13I keep seeing 'Ozzie' on emails and such now due mainly to Ray Ozzie who is now the Chief Software Architect at Microsoft and his brother Jack Ozzie. Whenever I see his name I think of Ozzie from Chrono Trigger. He was one third of a trio of villains, the other two being Flea and Slash. I feel like I should be thinking of the Ozzy for which this Ozzie was named but I really don't.
Ray Ozzie. Links to license.Ozzie from Chrono Trigger. Links to license.Ozzy Osbourne. Links to license.
My next thought on Ozzie is the Scottish guy who went to my high school. He'd shout 'Ozzie! Ozzie! Ozzie!' to which listeners were compelled to respond 'Oi! Oi! Oi!'. The wikipedia article on the chant has some thoughts on the origins but I suppose at Microsoft it could take on entirely new meaning. I really hope I'm someday in a meeting with Ray or Jack Ozzie and have the opportunity...PermalinkCommentsozzy personal ozzie random nontechnical

Spam (dance) - Wikipedia, the free encyclopedia

2007 Mar 30, 3:29Apparently there's a dance form named 'spam'. From the link: "The term originated in the underground scene from Ontario, Canada. It was lifted from the video game and technological meanings of spam, relating the concepts of rapid speed and randomness."PermalinkCommentsspam dance

RandomGrammar

2007 Mar 28, 12:54Given an ABNF description of a grammar, RandomGrammar produces a random string that fits that grammar. This is a personal project I worked on previously and have just now made available again on my website.PermalinkCommentsme personal projects java randomgrammar abnf

How to Add a Favicon to your Site - QA @ W3C

2007 Jan 22, 9:42In my continued efforts to learn about random web things and implement them on my page, here's the W3C's document on favorite icons. Update: Well what they said to do sure doesn't work in IE =)PermalinkCommentsfavicon w3c standards web icon html howto favorite

Moved to Server-Side Scripting

2007 Jan 19, 9:15I've moved my homepage to server-side scripting. Previously I've mentioned that I was using client side scripting to interpret and sort my livejournal and delicious entries together. Now I'm using PHP and XSLTs to process and sort my livejournal, delicious, flickr, and librarything entries. See my homepage for the finished result.
LibraryThing is pretty cool despite being pretty niche. Its like flickr but for books. I display a random sampling of the covers of books I have listed in librarything on my page. I've also hooked the display of the covers of my book up to the corner image. Now when you hover over the cover of a book a bigger picture of its cover appears in the corner of the webpage. Also, flickr entries in the main section how have the same on hover behavior.
This may not be the best use of my time, but its still fun.PermalinkCommentslibrarything xslt delicious homepage flickr technical php livejournal script

Random Number Generation

2006 Jan 16, 11:59A Better Random Number GeneratorPermalinkCommentsdevelopment math random-number java c csharp algorithm csc
Older EntriesNewer Entries Creative Commons License Some rights reserved.