Archive

Posts Tagged ‘download’

Hood Beta 2

October 20th, 2009 fforw No comments

After fixing a pretty serious bug in the combination of svenson and jcouchdb and releasing svenson 1.3.4 and jcouchdb 0.9.1-4 and jcouchdb 0.10.0-2, I got around to release a new, improved version of Hood, too. It’s called “Beta 2″ and still lacks some features but the documentation is a lot better and the application design is basically what I think will be the final layout of things.

Head over to google code and grab yourself a copy.

Links:

Categories: Blog Tags: , , , , ,

Hood: example application for jcouchdb 0.10.0-1

October 15th, 2009 fforw 2 comments

On the occasion of presenting CouchDB and jcouchdb at my place of work, I got around to finally create a small example application that is now downloadable as sneak preview. There need to be bugs fixed, features implemented and lots of documentation to be added, but it kind of works.

It’s called “Hood” for neighbourhood and allows you to mark places or people around a place of activity of yours, called hood. it is meant to foster collaboration / tips on local places etc.

It’s Spring Web Application demonstrating some techniques of working with jcouchdb. It’s an eclipse WTP/Spring IDE project with all dependencies you need besides couchdb and tomcat or another servlet container.

Stay tuned for hood to grow into a fullblown app.

Links:

Twitter/IRC integration with boticelli

October 6th, 2009 fforw No comments

I have been planning to release my IRC bot project as open source for quite a while now and the recently added twitter integration gave me the final push to actually do it. So now I am proud to announce the inital release of boticelli, a java / spring IRC bot/web application based on the martyr IRC library. Its mean to be easily configurable and extendable and ships with lots of plugins already included.

Available Plugins:

  • Logging – log channel conversation and provide a web interface to browse and search them
  • Seen – Remembers when a user last spoke in the channel
  • FAQ – Manages a keyword list of FAQ keywords that are matched to a description. Useful to provide answers for reoccuring topics in the channel.
  • AccountCreator?/Revoke/Grant – commands to automatically create accounts for the webapplication and to revoke / grant web app access rights (for ops)
  • ServerPing? – plugin that detects broken connections and makes the bot reconnect.
  • Say – plugin to let the bot say something or make it do something (a CTCP Action)
  • Twitter – two way integration into twitter over a bot specific twitter account.

So if you’re into old-school IRC fun, head over to google code and grab yourself a copy.

Links:

Categories: Blog Tags: , , , ,

YUIZilla Compressor

March 28th, 2009 fforw No comments

After again spending time to fix issues resulting from a collision of the yuicompressor jar and the normal rhino jar in one of my projects, I came up with a more radical solution:

  1. Download the source codes from yuicompressor and the corresponding rhino release
  2. Replace every occurance of “mozilla” with “yuizilla”
  3. PROFIT!

 So now I have a version of the yuicompressor that works fine and does not conflict with the rhino version I also have in my project. And I don’t need any stupid jar class loaders or have to write stdin/stdout handling for some terribly slow external yuicompressor process. I can just use the classes

  • com.yahoo.platform.yui.compressor.CssCompressor
  • com.yahoo.platform.yui.compressor.JavaScriptCompressor 

and be done with it. Hurray for fast dynamic server-side script and style compression!

Two new projects: svenson and jcouchdb

November 1st, 2008 fforw No comments

In my never ending fight against teh wind-mills, I have produced two new open source projects that are somehow connected to each other.

First there is svenson which is a release of my own personal JSON generator / parser. The name is a result of a joke. When my boss asked me what was the unique characteristic of it, my first answer was: “It’s written by me!”. So the name comes from “Sven’s JSON”. 

The answer was of course not totally serious. I wrote svenson because none of the JSON parsers out there seemed to have the right combination of being not too complicated yet flexible enough to work well in different scenarios. Being able to use a healthy mix of concrete typed java beans and dynamic map / list constructs seemed to be the best way to go, yet none of the JSON libraries out there seemed to go even near that direction. 

See the svenson wiki at google code for an explanation of how svenson works.

The other project is called jcouchdb and is my attempt at writing a Java driver for couchdb. It is very much connected to svenson as it was the driving force for the parser part of svenson. it offers an API that lets you use all those nice svenson features with couchdb documents. 

Links:

update:  link to couchdb

Categories: Uncategorized Tags: , , ,

JsServ – Serverside Javascript and DOM emulation

November 4th, 2007 fforw 4 comments

I played around with some ideas about JavaScript on the server-side and came up with this little prototype. It’s a set a spring components that allow running the scripts in a website on the server side in case a user has no support for JavaScript or has disabled it.

The following diagram shows the way things work:

The parts of jsserv

The parts of jsserv

The DOMInterceptor intercepts the HTML output of other controller and initializes a dom state with it. The document itself is parsed into a DOM tree and the referenced scripts are loaded and executed. Additional patch scripts can be defined to alter the behaviour of other scripts.

The current version adds
<a class="eventHelper" href="/app/event?uuid=42">...</a>

Links around every element for which a onclick handler is registered. The links point to a DOMEvent Controller that triggers updates in the user’s DOM State.

A little example scripts implements a collapsable tree that changes the style classes of nested unordered lists. With the JsServ DOM Manipulation this works with JavaScript as well as without JavaScript on the client side.

While this code is only a rough sketch it promises a lot in terms of vastly reducing the amount of work for sites that must use javascript to get an optimal user experience but who cannot or want not to have a java-script only site. Although the link-as-click event method is rather limited, it is good enough to make a lot of DOM manipulations possible. Expressed only once in JavaScript. Running in it’s deluxe form for people with client-side JavaScript and in a basic form for people with the help of using server-side JavaScript. All is seamlessly integratable into all kinds of Controllers.

Links:

Dependencies:

Edit: code.google.com link added, update to 0.12

Categories: Blog Tags: , , ,

ff javascript library update to 1.11

March 24th, 2007 fforw No comments

The ff javascript library is now available in the version 1.11 which is a small maintainance update to version 1.1

Changes are:

  • introduced ff.extend
  • made ff.dom functions ignore null arguments and handle the tabindex attribute correctly in Internet Explorer

See the documentation for the ff.extend.

Links:

Categories: Uncategorized Tags: , ,

Creating JSP Layouts with Page Tags

March 3rd, 2007 fforw 2 comments

For some time now I’ve been following a new approach when creating the basic layout structure for JSP based web applications. The new approach is based on JSP 2.0 tag files and changes the way that the single pages are build up from reusable parts.


The most common way to do so is to use included files with common blocks:

<%@include “head.inc”%>

<b>page specific markup</b>

<%@include “tail.inc”%>

Here the individual pages contain two or more includes which define the page start and end. Often navigation or sidebars or whatever are included in their own files. Changing the output of the title in the header e.g. requires passing data through the page scope or so.

My new approach defines the basic layout as JSP 2.0 tag file. Let’s take a look at an example:

<%@tag description=”page layout” %>
<%@taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core”%>
<%@attribute name=”head” fragment=”true”%>
<%@attribute name=”title” required=”true” type=”java.lang.String”%>
<%@attribute name=”script” required=”false” type=”java.lang.String”%>
<%@attribute name=”stylesheet” required=”false” type=”java.lang.String”%>

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title>${title} – Page Tag Example</title>
<style type=”text/css”>
@import url(“<c:url value=”/style/style.css”/>“);
<c:forTokens var=”item” items=”${stylesheet}” delims=”,”>
@import url(“<c:url value=”/style/”/>${item}“);
</c:forTokens>
</style>

<c:forTokens var=”item” items=”${script}” delims=”,”>
<script type=”text/javascript” src=”<c:url value=”/script/”/>${item}“>
</script>
</c:forTokens>
<jsp:invoke fragment=”head” />
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<meta http-equiv=”Pragma” content=”no-cache”>
</head>
<body>
<h1>Page Tag Example</h1>
<ul id=”nav”>
<li><a href=”index.jsp”>Index</a></li>
<li><a href=”page1.jsp”>Page 1</a></li>
<li><a href=”page2.jsp”>Page 2</a></li>
</ul>
<div id=”content”>
<jsp:doBody />
</div>
<hr>
<div id=”footer”>
<a href=”http://validator.w3.org/check?uri=referer”><img
src=”http://www.w3.org/Icons/valid-html401″ border=”0″
alt=”Valid HTML 4.01 Transitional” height=”31″ width=”8″></a>
</div>
</body>
</html>

The tag defines the example page layout with a page header, a navigation and a footer. There are several attributes to control the page tag from inside the JSP page it is used in:

  • head – Fragment attribute used to add additional HTML markup to the head section of the page
  • title – Required attribute which sets the page specific part of the page title
  • script – Comma separated lists of script files to include from the /script directory
  • stylesheet – Comma separated lists of style sheets to import from the /style directory

The head fragment attribute demonstrates how to setup a fragment attribute which makes it possible to set HTML code as an attribute. To use such a fragment attribute inside a page you need to use the <jsp:attribute> and <jsp:body> tags:

<%@taglib tagdir=”/WEB-INF/tags” prefix=”example”%>
<example:page title=”Page 1″>
<jsp:attribute name=”head”>
<meta name=”author” content=”Sven Helmberger”>
</jsp:attribute>
<jsp:body>
Page 1 – demonstrates the use of the head fragment attribute
</jsp:body>
</example:page>

If you only use normal (non-fragment) attributes you can leave out the <jsp:attribute> and <jsp:body> tags and specify the rest of the attributes like the title attribute above. Fragment attributes can also be useful to define common code blocks besides the tag body like a page-specific area in a sidebar or so.

You can see that, even with fragment attributes complicating things, the page tag leads to a simple JSP code with high reuse and clear passing of data from the special page code to the common code.

Categories: Uncategorized Tags: , ,

ff javascript library 1.1 released

August 12th, 2006 fforw No comments

After some more work on it, I am proud to announce the version 1.1 of the ff javascript library. It includes various bug-fixes ( ff.dom.append , various Internet Explorer compatibility fixes especially in the DOM builder) and some more functions in ff.dom and ff.style. The ffjs documentation moved to a new location. It includes a lot more documentation and 2 examples. I may add some more examples in the future. 

Categories: Uncategorized Tags: , ,

Javascript Slim-Down

July 24th, 2006 fforw No comments

Modern javascript libraries tend to be fat. This increases the page load latency, wastes bandwidth and is a real problem for people with slower connections (There are still about 50% dialup users). So trying to slim things down comes almost naturally.

In this article I will try to present two compression methods that together will make your scripts lose up to 80% of their weight and I will also present an alternative way to serve gzip compressed files with Turbogears : a precompressing gzip controller for Turbogears.


The first thing one can do is javascript compression. Stripping unnecessary whitespace and renaming local variables can already bring down the size a bit, The dojo javascript compressor ( online version ) does both.

Let’s take two of the javascript libraries used for this site as examples:

  • ff-src.js – source version of my own javascript library

    Uncompressed: 10.1 KB
    Javascript compressed: 6.7 KB
    Compression: 33%

  • tinymce.js – all sources I need from the tinymce richtext editor joined together

    Uncompressed: 329.0 KB
    Javascript compressed: 233.6 KB
    Compression: 29%

This sure is nice for a start, but we can go even one step further with gzip compression. Gzip compression is a w3 standard ( defined in RFC 2616 ) and can be used to send the output of a server compressed to a client. Using this our files shrink even more:

  • ff-src.js
    Uncompressed: 10.1 KB
    Js and gzip compressed : 2.8 KB
    Compression: 73%
  • tinymce.js
    Uncompressed: 329.0 KB
    Js and gzip compressed : 57.8 KB
    Compression: 82%

Most modern web servers allow you to enable general gzip compression. IIS does it, Apache has mod_gzip for it, Turbogears can do gzip compression via cherrypy’s gzip filter.

Personally this felt like an overkill to me. I don’t really want to use my precious server CPU cycles to compress output where it’s no larger win to do so. So I wrote myself a precompressing gzip controller for Turbogears. It creates gzipped copies of a configurable set of files and automatically updates them. If the client browser supports gzip encoding, the gzipped file copy is sent, otherwise the normal file is send.

The controller is meant to be used as a subcontroller list this

class Root( controllers.RootController ):
# subcontroller
gz = GzipController()

This would map the gzip controller to /gz/ .

Download:

  • gz.py — precompressing gzip controller
  • serveFile.patch — Update: the patch has been integrated into the turbogears distribution