| Python-like urlparser module for JavascriptPosted on November 29, 2008 by Mikko OhtamaaFiled Under Uncategorized I had to deconstruct and reconstruct URLs from pieces when doing advanced Javascripting for Plone. I found this nice library from Denis Laprise. However, it had a bug with fragment extractor and lacked reconstruction possibilies. So I decided to make a new version. Download urlparse.js version 0.2. thank you Couple of examples: var p = new Poly9.URLParser('http://user:password@poly9.com/pathname?arguments=1#fragment');
p.getHost() == 'poly9.com';
p.getProtocol() == 'http';
p.getPathname() == '/pathname';
p.getQuerystring() == 'arguments=1';
p.getFragment() == 'fragment';
p.getUsername() == 'user';
p.getPassword() == 'password';
var p = new Poly9.URLParser("http://localhost:8080/path);
p.setQuerystring("foo=bar");
p.setFragment("anchor");
p.setPort(7070);
var url = p.getURL() // http://localhost:7070/path?foo=bar#anchor
Tourist is mobilePosted on November 19, 2008 by kipiFiled Under Business, Uncategorized, linux Tourists and travelers do carry nowadays mobile phones all the time with them, but are not using them only for calls and sending text messages. More and more, because of faster mobile phone networks, they are using mobile phones for chatting, checking emails and using other network based services, like searching for information. And use most likely will increase, especially here in Europe as European Union bureaucrats has taken lately active role for making use of mobile phones more cheaper while traveling in Europe. Country and city tourist offices, as well as other organizations publishing information for tourists and travelers, traditionally have lots of information available on the internet. Background information, history, practical information like about transportation, sights, restaurants, bars and nightlife, not forgetting maps and other content types like videos and audios. Unfortunately this information is not easily usable, if at all, by mobile phones and mobile phone browsers thus making it practically unusable for tourist after s/he has left home and started her/his travel. Its actually surprise how little there’s usable tourism and travel information which can be used with mobile phones. Here in Finland Helsinki has its own mobi site but, well, not so attractive service and could have more content. Especially if compared for the mobile service provided by eg. SAS, even their focus is a bit different. What’s the problem? Most likely that those tourism offices and boards are just so traditional, slowly moving elephants. This have seen already when internet, as term and a “channel”, was new and how slowly tourism and travel communications moved into the net. Now the good sides, more cost effective and up to date communication, has been seen but hopefully value of mobile phones and services for them wont take so much time as it did with web services. Because the tourists and travelers are here, now, and willing to use information if that’s just available. Speeding up Plone loading with PTS_LANGUAGESPosted on August 19, 2008 by Mikko OhtamaaFiled Under Uncategorized If you are not a Finnish speaker (like 99,9% of you) you might not want to (re)load Finnish and other unwanted language catalogs during the Plone start up. This is possible for Plone 3.1, as Reinout van Rees explains (found out afterwards). For your Plone launcher, set environment variables (space separated list) PTS_LANGUAGES=en mylanguagecodehere If your Data.fs is not fresh (i.e. you have an existing Plone instance) there is still one task to do. Go to Placess Translation Service in Zope. Delete all translation catalogs. If there exists a translation catalog entry in ZODB a reload event seem to be triggered even though PTS_LANGUAGES settings is effective. Restart Zope. Maybe this is a bug? Do this on a development box only – this code seems to be quite new. Facebook requests…Posted on August 14, 2008 by Mikko OhtamaaFiled Under Uncategorized I love you all guys. I just learnt that Firefox web page screen capture tools (any of them) can’t take web page screenshots higher than short 16-bit interger (32768) pixels. Crash crash crash. But I hope I am alone with my problem. So, thanks for being so supportive… and it’s not fully rendered (over 250 of them), since after 3200 the image was cut. Excuse me if I am not willing to support your cause. Updated: Eclipse web developer plug-in memoPosted on July 14, 2008 by Mikko OhtamaaFiled Under Plone (old), Uncategorized, eclipse, python Below are my personal notes what plug-ins are needed to get “perfect” Eclipse web development set-up. Basically they are just my own notes so that I don’t need to Google everything all over again every time I reinstall. I hope the readers can find new pearls here or suggest improvements. This post is update to previous Eclipse web developer plug-in memo post. New versions are available and some plug-ins have become deprecated. This blog post reflects those changes. These instructions are good for:
Choosing Eclipse distribution
sudo apt-get install sun-java6 eclipse
EasyEclipse bundles some of the stuff listed here with it – when using EasyEclipse you don’t need to have separate PyDev and Subclipse downloads. Eclipse for 64-bit Linux has various problems. You might want to run 32-bit Eclipse (another relevant blog post). When you use Linux distribution specific Eclipse install, all your personal Eclipse files go to .eclipse folder under your home folder. Installing plug-insEclipse has internal updater/web installer. All plug-ins are downloaded as ZIP files and extracted to Eclipse folder or installed through the internal updater. Paste Eclipse update site URLs to menu Help -> Software updates -> Find and Install, New Remote Location. PythonPyDev is a plug-in for Python and Jython development. It has enhanced commercial extensions for professional developers with more intelligent autocomplete and debugger. Site URL: http://pydev.sourceforge.net PyDev Eclipse update URL: http://pydev.sourceforge.net/updates/ PyDev extensions Eclipse update URL (this commercial, but worth of every penny): http://www.fabioz.com/pydev/updates PDTPDT download provides Eclipse, HTML editor, PHP editor and CSS editor. Site URL: http://www.eclipse.org Eclipse update site URL: http://download.eclipse.org/tools/pdt/updates/ JavaIf you need to do J2EE development use IBM’s Web Tools Platform. If you don’t need Java capabilities don’t install these, since they just bloat Eclipse and make the start up time worse. SubclipseSubclipse provides Subversion version control integration to Eclipse. Eclipse update site URL: http://subclipse.tigris.org/update_1.4.x/ In the installer, uncheck the integration modules checkbox or the installer will complain about missing modules. Aptana Studio
Aptana Studio is state-of-the-art Web 2.0 development suite for Eclipse. It has Javascript, CSS and HTML editors. It supports various Javascript libraries out of the box and has support for Firefox and IE in-browser Javascript debugging. Eclipse update site URL: http://update.aptana.com/update/studio/3.2/site.xml ShellEdSyntax coloring for Unix shell scripts Project site: http://sourceforge.net/projects/shelled SQL ExplorerSQL terminal and SQL editor with some GUI capabilities. Eclipse update site URL http://eclipsesql.sourceforge.net/ SQL Explorer needs MySQL JDBC driver. Download from here. Install MySQL connector by extracting the file and adding it from SQL Explorer preferences. Verifying Javascript files with JSLint from Eclipse IDEPosted on March 27, 2008 by Mikko OhtamaaFiled Under Uncategorized, javascript
Javascript is executed run-time. Thus, any errors cannot be cached until the code is run. JSLint is a verifier tool which checks Javascript syntax offline. Of course, it cannot detect application logic errors, but it makes sure that you don’t have cross-browser compability problems in your Javascript syntax. Maybe the most famous of these problems is the extra comma before the list termination which is ok for Firefox, but kills the page on Internet Explorer. Some argue that this does not really catch bugs and instead a comprehensive unit-test suite should be used. This might be a requirement for a platform level Javascript library code, but it is often an overkill for your little site with some flashy dialog windows. Installing JSLint JSLint itself is written in Javascript. So you need to offline Javascript interpreter to run it. On Linux there exists Rhino. On Ubuntu, Rhino package is broken. and you need to download the orignal Rhino JAR from here and copy it to /usr/share/java. sudo apt-get install rhino # Note https://bugs.launchpad.net/ubuntu/+source/rhino/+bug/93885 Then get JSLint offline version from here. Running JSLint straight from the Eclipse We use JSEclipse plug-in in Eclipse for Javascript development. Thus, it is convenient to to execute JSLint directly from the Eclipse IDE. Drag and drop jslint.js to your project/scripts folder in Eclipse. Create a new External tool like in the example below. Then you can run it by just clicking “run external tool” icon. Output comes to the console window. Checking all Javascript files during unit test verify_javascript.bash can be executed from shell and it checks all JS files in your project. This is a nice feature to integrate to your unit test cycle. Example:
$ bash scripts/verify_javascript.bash source/server/media/jssource/server/media/js/jquery.js
Lint at line 11 character 30: Expected '{' and instead saw 'var'.
...
Technocrati claimingPosted on November 11, 2007 by Mikko OhtamaaFiled Under Uncategorized I am adding this blog to Technocrati |
