4/29/13

West Coast Sunset Photography Competition Idea

here's an idea for a website:

The idea is to have a photo contest localized in time. The whole contest would happen over an hour and a half.

The site announces a weekly competition to take place on Saturday at sunset. During the hour when the sun is scheduled to set, the site allows image uploads. After that hour, there is a 10 minute voting period where everyone who submitted an image votes on other people's images. After that, everyone gets to see the sorted list of images, and where their image ranked.

  • To encourage voting, submissions from non-voters are disqualified and removed from the ranking.
  • To ensure that images were taken on the contest day, the site could require a "proof" video, which could be something like: "write 4832 on a piece of paper, put it on the ground, and take a video panning from the piece of paper to the sun", where the number would be different each week, and in addition to voting, each person would check one other person's proof video.

The Monty Hall problem, and why I learned to love programming.

here's a script for a youtube video I want to create:

web browser opens to the Monty Hall problem on wikipedia

♖ : Hm.. the Monty Hall problem.. so there's a prize behind one of three doors, and I get to pick one, but before opening it, one of the other doors is opened to reveal a goat, and I get to switch my guess if I want. Seems like it wouldn't matter, but they say I should. I'm skeptical.

scrolls down to solutions

♖ : Ok, here we have lots of crazy diagrams and heartfelt arguments about why I should believe what they're saying. But I've seen smart people be wrong before. This sounds like a job for programming.

web browser opens to a javascript read-eval-print-loop program, like jsFiddle

♖ : Ok, we have a prize (types: var prize) behind one of three doors (types: = Math.ceil(Math.random() * 3)). Next, we choose a door (types: var guess = Math.ceil(Math.random() * 3)). But before it opens, Monty Hall opens one of the other doors to reveal a goat (types: var open = Math.ceil(Math.random() * 3)), of course, Monty Hall wouldn't open the prize door, so if we pick that one, we need to pick again (types: if (open == prize) continue), where that continue will repeat a loop (puts a while-true loop around the previous two lines). Monty Hall also wouldn't open the door we guessed (types: if (open == guess) continue), and if neither of those bad things happen, we can break from the loop (types: break). Great, now let's print out where the prize was (types: if (guess == prize) print('prize behind guessed door') else print('prize behind remaining door')). Now let's run it a few times.

runs program a few times, and it outputs a sequence of 'prize behind guessed door' and 'prize behind remaining door'

♖ : Hm.. if I squint, I might be able to convince myself that one thing is happening more often than the other.. let's run this a million times (adds for (var i = 0; i < 1000000; i++) around code), and it's probably best to count rather than print out what happens each time (adds var prizeBehindGuessedDoor = 0 and var prizeBehindRemainingDoor = 0 to top, and changes print statements to prizeBehindGuessedDoor++ and prizeBehindRemainingDoor++), and we'll want to know what those numbers are at the end (adds print('prize behind guessed door count: ' + prizeBehindGuessedDoor) and print('prize behind remaining door count: ' + prizeBehindRemainingDoor))

runs program, and it prints out something like: prize behind guessed door count: 333, prize behind remaining door count: 667

♖ : Hm.. kinda seems like it's better to pick the remaining door. I guess they were right. This time. Thankyou programming.

subtle bug


a node module I'm using has some code like this:


function (x, y, callback) {
    var data = ...get some data based on x and y...
    try {
        var json = JSON.parse(data)
        return callback(null, json)
    } catch (error) {
        return callback(error)
    }
}

the idea is to get some data, and try to parse it as json, and if the parsing succeeds, pass the parsed object to the callback, otherwise, send the parse error to the callback.

however: if the callback code itself throws an error, this is also caught, and the callback is called again with the error that it just threw.

I think the code should look like this instead, where the call to the callback has been taken outside the try/catch

function (x, y, callback) {
    var data = ...get some data based on x and y...
    try {
        var json = JSON.parse(data)
    } catch (error) {
        return callback(error)
    }
    return callback(null, json)
}


4/23/13

I want to run this humanscript: https://github.com/dglittle/heroku-mongo/issues/1

wow: http://thejh.net/misc/website-terminal-copy-paste

ideas: programming ideas to humanscript eventually, maybe:
- recreate infinite gearbox using WebGL
- create a side-scroller shooter (maybe with a paper airplane as the avatar)

want to do: go to Ireland and drink guinness from a guinness cup that was gifted to me

want to do: write something in Haskell

want to do: understand the problem with a big-number-solution presented here

4/22/13

note: how should I remember the difference between apply and call in javascript? how about: the 'a' in apply stands for 'array', because it takes an array as an argument.

done, mostly: got node-odesk-utils repo which adds a getAll and postFixedPriceJob function.. I still need to add a closeContract function, and I am going to try committing this repo with the command line (usually I use SourceTree).

done: committed and pushed with the command line — patting self on back. not sure I'm going to do it that way again, but it wasn't as painful as I thought.

done: added/tested closeContract function (called closeFixedPriceJob).

thoughts:
- nodesk is going to need to store a lot of credentials: oauth-token + username + password + security-answer, in addition to github username and password (or oauth, if they have that.. I assume they do).
- I think I want to guard against CSRF in nodesk
- my rough goal right now is to make it so you can paste a url to a github issue into nodesk, and it will create a job pointing to that issue, and update the issue to direct users to the job
- I think I should create a test app that can interface with github

done: implemented a CSRF token for nodesk — it is sent to the client in a cookie, and when the client makes rpc calls, it needs to put the token in the url (proving that it knows what's in the cookie, which presumably a CSRF attacker would not know). I like this solution because it doesn't involve keeping track of the token in a database, and doesn't have issues with a user having multiple browsers open accessing the site. I also used the cookie technique to send the rpc version number (whereas I was previously dynamically modifying the index.html to include the version number, but now I can get the efficiency gains of treating index.html as purely static).

done: moved u.js to gl519 (a random name). the goal here is to start making it so I can grab my utility using npm. Next step, try to import gl519 using a package.json file in a new project.

done: successfully included gl519 into a test project using this package.json and "npm install"


{
    "dependencies" : {
        "fibers" : "*",
        "gl519" : "git://github.com/dglittle/gl519.git#gh-pages"
    }
}

the part in bold was unexpected. I often make my projects use gh-pages, since it allows them to be viewed as webpages served on github, but apparently npm looks for the master branch, even if there isn't one.

next step: I want to put my odesk api extentions into a node-odesk-utils repo. These will include a method for grabbing all of some item using odesk's paging api. It will also include a couple methods not currently supported in the api: posting a job with skills, and ending a contract with feedback.

4/21/13

want to do: understand proof of not trisecting an angle

want to do: move TurKit to node.js

want to do: learn about "representation theory"

idea: to make a truly self-contained web-app, try having it use its own github repository as a database

want to do: figure out how to deal with externalities in capitalism

want to do: think about whether humans would claim to be conscious, even if we were all philosophical zombies

want to do: create an negotiating app, where both a buyer and seller enter their true price point, and the system tells them whether they have a deal, and for how much, without revealing to either party the other person's price point (e.g. perhaps it could pick a random number between the two price points).

want to do: post this paper on this blog (written for a philosophy class in grad school)

idea: a cloth which says "reserved" on one side, and "please take one!" on the other — mom's could use it to put over cookies

idea: I'd like to grow up to be a "thought catalyst", where people pay me to be in a meeting and facilitate rational thought, sortof like a diplomat, but for situations where people are trying to work out an idea or plan. I think the job would involve noticing points of misinterpretation, and crystalizing people's thoughts for them

want to do: write up story of trying to trisect an angle, and failing, but re-inventing how to take the square root of a number with a compass and straight-edge along the way, so working on impossible problems isn't always bad

want to do: post simulation showing that dividing by "n - 1" when calculating the variance really is the right thing to do (which was surprising to me)

want to do: do something with WebGL (and look into WebCL)

4/20/13

idea: I have witnessed some incredible use of google docs — hundreds of thousands of rows split across multiple spreadsheets with hundreds of people accessing them. The idea is: a google doc style spreadsheet that supports millions of rows and users.

4/19/13

watched King of Kong. made me think of stupid video game accomplishments I've had:

  • beat the original Zelda without dying (took about 6 straight hours)
  • got a high enough score in Tetris for the kremlin to take off instead of a rocket
  • beat the original Sonic the Hedgehog, collecting all the chaos emeralds
  • could beat every level in Mario Brother's 3 starting small
  • got every star in Mario 64
  • could tame dragons in Ultima Online
  • beat OMF 2097, for some definition — the only fighting game I ever got good at
  • beat Riven and Exile (sequels to Myst) without cheats or guides

watched V for Vendetta. great movie.

played on the piano. recorded a riff. not sure a good way to post it — blogger doesn't have an "insert audio" the same way it has an "insert image". hm.. tried inserting it using "insert a video", but it "had an error while processing video".

update: thanks to Luca:

4/18/13

idea dump

idea: commission someone to take a foreign language youtube song and create a version with subtitles in both that language and english, as a language learning tool.

idea: mturk app for sorting photos — you point it at picassa or dropbox, and it tells you which photos are worth showing your friends.

idea: create heroku app that serves random numbers with json-p. it can initialize a mersenne twister from random.org as often as their api allows, and serve pretty-darn-random numbers without rate limiting issues.

cool thing a friend made where people improve on each other's sketches: http://sketchabit.adamsmith.as/ and http://sketchabit.adamsmith.as/master.php

a couple notes about humanscript:

  • I original thought the "big idea" was writing instructions in an imperative way, but I think the real insight is writing instructions in such a way as to never need to communicate with the person doing the work — the real power comes from just getting a result, with no management.
  • humanscripting requires architecting a project differently — more UNIXy — since it's easier to specify a self-contained module than to specify how to mess with the "glue" code at the core of a project. this seems like a skill that people will need to learn, like learning to program.



4/17/13

thoughts last night

it is hard to keep an image of a red square in my mind as I count 100 breaths.

programming desire: i want a javascript function called evalInSandbox(code, maxMemory, maxTime) that runs arbitrary code in a sandbox with memory and time limits.

game idea: two players pretending to be a buyer and seller in a market. the game tells the players how much they're willing to buy or sell items for, and they haggle over a price. the player who gains the most economic surplus wins.

meta-game idea: i like the idea of a board game on a cell phone, where each player has a cell phone, but the game is meant to be played when everyone is in close proximity.

4/14/13

philosophical advertising

I talk about the idea of philosophical advertising here.

A pre-existing example of this occurred to me: the phrase "knowing is half the battle", from the G.I. Joe cartoon.

Reading that article, it appears that the phrase followed a public service announcement, which is also a form of philosophical advertising.

4/12/13

business people, please stop being evil


I've been complaining recently about companies doing evil things, e.g.:

  • tricking people into buying or downloading crap they don't want (toolbars)
  • charging more for stuff than it's worth ($30 usb cables, text messages)
  • lock-in (non-standard file formats, incompatible power adapters)
  • etc...

Here are some solutions that don't work:

  • markets (they often aren't efficient enough, or people collude, or there are externalities that are too difficult to account for in the market)
  • government (too inefficient)

Both of the systems above start with the premise that people will act selfishly, and they try to control it.

I'd like to entertain the following potential solution:

  • decide at a culture level to not act selfishly, even in business

A couple references came up in my complaints to people:

the best artists steal

Note to self:

I want to try writing a story by blatantly copying an existing story, like Star Wars, and just tweaking it a little bit.

If I give myself license to copy blatantly, I wonder if it will get my brain rolling toward something truly novel and interesting.

interesting ways of getting at the truth


I just wanted to bring together a few ideas I've encountered under the heading "interesting ways of getting at the truth".

Idea 1: bayesian truth serum — ask people not only what they think, but also what they think other people will think. Allows people to express a minority opinion while also demonstrating that they are aware that their opinion is in the minority.

Idea 2: list experiment — ask people how many items in a list they agree with, but not which items they agree with, where half the people see a list with a socially objectionable thing added to it, and half don't. Allows each individual plausible deniability about agreeing with the socially objectionable thing, while still revealing what percent of the group agrees.

Idea 3: wine tasting — have someone write a yes/no question about some wine, and then have two groups answer the question, where one group gets to taste the wine, and the other doesn't. If the group that gets to taste the wine can answer it better than the group that doesn't, then the question is, in some sense, legitimate.

4/11/13

80% autocomplete

I often have an idea, or hear an idea, of the form: it would be great if we could do X. But X has some small part x that is much much easier to do than X, and gets 80% of the value.

For example, autocomplete. It would be great if an editor could suggest semantically valid tokens at the cursor position. However, this is hard, because knowing what is semantically valid often requires, among other things, building an abstract syntax tree of the language in use.

A much easier thing is suggesting some possible tokens based on keywords in the language or tokens that appear elsewhere in the file. And I find it about 80% as useful as autocomplete. The sublime text editor does this:


Another example I've heard is getting a computer to drive a car autonomously. This is hard (though google seems close). A far easier thing might be getting a computer to drive a car in particular situations, like stop-and-go traffic on the freeway. I could read a book while my car inches forward when there's space available, and stops when there isn't.

pipe


4/10/13

ha!

just a little excitement I get when I circumvent a system that was keeping me from doing something useful — take that!

I'd like to thank a few tools:

  • the record button in the networking tab of Chrome's debugger
  • the node "request" module


Shania says I need to relax and watch TV.. I'm on it.

4/9/13

kindof watching

These are shows I'm kindof watching. I like them enough that I wouldn't mind watching another episode of any of them, but not so much that I can't put them down, so to speak.







todo dimensions



I've heard of organizing todo items by importance and urgency, and I've even tried to do this in pima, but my approach was to use an absolute scale, e.g., 1=low, 10=high, and I would always have too many 10's.

So now I'm sorting them instead. If I click "important", it shows me two items to compare, and it keeps having me compare items until it knows the top 20 items. I can also adjust the sorting by clicking the down arrow next to any item to move that item down.

I also added an "easy" dimension, since what I often want are items that have a high benefit to cost ratio (where importance is sortof like benefit).

The green items are on the parato frontier — items for which nothing else is more important, urgent, and easy.

The gold item is just the currently selected item, which is open in an editor outside of this screenshot.

4/8/13

boxes

A friend made this app. It takes me back to my days of creating ASCII art.


idea: use MTurk for unbiased self-assessment

Do I sing well? I have no idea. I can't trust my friends.

Perhaps I could sing a sample, and have a bunch of turkers also sing a sample, and then sort them all.. and see where I rank.

Perhaps this could also be done with "attractiveness".

4/4/13

backlog

I often get backlogged with my todo list.
My todo list makes it easy to push stuff back,
but even still,
I get so many items showing that it takes a while even to push them back,

and then they just show up again later

I've thought of tagging things with importance and urgency,
but it's too hard to assign absolute values that sort things the way I want

I'm thinking of adding a feature that shows me two todos at a time,
and asks me
"which is more important?"
"which is more urgent?"

since I tend to think that comparisons are easier than assigning absolute values

dance connection

I take dance lessons
and there's this concept of resistance or opposition or connection
when you're leading someone

if their arm is loose
and you move it
their arm will move
but not their body

I feel like this concept is relevant when sharing information with others
communicating
even with one's self

hugs x 12

a friend read something saying
4 hugs a day can relieve symptoms of depression
8 hugs a day can keep a person normal
12 hugs a day fosters some sort of psychological growth

I get 0 hugs a day.
Is there a match.com for hugs?

4/3/13

hill climbing

when I'm in nature
I pick a random place to go
someplace a little hard to reach

and I go there
and I'm excited when I arrive
and then I pick another destination

is it fine if that's all life is?