Hopbot log for 2009-03-10 - Helma IRC channel: #helma on irc.freenode.net

2009-03-10:

[0:47] <mykes> hello
[0:47] <mykes> anyone alive here? :)
[0:47] <zumbrunn_> hi mykes
[0:47] <mykes> hi there!
[0:48] <mykes> I am new to Helma and very much in love with her
[0:48] <mykes> I have a question tho
[0:48] <zumbrunn_> still trouble with that load order?
[0:48] <mykes> I have a database with UTF8 data in it
[0:48] <mykes> (load order I think I can figure out)
[0:48] <mykes> when I query the database from PHP and just print it to the browser with meta tag for utf8
[0:48] <zumbrunn_> (load order I think shouldn't matter)
[0:48] <mykes> it shows proper
[0:49] <mykes> when I query the db from js in helma
[0:49] <mykes> with the same HTML
[0:49] <mykes> I get garbage characters
[0:49] <mykes> and I particularly want to send the proper UTF8 via json to my client app
[0:49] <zumbrunn_> how are you querying the database?
[0:49] <mykes> helma.database.query
[0:50] <zumbrunn_> through helma's orm?
[0:50] <zumbrunn_> ok
[0:50] <mykes> the kinds of javascript programs I do are comet
[0:50] <mykes> and lots of json
[0:50] <mykes> no html at all
[0:50] <mykes> so I have no real need for the ORM
[0:50] <mykes> I have made some changes to your database class
[0:51] <zumbrunn_> not sure about helma.database, but generally inside of helma everything is unicode
[0:51] <zumbrunn_> so there shouldn't be any encoding problems there
[0:52] <zumbrunn_> usually, the encoding problems happen between helma and the browser
[0:52] <zumbrunn_> anywhere in between there
[0:52] <mykes> I examine the HTML from php and from helma
[0:52] <mykes> identical
[0:52] <mykes> except in php I do emit $string; and it's proper (russian)
[0:52] <zumbrunn_> like between helma and the web server helma is deployed behind, for example
[0:52] <mykes> in helma I do res.write(string)
[0:53] <mykes> I get garbage characters
[0:53] <mykes> I am using helma from the zip downloaded on your site
[0:53] <mykes> start.sh
[0:53] <zumbrunn_> are you setting the content type of the response?
[0:54] <zumbrunn_> http://helma.server-side-javascript.org/reference/res.html#res.contentType
[0:54] <mykes> page.start('test'); res.charset="UTF8"; res.writeln(rows[0].username); page.finish();
[0:54] <mykes> that's 4 lines
[0:54] <zumbrunn_> ehm, yes that's what I meant :-)
[0:55] <zumbrunn_> http://helma.server-side-javascript.org/reference/res.html#res.charset
[0:55] <mykes> I read that page
[0:55] <mykes> I don't see anything to solve this problem...
[0:56] <zumbrunn_> maybe take a look at this:
[0:56] <zumbrunn_> http://209.85.129.132/search?q=cache:OQexYTHetjQJ:www.knallgrau.at/company/weblog/files/helmabootcamp2_utf8/
[0:57] <mykes> does -Dfile.encoding have to do with anything but reading/writing files?
[0:58] <zumbrunn_> I wouldn't think so
[0:58] <zumbrunn_> but I'm not sure
[0:59] <mykes> mykes@dionysus:/home/helma/helma-1.6.3$ java -version java version "1.6.0_10" Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)
[0:59] <mykes> it complains when I uncomment the JAVA_OPTIONS line in start.sh
[1:00] <mykes> Unrecognized option: --Dfile.encoding=UTF-8
[1:01] <zumbrunn_> I was more thinking about slide 5
[1:01] <zumbrunn_> did you say what kind of database you are using?
[1:01] <zumbrunn_> a relational database?
[1:02] <zumbrunn_> or the built-in xml db?
[1:02] <zumbrunn_> oh, yes
[1:02] <zumbrunn_> helma.database you are using
[1:02] <mykes> mysql
[1:02] <mykes> I query the same table, same query from php and print, it prints correctly
[1:03] <mykes> I have the ?options in the db.profile as well as use
[1:03] <mykes> cms.password = mysqlmysql cms.useUnicode=true
[1:03] <mykes> heh
[1:04] <mykes> cms.useUnicode=true cms.characterEncoding=UTF-8
[1:05] <mykes> this is what the characters look like:
[1:05] <mykes> ????? ????????
[1:05] <mykes> php prints the same value:
[1:05] <mykes> ???? ??????
[1:06] <zumbrunn_> have you tried it the way it is in slide 5?
[1:06] <mykes> exactly as in slide 5
[1:06] <mykes> the database must be fine
[1:06] <mykes> php is able to read it and show the right characters
[1:07] <zumbrunn_> then you should probably ask for other ideas on the helma mailing list
[1:07] <mykes> in firefox, I view source of php output and helma and see identical except for those garbage characters
[1:08] <zumbrunn_> maybe you can somehow verify at which stage the problem happens
[1:08] <mykes> when I query the DB from a command line mysql client, it's the same garbage characters
[1:08] <zumbrunn_> it's kind of tricky to debug this though, I guess
[1:09] <zumbrunn_> oh, interesting
[1:09] <zumbrunn_> did you store the data using php?
[1:10] <mykes> yes
[1:10] <zumbrunn_> maybe php does something funny when storing and then "undoes" that when reading
[1:10] <mykes> it may convert the string to utf8 when it sees the first byte
[1:10] <mykes> the BOM
[1:10] <mykes> but I am not sure of that
[1:11] <mykes> I have spent like 12 hours of work time on this problem :/
[1:12] <zumbrunn_> that sucks
[1:12] <zumbrunn_> you didn't bring it up on the mailing list yet, did you?
[1:12] <mykes> I run a decent sized message board
[1:12] <mykes> http://sportstwo.com
[1:13] <mykes> I would like to replace vbulletin software with something custom using helma
[1:13] <zumbrunn_> cool :-)
[1:14] <mykes> but I have this user with the russian username
[1:14] <mykes> LOL
[1:15] <zumbrunn_> rofl
[1:18] <zumbrunn_> you could try the deprecated getDBConnection() global function and see if you get a different result with that
[1:18] <zumbrunn_> http://helma.server-side-javascript.org/reference/global.html#getDBConnection
[1:25] <mykes> looking at it
[1:25] <mykes> just posted to the google group
[1:26] <mykes> helma.database.js
[1:26] <mykes> it simply uses the jdbc methods directly
[1:27] <mykes> at about line 200, I made this change:
[1:27] <mykes> statement.executeUpdate(sql, statement.RETURN_GENERATED_KEYS ); var result = statement.getGeneratedKeys(); if (result.next()) { this.insert_id = parseInt(result.getInt(0)); } else { this.insert_id = 0; }
[1:27] <mykes> not pretty
[1:27] <mykes> but it lets you get the last insert_id
[1:27] <mykes> for auto_increment
[1:28] <mykes> it is calling getString(i) to get the field value
[1:28] <mykes> I think that is correct
[13:13] <philipp> hi guys! i just added some lines to the _parent documentation ( http://dev.helma.org/docs/Type.properties+Documentation/ ) - would be nice if someone can verify or extend my example, I didn't tested it with a real helma app.
[13:27] <simono> looks good. maybe highlight some of the longer codelines as code, i had a hard time reading "If you define _parent = root.warphotographers, agency, root.photographers Helma?s..."
[13:36] <philipp> another question: is there nothing better than this.__proto__.__proto__.function() - i found no this.super() or something similar.
[13:44] <philipp> Solution: HopObject.prototype.onRequest.apply(this); ;-)
[13:45] <simono> :)
[14:38] <mib_ngpxqr> Hi
[14:39] <mib_ngpxqr> Is somebody here ?
[14:45] <simono> hi
[14:46] <mib_ngpxqr> I would like to know what is the simple way to add a comet servet to the helma server
[14:47] <mib_ngpxqr> The idea is to send some events fron javascript server side to the clients
[14:47] <mib_ngpxqr> so I need access to this servet from the javascript
[14:53] <simono> hm, i don't know. just found "comet support" on the wishlist page :|
[14:55] <simono> have you done this kind of stuff in other java environments?
[14:57] <zumbrunn> mib_ngpxqr: what's the exact functionality you are looking for?
[14:57] <simono> mib_ngpxqr, can't you do it with ajax polling from the clientside
[14:57] <zumbrunn> if I remember correctly, there were comet specific features added to jetty specifically
[14:58] <mib_ngpxqr> polling is nether a good idea, I think
[14:58] <zumbrunn> and the jetty in helma 1.x is older than those features
[14:58] <mib_ngpxqr> I had a jetty server with comets installed, but with helma, I dont know how to access the server to add the servlet
[14:59] <zumbrunn> which version of jetty was that?
[14:59] <zumbrunn> probably a 6 or a 7 version
[15:00] <zumbrunn> Helma 1.x is still using a jetty 5 version
[15:00] <mib_ngpxqr> jetty 6.1.9
[15:00] <zumbrunn> right
[15:00] <zumbrunn> plus, in Helma 1.x the javascript environment doesn't have direct control over jetty
[15:01] <zumbrunn> maybe you should look at helma-ng instead?
[15:01] <mib_ngpxqr> so, there is simple solution I guess
[15:01] <zumbrunn> depends on what it is you want to do and which functionality you need
[15:01] <mib_ngpxqr> I'am not familiar with helma-ng, is it released yet ?
[15:02] <zumbrunn> no, far from it
[15:02] <zumbrunn> but, again, it depends on what you need
[15:02] <zumbrunn> helma-ng is a very small, very simple core
[15:02] <mib_ngpxqr> I need to add the cometd servlet and have access to it from the javascript environement
[15:03] <zumbrunn> if it provides all you need, then helma-ng might be perfectly ready for you, even-though it is only at version 0.2 currently
[15:04] <zumbrunn> which features of helma are you currently using
[15:04] <zumbrunn> (or planning to use)
[15:04] <mib_ngpxqr> I am not using the database features, just added my own jars
[15:05] <mib_ngpxqr> I keep my database in json files
[15:05] * zumbrunn wouldn't be surprised if you prefer helma-ng, even at its current state
[15:05] <mib_ngpxqr> I need acces to my java classes through rhino
[15:06] <zumbrunn> no problem with that either-way
[15:07] <mib_ngpxqr> I will take a look at it, what is the jetty version on ng ? Can I add a servet and have access to it from javascript ?
[15:07] <zumbrunn> 6 something
[15:08] <zumbrunn> not sure exactly how you would add a servlet
[15:08] <zumbrunn> take a look at this code....
[15:09] * zumbrunn is looking for it
[15:09] <zumbrunn> http://github.com/hns/helma-ng/blob/2d07a57bcc248d846be3a9732cf479d1db0cabe6/modules/helma/httpserver.js
[15:09] <zumbrunn> this is how helma-ng adds the helma servlet to the jetty server
[15:10] <zumbrunn> and starts the server
[15:11] <zumbrunn> I'm not sure, just guessing, but you probably would have to stop the server and start it again in order to add other servlets?
[15:11] <zumbrunn> maybe you can tell from looking at that code
[15:12] <zumbrunn> as you can see, helma-ng *does* start and stop the jetty server through javascript
[15:12] <mib_ngpxqr> Yes, better if I could get the server before it is started, add the servlet, and start it after
[15:12] <mib_ngpxqr> yes, very cool
[15:13] <zumbrunn> that is the main difference between helma 1.x and ng, that in ng you control almost everything through the javascript environment
[15:13] <mib_ngpxqr> I suppose this js file is accessible and can be changed easily
[15:14] <zumbrunn> where as in helma 1.x the js environment was just the scripting language that handled requests inside the helma servlet
[15:14] <zumbrunn> sure
[15:14] <zumbrunn> it is just a module that can be used by an app somewhere
[15:15] <mib_ngpxqr> I'm going to download it and try. Is there an official download page ?
[15:16] <zumbrunn> (in helma-ng, every js file is a module)
[15:16] <zumbrunn> jusy grab it here:
[15:16] <zumbrunn> just
[15:16] <zumbrunn> http://github.com/hns/helma-ng/tree/master
[15:17] <zumbrunn> (the download button near the top)
[15:17] <zumbrunn> then untar or unzip it
[15:17] <zumbrunn> cd into that dir
[15:17] <zumbrunn> and say: ant package
[15:20] <mib_ngpxqr> Thanks a lot for your help. I'll try to port the actual server and add the cometd servlet
[15:21] <zumbrunn> I'm interested in that myself
[15:21] <zumbrunn> so, let me know how it is going
[15:21] <mib_ngpxqr> ok, I can give you feedback later if you want
[15:21] <zumbrunn> :-)
[15:21] <mib_ngpxqr> sure
[15:23] <zumbrunn> what are the bits and pieces needed to qualify for the "comet" label
[15:24] <zumbrunn> maybe the continuation support in the demo app is a good starting point?
[15:25] <mib_ngpxqr> you mean, to demonstrate comet in helma ?
[15:31] <zumbrunn> I mean this demo app:
[15:31] <zumbrunn> http://github.com/hns/helma-ng/tree/2d07a57bcc248d846be3a9732cf479d1db0cabe6/apps/demo
[15:31] <zumbrunn> it contains a continuation demo
[15:32] <zumbrunn> http://github.com/hns/helma-ng/blob/2d07a57bcc248d846be3a9732cf479d1db0cabe6/apps/demo/skins/continuation.html
[15:32] <mib_ngpxqr> well, it means it has been done yet...
[15:33] <simono> i'm also interested.. what does your app do, that it needs comet functionality? "comet" always seemed like a strange concept to me
[15:34] <zumbrunn> mib_ngpxqr: well, the thing you are really looking for is long holding requests probably, right?
[15:34] <mib_ngpxqr> I need to receive state events for now
[15:35] <mib_ngpxqr> on the client I mean
[15:35] * zumbrunn thinks that current continuation example doesn't use long holding requests
[15:35] <zumbrunn> just does its continuation magic on the server side
[15:36] <mib_ngpxqr> yes, I need to keep a connection opened to receive these events

 

 

In the channel now:

Logs by date: