Tags: google
Protocol Buffers
2008/07/12 @ 20:22A few days ago Protocol Buffers was released by Google as an open source project. Protocol Buffers is a way to generate code for objects that can be serialized to and de-serialized from the protocol buffers binary format. An implementation of the protocol buffers compiler which reads a "proto" and can output Java, Python, and C++ code. Because the format is a binary format and the compiler can output in several languages, this would allow for fast message passing between applications that may or may not be implemented in the same language.
I went ahead and created two simple Java and Python applications that test protocol buffers by simply creating a simple User object, prompting the user for a nickname and e-mail and then serializing the result. I also added a command to de-serialize the output and show the contents of the reconstituted object.
Here I ran the Java program to write the protocol buffers data to a file and then I run the python program to read it.
ian@laptop:~/src/protocol-buffers-test$ make javawrite
mkdir -p java
protoc --java_out=java/ prototest.proto
javac -classpath "java/:protobuf-java-2.0.0beta.jar" java/test.java java/prototest/Prototest.java
java -cp ".:java/:protobuf-java-2.0.0beta.jar" test write test.out
Nickname: Ian <- this is input
Email: test@test.com <- this is input
土 7月 12 19:09:28
ian@laptop:~/src/protocol-buffers-test$ make javaread
java -cp ".:java/:protobuf-java-2.0.0beta.jar" test read test.out
User
Nickname: Ian <- this is output
Email: test@test.com <- this is output
土 7月 12 19:09:33
ian@laptop:~/src/protocol-buffers-test$
Code available here. Code listing follows.
I went to Google Developer Day 2008 in Yokohama Japan yesterday. The keynote speech was pretty much the exact same info as was given at the keynote at Google I/O where Google announced their direction, moving forward the web as a platform.
Keynote
As with the Google I/O keynote it was mentioned how Google feels that Computing power and accessability have kind of flip-flopped over the years. In the mainframe era you had computing power but no accessability, in the PC era you had accessability but lost relative computing power, and now in the web era we are getting back computing power in the form of cloud computing but we are loosing accessablity to those resources. They plan on fixing this with the, so called, three Cs. Client, Connectablity and Cloud.
The first refers to the browser, so Google wants to make the browser richer in order to give us accessability to the computing power that they can provide. They are doing this with Google Gears and some other handy browser plugins.
Connectability refers to allowing everyone equal access to resources and making sure every one can connect. This means making sure that internet lines are fast, airwaves are open etc. They see mobiles as big in the future so they hope to help the connectability problem with Android, their free, open operating system for mobiles.
Cloud refers to their vast data centers. They hope to give access to these resources through products like Appengine where developers can access the vast resources and scalability that Google's data centers provide.
Appengine Hackathon
In the afternoon I attended the Appengine Hackathon which was presided over by Brett Slatkin, who is none other than the guy in the Appengine demo video. It was interesting because from the e-mails I recieved about the event, I figured it would be in Japanese but it ended up being entirely in English. Many of the Japanese folks had trouble following along so I tried to help where I could.
In the beginning, Brett talked about Appengine and used an example wiki as a demo app. Then we went into coding our projects. At the end some folks showed off their applications. Despite the language barriers many folks came up with some really original, and cool ideas. The first was created by a Google engineer, who said he would set the bar low but ended up with one of the better applications. His app read calandar events from RSS and allowed users to add comments to it. He also implemented memcache support. There was an application with the idea to attach pictures based on the hostility/mood level of a chat message or Twitter tweet. There was a social bookmarking app, and an app to allow live translating of a django application.
For what it's worth I presented my application which I hope to make into a workable form application builder. I haven't uploaded it yet so you'll have to make do with my first Appengine application, a prefix calculator with a simple rest api.
Dinner
Afterwards I went out to dinner with a number of folks who participated in the Hackathon. It turned out to be a lot of fun and I made a lot of new friends many of whom are now in my twitter contacts
All in all a hugely satisfying experience.
Google Developer Day Japan 2008 is being held on June 10th at Google's offices in Shibuya and I've registered to attend this year. There were a number of sessions that people could take part in but I decided to register for a Google appengine hackathon. I'm pretty curious about appengine since I've been working at becoming more familiar with really newly evolving technologies and not necessarily ones that have been around a while. Newly evolving technologies is something I've always felt I've had to catch up on since starting programming in high school. Going to high school with folks like Bob Ippolito (Mochikit, simplejson) and Konrad Rokicki who started coding stuff when they were in early middle school didn't help my self esteem.
Anyway, in the spirit of learning about Appengine I took a dive into the documentation and learned a few of appengines silly limitations but I came up with a simple application that utilizes the simple python library I created for prefix back in college. I put it up in my mercurial repository under prefix-appengine if you care to take a look.
The main work is done in two handlers which are essentially the controller part of the MVC pattern. One simply renders the page as a template, which is really simple since there isn't any template code, and the other implements a simple rest API that I use for an AJAX call to evaluate an expression given by the user. Using JSON seemed like a waste since there was only one returned value.
| class PrefixHandler(webapp.RequestHandler): | |
| def get(self): | |
| self.response.out.write(template.render("main.tpl", {})) | |
| | |
| # def post(self): | |
| # self.redirect('/') | |
| class EvalHandler(webapp.RequestHandler): | |
| def get(self): | |
| expression = self.request.get("exp") | |
| values = {} | |
| try: | |
| output = prefix.parser.parse(expression).evaluate() | |
| values = { | |
| "value": output | |
| } | |
| except ValueError, arg: | |
| output = "ERROR: " + str(arg) | |
| values = { | |
| "error": output | |
| } | |
| self.response.out.write(simplejson.dumps(values)) |
The rest of the code is in the javascript which I just wrote strait into the template file because I was lazy. The javascript uses jquery to do an AJAX call when the button is pressed and update the HTML DOM.
| var lastvalue = ""; | |
| $(document).ready(function() { | |
| $("#eval").click(function() { | |
| expression = $("#exp").val(); | |
| $("#output").html("Loading.."); | |
| uri = "eval?exp="; | |
| uri += encodeURIComponent(expression.replace("Ans", lastvalue)); | |
| uri = uri.replace(/%20/g|>, '+'); | |
| $.getJSON(uri, | |
| // Callback | |
| function (data) { | |
| output = "<font color='#FF0000'>ERROR: Invalid response from server</font>"; | |
| if (data.value != null) { | |
| output = expression + " = <font color='#00FF00'>" + data.value + "</font>"; | |
| lastvalue = data.value; | |
| } else { | |
| if (data.error && data.error.length>0) { | |
| output = "<font color='#FF0000'>"+ data.error +"</font>"; | |
| } | |
| } | |
| $("#output").html(output); | |
| } | |
| ); | |
| }); | |
| }); |
Big Buck Bunny on the Google Open Source Blog
2008/05/14 @ 11:57
The Google Open Source Blog mentioned the Blender Foundation's project Big Buck Bunny in their most recent post about the Libre Graphics Meeting. Hopefully that will get some more exposure for what I think is a really cool and successful project to improve the quality and usefulness of open source software. The chairman, Ton Roosendaal, is truely an amazing person.
Google Docs has gears support (how about in Japanese?)
2008/04/01 @ 14:19I read today on the Official Google Blog that Google documents has offline support using Google gears but unfortunately it's perhaps not released to me yet. Unfortunately it sometimes takes time for new versions to get out to everyone and it takes even longer before they are supported in different languages other than English.
One thing that many people might not realize is that features often take a good amount of time to be released in other languages other than English. My Japanese version of Gmail still doesn't support greasemonkey scripts. I think that feature was released many months ago. Google Reader in Japanese still doesn't support showing your the shared items of your contacts or Google gears. Another feature that was released many months ago. Google docs tends to be pretty decent about getting the newer versions released in Japanese but Gmail has been particularly lacking. I hope they continue that with this new version.
BBC Open Source
2008/03/18 @ 12:09Zoho Creator
2008/01/13 @ 12:16I came across this website called Zoho which has a lot of interesting web apps like Google's web apps. Google has Google docs, spreadsheets, and presentations. Zoho has docs, spreadsheets, and presentations. Google has Google notebook. Zoho has a notebook. Google has gmail. Zoho has Zoho mail. Google has... well you get the idea.
| All that stuff is well and good but the thing that caught my eye was the Zoho creator and the Zoho DB & Reports. Granted, Google has it's own things like a neat little chart api(on the right) but nothing like Zoho's DB and integrated report creator that I know of. Google Base seems built for an entirely different purpose. Granted that the Zoho DB and Reports are not going to rival any enterprise reporting software but would provide you with an easy to use reporting tool for small to <the step above small (not medium)> sized databases. |
Anyway, the possibilities seemed interesting for an online set of integrated applications like Zoho has. Especially the DB, App creator, and Spreadsheets but I'm sure you could think of powerful ways to integrate the other things like TODO and e-mail. The problem is that Zoho hasn't integrated these (yet?). The Zoho creator, though billed as a way to "Create Database Applications", is not integrated with the DB. When you create an app, and with it, a form and a view in the creator, the database and tables don't show up in the database app. *scratches head* Isn't integrating these two obvious? It would be cool to have an application with a database that you could then load in Zoho Database and create reports etc. But alas, the creator is a stand alone.
The integration issues combined with bugs in the creator when saving data, when saving text other than english, and when accessing using a Japanese phone, all are pretty much show-stoppers for me using it. It seems like it's so close, but missing some critical pieces. They may be adhering to the release early, release often philosophy and they are definitely sticking to the "release early" part. I just hope they stick to the "release often" part.













