Scredit Crunch

Scred at this year’s Pixelache festival in Helsinki

Posted in Uncategorized by setok on March 31, 2009

Kristoffer, one of Scred’s founders, will be talking about alternative economies and peer-funding in relation to Scred at this year’s Pixelache festival (a large event on digital cultures). Feel free to come by and check it out!

Bye bye Perl (the story of HTTP chunked encoding with Django)

Posted in Hacks, Night of Code by setok on March 10, 2009

A week or so ago the last remnants of our old Perl version were banished from Scred. Last year, during summer, we spent quite some time porting Scred completely from Perl to Python and Django. Users did not really notice anything: the new version looked and acted identically to the old one. The reason for this switch was simple: our old self-baked framework was beginning to fray at at the edges and development was slow and painful.

We did evaluate moving Scred to Catalyst. However, Perl is a language which definitely splits opinions, both within Scred and beyond, and we needed to find something everyone would be at least semi-comfortable with. Now, as many know, my own personal favourite language is Tcl, for its wonderful simplicity and ultimate power. In fact it’s probably the most underrated language out there. For that reason we took a look at OpenACS which is reckoned to be extremely mature and scalable, but the learning curve at the time also felt very severe. It would also require running AOLWebServer. This has been built to be an extremely scalable web server, with Tcl at its scripting core, but everyone in the team had had at least some experience with Apache. Moving away from that did not feel appealing at all. There are Apache modules for Tcl on Apache, but nothing in the way of a full web framework (something for a summer project, perhaps?).

So Django it was, despite the pre-1.0 status, and overall it has mostly managed to do the job.

Everything was then ported, except one crucial part: the internal API used by the mobile Scred client. This was working perfectly well as it was so was never high up on the priority list to port. More importantly, Django/WSGI/mod_python have frankly no support for chunked HTTP encoding. This is an utterly inexplicable oversight as the HTTP standard quite clearly says chunked encoding MUST be supported, and one that has still not be satisfactorily remedied. Often browsers do not use chunked encoding but our friends the mobile platforms commonly do (both MIDP and the iPhone). Finally in January it was decided that this port really had to be done, as it was slowing the pace of our development to have to keep checking that the Perl based API would continue to work with new database changes.

After some amount of Googling we found a solution that was based on using Apache’s mod_proxy for dechunking. It was a hack, no doubt about it, but it seemed to be working right up until we tested with the MIDP emulator (ancient 1.0.3 as there’s nothing later for Macs and MIDP 1 was our target platform). API calls would regularly end up in an explicable “Network error” on the client. After some amount of debugging we could not find any reason for this. Once more the update to Python was put on the back burner to make way for several other important features which had to be pushed out.

Finally we dug up some time to continue to solve this issue. The confusing thing was that it worked on an actual device, but we could not be sure if that was just luck without pulling out tcpdump, netcat and similar tools. To cut a long story short we found that mod_proxy was closing the connection right after sending a response to each HTTP request. Now, this is perfectly fine, although usually web servers today keep connections open, at least for a time. Disconnecting after response was the HTTP 1.0 way. Unfortunately it seems like there is a bug in the 1.0.3 MIDP runtime. It did not react to this disconnect by then reconnecting with the next request. Instead it would just cause an IOException once a new request was sent (the details of the actual underlying socket are somewhat hidden in J2ME). That means that every other request works fine, every other one not.

At the end of the day we decided to push the update out. We tested on some phones and did not detect any problems so, with any luck, it’s only the emulator environment which does not handle this correctly. If you stumble across problems, do let us know!

Moral of the story: if you want to handle chunked encoding with Django, set up mod_proxy and be aware that the 1.0.3 MIDP environment has a potential bug in it!

Debt settlement now made more obvious + Indian rupee

Posted in Scred by setok on March 9, 2009

Look at your pool member tab to see a settlement suggestion

We have just released a feature which many of our users have been pleading
to get: a calculated settlement path. Before it was more of a running
balance and any settlement had to be worked out by manually matching the
negative balances with the positive. We have now improved that. This means
that now in a pool, if you want to know how much people should pay, and to
whom, just take a look at the ‘Members’ tab. It includes a helpful
suggestion!

Additionally, due to popular demand, we have added support for the Indian
rupee. Old exchange rates will be somewhat inaccurate, but all new
transactions made against the rupee are based on current rates.

Log into Scred to start using the new features!

Tagged with: ,

Scred announces inventory and pool pictures

Posted in Scred, Uncategorized by setok on March 4, 2009

Inventory and Pool pics added

Now usually our release names advance alphabetically, but in honour of one of our all time favourite episodes, Backwards from Red Dwarf, we are doing it a bit different. That particular episode also brings back memories to some of the people working at Scred. One of our previous startups went by the project name of ‘Nodnol’. This was a geo location and browsing platform for mobile devices, not unlike Google Maps today (but done in 2001). Unfortunately it was way ahead of its time.

Anyway, back to the release. We’ve got loads of great feedback and are busy working night and day to get things done. In response to some of that, today we launched:

  • A simple way to manage inventory for MiniCorps. Scred also works out the value of it.

  • A setting for MiniCorp shop items to control how many can be purchased at
    once.

  • Pools can now have their own personal picture shown in the pool page and
    pool list. It is also shown in their shop, if they have one.

  • The ‘Revenue’ tab for MiniCorps has now been renamed ‘Our Shop’. The
    profit calculation now appears in the top section about the pool. More
    revenue related functionality will appear elsewhere later.

  • A fix to how profit was calculated in MiniCorps has been made. Now only
    orders which have been processed will be included (as was the case for
    revenue calculation).

  • The user who paid for an item is now listed in a MiniCorp’s order list in
    addition to the detailed view. Makes going through list easier.

  • Negative values may no longer be entered into pool transactions on the
    web. This used to be the way to add shared income but with the new UI is no
    longer necessary (for cancellation, use the cancel button).

  • A fix to remove MiniCorp shops from the listing if the MiniCorps no longer
    have a PayPal account or if they have no members.

  • A “No picture” is shown in MiniCorp shop if item has no image. Layout is
    better, but best is to add an image!

Go to Scred to check this out.

Want to use Scred MiniCorps?

While MiniCorps are still in closed beta, if you have something planned or
an idea in mind which could use a Scred MiniCorp, get in touch with us using
the feedback form to request to become a beta user. We’re generally pretty
friendly and keen to hear about cool projects.

Follow

Get every new post delivered to your Inbox.