Sunday, February 23, 2014

pypubjs exports to Android


The Pypubjs IDE can now export to Android using Phonegap. This requires installing PhoneGap and the Android SDK. Phonegap is easily installed with one command sudo npm install -g phonegap. The Android SDK is more work to setup, download it and set your PATH environment variable to include: /tools and /platform-tools. You also need Oracle's Java, here is the steps I did to get it running in Ubuntu:

 sudo add-apt-repository ppa:webupd8team/java
 sudo apt-get update
 sudo apt-get install oracle-java7-installer
 sudo apt-get install ant

 export JAVA_HOME=/usr/lib/jvm/java-7-oracle

Code Visualization


I have integrated a new backend into PythonJS that translates Python code into a visual graph using vis.js. You can load code into the Pypubjs editor, and by clicking "graph" it will run the translation in the background and display the graph in a new window. This can be helpful if you are working with code written by someone else, and need a way to quickly understand it at a higher level.

source code

Friday, February 21, 2014

Fishing in a River of Trash - part2


pypubjs


I am working on an integrated development environment for PythonJS, called Pypubjs. Using Pypubjs you will be able to easily put together HTML5 projects written in CSS, JavaScript and Python, and quickly package binaries for all platforms: Linux, Windows, OSX and mobile using PhoneGap. The IDE itself is written in PythonJS and HTML5 using Node-Webkit and the Ace.js code editor with Darkstrap CSS by Dan Neu (a hack of Twitter's Bootstrap.

see source code

Thursday, February 20, 2014

Fishing in a River of Trash - part1


I had posted earlier this month about the garbage polluting the river that flows into Tarlac City here. 30Km downstream in the center of Tarlac City, things get much worse.

Passing through the city I often see people of all ages fishing in the river, despite its extreme level of pollution. Today I saw four young boys with a battery and two long prods shocking fish to catch them. They were also collecting coconuts from the river.

Tuesday, February 11, 2014

PythonJS to Lua


I recently refactored PythonJS into a better meta-translator and added new backends for: CoffeeScript and Lua. The regression tests now include benchmarks that generate the bar graphs below. I also merged the Lua.js translator to see what happens when you translate Python to Lua and then to JavaScript, the result is slower than PythonJS direct to JavaScript. The Dart backend has the highest performance. LuaJIT also performs well with about half the Pystones of CPython.

Recursive Fibonacci


(time in seconds, less is better)

Pystones


(time in seconds, less is better)

Monday, February 3, 2014

San Jose - Tarlac Province


San Jose, Tarlac Province, has a network of cool streams flowing from the western mountains, it one of the few places in the Philippines that it is still safe to drink water directly from the river. Many small villages can be found near and along the water ways.

Until recently the people in San Jose had lived in near perfect harmony with their environment; sadly things have recently changed. Along my short 3km hike to the river, I estimate I encountered about twenty small dumping sites composed mainly of baby diapers. All of these sites were relatively new. Each site had about 20-100 diapers.

above: baby diapers torn apart and scattered by wild dogs.

Garbage Dynamics

Garbage accumulates at different rates depending on what type it is and where it was dumped. Often it starts out as a few pieces of discarded plastic, once a place no longer is pristine, people are more likely to litter more. Once some threshold has been reached, someone will dump the first big bag of trash, this quickly leads others to dump more in the same area. There is a powerful feedback effect.

It is routine in the Philippines to burn trash in remote areas, this helps restore the areas to a relatively clean state, and control the feedback effect. Diapers are hard to burn compared to most other trash, so they tend to build up and encourage the growth of dumping sites. The Pinoy style for trash burning is simply to throw some grass on top and set it ablaze. This technique fails with diapers.

How To Safely Burn Plastics

Grass and wood should be placed under the plastic. A ratio of at least 50/50 wood/plastic is the minimum. Less harmful dioxins are released when the fire is hot, so the more dry wood the better.

Anything thing with chlorine (like paper products) when burned with plastics creates more dioxins, so burn them separately. Avoid burning black and dark colored plastics. Obviously, try to recycle as much of the plastic as possible, instead of burning it.