<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>insane innovations from a sane insanity</description><title>From bit to a heart beat</title><generator>Tumblr (3.0; @emotionull)</generator><link>http://jon.is.emotionull.com/</link><item><title>Create a web service in Clojure without start/stopping the server</title><description>&lt;p&gt;&lt;em&gt;This is a cross-post from &lt;a target="_blank" href="http://blog.socialcaddy.com/create-web-service-in-clojure-without-startst"&gt;SocialCaddy&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The problem using Jetty (or Netty or Ring) is that after you start the process, your beloved REPL is “binded” to the server thus forcing you to kill the service, make a change, start the process again, refresh and do it again. Not fun at all. It’s easy to run the process “in the background” and have the REPL available to make changes. &lt;/p&gt;
&lt;p&gt;Let’s create a new project (using lein).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&gt; lein new TinyService&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Now, we need  a project.clj (so we can do a lein deps and have everything installed automagically)&lt;/p&gt;
&lt;p&gt;
&lt;script src="http://gist.github.com/481262.js?file=project.clj"&gt;&lt;/script&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&gt; lein deps&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Edit core.clj with this:&lt;/p&gt;
&lt;p&gt;
&lt;script src="http://gist.github.com/481266.js?file=core.clj"&gt;&lt;/script&gt;&lt;/p&gt;
&lt;p&gt;You can run the service in REPL by (boot) and then you’ll still have access to REPL. You can change stuff, C+c C+c, refresh and voila! You can even connect to web server (to a JVM to be more exact) and make changes without the need for compilation. And all this from your local emacs!&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/831673339</link><guid>http://jon.is.emotionull.com/post/831673339</guid><pubDate>Mon, 19 Jul 2010 14:17:37 +0300</pubDate><category>emacs</category><category>clojure</category></item><item><title>"Having a developer write his own unit tests is like asking a crazy man if he’s sane."</title><description>“Having a developer write his own unit tests is like asking a crazy man if he’s sane.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;reddit&lt;/em&gt;</description><link>http://jon.is.emotionull.com/post/634943883</link><guid>http://jon.is.emotionull.com/post/634943883</guid><pubDate>Wed, 26 May 2010 20:30:23 +0300</pubDate></item><item><title>Activerecord in Python: Do it like Rails!</title><description>&lt;p&gt;I’ve searched around the net for a nice, clean implementation of activerecord in Python but I found none. There are many better libraries for database abstraction out there in Python but I think that Rails’ “activerecord” way is a breeze and a fun way to access a database.&lt;/p&gt;
&lt;p&gt;So, my weekend project was to see whether I could hack together a small activerecord for Python.&lt;/p&gt;
&lt;p&gt;The first thing I reeeeaally wanted to do, is to create dynamic queries. What dynamic queries are you ask.&lt;/p&gt;
&lt;p&gt;Let’s say you have a database and a table with some &lt;strike&gt;fruits&lt;/strike&gt; fields.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Table: People&lt;/p&gt;
&lt;p&gt;Fields: id, name, sex&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Using ActiveRecord you can do this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;user = People.find_by_name(“Robert”)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;and you’ll get all the People with the name Robert. The magic thing is that you haven’t defined anywhere the function find_by_name. Activerecord has only the function find_by and depending on your search it creates automatically a new function called find_by_name (if the ‘name’ field exists on your table). This is all thanks to Ruby’s method_missing function.&lt;/p&gt;
&lt;p&gt;Ruby’s method_missing is called automatically from ruby’s VM everytime a function you tried to call was not found. So, when you called find_by_name, ruby couldn’t find the function and after all the search it went to method_missing. From there, activerecord took control and done it’s magic.&lt;/p&gt;
&lt;p&gt;That are many different ways to do it in Python but only one comes close to Rails’ implementation.&lt;/p&gt;
&lt;p&gt;Behold:&lt;b&gt; __getattr__&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Everytime you call a class attribute, this function is called. So, in Python:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;user = User.find_by_name(“Robert”)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;calls __getatr__ and if the attribute does not exist, it throws an ‘AttributeError’ exception. That’s the place we are going to put our code and create the dynamic queries.&lt;/p&gt;
&lt;p&gt;The most difficult part was this: The function __getattr__ gets one parameter (the attribute) so in this example it was the &lt;b&gt;find_by_name&lt;/b&gt;. I had to find a way to pass to __getattr__ the query’s argument.&lt;/p&gt;
&lt;p&gt;Behold: &lt;b&gt;Lambda&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I know a hobby project of mine is awesome when I have to use lambda (old habits from C and Lisp). Using&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;lambda &lt;b&gt;value&lt;/b&gt;: do_smth(&lt;b&gt;value&lt;/b&gt;),&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;you open up the way for another parameter to join the game (hint: &lt;b&gt;value&lt;/b&gt;). So, we have this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;dynamic_query = {&lt;/p&gt;
&lt;p&gt;“find_by_”: lambda value: self._find(field, value)&lt;/p&gt;
&lt;p&gt;}[query]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is a dictionary emulating a switch/case in Python with lambdas. If you want to add more functions (insert,update) or more logic (find_by_name_and_sex), this is the place to hack.&lt;/p&gt;
&lt;p&gt;Check it online at &lt;a target="_blank" href="http://bitbucket.org/jonromero/pyactiverecord/"&gt;my bitbucket account&lt;/a&gt; and push your changes.&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/339111307</link><guid>http://jon.is.emotionull.com/post/339111307</guid><pubDate>Sun, 17 Jan 2010 15:33:36 +0200</pubDate><category>metaprogramming</category><category>rails</category><category>python</category><category>activerecord</category></item><item><title>Nimbuzz, Android and Skype: Put your headphones on!</title><description>&lt;p&gt;I love &lt;a href="http://nimbuzz.com/"&gt;Nimbuzz&lt;/a&gt; (loving it since I first learn about it when I was at the &lt;a target="_blank" href="http://erlang-factory.com"&gt;Erlang Factory&lt;/a&gt; in London and spoke with a guy from Nimbuzz) ‘cause it was running smoothly on my Symbian and allowing me to connect with Skype. So when I got my HTC Hero, it was the first app I was going to install. But Skype(to Skype) didn’t seem to work (couldn’t speak, couldn’t hear).&lt;/p&gt;
&lt;p&gt;I tried &lt;a href="http://fring.com"&gt;Fring&lt;/a&gt; where everything seemed to be working smoothly and I noticed that a headphones icon was appering on my notification bar eventhough I had no headphones connected. So, I connected my slick HTC Hero headphones, fired up Nimbuzz and tadaaaa!&lt;/p&gt;
&lt;p&gt;Maybe this solves the muted mic for the Droid on Nimbuzz. I hope for an update and video call!&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/319634186</link><guid>http://jon.is.emotionull.com/post/319634186</guid><pubDate>Wed, 06 Jan 2010 13:01:44 +0200</pubDate><category>android</category></item><item><title>Facebook Connect for web2py</title><description>&lt;p&gt;Even though web2py has support for building facebook applications, we didn’t have a way to use Facebook Connect.&lt;/p&gt;
&lt;p&gt;I’ve studied many ways (like Facebook’s Javascript API) and checked other frameworks (Rails and Django) and after 4 hours I made a patch to facebook.py that enables web2py (and I’m sure that other python frameworks can use - like webpy) to use Facebook Connect by doing this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;def index():&lt;br/&gt;   connected = facebook_connect(request, facebook_settings)&lt;br/&gt;   if connected:&lt;br/&gt;       user = get_facebook_user(request.facebook)&lt;br/&gt;       response.flash = "Hello ", user        &lt;br/&gt;   return dict(api_key=facebook_settings.FACEBOOK_API_KEY)&lt;code&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Just one line of code and you are done!&lt;/p&gt;
&lt;p&gt;You can check a live example &lt;a title="here" target="_blank" href="http://fbconnect-demo.emotionull.com/"&gt;here&lt;/a&gt; and grub the &lt;a target="_blank" href="http://github.com/jonromero/fbconnect-web2py"&gt;code&lt;/a&gt; from github&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/319023923</link><guid>http://jon.is.emotionull.com/post/319023923</guid><pubDate>Wed, 06 Jan 2010 04:37:26 +0200</pubDate><category>facebook connect</category><category>web2py</category></item><item><title>Implementing a Rails-like scaffolding in web2py (but better!)</title><description>&lt;p&gt;Sometimes I want to create a better administration panel for our clients. With this hack you can create an add/edit/delete panel for every table you like and extend it easily. in order to use it you just go inside the controllers and add:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@scaffold(None)&lt;br/&gt;def authors():&lt;br/&gt;    pass&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;this will create an admin page (authors) that has all the properties from the table “authors”. if you have to “admin” a different table just put it’s name:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@scaffold("other_table")&lt;br/&gt;def authors():&lt;br/&gt;    pass&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Read the comments for more hacks. PS: I have also a new version that you can pass custom queries (I’ll keep you updated). PS2: Also a version with DataTables (&lt;a href="http://datatables.net/"&gt;http://datatables.net/&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;You can also chain decorators in order to prevent unauthorized access:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@auth.requires_login()&lt;br/&gt;@scaffold("other_table")&lt;br/&gt;def authors():&lt;br/&gt;    pass&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, the installation:&lt;/p&gt;
&lt;p&gt;First, put this code inside a module (or in a separate file in models).&lt;/p&gt;
&lt;p&gt;def scaffold(tbl&lt;i&gt;name=None, field&lt;/i&gt;id=None):         “””         Decorator that exposes show/add/edit/delete         for admin purposes&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    You can specify a table name else it will use the&lt;br/&gt;    name of the function as table name&lt;br/&gt;    You can specify a field id that will be displayed for the record&lt;br/&gt;    else it will use the first field value&lt;br/&gt;    """&lt;br/&gt;&lt;br/&gt;    def decorator_outside(func):&lt;br/&gt;&lt;br/&gt;        def decorator_inside(*args):&lt;br/&gt;&lt;br/&gt;            db_name = db # we could get the database name from globals&lt;br/&gt;            table_name = func.__name__ if tbl_name == None else tbl_name&lt;br/&gt;            if table_name not in db_name.tables:&lt;br/&gt;                raise Exception("No table with name '%s' found" % table_name)&lt;br/&gt;&lt;br/&gt;            form = None&lt;br/&gt;            if len(request.args) &gt; 1:&lt;br/&gt;                action = request.args[0]&lt;br/&gt;                record_id = request.args[1]&lt;br/&gt;&lt;br/&gt;                if action == 'create':&lt;br/&gt;                    form = crud.create(db_name[table_name])&lt;br/&gt;&lt;br/&gt;                elif action == 'show':          &lt;br/&gt;                    form = crud.read(db_name[table_name], record_id)&lt;br/&gt;&lt;br/&gt;                elif action == 'edit':          &lt;br/&gt;                    form = crud.update(db_name[table_name], record_id)&lt;br/&gt;&lt;br/&gt;                elif request.args[0] == 'delete':           &lt;br/&gt;                    form = crud.delete(db_name[table_name], record_id)&lt;br/&gt;&lt;br/&gt;            result = db_name(db_name[table_name].id &gt; 0).select()       &lt;br/&gt;            func()&lt;br/&gt;&lt;br/&gt;            return dict(rows=result, cntr_name=table_name, form=form, field_id=field_id)&lt;br/&gt;        return decorator_inside&lt;br/&gt;&lt;br/&gt;    return decorator_outside&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The do the action in the controller     @scaffold(“other_table”)     def authors():         pass&lt;/p&gt;
&lt;p&gt;Finally create a view file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{{extend 'layout.html'}}&lt;br/&gt;{{ include 'scaffold.html' }}&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and paste this into your views folder:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{{= form if form != None else "" }}&lt;br/&gt;&lt;br /&gt;&lt;br/&gt;&lt;table&gt;&lt;br/&gt;  {{ i = 0 }}&lt;br/&gt;  {{ for row in rows: }}&lt;br/&gt;  {{ i += 1 }}&lt;br/&gt;  &lt;tr class="{{='even' if i%2 else 'odd'}}"&gt;&lt;br/&gt;    &lt;td class='main'&gt;&lt;a href="{{= URL(r=request, f=cntr_name+'/show',&lt;br/&gt;                     args=row.id) }}"&gt;{{= row.values()[field_id] }}&lt;/a&gt;&lt;/td&gt;&lt;br/&gt;    &lt;td&gt;&lt;a href="{{= URL(r=request, f=cntr_name+'/edit',&lt;br/&gt;                     args=row.id) }}"&gt;Edit&lt;/a&gt;&lt;/td&gt;&lt;br/&gt;    &lt;td&gt;&lt;a href="{{= URL(r=request, f=cntr_name+'/delete',&lt;br/&gt;                     args=row.id) }}"&gt;Delete&lt;/a&gt;&lt;/td&gt;&lt;br/&gt;  &lt;/tr&gt;&lt;br/&gt;  {{ pass }}&lt;br/&gt;&lt;/table&gt;&lt;br/&gt;&lt;br/&gt;{{ if not len(rows): }}&lt;br/&gt;No records found&lt;br/&gt;{{ pass }}&lt;br/&gt;&lt;br/&gt;&lt;br /&gt;&lt;br/&gt;&lt;a href="{{= URL(r=request, f=cntr_name+'/create/new') }}"&gt;Add new&lt;/a&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;</description><link>http://jon.is.emotionull.com/post/301344546</link><guid>http://jon.is.emotionull.com/post/301344546</guid><pubDate>Sat, 26 Dec 2009 17:08:00 +0200</pubDate></item><item><title>Uploading files using CKEditor in web2py</title><description>&lt;p&gt;This is the second part of integrating CKEditor in web2py. I should warn you that quotes are messed up in the blog so you can check at &lt;a target="_blank" href="http://www.web2pyslices.com/main/slices/take_slice/18"&gt;web2pyslices&lt;/a&gt; for the updated (and ready for copy-paste) version.&lt;/p&gt;
&lt;p&gt;What it needs to be done in order to have ckeditor uploading works. First, it needs a “file browser” url. That’s just a form with an upload field where we can use to find and upload files. The think is that we must return the path of the uploaded file BACK to the parent form. The most difficult part is activating the Upload button. That is done by specifying the “filebrowserBrowseUrl”. So, here it goes!&lt;/p&gt;
&lt;p&gt;Let’s add a new table that will hold our files:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import datetime;&lt;br/&gt;timestamp = datetime.datetime.today()&lt;br/&gt;    db.define_table('files',&lt;br/&gt;                    Field('title', 'string'),&lt;br/&gt;                    Field('uploaded_data', 'upload'),&lt;br/&gt;                    Field('created_on','datetime',default=timestamp))&lt;br/&gt;&lt;br/&gt;db.files.title.requires = IS_NOT_EMPTY()                &lt;br/&gt;db.files.uploaded_data.requires = IS_NOT_EMPTY()&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, lets add an action the our controller&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def upload_file():&lt;br/&gt;    url = ""&lt;br/&gt;&lt;br/&gt;    form = SQLFORM(db.files, showid=False)&lt;br/&gt;    if form.accepts(request.vars, session):&lt;br/&gt;        response.flash = T('File uploaded successfully!')&lt;br/&gt;        url = URL(r=request, f="download", &lt;br/&gt;                 args = db(db.files.title == request.vars.title).select(orderby=~db.files.created_on)[0].uploaded_data)&lt;br/&gt;    return dict(form=form, cknum=request.vars.CKEditorFuncNum, url=url)&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and a view upload_file.html:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{{extend 'layout.html'}}&lt;br/&gt;&lt;br/&gt;&lt;h2&gt;Upload file&lt;/h2&gt;&lt;br/&gt;{{=form}}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;{{ if url != "": }}&lt;br/&gt;&lt;script type="text/javascript"&gt;&lt;br/&gt;  window.opener.CKEDITOR.tools.callFunction({{=cknum}}, '{{=url}}');&lt;br/&gt;&lt;/script&gt;&lt;br/&gt;{{ pass }}&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, lets add the javascript files to our layout AFTER web2py_ajax.html:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; &lt;script type="text/javascript" src="{{=URL(request.application,'static','js/ckeditor/ckeditor.js')}}"&gt;&lt;/script&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, lets create a test page:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{{extend 'layout.html'}}&lt;br/&gt;&lt;br/&gt;{{=form}}&lt;br/&gt;&lt;br/&gt;&lt;script type="text/javascript"&gt;&lt;br/&gt;  var ckeditor = CKEDITOR.replace('page_body', {&lt;br/&gt;  filebrowserBrowseUrl : "{{=URL(request.application, c='default', f='upload_file')}}",&lt;br/&gt;  //filebrowserUploadUrl : "{{=URL(request.application, c='default', f='upload_file')}}",&lt;br/&gt;});&lt;br/&gt;&lt;/script&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We are ready!&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/288806037</link><guid>http://jon.is.emotionull.com/post/288806037</guid><pubDate>Fri, 18 Dec 2009 13:00:41 +0200</pubDate></item><item><title>Creating unicode permalinks in Python (even from Greek!)</title><description>&lt;p&gt;Optimizing &lt;a href="http://betabug.ch/blogs/ch-athens/135"&gt;this blog post&lt;/a&gt;, which shows you how to create a greek to greeklish “translator”, I’ve created a permalink function that creates urls from greek titles (but you can use your language).&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;blockquote&gt;def create_permalink(s):&lt;br/&gt; “”“&lt;br/&gt; Create greeklish permalinks.&lt;br/&gt; Also works for english.&lt;br/&gt; “”“&lt;br/&gt; import string&lt;br/&gt; import re&lt;br/&gt;&lt;br/&gt; input_string = s.lower().decode(‘utf-8’).encode(‘iso-8859-7’, ‘replace’)&lt;br/&gt; from_chars = ‘αβγδεζηθικλμνξοπρσςτυφχψωάήέίόύώϊ’.decode(‘utf-8’).encode(‘iso-8859-7’, ‘replace’)&lt;br/&gt; to_chars = ‘abgdezh8iklmn3oprsstufxywaheiouwi’&lt;br/&gt;&lt;br/&gt; translation_table = string.maketrans(from_chars, to_chars)&lt;br/&gt; input_string = string.translate(input_string, translation_table)&lt;br/&gt;&lt;br/&gt; return re.compile(“\W+”, re.UNICODE).sub(“_”, input_string)&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
&lt;/blockquote&gt;</description><link>http://jon.is.emotionull.com/post/248260459</link><guid>http://jon.is.emotionull.com/post/248260459</guid><pubDate>Wed, 18 Nov 2009 10:28:00 +0200</pubDate></item><item><title>Using widgets in web2py (integrating CKEditor)</title><description>&lt;p&gt;Although web2py comes with an integrated editor, I really like &lt;a title="ckeditor" target="_blank" href="http://ckeditor.com/"&gt;ckeditor&lt;/a&gt; and using it for a text field is trivial using widgets!&lt;/p&gt;
&lt;p&gt;First, install ckeditor (put the ckeditor inside a js/ckeditor file in your static folder and include it) :&lt;/p&gt;
&lt;blockquote&gt;&lt;script type=”text/javascript” src=”{{=URL(request.application,’static’,’js/ckeditor/ckeditor.js’)}}”&gt;&lt;/script&gt;&lt;br/&gt;
&lt;/blockquote&gt;
&lt;p&gt;After that, we define a ‘body’ text field (or whatever name you like):&lt;/p&gt;
&lt;blockquote&gt;db.define_table(‘page’,&lt;br/&gt; # more Fields …&lt;br/&gt; Field(‘body’, ‘text’))&lt;/blockquote&gt;
&lt;p&gt;Then, inside your db.py (or to another file in your models directory) put the widget:&lt;/p&gt;
&lt;blockquote&gt;def advanced_editor(field, value):&lt;br/&gt; return TEXTAREA(_id = str(field).replace(‘.’,’_’), _name=field.name, _class=’text ckeditor’, value=value, _cols=80, _rows=10)&lt;br/&gt;
&lt;/blockquote&gt;
&lt;p&gt;and use the widget&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;db.page.body.widget = advanced_editor&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;From now, SQLFORM will use ckeditor to show/edit/save data!&lt;/p&gt;
&lt;p&gt;&lt;img alt="CkEditor in web2py" src="http://emotionull.com/blog_files/ckeditor-in-web2py.png" height="235" width="470"/&gt;&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/227873650</link><guid>http://jon.is.emotionull.com/post/227873650</guid><pubDate>Fri, 30 Oct 2009 14:14:08 +0200</pubDate></item><item><title>Creating a dropdown with country names in web2py</title><description>&lt;p&gt;There are many ways to create a dropdown that includes all countries in web2py but the most pythonic way goes like this:&lt;/p&gt;
&lt;p&gt;Create a module (let’s name it countries.py) and put a list of countries :&lt;/p&gt;
&lt;blockquote&gt;COUNTRIES=(‘United States’, ‘Afghanistan’, ‘Albania’, ‘Algeria’, ‘Andorra’, ‘Angola’, ‘Antigua and Barbuda’, ‘Argentina’, ‘Armenia’, ‘Australia’, ‘Austria’, ‘Azerbaijan’, ‘Bahamas’, ‘Bahrain’, ‘Bangladesh’, ‘Barbados’, ‘Belarus’, ‘Belgium’, ‘Belize’, ‘Benin’, ‘Bhutan’, ‘Bolivia’, ‘Bosnia and Herzegovina’, ‘Botswana’, ‘Brazil’, ‘Brunei’, ‘Bulgaria’, ‘Burkina Faso’, ‘Burundi’, ‘Cambodia’, ‘Cameroon’, ‘Canada’, ‘Cape Verde’, ‘Central African Republic’, ‘Chad’, ‘Chile’, ‘China’, ‘Colombia’, ‘Comoros’, ‘Congo’, ‘Costa Rica’, “C&amp;ocirc;te d’Ivoire”, ‘Croatia’, ‘Cuba’, ‘Cyprus’, ‘Czech Republic’, ‘Denmark’, ‘Djibouti’, ‘Dominica’, ‘Dominican Republic’, ‘East Timor’, ‘Ecuador’, ‘Egypt’, ‘El Salvador’, ‘Equatorial Guinea’, ‘Eritrea’, ‘Estonia’, ‘Ethiopia’, ‘Fiji’, ‘Finland’, ‘France’, ‘Gabon’, ‘Gambia’, ‘Georgia’, ‘Germany’, ‘Ghana’, ‘Greece’, ‘Grenada’, ‘Guatemala’, ‘Guinea’, ‘Guinea-Bissau’, ‘Guyana’, ‘Haiti’, ‘Honduras’, ‘Hong Kong’, ‘Hungary’, ‘Iceland’, ‘India’, ‘Indonesia’, ‘Iran’, ‘Iraq’, ‘Ireland’, ‘Israel’, ‘Italy’, ‘Jamaica’, ‘Japan’, ‘Jordan’, ‘Kazakhstan’, ‘Kenya’, ‘Kiribati’, ‘North Korea’,’South Korea’, ‘Kuwait’, ‘Kyrgyzstan’, ‘Laos’, ‘Latvia’, ‘Lebanon’, ‘Lesotho’, ‘Liberia’, ‘Libya’, ‘Liechtenstein’, ‘Lithuania’, ‘Luxembourg’, ‘FYROM’, ‘Madagascar’, ‘Malawi’, ‘Malaysia’, ‘Maldives’, ‘Mali’, ‘Malta’, ‘Marshall Islands’, ‘Mauritania’, ‘Mauritius’, ‘Mexico’, ‘Micronesia’, ‘Moldova’, ‘Monaco’, ‘Mongolia’, ‘Montenegro’, ‘Morocco’, ‘Mozambique’, ‘Myanmar’, ‘Namibia’, ‘Nauru’, ‘Nepal’, ‘Netherlands’, ‘New Zealand’, ‘Nicaragua’, ‘Niger’, ‘Nigeria’, ‘Norway’, ‘Oman’, ‘Pakistan’, ‘Palau’, ‘Palestine’, ‘Panama’, ‘Papua New Guinea’, ‘Paraguay’, ‘Peru’, ‘Philippines’, ‘Poland’, ‘Portugal’, ‘Puerto Rico’, ‘Qatar’, ‘Romania’, ‘Russia’, ‘Rwanda’, ‘Saint Kitts and Nevis’, ‘Saint Lucia’, ‘Saint Vincent and the Grenadines’, ‘Samoa’, ‘San Marino’, ‘Sao Tome and Principe’, ‘Saudi Arabia’, ‘Senegal’, ‘Serbia and Montenegro’, ‘Seychelles’, ‘Sierra Leone’, ‘Singapore’, ‘Slovakia’, ‘Slovenia’, ‘Solomon Islands’, ‘Somalia’, ‘South Africa’, ‘Spain’, ‘Sri Lanka’, ‘Sudan’, ‘Suriname’, ‘Swaziland’, ‘Sweden’, ‘Switzerland’, ‘Syria’, ‘Taiwan’, ‘Tajikistan’, ‘Tanzania’, ‘Thailand’, ‘Togo’, ‘Tonga’, ‘Trinidad and Tobago’, ‘Tunisia’, ‘Turkey’, ‘Turkmenistan’, ‘Tuvalu’, ‘Uganda’, ‘Ukraine’, ‘United Arab Emirates’, ‘United Kingdom’, ‘Uruguay’, ‘Uzbekistan’, ‘Vanuatu’, ‘Vatican City’, ‘Venezuela’, ‘Vietnam’, ‘Yemen’, ‘Zambia’, ‘Zimbabwe’)&lt;br/&gt;
&lt;/blockquote&gt;
&lt;p&gt;then import it to db.py&lt;/p&gt;
&lt;blockquote&gt;from applications.yourapplicationname.modules.countries import *&lt;br/&gt;
&lt;/blockquote&gt;
&lt;p&gt;and just “map” the whole list to a database field&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;db.shipping_info.countries.requires = IS_IN_SET(COUNTRIES)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now, when you render the field using SQLFORM in your view, a dropdown (select) will be created automatically including all the countries.&lt;/p&gt;
&lt;p&gt;Yeap, SQLFORM rocks.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/206908869</link><guid>http://jon.is.emotionull.com/post/206908869</guid><pubDate>Wed, 07 Oct 2009 22:42:00 +0300</pubDate></item><item><title>Adding your .emacs to Mercurial / Git</title><description>&lt;p&gt;Having my favorite .emacs settings available, in the tip of my “hg clone” command is &lt;b&gt;precious. &lt;/b&gt;No more backups and no more “oh no, I have an older version in my usb stick”. And it’s easy!&lt;/p&gt;
&lt;p&gt;First of all, you need a mercurial server. Or an account at &lt;a title="bitbucket" href="http://bitbucket.org/"&gt;&lt;a href="http://bitbucket.org/"&gt;http://bitbucket.org/&lt;/a&gt;&lt;/a&gt;. Of course the same procedure stands for git.&lt;/p&gt;
&lt;p&gt;Then you create a new repository (let’s call it my-emacs).&lt;/p&gt;
&lt;p&gt;After that, you must move/rename your .emacs.d/ directory to .emacs.d-old/ and clone your repository.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;cd ~&lt;/p&gt;
&lt;p&gt;mv .emacs.d/ .emacs.d-old&lt;/p&gt;
&lt;p&gt;rm -R .emacs.d/&lt;/p&gt;
&lt;p&gt;hg clone https://yourname@bitbucket.org/yourname/my-emacs .emacs.d&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;the last line is available for copy-past on bitbucket.&lt;/p&gt;
&lt;p&gt;Then you copy all your files to the .emacs.d which is now under version control&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;cp .emacs.d-old/ .emacs.d -R&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now the only thing is missing is adding your .emacs file. There are two ways. One is creating a init.el and the other one is having a .emacs file that loads another one dot-emacs.el which is in your version-controlled .emacs.d/&lt;/p&gt;
&lt;p&gt;So,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;cp .emacs .emacs.d/dot-emacs.el&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The .emacs which is outside of .emacs.d (thus not under version control, should have this line:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;(load “~/.emacs.d/dot-emacs.el”)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And you are ready! If you need to ignore a directory (which is inside .emacs.d/) just create a .hgignore file inside .emacs.d/ and add the name of the directory or any other files (google “hg ignore”):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ignore-dir/&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Finally commit everything and push them to server.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;cd .emacs.d&lt;/p&gt;
&lt;p&gt;hg add *&lt;/p&gt;
&lt;p&gt;hg commit -m “First commit”&lt;/p&gt;
&lt;p&gt;hg push&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/199411993</link><guid>http://jon.is.emotionull.com/post/199411993</guid><pubDate>Mon, 28 Sep 2009 22:46:48 +0300</pubDate></item><item><title>First review - Karmic Ubuntu Moblin Remix</title><description>&lt;p&gt;No one has posted a review of the upcoming Ubuntu remix, so here we go!&lt;/p&gt;

&lt;p&gt;&lt;img src="http://emotionull.com/blog_files/19092009559.jpg" height="354" width="527"/&gt;&lt;/p&gt;
&lt;p&gt;First of all, I installed it via usb-creator on a 64gb USB (you need more than 1gb usb for installation via usb - even a 2gb will do) with no problem at all.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://emotionull.com/blog_files/19092009561.jpg" align="text-top" height="100" width="145"/&gt;The boot stage is identical to the Ubuntu 9.10 and way slower than Moblin’s boot stage (+10secs). After that, the environment seems the same, but now we have the Ubuntu wallpaper and many Ubuntu programs (OpenOffice, Empathy, Synaptic package manager, etc).&lt;/p&gt;
&lt;p&gt;&lt;img src="http://emotionull.com/blog_files/19092009566.jpg" height="217" width="290"/&gt;&lt;/p&gt;
&lt;p&gt;The network still has the same bugs as the Moblin has (can’t save password and I couldn’t connect to wifi) and the main problem is that every time you run a program, it doesn’t seem very integrated into the Moblin UI, so when you close the application, a white screen welcomes you. After that you have to click the menu bar and return to whatever you were doing.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://emotionull.com/blog_files/19092009570.jpg" height="288" width="480"/&gt;&lt;/p&gt;
&lt;p&gt;Another thing is that whenever you are starting a program you have to decide whether you want a new space or you want to squeeze it to an old one (the dialog stays for about 3 secs).&lt;/p&gt;
&lt;p&gt;Definitely not a production-ready image (it’s called “development iso” for a reason) but I think that in order to utilize the Moblin v2 UI, many application must be rewritten or replaced.&lt;/p&gt;
&lt;p&gt;You can check the images in better quality and some more &lt;a target="_blank" href="http://emotionull.com/blog_files/"&gt;here&lt;/a&gt;&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/191927255</link><guid>http://jon.is.emotionull.com/post/191927255</guid><pubDate>Sat, 19 Sep 2009 22:03:50 +0300</pubDate></item><item><title>Ubuntu Moblin Remix is out!</title><description>&lt;p&gt;&lt;img src="http://emotionull.com/blog_files/ubuntumoblincomputex-small_001.png" align="left" height="307" width="514"/&gt;It seems that I am the first one the found that Canonical &lt;a target="_blank" href="http://cdimage.ubuntu.com/ubuntu-moblin-remix/daily-live/current/"&gt;released an iso image&lt;/a&gt; of Ubuntu Moblin Remix (UMR), four months after the &lt;a target="_blank" href="http://www.ubuntu.com/news/canoical-commits-ubuntu-moblin"&gt;official announcement&lt;/a&gt; that Moblin v2 will be supported and a couple of months after the announcement that&lt;a target="_blank" href="http://news.softpedia.com/news/Computex-2009-Ubuntu-Moblin-Remix-Announced-113153.shtml"&gt; they are working on Ubuntu Moblin Remix&lt;/a&gt;. That means that the sexy interface of Moblin v2, will be included at the ubuntu repositories (and it will be supported by Canonical).&lt;/p&gt;
&lt;p&gt;Pics/videos are coming along with a full review!&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/189343845</link><guid>http://jon.is.emotionull.com/post/189343845</guid><pubDate>Wed, 16 Sep 2009 16:06:56 +0300</pubDate></item><item><title>How to setup Emacs 23.1 and slime for Ubuntu </title><description>&lt;p&gt;After searching and patching around this is what you have to do:&lt;/p&gt;
&lt;p&gt;First, install emacs23 (emacs-snapshot) from here&lt;a title="https://launchpad.net/~ubuntu-elisp/+archive/ppa" href="https://launchpad.net/~ubuntu-elisp/+archive/ppa"&gt; &lt;a href="https://launchpad.net/~ubuntu-elisp/+archive/ppa"&gt;https://launchpad.net/~ubuntu-elisp/+archive/ppa&lt;/a&gt;&lt;/a&gt;. Choose your distro, add the entries to your sources.list, install and you have emacs 23.1.&lt;/p&gt;
&lt;p&gt;Now, add slime and sbcl from ubuntu repositories and add this to your .emacs file:&lt;/p&gt;
&lt;p&gt;;; Lisp&lt;br/&gt;(setq inferior-lisp-program “sbcl”)&lt;br/&gt;(add-to-list ‘load-path “/usr/share/emacs/site-lisp/slime”)&lt;br/&gt;(require ‘slime)&lt;br/&gt;(slime-setup ‘(slime-fancy))&lt;/p&gt;
&lt;p&gt;and happy hacking!&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/172899854</link><guid>http://jon.is.emotionull.com/post/172899854</guid><pubDate>Thu, 27 Aug 2009 14:00:44 +0300</pubDate></item><item><title>OpenShare :: The First OpenSource Ad network!</title><description>&lt;p&gt;This started as a project for a company that wanted an ultra fast advertising server to use for their “ring of sites”. After the project finished, I kept thinking that the OpenSource community could benefit from a “Banner Exchange” service that is free, fast and reliable. So, I started hacking one in &lt;a title="web2py" href="http://www.web2py.com"&gt;web2py&lt;/a&gt; running on Google App Engine (no, it has nothing to do with the previous one I’ve built) and after a couple of days (you can tell from the design) it is done.&lt;/p&gt;
&lt;p&gt;I think that OpenSource projects, blogs, N.G.Os, forums etc, can benefit from a non-profit ring of sites that could help them increase their hits/clicks.&lt;/p&gt;
&lt;p&gt;If you have an OpenSource project, blog, NGO, forum, portal, whatever that is free, you are more than welcome to join OpenShare!&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;p&gt;&lt;a title="OpenShare" href="http://openshare.emotionull.com/"&gt;&lt;a href="http://openshare.emotionull.com/"&gt;http://openshare.emotionull.com/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/170499188</link><guid>http://jon.is.emotionull.com/post/170499188</guid><pubDate>Mon, 24 Aug 2009 18:40:23 +0300</pubDate></item><item><title>Using your mobile as a Bluetooth modem for Ubuntu (10 simple steps!)</title><description>&lt;p&gt;I have free GPRS on my mobile and sometimes I just need my daily dose of Internet even when I am at places with no Internet connection (island / mountain). I know there are many good solutions but sadly many of them are missing some important stuff. So, here is my take:&lt;/p&gt;
&lt;p&gt;1. Download bluez-passkey-gnome&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sudo apt-get install bluez-passkey-gnome&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;2. Run bluetooth-applet (you’ll see why in the next step)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sudo bluetooth-applet &amp;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;3. Pair you mobile with your Ubuntu&lt;/p&gt;
&lt;p&gt;There is no need to enable your Bluetooth on your phone (will be automatically enabled later) but is vital to make your phone visible (at least for the time being). Also, enable your bluetooth on your Ubuntu. If you don’t know how, google around. There are many guides (it’s reeealy easy and probably is already enabled along with your wireless connection).&lt;/p&gt;
&lt;p&gt;Find the “Paired Devices” screen on your phone’s menu and select “New paired device” and select your Ubuntu. Then you’ll be asked for a password (put whatever you like). At the same time, a dialog will popup from your Ubuntu, asking for the same password. After that, congrats, your phone and your Ubuntu are paired :D&lt;/p&gt;
&lt;p&gt;There is no need to create a pin file inside the bluetooth directory (in case you where reading other tutorials). Bluetooth-applet handles everything.&lt;/p&gt;
&lt;p&gt;4. Search for your phone from Ubuntu&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ hcitool scan&lt;br/&gt; Scanning …&lt;br/&gt; xx:xx:xx:xx:xx:xx My phone&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The xx:xx:xx:xx:xx:xx your phone’s “id”. Will use it at the next steps.&lt;/p&gt;
&lt;p&gt;4. Find the correct channel for Dial-Up networking (usually is channel 2)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sdptool browser xx:xx:xx:xx:xx:xx&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Search for the Dial-Up networking and then check the number of channel.&lt;/p&gt;
&lt;p&gt;5. Modify the file: /etc/bluetooth/rfcomm.conf&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;rfcomm0 {&lt;br/&gt; #       # Automatically bind the device at startup&lt;br/&gt; bind yes;&lt;br/&gt; #&lt;br/&gt; #       # Bluetooth address of the device&lt;br/&gt; device xx:xx:xx:xx:xx:xx;&lt;br/&gt; #&lt;br/&gt; #       # RFCOMM channel for the connection&lt;br/&gt; channel &lt;b&gt;2&lt;/b&gt;;&lt;br/&gt; #&lt;br/&gt; #       # Description of the connection&lt;br/&gt; comment “My phone”;&lt;br/&gt; }&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Add your mobile’s “id” and the channel and you are set.&lt;/p&gt;
&lt;p&gt;6. Restart bluetooth services&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sudo /etc/init.d/bluetooth restart&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;7. Connect to the phone&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ rfcomm connect 0&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There is another way to connect to your phone (using the id) but as long as you’ve done step 5, you are set :D&lt;/p&gt;
&lt;p&gt;If it works, you should see&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Press CTRL-C for hangup&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;8. Connection settings&lt;/p&gt;
&lt;p&gt;You need to put these files (search for your provider). The examples below are for Vodafone Greece (I couldn’t find it anywhere online). If you can’t find yours online, you can either call them OR check the setting from your mobile (Internet Settings, connections, something like that). You should see something like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Name of access point:&lt;b&gt; wapkarta.vodafone.gr&lt;/b&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Write that down. We are gonna need it.&lt;/p&gt;
&lt;p&gt;Update: These setting usually a proxy for your browser. Google around for the proxy or a better access point.&lt;/p&gt;
&lt;p&gt;Now,  create a file :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sudo nano /etc/ppp/peers/vodafone&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;and paste this (they might be different for your provider! Google around!)&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;# from &lt;a href="http://www.hingston.demon.co.uk/mike/nokia6680.html"&gt;www.hingston.demon.co.uk/mike/nokia6680.html&lt;/a&gt; &lt;br/&gt; noauth&lt;br/&gt;#change this if you move the path to your connect script&lt;br/&gt;  connect "/usr/sbin/chat -v -f /etc/chatscripts/vodafone-connect"&lt;br/&gt;#change this if you move the path to your disconnect script&lt;br/&gt;  disconnect "/usr/sbin/chat -v -f /etc/chatscripts/vodafone-disconnect"&lt;br/&gt;#I found that I needed this to remove problems with loopback on connecting&lt;br/&gt;  silent&lt;br/&gt;#remove this if you don't want lots of information going to /var/log/messages&lt;br/&gt;  debug&lt;br/&gt;#this is the device specified in your rfcomm.conf file&lt;br/&gt;  /dev/rfcomm0&lt;br/&gt;#speed at which to connect - might be worth trying higher...&lt;br/&gt;  115200&lt;br/&gt;#this is needed so that a default route is added to your routing table&lt;br/&gt;  defaultroute&lt;br/&gt;#this is needed so that you pick up Orange's DNS settings&lt;br/&gt;  usepeerdns&lt;br/&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Next,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sudo nano /etc/chatscripts/vodafone-connect&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;and paste this BUT put your access point (again, this is for Vodafone Greece)&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;#from &lt;a href="http://www.hingston.demon.co.uk/mike/nokia6680.html"&gt;www.hingston.demon.co.uk/mike/nokia6680.html&lt;/a&gt;&lt;br/&gt;TIMEOUT         5&lt;br/&gt;ECHO            ON&lt;br/&gt;ABORT           '\nBUSY\r'&lt;br/&gt;ABORT           '\nERROR\r'&lt;br/&gt;ABORT           '\nNO ANSWER\r'&lt;br/&gt;ABORT           '\nNO CARRIER\r'&lt;br/&gt;ABORT           '\nNO DIALTONE\r'&lt;br/&gt;ABORT           '\nRINGING\r\n\r\nRINGING\r'&lt;br/&gt;''              \rAT&lt;br/&gt;TIMEOUT         12&lt;br/&gt;&lt;br/&gt;OK              ATE1&lt;br/&gt;#here's the magic bit!&lt;br/&gt;#OK              'AT+cgdcont=1,"IP","&lt;b&gt;wapkarta.vodafone.gr&lt;/b&gt;"'&lt;br/&gt;# We found a better one that doesn't need a proxy and allows even ssh!&lt;br/&gt;OK              'AT+cgdcont=1,"IP","&lt;b&gt;webkarta.vodafone.gr&lt;/b&gt;"'&lt;br/&gt;OK              ATD*99***1#&lt;br/&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;and finally,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sudo nano /etc/chatscripts/vodafone-disconnect&lt;/p&gt;
&lt;pre&gt;# from &lt;a href="http://www.hingston.demon.co.uk/mike/nokia6680.html"&gt;www.hingston.demon.co.uk/mike/nokia6680.html&lt;/a&gt;&lt;br/&gt;ABORT		"BUSY"		&lt;br/&gt;ABORT		"ERROR"		&lt;br/&gt;ABORT		"NO DIALTONE"	&lt;br/&gt;SAY		"\nSending break to the modem\n"	&lt;br/&gt;""		"\K"		&lt;br/&gt;""		"\K"		&lt;br/&gt;""		"\K"		&lt;br/&gt;""		"+++ATH"	&lt;br/&gt;""		"+++ATH"	&lt;br/&gt;""		"+++ATH"	&lt;br/&gt;SAY		"\nPDP context detached\n"&lt;br/&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;9. Let’s connect!&lt;/p&gt;
&lt;p&gt;First, check if the connection to your mobile is still up (step 7). If you don’t see&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Press CTRL-C for hangup&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;connect to your phone again.&lt;/p&gt;
&lt;p&gt;Now, the big monent!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sudo pon vodafone&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;starts the connection and you are online!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$ sudo poff vodafone&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;bring the connection down :P&lt;/p&gt;
&lt;p&gt;10. Troubleshooting&lt;/p&gt;
&lt;p&gt;Check /var/log/messages for problem when “calling your phone”.&lt;/p&gt;
&lt;p&gt;If everything goes well you should see:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Jul 17 22:46:33 trinity pppd[9401]: PAP authentication succeeded&lt;br/&gt;Jul 17 22:46:35 trinity pppd[9401]: local  IP address 10.2.116.125&lt;br/&gt;Jul 17 22:46:35 trinity pppd[9401]: remote IP address 10.4.4.4&lt;br/&gt;Jul 17 22:46:35 trinity pppd[9401]: primary   DNS address 210.239.17.10&lt;br/&gt;Jul 17 22:46:35 trinity pppd[9401]: secondary DNS address 210.239.17.11&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;PS: Forget SSH unless you are ready for some tunneling&lt;/p&gt;
&lt;p&gt;Also check this (great tutorial which I borrowed MANY stuff) &lt;a href="http://www.lynchconsulting.com.au/blog/index.cfm/2006/12/11/Nokia-N73-Bluetooth-modem-with-Ubuntu-Linux-Howto"&gt;http://www.lynchconsulting.com.au/blog/index.cfm/2006/12/11/Nokia-N73-Bluetooth-modem-with-Ubuntu-Linux-Howto&lt;/a&gt;&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/143759757</link><guid>http://jon.is.emotionull.com/post/143759757</guid><pubDate>Sat, 18 Jul 2009 01:35:00 +0300</pubDate><category>ubuntu</category><category>mobile</category><category>bluetooth</category><category>vodafone greece</category></item><item><title>Erlang Factory and RainUp Project - Phase I</title><description>&lt;p&gt;All I can say is: I am &lt;b&gt;AMAZED&lt;/b&gt; by the Erlang community! Sadly here in Greece there isn’t an active Erlang community (but if your are interested in starting one, give me tweet at jonromero) even though there are some crazy Erlang projects (tidier/HiPE/Dialyzer) and some &lt;a href="http://erlang-factory.com/conference/London2009/speakers/kostissagonas"&gt;crazy researchers/developers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;All the presentations were inspiring (and most of them uplifting) but what was very strange was the bonding of the community. Guys (and girls) with great knowledge about distributed systems, hacking and expertise in the their field, were easy not only to be approached but also give share thoughts, business directions and discuss about everything (ranging from new BEAM features to “I love summer in Greece”). And of course &lt;a href="http://en.wikipedia.org/wiki/Joe_Armstrong_(programming)"&gt;Joe Armstrong&lt;/a&gt; is not only a great scientist but a VERY funny, inspiring and open-hearted person. We had great discussions with him during Speaker’s dinner (where he was ecstatic about us trying to run thousand of nodes for our &lt;a href="http://rainup.org"&gt;project&lt;/a&gt;) but also bought us some beers the last day where we chilling out after the conference. What a great guy!&lt;/p&gt;
&lt;p&gt;O’Reilly was there with 35% discount with books for Clojure, Python, Ruby, Software architecture and of course the &lt;a href="http://oreilly.com/catalog/9780596518189/"&gt;Erlang Programming&lt;/a&gt; and &lt;a href="http://oreilly.com/catalog/9781934356005/?CMP=AFC-ak_book&amp;ATT=Programming+Erlang%2c"&gt;Programming Erlang&lt;/a&gt; (with signatures of Joe Armstrong, Francesco Cesarini and Simon Thompson).&lt;/p&gt;
&lt;p&gt;After having a GREAT time at the &lt;a title="Erlang Factory - London 2009" href="http://erlang-factory.com/conference/London2009"&gt;Erlang Factory&lt;/a&gt; and meeting with a lot of interesting and fun-to-be around people, it’s time to continue working on RainUp. We’ve uploaded some info &lt;a title="RainUp" href="http://rainup.org"&gt;here&lt;/a&gt; and you can download our presentation slides &lt;a href="http://erlang-factory.com/upload/presentations/114/JonVlachoyiannis,JimMyhrberg-ErlangFactoryLondon2009-RainUp-TheBiggestCloudComputingeverbuilt.pdf"&gt;here&lt;/a&gt; (soon the video will be available from the &lt;a href="http://erlang-factory.com"&gt;erlang-factory.com&lt;/a&gt; ).&lt;/p&gt;
&lt;p&gt;For our first phase we need to find some really interesting problems to start working on, so if you have any interesting algorithms please send us an email at contact@rainup.org.&lt;/p&gt;
&lt;p&gt;We have some servers to start working on but we are still interested in more computing power (there is along way to infinity), so if you have a datacenter to spare or money to help us fund the whole thing, send us an email at contact@rainup.org&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/132872255</link><guid>http://jon.is.emotionull.com/post/132872255</guid><pubDate>Tue, 30 Jun 2009 14:55:37 +0300</pubDate></item><item><title>A quick hack for random numbers in Erlang</title><description>&lt;p&gt;It seems that you can’t get random numbers in Erlang when you are in different processes. I am building a distributed Monte Carlo simulation and I wanted two random numbers for the x and y (of the dart). So, the only way to do it (if you want it to run in a cluster) is this (at least that’s what I’ve found).&lt;br/&gt;&lt;br/&gt; {Seed1, Seed2, Seed3} = erlang:now(),&lt;br/&gt; X = random:uniform(),&lt;br/&gt; random:seed(Seed1, Seed2, Seed3),&lt;br/&gt; Y = random:uniform().&lt;br/&gt;&lt;br/&gt;Any suggestions / better implementations?&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/121786603</link><guid>http://jon.is.emotionull.com/post/121786603</guid><pubDate>Thu, 11 Jun 2009 17:45:43 +0300</pubDate></item><item><title>"Awesomeness : Looking at your own code after a couple of days and thinking: “f*ck, I wish..."</title><description>“Awesomeness : Looking at your own code after a couple of days and thinking: “f*ck, I wish I could code like that””&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;By me&lt;/em&gt;</description><link>http://jon.is.emotionull.com/post/94824345</link><guid>http://jon.is.emotionull.com/post/94824345</guid><pubDate>Fri, 10 Apr 2009 14:55:24 +0300</pubDate></item><item><title>Between Erlang/Reia/LFE with Joe Armstrong - Erlang's creator (or Building the Biggest Cloud ever!)</title><description>&lt;p&gt;I love Erlang but for a couple of months I was wondering whether using &lt;a title="LFE" href="http://github.com/rvirding/lfe/tree/master"&gt;LFE&lt;/a&gt; or &lt;a title="Reia" href="http://wiki.reia-lang.org/wiki/Reia_Programming_Language"&gt;Reia&lt;/a&gt; could speed up development (so other developers could jump in easily on an OpenSource project I am working on - read on for more about the project). Even though that Erlang is very powerful, it’s syntax is a deal-breaker for a lot of people. So, I thought that bringing developers from the world of lisp and Ruby/Python and showing them a &lt;i&gt;similar&lt;/i&gt; (in syntax at least!) language could &lt;strike&gt;trick them&lt;/strike&gt; make them give Erlang a shot. Boy, I was wrong…&lt;/p&gt;
&lt;p&gt;Trying to write Erlang using the philosophy of other languages is like writing Lisp using a php mentality. Or better trying to eat spaggeti with a spoon. It just doesn’t feel right. You &lt;b&gt;have&lt;/b&gt; to try Erlang, feel it’s core power and then try adding a layer on top of it. Writing software that communicates with it’s parts and expands easily, feels natural in Erlang. And a familiar syntax won’t save you from having to think in functional programming ways. Bottom line: Learn Erlang/Haskell and then try Reia/LFE to put some syntactic sugar. Sure that would bring many developers to the project…&lt;/p&gt;
&lt;p&gt;But then, what’s the point of trying to move more languages to BEAM (Erlang’s VM)? I emailed &lt;a title="Joe Armstrong" href="http://armstrongonsoftware.blogspot.com/"&gt;Joe Armstrong&lt;/a&gt; (the creator of Erlang) about whether investing time and building your whole framework around a language wrapper is a sane thing to do. And here is his answer about LFE:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It depends on what you want to do - LFE is Roberts hobby project,Erlang has a entire Ericsson group supporting it. Erlang is battle tested in many industrial projects - If it’s a hobby project, then choose whichever you like if you want long-term support - go for Erlang.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And about Reia:&lt;/p&gt;
&lt;blockquote&gt;Same. Erlang OTP here to stay and supported by dozens of people and companies the others are hobby projects. (( I’m not being derogatory here - hobby projects are fine - but they have an uncertain future))&lt;/blockquote&gt;
&lt;blockquote&gt;/Joe&lt;/blockquote&gt;
&lt;p&gt;That’s the result I came about, enhanced by the recent syntactic changes in Reia. These languages do a GREAT job in trying to bring more people to Erlang but I don’t think that you can use them without knowing Erlang (and I know that’s not their purpose but many feel that if you learn Reia there is no need to learn Erlang).&lt;/p&gt;
&lt;p&gt;Of course, both Reia and LFE are very cool projects but I really wonder if they can survive the test of time and offer a nice alternative to Erlang (so they can pave the way for more languages in BEAM).&lt;/p&gt;
&lt;p&gt;UPDATE: For those still reading:&lt;/p&gt;
&lt;p&gt;How all this started?&lt;/p&gt;
&lt;p&gt;We are planning (me and &lt;a title="Jim" href="http://twitter.com/jimeh"&gt;Jim&lt;/a&gt; ) to build the biggest cloud computing project man has ever seen and use it for scientific reasons (something like seti@home but BIGGER), that will fully utilize Erlang’s power and let it run on Clouds (Amazon / Mosso /…) and we are even thinking about trying to squeeze Erlang inside GPU and try a GPU cloud. It will be OpenSource, it’s called &lt;a title="RainUp" href="http://www.rainup.org"&gt;RainUp&lt;/a&gt; and  we already made a small presentation at &lt;a title="mediacamp2" href="http://mediacampathens.wordpress.com/"&gt;mediacamp2&lt;/a&gt; here in Greece. We’ll upload more info in a couple of days and some demos. So, as you can understand, choosing the correct language is crucial for our project. If you are an Erlang hacker or Cloud expert or just wanna help, send an email at: contact[at]rainup.org.&lt;/p&gt;
&lt;p&gt;Thanks for reading and I’d love to hear your opinions here or at &lt;a title="twitter" href="http://www.twitter.com/jonromero"&gt;twitter&lt;/a&gt;.&lt;/p&gt;</description><link>http://jon.is.emotionull.com/post/87342012</link><guid>http://jon.is.emotionull.com/post/87342012</guid><pubDate>Tue, 17 Mar 2009 21:54:00 +0200</pubDate></item></channel></rss>
