Manymo and Eclipse

Manymo calls itself “A Better Emulator”, and that’s a fair call. They go on to add that manymo emulators; “Start quickly. Run smoothly. Are lightweight. Match every current OS version & screen size. Are accessible from your browser.” In spite of the network lag, it certainly feels more responsive than the emulator that ships with the Android SDK.

Some of Manymo devices

These are some of manymo devices. Each of them can be started with different versions of Android.

The only catch is how do I configure it for use with eclipse? The first thing is to download and install the manymo command line client. Now launch and emulator inside the browser, then at the top of the emulator page you will see something that looks like:

Use the Manymo command line tool to work with Eclipse, IntelliJ/IDE or SDK tools (e.g., adb): manymo tunnel w3d.manymo.com:5560:59c9d3af135f3bd2194c91ee1c96853c

Copy paste that command and type it into a shell. Now just type adb devices, if a new devices shows up, you are in luck. The manymo emulator can be used with no further effort. If a new device doesn’t show up try this:

adb connect localhost:5554

adb kill-server

Now a new device really should show up when you type in adb devices at the command line and it will show up in the DDMS perspective of eclipse.  But if you are still having trouble, it could possibly be that the  manymo tunnel is tied to a different port. Try this:

netstat -anp --tcp | grep ssh

Look for a line similiar to the following.

tcp        0      0 127.0.0.1:5555         0.0.0.0:*               LISTEN      30060/ssh

This output shows that the port number you should listen to is actually 5555, so user that instead (eg adb connect localhost:5555 ) and this really ought to work and you can launch apps on it with eclipse.

 

Feb 20th, 2013 | Filed under Mobile

Back to jekyll

So here I am, back on Jekyll but with a fresh start. Yep, started off by deleting the old stuff and making a clone of Jekyll-Base to lay the foundation. Next ran the wordpress to jekyll exporter plugin and downloaded the markdown. After that I remembered to start jekyll with the --auto option (eg jekyll --auto --server ) . If you don’t do it that way, jekyll will not detect changes in your templates or markdown.

Jekyll was abandoned the last time  because it wanted plugins, yes dreaded plugins need to be installed to make jekyll behave the way I want it to. This plugin phobia is a direct result of suffering the WordPress plugin system for many years. I wasn’t keen for a repeat of that experience with Jekyll. Now after a full circle, it doesn’t look as if I have any other choice, so here I am taking the plunge by choosing the category sidebar plugin by  Nikolay Sturmas as the first one to install.

I would have been very surprised if the first plugin worked as expected, it didn’t (Liquid Exception: Unknown tag ‘category_list’ in post). It took a bit of head scratching  to figure out why something as simple as that wouldn’t work. In the end the reason turns out to be that even though jekyll with the --auto param recognizes changes to templates or markdown, it will not detect  changes to plugin code. So when working with plugins, always remember to kill and restart the server for each change.

Next step was to generate the category pages. For that I initially used the example on the jekyll plugins wiki, and later switched to the one provided by the folks at Recursive design. Neither of these provide pagination, which is going to be addressed next, because even the home page isn’t paginated by default.

Simple pagination can be enabled by adding paginate: <n> to the config.yml file. This uses the built in paginator. The result while usefull wasn’t what I was looking for. It produces links like page2/, page3/ etc while permalink structure on the current blog is page/2/ , page/3/ etc . In other words, each page needs to be in it’s own folder. There was a suggestion at bencurtis.com that one should just copy over the default pagination.rb file into the _plugins directory and edit line 32 to create a directory instead of a file. Since that post was written the pagination code has changed a bit and the line to be edited is now #40.

Modding the plugin ensures that the archives are correctly placed into separate sub directories but the link is still using the old page2/, page3/, page4/ … format. To fix it, I needed to edit the template (which was borrowed from the jekyll wiki on pagination). The diff looks like this:

&lt; <a class="previous" href="/page/{{paginator.previous_page}}">Previous</a>
---
&gt; <a class="previous" href="/page{{paginator.previous_page}}">Previous</a>
27c27
&lt; <a class="next " href="/page/{{paginator.next_page}}">Next</a>
---
&gt; <a class="next " href="/page{{paginator.next_page}}">Next</a>

That takes care of paginating the main page and the archives pages were also generated with the help of another plugin by Ben Curtis. Now all that’s left is to create the category and tag pages.

Feb 19th, 2013 | Filed under Uncategorized
Tags:

Tizen install

The previous attempt to install Tizen was abandoned because of all the errors that kept popping up. It turns out I had made an elementary mistake; a mix up of 32 and 64 bit binaries. Sorted out that mess and gave it another go. These are the steps installed.

Install Oracle JDK

Why on earth Tizen insist on using Oracle JDK is a mystery why not use Open JDK. Let us not forget that Oracle is the company that files a law suite against the use of Java on the Android platform for god’s sake

Install an ancient version of Eclipse.

Downloaded the latest and hottest version of Eclipse direct from the site because distro’s repositories only have ancient versions. Well buddy you are going to have to go back to apt or yum or  whatever it is that you prefer to use and install that ancient version because Tizen refuses to work with Eclipse Juno.

You know that Tizen development is going to suck because Juno sucks and Eclipse 3.7 sucks even more (what the hell did they call that anyway? I have already forgotten)

Get the tizen installer

Having downloaded a 100 Mb JDK and a 300 Mb over your lousy over priced internet connection, you will no doubt heave a sigh of relief when you realize that the tizen downloader is just 3.5 Mb. Sorry to disapoint you my friend that’s just an online installer the real download is 1.6Gb

Tizen's loooong download

Installing Tizen, a right royal pain

 

Feb 18th, 2013 | Filed under Java, Linux
Tags: ,

Pelican or back to Jekyll?

Pelican, looked really promising. I made more progress with Pelican than any of the other static blog generators with the possible exception of mynt. I even found a Bootstrap template which can be used as a starting point, but still there is that little something missing.

The trouble here is that the article template, which is used to display individual blog posts  seems to combine the post content and the tags all into one. The Article class isn’t documented, I looked at the source but it doesn’t seem to provide methods to separate  the post body from the tags. Pelican also appears to have limitations on the structure of the permalink.

The obvious thing to do is to fork the project and try to change it so that it behaves the way I want it to behave.  But then, I can do the same with mynt as well. So which one is going to be easier to modify? Perhaps it’s better to dump them both and return to Jekyll or punch? Decisions. Decisions.

 

Feb 18th, 2013 | Filed under Uncategorized

Tizen on Ubuntu

Lot of speculative news articles and blog posts these days about the world’s largest smart phone maker ditching android in favor of Tizen. What I know about tizen at the moment can be written on the back of a postage stamp (if I can find one lying around), so here is an attempt to put that right.

Started off by downloading the Tizen binaries for Ubuntu. I have done this sort of thing far too often to know that it will not work the first time so I was quite prepaperd for the first error, when the installer insisted that I switch to Oracle JDK.

 OpenJDK is not supported. Try again with Oracle JDK.

I have moved forward since my rant, in 2008 against /etc/alternatives but unfortunately Oracle has moved Java in the wrong direction. As a result you still need to download the damn JDK manually and configure /etc/alternatives too. The best guide for that is at askubuntu.  I didn’t expect to get far forward after changing to Oracle JDK, and once again I wasn’t disappointed.

f you want to install TIZEN-SDK, you must install “gtk2-engines-pixbuf” “ia32-libs”  package(s).

Why they can’t just make a plugin for eclipse or netbeans is beyond me.  So what happens after adding the dependencies? this:

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.swt.widgets.Display
        at org.eclipse.swt.widgets.Widget.isValidSubclass(Unknown Source)
        at org.eclipse.swt.widgets.Decorations.checkSubclass(Unknown Source)
        at org.eclipse.swt.widgets.Shell.(Unknown Source)
        at org.eclipse.swt.widgets.Shell.(Unknown Source)
        at org.eclipse.jface.window.Window.createShell(Window.java:487)
        at org.eclipse.jface.window.Window.create(Window.java:430)
        at org.eclipse.jface.window.Window.open(Window.java:790)
        at org.tizen.installmanager.ui.InstallManagerWindow.main(InstallManagerWindow.java:743)
        ... 5 more

Surprise, surprise, the installer is looking for eclipse. Now show me where in the tizen installation guide it says that eclipse is a requirement? or that tizen should be installed as part of eclipse?

This error is probably caused by the fact that my version of Eclipse is juno and as such was not installed using apt. Ubuntu 12.04 by default provides only Eclipse 3.7. I suppose installing eclipse through apt ought to fix it but Tizen can wait.

 

Feb 17th, 2013 | Filed under Mobile, Uncategorized
Tags: ,

django.template.base.TemplateSyntaxError: ‘block’ tag takes only one argument

Have you run into an error of this nature? It’s because your django template blocks are incomplete. You probably have something like this:

{% block %}

where as what you really ought to have is something like this (choose a suitable name):

{% block content %}

Yes it’s a trivial solution. This error  was encountered when trying to import from WordPress into Cactus. I had reached that stage only after overcoming another one related to encoding, so I just gave up on it. However I felt I the need to write this blog entry because the previous post ranked pretty high in search results, and it seems rude to turn people away without a solution. .

 

Feb 16th, 2013 | Filed under Uncategorized

exit wp

It suddenly occurred to me that the trouble may not be with the all static blog generators that I have been trying out but with the word press exporters. So far I had been using WordPress to Jekyll exporter but because pelican had trouble with it, I used pelican’s own importer. The pelican importer works with the wordpress xml file where as the former is a WP plugin. The importer didn’t work out too well either but that started me looking for wordpress to markdown convertors and exitwp was one of the first that I ran across.

exitwp takes the wordpress xml as input and produces a collection of files as output. If you choose markdown as the format the file extension becomes .markdown which is not to Pelican’s taste. However using the little known rename command you can change the suffix quite easily.  rename 's/.markdown/.md/' *markdown

Having done so the generated HTML shows up correctly without any visible garbage. However I still have to open the pandora’s box labelled templates. OTH, it might be a good idea to use the output from exitwp on other static blog generators and see what the result is like

Feb 15th, 2013 | Filed under Uncategorized

Pelican

Now how did I miss Pelican in my quest for the perfect static blog generator? Maybe because it’s not perfect either but  certainly deserves to be ranked alongside Jekyll and Punch. Since it’s written in Python, which means my religious beliefs are not offended.

When trying to import my blog into one of the static generators, the output from WP to jekyll exporter has always been the input. So that same thing was tried with Pelican but it didn’t work out too well. The issue seemed trivial however.  Pelican doesn’t like the YAML front matter block in each post. Before trying to create a regext to eliminate it,  I looked around for options and was quite pleased to find that pelican can import directly from WordPress as long as you have something called pandoc installed. Absolutely kicking myself for not knowing about pandoc till now. It looks like a really useful tool.

However the importer had it’s fair share of problems producing errors like these:

/home/raditha/django/pelican/content/the-colombo-fort-stolen.rst:41: (WARNING/2) malformed substitution definition.
/home/raditha/django/pelican/content/the-colombo-fort-stolen.rst:42: (WARNING/2) Explicit markup ends without a blank line; unexpected unindent.
/home/raditha/django/pelican/content/the-colombo-fort-stolen.rst:42: (ERROR/3) Undefined substitution referenced: "image2".
/home/raditha/django/pelican/content/the-colombo-fort-stolen.rst:42: (ERROR/3) Undefined substitution referenced: "image3".
/home/raditha/django/pelican/content/the-colombo-fort-stolen.rst:8: (ERROR/3) Unknown target name: "|colombo|".
/home/raditha/django/pelican/content/the-colombo-fort-stolen.rst:31: (ERROR/3) Unknown target name: "|government ad with stolen photo|".

The importer produces reStructuredText and putting that through the generator resulted in weird stuff popping up all over the place in the HTML like this:

System Message: ERROR/3 (/home/raditha/django/pelican/content/the-giant-tea-boiler.rst, line 29); backlink

Undefined substitution referenced: "image1".

System Message: ERROR/3 (/home/raditha/django/pelican/content/the-giant-tea-boiler.rst, line 8); backlink

Unknown target name: "|giant tea boiler at devon|".
System Message: ERROR/3 (/home/raditha/django/pelican/content/the-giant-tea-boiler.rst, line 14); backlink

Unknown target name: "picture of the modern variant".

The default format used by pelican-importer is rst but it has the capability to produce markdown as well. Quite interestingly, make html produced no errors at all for the markdown version. Where as rst produced at least one error or warning for each post (more than 200 in total in the blog being imported). The markdown version had only these two errors plus three warnings

ERROR: Skipping /home/raditha/django/pelican/content/dew-on-flower.md: impossible to find informations about'date'
ERROR: Skipping /home/raditha/django/pelican/content/pruned.md: impossible to find informations about'date'
A screen shot with the default template

Using the default template, can you see the weird characters?

But it’s too early to celebrate, there are still a few strange [ and ] characters scattered all over the HTML. It looks like the markdown produced by the pelican-importer has it’s own share or problems though no errors are reported.

Feb 13th, 2013 | Filed under Uncategorized