MacPython Logo from __future__ import *

buy music albums Silver Apples buy mp3 albums Tarrus Riley buy tracks mp3 Kravits buy Reaper albums mp3 buy Kravits albums music buy music Evita CD online albums mp3 Silver Apples download Madonna CD music buy tracks music Kravits download music albums Silver Apples

2008-05-03

simplejson 1.9

Filed under: python, simplejson — bob @ 12:49 pm

simplejson is a simple, fast, complete, correct and extensible JSON (RFC 4627) encoder/decoder for Python 2.3+. It is pure Python code with no dependencies.

simplejson 1.9 is a minor update:

  • Rewrote test suite with unittest and doctest (no more nosetest dependency)
  • Better PEP 7 and PEP 8 source compliance
  • Removed simplejson.jsonfilter demo module
  • Misc. bug fixes

There is one backwards incompatible changes in this release:

  • simplejson.jsonfilter is no longer included

2008-04-08

Google App Engine - Changes Everything

Filed under: Mochi Media, appengine, google, python — bob @ 4:28 am

I had the privilege last night of going to Google's Campfire One where the Google App Engine was launched, which is basically a service that I've been secretly hoping that Google would release for the past three years. App Engine is going to change everything -- as soon as they come up with a pricing model, anyway. I'm sure whatever it is will be more than competitive with Amazon's offerings, which isn't really worth any price given that they can't keep it fully operational. Yesterday was the perfect day for EC2 to fall over again, they might as well shut it off altogether once Google gets this service into production ;)

So why does Google App Engine change everything? I don't have a lot of time to spend here but a few key points:

  • Single sign-on for Google users. Everyone with a gmail account is already registered for your service. You have no idea how cool this actually is :)
  • BIGTABLE. My god. I would've spent in excess of $100k to have access to this part of Google's infrastructure and saved money. Scaling SQL databases sucks. If you have the kind of access patterns that we do, databases designed for OLTP are simply not suitable and it's a real pain to try and make it work. The fact that schema is managed directly in the code and that schema upgrades look awfully painless is a huge extra bonus.
  • Works locally, deploys globally
  • Python and WSGI!
  • No more going to the data center, provisioning bandwidth from telcos, etc.
  • Payment is surely coming. No more PayPal or Verisign or whatever.

In the same way that Google Apps (and Mac OS X) have enabled people to run without IT departments, Google App Engine is going to let them go big without an ops department. With the current imposed limits I can't prove this theory at Mochi Media, since everything we do is beyond the scale of their current quotas, but maybe I'll allocate some of my "infinite spare time" to ditch this Wordpress crap and try it out for my blog while they sort that out :)

The minus is that this project is actually probably pretty horrible for open source. Yahoo and the rest of the Hadoop team have their work cut out in making that stack competitive with this. If they don't, Google is going to own scale for a while. While MySQL and PostgreSQL still have some years left in them as people learn how to write scalable apps, I can't see that model lasting very long now that you don't have to be in Google's employ to use better solutions to the data problem.

2008-03-24

simplejson 1.8.1

Filed under: python, simplejson — bob @ 7:40 am

simplejson is a simple, fast, complete, correct and extensible JSON (RFC 4627) encoder/decoder for Python 2.3+. It is pure Python code with no dependencies.

simplejson 1.8.1 is a major update:

  • Optional C extension for accelerating the decoding of JSON strings
  • Command line interface for pretty-printing JSON (via python -msimplejson)
  • Decoding of integers and floats is now extensible (e.g. to use Decimal) via parse_int, parse_float options.
  • Subversion and issue tracker moved to google code: http://code.google.com/p/simplejson/
  • Misc. bug fixes

There is one incompatible change:

  • "/" is no longer escaped, so if you're embedding JSON directly in HTML you'll want to use .replace("/", "\\/") to prevent a close-tag attack. Sorry, but the in-HTML use case just isn't worth the bloat in everyone else's documents.

2008-03-15

Cogent = Bad choice

Filed under: General — bob @ 2:58 pm

So it seems that I made the wrong decision for our uplink at Mochi Media. We have a gigabit line to Cogent at 365 Main. They've been mostly good so far (and cheap), but their recent spat with Telia has cut us off to parts of Europe (at least Sweden and Denmark). Not cool.

Anyone have any recommendations on other providers we should talk to? I don't want us to be dependent on Cogent for a minute longer than we have to be.

2008-03-08

Exploring Erlang @ C4[1] video

Filed under: erlang, mochiweb — bob @ 8:56 am

The video of the Exploring Erlang talk I gave at C4[1] last August is up on the interwebs! It only took seven months :)

Video:
http://rentzsch.com/c4/c41VideosAvailable
Slides and source:
http://bob.pythonmac.org/archives/2007/08/11/exploring-erlang-c41/

2007-12-17

Printing floats with Erlang

Filed under: erlang, mochiweb — bob @ 10:37 pm

The float printing options that ship with Erlang all suck. You either don't have sufficient precision, or you have an extremely verbose representation:

1> io:format("~w ~.18g ~g ~s~n", [0.1234567, 0.1234567, 0.1234567, float_to_list(0.1234567)]).
0.123457 0.123456700000000003 0.123457 1.23456700000000002548e-01
2> io:format("~w ~.18g ~g ~s~n", [0.1, 0.1, 0.1, float_to_list(0.1)]).
0.100000 0.100000000000000006 0.100000 1.00000000000000005551e-01

mochiweb includes an implementation of the algorithm from the "Printing Floating-Point Numbers Quickly and Accurately" paper in the mochinum module (which is standalone, if you just want to use it without the rest of mochiweb):

3> io:format("~s~n", [mochinum:digits(0.1234567)]).
0.1234567
4> io:format("~s~n", [mochinum:digits(0.1)]).
0.1

Problem solved :)

Using the mochiweb project skeleton

Filed under: erlang, mochiweb — bob @ 9:06 pm

A bit over a week ago we moved a slightly modified version of our project skeleton into the open source mochiweb repository, which gets you a start shell script, a skeleton application following (most of) the OTP paradigms, a Makefile, and a web server that serves static files out of priv/www.

The first thing you have to do is make sure mochiweb is built:

$ cd ~/src/mochiweb
$ make
(cd src;make)
make[1]: Nothing to be done for `all'.

After that you just run ./scripts/new_mochiweb.erl with the project name and destination (you can put a symlink of that script on your PATH somewhere).

$ ./scripts/new_mochiweb.erl mochidemo ~/src
...

Starting it is easy, just build with make and then run start.sh or start-dev.sh from ~/src/mochidemo. The only difference between the two at the moment is that start-dev.sh will poll for changes in ebin files and purge them automatically when they're updated. The default port is 8000 listening on all IPs and it's configured in src/PROJECT_sup.erl.

$ cd ~/src/mochidemo
$ make
...
$ ./start-dev.sh
...
=PROGRESS REPORT==== 17-Dec-2007::20:58:33 ===
         application: mochidemo
          started_at: nonode@nohost

1> http:request("http://127.0.0.1:8000/").
...
{ok,{{"HTTP/1.1",200,"OK"},
     [{"date","Tue, 18 Dec 2007 04:58:55 GMT"},
      {"server","MochiWeb/1.0 (Any of you quaids got a smint?)"},
      {"content-length","88"},
      {"content-type","text/html"}],
     "<html>\n<head>\n\n</head>\n<body>\nMochiWeb running.\n</body>\n</html>\n"}}

As far as deployment goes, it's a convenience that mochiweb makes a symlink to itself as PROJECT/deps/mochiweb-src so that the start scripts can find it and put them in your code path. You'll probably want to put a full copy of mochiweb in its place, use a svn:external (which is what we do right now), or manage the mochiweb dependency by some other means.

2007-11-07

mochiweb - another faster web server

Filed under: erlang, mochiweb — bob @ 9:39 pm

mochiweb is finally well on its way to becoming a proper open source project, thanks to Matthew Dempsky. We've got a mochiweb project on google code and a mochiweb group on google groups.

Similarly interesting is that iserve is now turning into something more useful. iserve and mochiweb are pretty much the same thing under the hood, but mochiweb exposes a different API (which I find to be nicer, but I designed it) and supports more of the HTTP protocol. They both (ab)use inets' {packet, http} mode and they're both very minimal.

Here's a mochiweb version of the minimal example that Tobbe gave for iserve:

-module(mochiweb_demo).
-export([mochiweb_request/1, start/1]).

start(Port) ->
    mochiweb_http:start([{port, Port}, {loop, {?MODULE, mochiweb_request}}]).

mochiweb_request(Req) ->
    Req:ok({"text/html",
    <<"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
        <html>
        <head><title >Welcome to mochiweb</title></head>
        <body>
            Hello
        </body>
        </html>">>}).

2007-10-15

MochiAds.com public launch!

Filed under: Mochi Media, flash, mochiads, mochibot — bob @ 10:12 am

It's hard to believe that almost a year has gone by since we launched the first private beta of MochiAds, but we just relaunched the site last night and the doors are wide open now! Every user of MochiBot already has an account via our MochiPass single sign-on, and anyone else can sign up and get in instantly. You can start making money with your Flash games today!

It's been quite a ride so far -- this time last year Jameson and I were working out of our apartment in the Mission with Ryan freelancing all of the design. Fast forward through a round of venture financing and a tremendous uptake by game developers and here we are with our own floor of office space in SoMa (so much space that we're subletting to three other startups) and 12 people on payroll. We've even got a team who writes Erlang code every day, who else can say that? :)

Oh, and we're hiring people of all sorts, so if you're interested in working at a cool startup in San Francisco with a real business model (and revenue, today), cool technology, and a LOT of potential then please get in touch! You'll even get to play cool Flash games every day, because "reviewing" them is part of our job :)

2007-08-11

Exploring Erlang @ C4[1]

Filed under: erlang, macosx — bob @ 2:46 pm

Slides from my Exploring Erlang talk today at C4[1] are available here: http://undefined.org/c4-1/

Yes, it is definitely caturday.

For those of you interested in learning more about Erlang, I highly recommend buying Joe Armstrong's Programming Erlang and/or read his 2003 ph.d thesis, which is kinda similar in content to his book but is more technical and is freely available: Making Reliable Distributed Systems in the Presence of Software Errors. The thesis is a bit more dense, but it was what really made Erlang "click" for me.

If you want to play with the examples, go to CEAN and download "Erlang/OTP Full (Standard)" at the bottom for you version of Mac OS X and follow the "How do I install CEAN to /usr/local/bin" FAQ entry. Alternatively, if you want to wait longer, you could use MacPorts to download and compile it. Once you've got that set up just run erl from the examples directory in the slides download and it should all work.

Next Page »

Powered by WordPress