If you are a nokia tablet user like me (n770/n800/n810), you must have wished for this feature I am going to describe.
When I am browsing the net on my desktop I come across a webpage that I would like to open on my n770 right away - mostly it's some maemo package that I would like to download and install. The problem is rewriting the cryptic URLs in n770's address bar is time-consuming and error-prone. Going to the same URL through google search takes couple of page loads, which takes sizeable time.
One way to ease this process is to use some clipboard sharing software (synergy, vnc viewer), I am not sure if that works, but I bet someone has tried it. Besides, it will be too heavy as compared to the following method I suggest here.
If you have ssh enabled on your tablet then you can run this simple script on your desktop and command the tablet to open any URL in its browser.
It is only this single command:
ssh root@<ip of tablet> "dbus-send --system --type=method_call --dest=\"com.nokia.osso_browser\" --print-reply /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:\"$1\""
Save this in a script nokia-browser.sh and the next time you want to open a URL, just execute:
nokia-browser.sh <URL>
You will be prompted for password (unless you have setup the keys)
Check your tablet, it must be loading the URL by now. If a browser is not already open it will be opened automatically because by d-bus magic.
I learnt about this command from this mailing list post. I am just trying to use it remotely.
Wednesday, December 26, 2007
Saturday, December 15, 2007
Picasso
I have no authority in art. But once in a while I try to understand the greatness of some masterpieces.
I have been watching this painting of Pablo Picasso while passing through one corridor in my office. It's titled "Bullfight - Horse air".
I liked it, in a sense that it is simple. You can see a man riding a horse hunting a bull. If one has gift of control over one's hand then one sure can paint this. I didn't exactly understand why Picasso would be a great artist for doing such work.
Every time before when I used to see this picture I used to see the three figures. But yesterday when I looked at it I only saw a handful strokes of brushes and that amazed me. In other words, what I saw was how the artist would have drawn it. It sure is trivial to duplicate something in real life on to paper (it's not trivial to me, but for gifted hands it is). But what is not trivial is, extracting the abstractions out of the real things and expressing them with minimal use of paint. I guess that qualifies the greatness of an artist.
I have been watching this painting of Pablo Picasso while passing through one corridor in my office. It's titled "Bullfight - Horse air".
I liked it, in a sense that it is simple. You can see a man riding a horse hunting a bull. If one has gift of control over one's hand then one sure can paint this. I didn't exactly understand why Picasso would be a great artist for doing such work.
Every time before when I used to see this picture I used to see the three figures. But yesterday when I looked at it I only saw a handful strokes of brushes and that amazed me. In other words, what I saw was how the artist would have drawn it. It sure is trivial to duplicate something in real life on to paper (it's not trivial to me, but for gifted hands it is). But what is not trivial is, extracting the abstractions out of the real things and expressing them with minimal use of paint. I guess that qualifies the greatness of an artist.
Thursday, November 29, 2007
Colbie Caillat
Last month or so I heard "Bubbly" and just loved it. For past week I have been listening to "Realize" and I just adored the way Colbie Caillat can play her voice.
She has great talent and genuine voice. Halfway through "Realize" she just takes her time to play her vocal chords to create magic out of the words "didn't I tell you...".
It's not usual to find someone's live performance as good as their post processed published albums. If you see this live performance by Colbie, you will find an exception to that rule.
She has great talent and genuine voice. Halfway through "Realize" she just takes her time to play her vocal chords to create magic out of the words "didn't I tell you...".
It's not usual to find someone's live performance as good as their post processed published albums. If you see this live performance by Colbie, you will find an exception to that rule.
Tuesday, November 20, 2007
Firefox 3 is brilliant!!!
If you read this on slashdot this morning you must already know. I just tried it on my Mac OSx and the review is completely true.
Starting firefox 2 on my freshly booted MacBook was taking very very long time. It was unusually slow even after compared to sluggishness of firefox on Linux. Don't know why. So when I tried firefox 3 beta 1 on it I could clearly tell the difference. The fire in firefox is back.
[The only reason you might want to hold from upgrading just as yet is lack of availability of compatible plugins. As the official release nears, this problem will go away]
Starting firefox 2 on my freshly booted MacBook was taking very very long time. It was unusually slow even after compared to sluggishness of firefox on Linux. Don't know why. So when I tried firefox 3 beta 1 on it I could clearly tell the difference. The fire in firefox is back.
[The only reason you might want to hold from upgrading just as yet is lack of availability of compatible plugins. As the official release nears, this problem will go away]
XML RPC server inside apache mod_python
Writing XML RPC server and client in python is extremely easy. There are many examples. xmlrpclib is part of python, so writing client doesn't need anything extra. There are many examples of XMLRPC server as well. I used Julien Oster's.
The problem comes when you want to use XML RPC server in a production environment alongside your apache web server. If you are not a big shop then you very likely want to host both of them on same machine. Then two different servers can't listen for HTTP on same port. You might use an alternate port (second in popularity to port 80), but the users behind corporate firewall will suffer. If you understand the protocol stack, you would know it shouldn't be difficult to run the XMLRPC server inside an apache server. I realized that last weekend, and in couple of hours I hosted Julien Oster's XML RPC server inside my apache mod_python framework.
Download the XML RPC server. You will find a single file xmlrpcserver.py.
You will find a class XmlRpcServer in it. That's all you need. Add following method to it:
Now host the following code in your index.py file (or any python file you have configured as PythonHandler in your apache settings)
Once you save the above index.py to your webserver, you can use a python client to invoke XMLRPC calls to your apache server.
Assuming you saved above file to $(DOCROOT)/xmlrpc/index.py, your client code would look like this:
And you are all set!
syntax highlighted by Code2HTML
The problem comes when you want to use XML RPC server in a production environment alongside your apache web server. If you are not a big shop then you very likely want to host both of them on same machine. Then two different servers can't listen for HTTP on same port. You might use an alternate port (second in popularity to port 80), but the users behind corporate firewall will suffer. If you understand the protocol stack, you would know it shouldn't be difficult to run the XMLRPC server inside an apache server. I realized that last weekend, and in couple of hours I hosted Julien Oster's XML RPC server inside my apache mod_python framework.
Download the XML RPC server. You will find a single file xmlrpcserver.py.
You will find a class XmlRpcServer in it. That's all you need. Add following method to it:
def handle(self,req):
length = int(req.headers_in["Content-length"])
request_string = req.read(length)
request = StringIO(request_string)
request.seek(0)
response = StringIO()
try:
self.execute(request, response, None)
except Exception, e:
return apache.HTTP_INTERNAL_SERVER_ERROR
finally:
response.seek(0)
rstr = response.read()
req.headers_out['Content-type'] = 'text/xml'
req.headers_out['Content-length'] = "%d"%len(rstr)
req.write(rstr)
return apache.OK
Now host the following code in your index.py file (or any python file you have configured as PythonHandler in your apache settings)
from mod_python import apache
from xmlrpcserver import XmlRpcServer
def handler(req):
try:
xmlserver = XmlRpcServer()
app = Application()
xmlserver.register_class('app',app)
result = xmlserver.handle(req)
return result
except Exception, e:
return apache.HTTP_INTERNAL_SERVER_ERROR
# The following class is where you can put your application logic
class Application:
def __init__(self):
pass
def getName(self):
return 'example'
Once you save the above index.py to your webserver, you can use a python client to invoke XMLRPC calls to your apache server.
Assuming you saved above file to $(DOCROOT)/xmlrpc/index.py, your client code would look like this:
import xmlrpclib
remote = xmlrpclib.Server('http://yourserver.com/xmlrpc/')
name = remote.app.getName()
And you are all set!
syntax highlighted by Code2HTML
Labels:
python xmlrpc apache
Subscribe to:
Posts (Atom)