2010-02-24
Posted in Web Wandering & Opinion
at 12:08
Well, I was wandering around YouTube (no clue why) when I found evidence that the Scribblenauts developers may be /b/-tards. At the very least, they’re pretty good at catching all the noteworthy memes.
Here are just some of the noteworthy objects I’d never thought to try:
I also ran across some interesting ways to combine items (some of which exploit flaws in the engine):
Commenters also recommended these terms:
- Ninja Shark
- Chinese Dragon (Unlike European dragons, these guys are friendly)
- Edison (A bandana-wearing T-Rex)
- Blob
- Chupacabra
- Maxwell (a copy of your character) and a Black Hole
- Urn (disturb it and you get a ghost)
- Corpse + Chain + Car Battery (or Lightning)
- Scribblenaut
Finally, just in case you want it, a complete list of all the terms the English version of Scribblenauts will recognize. Enjoy.
Permalink
2010-01-28
Posted in Web Wandering & Opinion
at 6:29
A few months ago, my mother sent me an interesting TED talk about motivation. It turns out that the carrot-and/or-stick model for encouraging rewards stifles creativity. We need more businesses like Atlassian and Google which employ “intrinsic motivation” (you do the work because it’s inherently a desirable thing to do) techniques like “20% time” and research commissioned by people like the US Federal Reserve agrees. Fair enough.
More recently, I was reminded of an interesting article titled Against School by John Taylor Gatto that originally appeared in Harper’s Magazine. More controversial, but also well-referenced and my personal experience generally agrees. Force kids to be surrounded by other kids, doing boring work and you’ll get mostly emotionally-driven, easily-manipulated adults with the less controllable being outcasts.
It wasn’t until today, though, that I realized how it all tied together. I discovered a long but very interesting article named “Roadmap to a New Economics: Beyond Capitalism and Socialism” by Riane Eisler. The central point of said article being that rather than thinking of capitalism vs. socialism, we should be thinking of domination systems vs. partnership systems.
It seems fairly obvious in retrospect that the real root of all these problems is this “Dominate first, co-operate only if that fails” mentality that our chimpanzee instincts encourage and society strengthens, and as my mother puts it, “bullying is endemic in our society”, but it doesn’t have to be that way.
I’ll leave this on a related note. I don’t have a URL handy, but I remember reading an article a few months ago about how, all around the world, there’s a direct inverse correlation between the size of the gap between rich and poor in a society and the life expectancy of everyone, rich and poor alike. (In other words, for whatever reason, the more unequal your society, the more years lost off your life… no matter how rich you are. Personally, I suspect stress as the culprit.)
Update: Since writing this, I received another TED talk about the necessity and lack of true liberal arts education in modern western society and an article about how kids teach themselves to read… and how could I have forgotten Bertrand Russell’s In Praise of Idleness?
Permalink
2009-12-23
Posted in Web Wandering & Opinion
at 8:19
Just thought I’d look up how people paginate efficiently in SQLite since, apparently, OFFSET is just an alias for “discard N first results”. The recommended solution is to use a WHERE clause to mimic offset using the same column index you use for sorting… but that’s only really possible for “Next” or “More…” links.
I ended up discovering that MS SQL, Firebird, Oracle, and DB2 also lack OFFSET and the solution (MS SQL version) is to grab a list of primary keys which should be skipped using a subquery. (because retrieving just primary keys is faster than retrieving and discarding all the columns you don’t need)
To make sure I didn’t forget, I threw up an SQLite version on GitHub Gists.
While doing that, I also ran across jPaginate (demo), a jQuery pagination plugin that, as long as you provide a gracefully-degrading fallback, is probably my new favorite design for a page selector.
Update: This site is also useful.
Permalink
2009-12-21
Posted in Geek Stuff
at 10:45
Despite the growing interest in functional programming, most people (myself included) seem to have a lot of trouble grasping the core concepts and constructs. (Probably because the early adopters are all, to some extent, math geeks who have never needed to practice explaining things to the lay-person.) Since I finally decided to sit down and figure these things out, I thought it only fair that I share the Google results that led me to my various epiphanies.
Note: The closest I’ve come to actual functional programming languages is adopting parts of the functional style in Python. If my terminology is a little off but I got the gist of the thing, be diplomatic in your complaints. (I’ve had too much experience with math teachers who seem to think that it’s pointless to know how to use math without perfectly comprehending the relevant proofs and being able to write your own.)
The Easy Stuff
First, let’s cover a few things which are generally easy to understand… but only if you’ve heard of them:
- Higher-order Function
- A function which takes another function as an argument. To make this more comfortable, many languages treat functions and data equally. (In object-oriented languages, this is “everything is an object” taken to its logical conclusion). This allows for things like
results = filter(arbitrary_test, input_data). This is an especially useful feature when combined with other features like closures. (explained later)
- Pure Function
- A function that only uses its arguments as input, doesn’t modify variables visible outside itself, and provides all of its output using the language’s “return” statement (or equivalent). In other words, a function with no hidden inputs or side-effects. Pure functions are a Good Thing™ because you know that, with a given set of arguments, they’ll always do the same thing. This helps immensely with testing and debugging. (and makes unit testing much easier and more reliable)
- Tail Recursion
- Getting loop-like behaviour by having functions re-call themselves as the last thing they do. People consider this a good thing because it lets you write loops in a purely functional fashion. (see previous explanation) Functional languages generally optimize this internally so you still get the speed and stack-avoidance of a loop.
List Comprehensions
Practically speaking, a list comprehension is just a shorthand for saying “Take the elements from list X that satisfy condition Y and perform operation Z on them, then return a list of the results”. The benefit of list comprehensions is that they’re a quick, easy, concise alternative to declaring an empty list and then wrapping a function in a for loop and an if statement. (Technically speaking, they let you build one list from another using set builder notation.)
For example, In Python, you could get the squares of all positive numbers in a list with new_list = [x**2 for x in old_list if x > 0]. Keep in mind, however, that list comprehensions aren’t limited to working with numbers. I often use one to quickly implement a simple, one-line input normalizer that, in plain English, would be “Take all lines which aren’t empty or beginning with # and strip leading and trailing whitespace.”
Monads
As one answer on StackOverflow put it, “Monads are simply a way [of] wrapping things and provid[ing] methods to do operations on the wrapped stuff without unwrapping it.” It’s a clear definition… but its doesn’t really give you that “Aha!” moment I was looking for. If you have any experience at all with Javascript, the explanations and examples in jQuery is a Monad should do just that. In short, Monads are useful for changing the set of verbs and how they behave.
The final realization of how useful they can be (and my first recognition of how nifty it can get when you mix functional and imperative styles in a compatible language came from another StackOverflow answer (same question) which showed how, in F#, you can use a monad to do Javascript-style asynchronous HTTP I/O without having to explicitly write callbacks.
Lazy Evaluation
When a programming language is given a statement or block of statements, there are various ways it can do things, ranging from fully strict evaluation to fully lazy evaluation. These are usually easier to explain with examples.
The most common subset of lazy evaluation is probably short-circuit evaluation. This means that, if I run something like fileContent = getFromCache(url) or getFromWeb(url) in Python and getFromCache returns something other than None, an empty string, or the like, getFromWeb will never run because “True or anything” will always be true, so why bother evaulating the second half? This can be confusing if you don’t expect it, but as my example shows, it can also be very useful.
As you probably guessed, strict evaluation operates on the premise that “they said to run it, so we run it… whether or not we’re throwing away the output”. Naturally, in every language, if/then/else constructs use lazy evaluation.
The area of lazy evaluation that is sometimes confusing is eager evaluation versus delayed evaluation. If you’re still reading this, you’re almost certainly familiar with eager evaluation. For example, if you look at a list, you might see something like [1, 2, 3, 4, 5, 6].
The gist of delayed evaluation is that, at any given time, that list could look more like [1, 2, 3, ...] with the language evaluating further into the “...” as needed. This is useful because you can do things like creating an infinite list (Wikipedia uses the Fibonacci sequence as an example) and then retrieving specific values from it.
On a more mundane note, lazy evaluation is also commonly used for improving program performance. For example, in graphical systems where drawing is done only at the last minute so that “Oops. Looks like those pixels aren’t visible to the user after all” doesn’t impair performance.
Haskell
I haven’t actually used Haskell yet, but from what I’ve seen, I think I’ll try to make time for it soon. (When I do, I’ll update this post) Here are the posts that brought me to that conclusion (In concert with what I’ve already linked, of course):
Among other things, I love the idea of a code repository where you can search for functions by specifying the inputs and return types you need.
Permalink
2009-11-28
Posted in Web Wandering & Opinion
at 4:18
Well, I finally got an invite to Google Wave. I haven’t had much time to play around with it yet, but my first impression is that it could potentially be just the thing I need for collaborative story planning… once they add an export feature.
From most to least bothersome, here are the problems I’ve found so far which aren’t on Google’s list of known issues:
- Google seems to have no plans to open-source the web-based client.
- There is no export functionality.
- As with Google Docs, the design will eventually allow someone else to un-invite me from a Wave I forgot to save a local copy of.
- No end-to-end, public-key crypto offering.
Problems 1, 2, and 3 can probably be solved together by writing a custom, open-source client which treats the Wave server the same way git-svn treats a Subversion server. (Ideal, since I consider DVCS-like behaviour to be the ideal data replication model for most things)
Knowing Google, problem 4 will probably have to be solved using something along the lines of OffTheRecord which grafts crypto onto the existing system. The main issue I see being that it’ll be up to the endpoints to “induct” new clients into a wave by translating the existing encrypted history for the newly-added public key.
My overall opinion is that, until export functionality of some kind is available, Wave is a toy at best and, even with export functionality, it won’t replace e-mail or IM for me unless they offer end-to-end crypto. However, if a client-developer (Google or third-party) does offer some sort of export functionality, then it’ll be an ideal successor to Google Docs for me. (I use it only for collaboration since I deeply distrust cloud computing.)
Permalink
2009-11-11
Posted in Otaku Stuff, Site Updates
at 1:41
After far too long, I finally found time to make some of the planned improvements to my gender-bending index.
Beta 2 brings the following improvements:
- The detail expanders on the tables are now at least as comprehensive as the original “static HTML page” version of the site.
- The “Other Sites” list has returned, complete with icon-bullets denoting site types and a handy legend.
- I filled in author/artist/director names for almost every entry. (The remaining ones are a bit tricky, so they’ll have to wait)
- At least half of the data has been reworked to be per-character, per-incident-type rather than per-story. When searching is implemented, this will be very important.
The major remaining features left un-implemented are:
- Filtering and searching (You still have to make do with category grouping and adjustable sort orders)
- Spoiler-hiding (Occasionally, there’s a big plot twist that’s relevant to the nature of the gender-bending. This will require much thought because I need to decide how to classify something that seems to be X but is revealed to be Y.
- An interface for submitting new data and reporting errors directly rather than having to visit my usual contact form.
Enjoy.
Permalink