Thursday, November 8, 2012

Write your own web browser in 9 lines flat

This web browser in 9 lines of code comes to you courtesy of the awesome python bindings to the webkit renderer on Mac OSX, WebKitCtrl. One simply defines a window and drops the webkit renderer in, done!

First, make sure you have installed wxPython

Then drop this code into a file called browser.py :
import sys
import wx
import wx.webkit       

theApp = wx.PySimpleApp(0)
theFrame = wx.Frame(None, -1, "", size=(640,480))
w = wx.webkit.WebKitCtrl(theFrame, -1)
w.LoadURL(sys.argv[1])
theFrame.Show()
theApp.MainLoop()
You launch the browser from the command line, passing the URL to go to as argument, like so:
python_32 browser.py http://www.google.com/
The last bit needed is the script python_32, which ensures python will run in 32 bit mode, because the 64 bit mode is broken unless you have installed the wxPython Cocoa libraries. Place these lines in the file 'python_32'
#!/bin/bash
export VERSIONER_PYTHON_PREFER_32_BIT=yes
/usr/bin/python "$@"
and place that file in the same directory as 'browser.py'. Now, also make sure that this script is executable
chmod a+x python_32
Nitpickers take note. One might say that this is no different from calling a browser from the command line directly, which, according to the line counting above, would give you a browser in 0 lines of code:
open http://www.google.com
However, I would not call that 'your own browser' in the sense that you cannot wrap your own controls around it and interact with the browser contents as you can with the script above.

Friday, July 20, 2012

Computer-Supported Collaborative Science, Summer 2012

It was an honor to work with the CSCS team again this summer in the yearly workshop for middle-school science teachers. In the first week of this workshop, we develop new science curriculum using the CSCS methodology: Computer-Supported Collaborative Science.

The teachers then proceed to teach these new lessons to middle-school students that participate in the SAEP (Summer Academic Enrichment Program). This provides instant feedback and allows rapid changes to the lessons based on real classroom experience.

For this workshop, I created two youtube screencasts:

Thursday, May 3, 2012

... or I shall replace you with a small shell script

So, this rather long description that I posted a while ago on how to get Sparkleshare (a cloud storage solution where you host your own cloud) working on Ubuntu can now be replaced with a simple

sudo apt-get install sparkleshare

or select it in the package manager.  This is all possible due to it being available in the repository in the latest Ubuntu: 12.04, aka "Precise Pangolin". Awesome.

Pretty soon I will be able to

sudo apt-get install write_grant write_paper win_nobel

Wednesday, March 21, 2012

Sparkleshare: not quite Dropbox, but better in ways that matter to me

So. You have been using dropbox for some time to make sure all your files are synced between different systems. Perhaps you have shared folders with collaborators and this is how you work together on documents. It has become part of your workflow.

But, there are things that bother you. First, you don't have ownership over where the data is stored. You're not paranoid, but you wonder if trusting all your precious data to an unknown location in the cloud is the best thing. Second, you really cannot afford to pay for more storage, but if would be sooo useful if you could just put everything in the cloud and be done with it, never having to decide whether something needs to go into Dropbox or not.

Enter Sparkleshare. It works on Linux, Mac, and Window 7/Vista (sorry, no XP). It is open source. It is free. And you can store the data in your own system. And it uses git, major geek cred there. That also means you can use sparkleshare to always have the latest snapshots on github etc on your local drive.

The following steps are not too difficult to follow, but it is definitely not as easy as Dropbox.

1. Preparation. As my linux box is running Ubuntu Lucid, I had to upgrade GIT by subscribing to this repository

2. Install sparkeshare, either by subscribing to this repository or installing the client from the website

3. Setup your own data store

4. ?

5. Profit!

Downsides

1. As it uses GIT on the backend, it is not very good at dealing with large binary files. I haven't found any issues yet, but that is what google tells me

2. As it uses GIT on the backend, forget about putting a GIT repository in a sparkleshare folder

3.No iphone/android/Webos clients. Although you may run a web frontend to the GIT repository so you can get to the files that way too.

Saturday, February 25, 2012

Would You Like to Know the Truth?

Spread the Word, people. PDF is here http://www.csun.edu/~hpostma/thetruth.pdf