Ian Lewis
Ian Lewis is a web developer living in Tokyo Japan. His current interests are in Django, python, alternative databases and rapid web application development. About Me...
  • Disqus Plugin

    The first version of the Disqus plugin has been released!

    The Disqus plugin allows you to use comments from the social commenting website Disqus. It embeds javascript to show comments when viewing a particular blog post and shows how many comments a post has when viewing a blog post list. Find out more about what Disqus does here. Read more about the plugin here.

    Download: disqus_plugin-0.1.zip

    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - Disqus Plugin
  • Wanted: Dictionary program for Windows/Linux

    I have wanted a good dictionary application that supports a number of dictionaries/dictionary formats for studying Japanese but I've been sort of frustrated that there is no single application that does what I would like. I have looked mostly at stardict and epwing because they are closest to the type of dictionary I want. Specifically I have the following requirements:

    1. It must work in Linux (epwing and stardict)
    2. It must work in Windows (epwing and stardict)
    3. It must support epwing format (epwing)
    4. It should ideally support an open dictionary format like stardict. (stardict)
    5. It must support lookup via a popup (epwing and stardict)
    6. It must support installing dictionaries as a non-root user (epwing)
    7. It should support minimization to the system tray (stardict)

    1 and 2 and 5 are supported by both stardict and epwing but epwing's popup support is less than ideal and epwing supports nothing but epwing and doesn't minimize to the system tray. The way epwing looks up words from multiple dictionaries is also less than ideal,

    Stardict on the other hand supports most of the things I want but doesn't support epwing or any way of converting the dictionaries from epwing to stardict format. There are a number of tools to read epwing dictionaries so I think this could be done, but I don't think stardict dictionaries currently support images or media like epwing dictionaries support so converting epwing dictionaries would lose that data. Stardict also has a  number of strange plugins and a net dictionary protocol which seems strange. I'm not sure if the server side code is open either.

    I've been looking ot the code for each of the dictionaries and it seems like while epwing's code is simpler and easier to read, stardict supports most of the features I want already so it would be better to explore how to add the features I want to add. Development on both projects is pretty much halted so I should be able to add features at my own pace without stepping on current development.

    I'm not looking forward to spending a lot of time on it but my frustration with dictionaries has reached a bit of a boiling point.

    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - Wanted: Dictionary program for Windows/Linux
  • jsonschema mentioned on json.com

    Kris Zyp (the author of the JSONSchema proposal) mentioned jsonschema on his blog at json.com. Thanks Kris!!

    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - jsonschema mentioned on json.com
  • JSON Schema Validator 0.1a for Python

    I just released the first version for a project that I've been working on since the Python Onsen. It's a validator for JSON Schema written in Python. It's based on the JSON Schema Proposal Second Draft.

    The source can be downloaded here: jsonschema-0.1a.tar.gz
    The documentation can be found here: jsonschema (version 0.1a) documentation

    JSON Schema's purpose is to allow validation of JSON documents much like XML Schema, DTD. You can use it to define what kind of data should be present in the document as well as the structure of the data. You might have some JSON for a contact like so:

    {
      "name": "Ian Lewis",
      "email": "IanLewis@xyz.com",
      "address": "123 Main St.",
      "phone": "080-1942-9494"
    }

    And you could describe this in JSON Schema with the following:

    {
      "type":"object",
      "properties":{
        "name": {"type":"string"},
        "age": {"type":"int", "optional":True},
        "email": {
          "type":"string",
          "pattern":"^[A-Za-z0-9][A-Za-z0-9\.]*@([A-Za-z0-9]+\.)+[A-Za-z0-9]+$"
        },
        "address": {"type":"string"},
        "phone": {"type":"string"}
      }
    }

    This can be validated with something like the following Python code:

    import jsonschema, simplejson

    data = """{
      "name": "Ian Lewis",
      "email": "IanLewis@xyz.com",
      "address": "123 Main St.",
      "phone": "080-1942-9494"
    }"""

    schema = """{
      "type":"object",
      "properties":{
        "name": {"type":"string"},
        "age": {"type":"int", "optional":True},
        "email": {
          "type":"string",
          "pattern":"^[A-Za-z0-9][A-Za-z0-9\.]*@([A-Za-z0-9]+\.)+[A-Za-z0-9]+$"
        },
        "address": {"type":"string"},
        "phone": {"type":"string"}
      }
    }"""

    x = simplejson.loads(data)
    s = simplesjson.loads(schema)
    jsonschema.validate(x,s)

    It can be easily extended to include support for new properties or to override the default validation for standard properties so I think it could be used for a wide range of applications. I plan to use it for a Form Maker application (code) on GAE. Let me know what you think!

    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - JSON Schema Validator 0.1a for Python
  • Gallery2 plugin with TinyMCE

    I made some changes to the TinyMCE plugin for b2evolution to support some callbacks which will allow other b2evolution plugins to register TinyMCE plugins automatically. This is especially useful for the Gallery2 plugin because it will allow me to add a button that allows users to add photos from Gallery2 to their blog posts to TinyMCE automatically when the Gallery2 plugin is installed. Currently it's a pain to get it to work because the standard gallery2 image chooser button doesn't work with TinyMCE and installing it requires you to copy the g2image directory to another location.

    Fortunately these sorts of callbacks are implemented in the b2evolution Plugin API already. I just needed to specify that the TinyMCE plugin has some extra callbacks and then fire the associated events at the right time. The code is a bit awkward but it serves it's purpose.

    The first part is specifying the extra events.

    function GetExtraEvents()
    {
        return array(
                     "tinymce_before_init" => "Event that is called before tinymce is initialized",
                     "tinymce_extend_plugins" => "Event called to allow other plugins to extend the plugin list",
                     "tinymce_extend_buttons" => "Event called to allow other plugins to extend the button list"
                    );
    }

    Then I fire the events like so. The 'tinymce_extend_plugins' and 'tinymce_extend_buttons' events allow other plugins to modify the plugins list and buttons list via a special "get_trigger_event" call.

    $tmce_plugins_array =
        $Plugins->get_trigger_event("tinymce_extend_plugins",
            array("tinymce_plugins" => $tmce_plugins_array),
                "tinymce_plugins");

    The plugins list is modified on the Gallery2 plugin side by adding an implementation of the event hook. In this case the 'tinymce_plugins' key in the $params array is a reference that can be modified and passed back to the TinyMCE plugin.

    function tinymce_extend_plugins( &$params ) {
        array_push($params["tinymce_plugins"], "-g2image");
    }

    You can view the changes made in the checked in code here.

    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - Gallery2 plugin with TinyMCE
  • Gallery2 for wordpress

    I took a look at the Gallery2 plugin for wordpress by ozgreg to get some ideas on how they had integrated Gallery2 with the Wordpress blog engine and how I might be able to bring those features to b2evolution. I felt somewhat bad looking at it as I've worked on by own gallery2 integration plugin for b2evolution for about a year and haven't really taken more than a cursory look at the wordpress counterpart. I felt even worse when I realized how slick it is compared to my, comparitavely, rather simple integration.

    The scale and amount of code was the first thing I noticed. My gallery2 plugin is on the bigger end, in terms of lines of code, for a b2evolution plugin but the wordpress gallery2 plugin has a few times as much code. This might be seen as bloat if it wasn't for the number of features that it offers.

    Both of our plugins use the Gallery image chooser (g2image) to allow users to add gallery images to posts and offer single sign on between the blog and gallery. But there are a number of things that the wordpress plugin either is done better than my plugin or isn't present at all in my plugin.

    • Both of the plugins allow mapping of blog users to gallery but the wordpress plugin goes a step further and allows you to manage each user mapping and create and delete users in gallery manually. This is a cool feature and I think I'm going to create something similar in b2evolution's gallery2 plugin.
    • The wordpress plugin also offers a wider range of widgets to place in the sidebar and allows more customization including a customizable template. This is cool but the implementation is questionable as it makes use of gallery's php classes themselves rather than relying on the Embedded API. It also generates the sidebar image block itself instead of letting gallery do it. I need to test it but I'm not sure if this works with say, the gallery2 multi-language plugin. I think this kind of manuvering is what precipitated the need for a release compatibility matrix which I think might be a pain for users, so I plan to add some more options while sticking as much to the embedded api as possible.
    • The wordpress plugin adds a button to tinymce automatically. Currently with my plugin you have to jump through some hoops. I would like to work with the author of the tinymce plugin for b2evolution to allow me to integrate seamlessly.
    • The wordpress plugin creates a page automatically that puts your gallery inside wordpress. This is pretty cool and allows users to more easily integrate their blog with gallery. I'd like to do something similar in b2evolution.
    • The wordpress plugin has some url rewrite options which seem to allow you to create nice permalinks inside your embedded gallery page. This might be used somehow to preserve previous gallery permalinks, or just to make nice new permalinks inside your wordpress blog.
    • The wordpress plugin searches some common paths for your gallery2 installation. Simple but a useful feature that I didn't implement into my gallery2 plugin.

    That seems like a lot doesn't it? I really need to get to work to close these gaps. The wordpress plugin has predated my plugin by almost 2 years and still makes mine look like child's play in terms of features. The integration into wordpress is pretty slick too. The menus are placed in intuitive locations within the admin. That's something I might not be able to do in b2evolution given it's rather antiquated, plugin interface (essentially a Plugin class you extend overridding any needed "hook" methods).

    Anyway, look for some of these improvements in the coming weeks/months. ;)

    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - Gallery2 for wordpress
  • Fat Jack recommends my plugins.

    Not sure how long ago it was but a guy at ivertech who calls himself Fat Jack wrote an article about b2evolution plugins that help in advanced blogging. In that article he mentions 2 of the plugins I've written, the Gallery2 Plugin and the Lightbox plugin. Though the lightbox plugin will need to be decommissioned and/or rewritten because it depends on prototype and the new versions of b2evolution are including jquery, it's cool that someone is mentioning them in an article on the internets. Even if his name is Fat Jack (well I wanted it to be a person but it's the name of a hosting service apparently).
    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - Fat Jack recommends my plugins.
  • Gallery2 Plugin 1.4 Released!!

    Version 1.4 of the Gallery2 Plugin has been released!!

    The Gallery2 Plugin is a full featured plugin that provides integration between your b2evolution blog and gallery2. It supports single sign on, and adding images to posts using the Gallery2 Image Chooser.

    This version adds support for gallery2 image block widget that enable you to show a random image, recently viewed image, recently added image etc. to the sidebar or page title, anywhere a widget can be added in b2evolution. See the sidebar of this blog for an example of how this looks. The image block widget works in conjuction with the Image block plugin for Gallery2 so you will need to make sure it is installed and activated in gallery2 before you can use the widget.

    The Gallery2 Plugin also offers full compatibility with the Lightbox Plugin for b2evolution as well so you can include your gallery2 photos in your posts and display them using Lightbox1 or Lightbox2.

    Check out a couple examples of what you can do with the plugin. Enjoy!!!

    A link to the gallery page for an item.A lightbox link to the resized image. A link to the parent album.

    You can also make text links to images in your gallery.

    Download: gallery2_plugin-1.4.zip

    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - Gallery2 Plugin 1.4 Released!!
  • Gnucash 2.2.3

    Gnucash 2.2.3 was released the other day and contains my first contribution to the project. Albiet, a pretty small and lame patch for a small bugfix, but a patch nonetheless!! I hope to do some more work particularly on the QIF import, eventually making it work with the generic importer, and then expand my contributions to include improvements for multi-currency and reporting.
    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - Gnucash 2.2.3
  • Gallery2 Plugin 1.3 Released!!

    The next version of the Gallery2 Plugin has been released!!

    This version fixes a number of problems with different versions of b2evolution . It should work in b2evolution 1.9.2 and newer. It was tested in 1.9.2, 1.13.0, and 2.1.0. This version also fixes a number of path issues with previous versions of the plugin. Paths to your gallery2 installation should be managed correctly now.

    The Gallery2 Plugin offers full compatibility with the Lightbox Plugin for b2evolution as well so you can include your Gallery2 photos in your posts and display them using Lightbox1 or Lightbox2.

    Check out a couple examples of what you can do with the plugin. Enjoy!!!

    DCF_0119

    DCF_0119

    DCF_0119
    A link to the gallery page for an item. A lightbox link to the resized image. A link to the parent album.

    You can also make text links to images in your gallery.

    Download: gallery2_plugin-1.3.zip

    Send feedback   このエントリーを含むはてなブックマーク はてなブックマーク - Gallery2 Plugin 1.3 Released!!