#jython IRC Log


IRC Log for 2013-09-12

Timestamps are in GMT/BST.

[0:19] * arctansusan (~susantan@173-11-98-81-SFBA.hfc.comcastbusiness.net) Quit (Ping timeout: 256 seconds)
[0:27] * bgrz (~bgr@109-93-61-241.dynamic.isp.telekom.rs) Quit (Ping timeout: 260 seconds)
[1:21] * lheuer (~Adium@unaffiliated/lheuer) Quit (Quit: Leaving.)
[1:24] <jimbaker> re special casing in the compiler - this looks doable, at least with some sort of heuristic. it will be difficult to always guarantee the method will not violate, without a more general solution
[1:28] <jimbaker> but this will be compatible w/ the more general solution. anyway here it is: in CodeCompiler#makeArray, in the iteration over nodes, simply break into groups of say 1000, if n > 1000. each grouping will then call a special helper method to initialize a subarray
[1:30] <jimbaker> so this will work with literals for dict, list, set, tuple (eg, {}, [], {}, ())
[1:30] <jimbaker> the more general solution fwiw is to write a python bytecode compiler. something we have needed to write for a while :)
[1:30] <jimbaker> to handle scenarios where we cannot compile to java bytecode, for a number of reasons
[1:42] <jimbaker> ok, i started a fork to track, https://bitbucket.org/jimbaker/jython-big-collection-literals
[2:05] <jimbaker> fwiw, requests has a few more problems than a number of large literals (remove big5freq.py, euckrfreq.py, gb2312freq.py, jisfreq.py, jpcntx.py to play along); we also need to support at the very least idna (http://bugs.jython.org/issue1153, should be straightforward now w/ at least java 6, using http://docs.oracle.com/javase/7/docs/api/java/net/IDN.html) and apparently overly strict zlib param checking. it also needs of course some more ssl client s
[2:05] <jimbaker>
[2:05] <jimbaker> i suppose getting requests running would be a useful compliance check for jython 2.7 :)
[2:07] <jimbaker> ok, i have this thing called teaching i should now work on, given it's 8p here and tomorrow's class starts in just over 13h :)
[3:43] * whg is now known as zz_whg
[4:00] * supersven_ (~sven@port-16317.pppoe.wtnet.de) has joined #jython
[4:04] * supersven (~sven@port-28592.pppoe.wtnet.de) Quit (Ping timeout: 264 seconds)
[5:49] * lheuer (~Adium@f049176118.adsl.alicedsl.de) has joined #jython
[5:49] * lheuer (~Adium@f049176118.adsl.alicedsl.de) Quit (Changing host)
[5:49] * lheuer (~Adium@unaffiliated/lheuer) has joined #jython
[6:50] * purplefox (~purplefox@host-80-43-245-210.as13285.net) has joined #jython
[7:35] <topi`> sounds odd, this 32K bytecode limitation for methods. JVM is odd.
[8:16] * lheuer (~Adium@unaffiliated/lheuer) Quit (Ping timeout: 264 seconds)
[8:22] * lheuer (~Adium@f049176118.adsl.alicedsl.de) has joined #jython
[8:23] * lheuer (~Adium@f049176118.adsl.alicedsl.de) Quit (Changing host)
[8:23] * lheuer (~Adium@unaffiliated/lheuer) has joined #jython
[8:23] * lheuer (~Adium@unaffiliated/lheuer) Quit (Remote host closed the connection)
[8:39] <topi`> I deployed a .war that works on my Tomcat onto another host, and Modjy complained about missing python.home
[8:40] <topi`> the question is, why does it work on my Tomcat setup, but not on the other host?
[8:41] <topi`> I thought that python.home comes from the web.xml (hence, inside the .war)
[8:51] * bgrz (~bgr@109-93-61-241.dynamic.isp.telekom.rs) has joined #jython
[8:51] * lheuer (~Adium@f049176118.adsl.alicedsl.de) has joined #jython
[8:51] * lheuer (~Adium@f049176118.adsl.alicedsl.de) Quit (Changing host)
[8:51] * lheuer (~Adium@unaffiliated/lheuer) has joined #jython
[8:54] <supersven_> maybe you have python.home as environment variable on your host?
[9:08] <topi`> hmm.
[9:08] <topi`> but how would Tomcat know that?
[9:13] <topi`> but AFAIK you should always define python.home in your web.xml when deploying with Modjy?
[9:20] <topi`> the django-jython documentation specifically states this about creating WARs with manage.py:
[9:20] <topi`> "And get a single mysite.war file which you can deploy in your preferred application server. This file doesn???t require anything special installed on the target server. No Django, no Jython, no nothing.
[9:21] <topi`> this is obviously a bug, then, if the .war fails to run correctly under a Tomcat installation (where other wars do work, for example from Grails)
[9:41] <supersven_> but it works on your localhost, right?
[9:42] <supersven_> so we're searching for differences in setups .. :)
[9:45] <supersven_> as a starting point, i would compare the options with which the two tomcats were started
[9:45] <supersven_> something like: ps aux | grep java | less
[9:46] <supersven_> maybe there's a -Dpython.home in one of the setups that isn't in the other ...
[9:51] <daenney> jimbaker: Good catch, my shell is zsh. If I use 'JYTHON_HOME=/usr/local/Cellar/jython/2.7-b1/libexec bash jython' the expr syntax errors are gone
[9:52] <daenney> Oddly enough, there's a /usr/bin/env bash shebang on top of that script so it should've picked the right interpreter
[9:55] <daenney> I added a 'set -x' in the startup script, I can see the error popping up now
[9:55] <daenney> It's odd that it doesn't happen if I explicitly add bash to the command line but it does if I don't
[9:57] <daenney> jimbaker: I updated https://gist.github.com/daenney/6530647
[9:58] <daenney> Looks like it's getting a wee bit confused about /usr/local/Cellar/jython/2.67b1/bin/jython being a symmlink to /usr/local/Cellar/jython/2.7b1/libexec/bin/jython
[10:00] <daenney> It's even more fun in my case since /usr/local/bin/jython is a symlink to Cellar/jython/2.7b1/bin/jython which is a symlink to etc :)
[10:01] <daenney> jimbaker: If you also look at the Dpython.executable added to the JVM it's a bit of a weird path :)
[10:02] <daenney> So the way homebrew has packaged things seems to confuse Jython's startup script
[10:08] * kral|off is now known as kral
[10:16] * truk77 (~kurt@pool-71-191-90-171.washdc.fios.verizon.net) Quit (Ping timeout: 245 seconds)
[10:18] * truk77 (~kurt@pool-71-191-90-171.washdc.fios.verizon.net) has joined #jython
[11:19] <jimbaker> daenney, yes, i'm certainly confused :)
[11:20] <jimbaker> topi`, no teaching for me today, the university is closed because of flash flooding. (i'm ok fwiw, but it's wet out there)
[11:20] <daenney> Oh we had that yesterday, people were rowing in the streets, pretty fun
[11:21] <jimbaker> topi`, so the salient point about the 32K limit is that we have to package everything in bytecodes, and ultimately into the constant pool
[11:21] <jimbaker> no various limits
[11:21] <jimbaker> sorry, *so* various limits :)
[11:22] <jimbaker> daenney, the best part is that i got numerous calls waking me up, from my kids' school district and the university. but i do not mind, it's extraordinarily dangerous in some parts
[11:24] <daenney> Yeah sure, flash floods no good
[11:25] <daenney> I'll see if I can figure out what's tripping up the startup script, got 2h30 of a train journey planned today
[11:25] <daenney> Should be able to get something done
[11:25] <jimbaker> daenney, sounds like a good way to get some quality hacking done
[11:27] <daenney> Depends on how many phone calls are going in with people talking to their friends recounting every disgusting little detail of their last doctor's appointment :P
[11:28] <daenney> You'd be surprised the stuff people tell eachother on a phone in a train. And then get pissed when you ask them to quiet it done a little because the details are bothering you going like 'what are you doing listening to my private phone call'
[11:28] <daenney> Society...
[11:29] <jimbaker> daenney, :)
[11:29] <jimbaker> where do you live?
[11:45] <jimbaker> topi`, so this is an interesting question re how modjy picks up python.home; ModjyJServlet.java is fairly trivial, just gluing jython together with the Servlet interface. my understanding here is that if you package up a registries file in the war, you should be able to do the desired overriding, see http://www.jython.org/jythonbook/en/1.0/appendixA.html#the-jython-registry
[11:46] <jimbaker> but it's been a long time since i thought about this - i do remember demoing this with leo soto almost exactly 5 years ago, fwiw :)
[11:54] <daenney> jimbaker: The Netherlands, Europe
[11:56] <jimbaker> daenney, nice, i have been to the netherlands a few times. i even took a train once from antwerp to dusseldorf, crossing the netherlands, for a joint jython/pypy sprint :)
[11:56] <jimbaker> that was a nice long train ride, i recall it being productive
[11:57] <daenney> Ha cool :). I tend to add the Europe to the list ever since someone answered with 'Oh cool, that's right next to Australia'
[11:58] <daenney> Netherlands, New Zeland, same diff
[11:58] <jimbaker> anyway, glad to see that my employer (rackspace) is helping with both jython and pypy development, which also helps out on projects for rackspace
[11:58] <jimbaker> daenney, well, there is zealand in denmark, so i guess there's that possible source of confusion :)
[11:58] <daenney> There's a zealand in The Netherlands, it's one of the provinces
[11:58] <jimbaker> ahh, ok
[12:01] <jimbaker> i was in zealand/copenhagen last year for the ubuntu developer summit, when i was working for canonical on ubuntu server. (working on ubuntu was sort of a holiday from working on jython, so to speak)
[12:01] <daenney> Figured out what goes wrong, not entirely sure how/why though
[12:02] <daenney> The expr regex matching is probably confused by my symlink
[12:08] <daenney> Right so the relative symlink seems to be confusing things
[12:08] <daenney> bash-3.2$ expr ../Cellar/jython/2.7-b1/bin/jython : '.*/.*'
[12:08] <daenney> 34
[12:08] <daenney> bash-3.2$ expr ../Cellar/jython/2.7-b1/bin/jython : /
[12:08] <daenney> expr: syntax error
[12:08] <daenney> I have no idea why it answers 34 either...
[12:11] <daenney> What I'm not getting is why that script isn't simply using `pwd -P` or `realpath` instead of doing some expr magic to resolve that link
[12:18] <jimbaker> daenney, possibly due to the fact that we also support cygwin
[12:18] <jimbaker> and apparently realpath is buggy there. but... could just realpath on non cygwin systems
[12:22] <daenney> jimbaker: Any idea if readlink works there? OS X has the bogus feature neither readlin or realpath behave like I want
[12:22] <daenney> BSD readlink is different from gnu readlink and for some reason OS X doesn't have realpath just yet
[12:23] <jimbaker> daenney, yeah, don't know - these are dark arts, this knowledge of compatibility ;)
[12:23] <daenney> Also, cygwin, really? It runs on the JVM...
[12:24] <jimbaker> well the idea here is to get to the jvm as quickly as possible
[12:25] <jimbaker> so i certainly have used cygwin in the past, but i don't have any windows boxes anymore
[12:26] <daenney> What I don't get is why cygwin on windows. Just duble-click the jar and done right?
[12:27] <daenney> Or create a .lnk which is added to the Start menu
[12:29] <daenney> Oh goodie, OS X actually has the realpath C function, just not a command line function
[12:30] <jimbaker> daenney, to be honest, i don't know why we don't just use cpython to start jython
[12:31] <jimbaker> instead of this shell script mess :)
[12:31] <daenney> Because there might not be a cpython?
[12:31] <jimbaker> oh sure, there's a small chance of that
[12:31] <daenney> Especially on all thos hipster embedded devices that happen to run a jvm
[12:32] <jimbaker> well, they are not going to be running bash either :)
[12:33] <daenney> Fair point
[12:33] <jimbaker> so certainly can start the jvm many ways, the jython script just works well in environments that invariably support python
[12:33] <jimbaker> i guess the one exception might be cygwin out of the box
[12:34] <jimbaker> anyway, i'm not a big fan of shell scripts that are more than 5 lines in length
[12:34] <jimbaker> or contain functions/loops
[12:35] <jimbaker> or for that matter if statements ;)
[12:38] <daenney> Hey wait, I can use readlink for everyone and on OS X resolve to python, since there we are guaranteed so alwys have python
[12:38] <daenney> Or actually just use python and if not found, readline
[12:39] <daenney> WE'd have to test cygwin's readline but I'm pretty sure that's the gnu one
[12:43] <daenney> That would fix the issues when it comes to correctly resolving the symlinks
[12:43] <jimbaker> daenney, right
[12:44] <daenney> We'll have to accept the slowdown of calling out to python though
[12:44] <daenney> But that should be barely noticeable on a modern system
[12:44] <jimbaker> much less than overall jython startup for sure
[12:45] <daenney> Starting up Jython is actually remarkably fast on my machine
[12:45] <daenney> It takes about 3s, I expected that to be much more
[12:46] <jimbaker> daenney, ok, that's not fast :)
[12:46] <jimbaker> on my laptop, it's just under 2s
[12:47] <daenney> Considering `lein repl` takes about 7-12s I'm fine with 3 :)
[12:47] <daenney> starts a clojure repl
[12:48] <topi`> first start of jython 2.7b on my mac takes about 9 s
[12:48] <topi`> second start takes 2-3 se
[12:49] <daenney> That's probably because of a bunch of jars that get loaded the first time
[12:49] <jimbaker> i find these times to be bad, but not so awful that it's a first priority to fix
[12:49] <topi`> indeed
[12:50] <jimbaker> btw, one interesting cpython/jython hybrid would be to make a decent nailgun
[12:50] <topi`> do we still have Frank W. working on jython?
[12:50] <jimbaker> especially now that we have unix domain sockets supported in jnr, with nio support
[12:50] <jimbaker> frank has been busy on other things for his company
[12:51] <topi`> right
[12:51] <topi`> we need to start a kickstarter campaign to get funds for jython dev!
[12:51] <jimbaker> topi`, :)
[12:52] <jimbaker> so i have been getting buy in for making my time available for jython at rackspace
[12:52] <topi`> well, with $50k funding, you'd employ two capable guys for a while, that would help a lot to tackle current bugs + jumpstart py3000 support
[12:52] <topi`> does rackspace let ppl have this 20% "own projects" law like Google?
[12:53] <topi`> every Friday ought to be a hack friday!
[12:53] <jimbaker> so that's why i have jumped back much more in the last 3 months. but even then, it has taken some time to really jump in
[12:53] <topi`> I put out a service written in Django on our production Tomcat server, lets see what the boss says :D
[12:53] <jimbaker> we have hackdays once or twice a month
[12:53] <topi`> he's probably going to call it a hack.
[12:53] <topi`> but so would I call languages like Groovy
[12:54] <jimbaker> groovy is a hack
[12:54] <topi`> indeed, I once had a peek at its grammar file - ugly
[12:55] <topi`> the python grammar is like from another planet in contrast
[12:55] <topi`> do you know if groovy works internally similarly to jython? or does it just compile to straight java? but it cannot, since it's interpreted...
[12:55] <jimbaker> topi`, they use the same model of compiling to java bytecode
[12:56] <jimbaker> however, there object representation is much, much more complicated
[12:56] <jimbaker> their
[12:56] <jimbaker> we have a much cleaner model for going back and forth between python and java object space
[12:57] <topi`> how do you know all this stuff? :)
[12:57] <topi`> I bet you know JRuby internals as well ;)
[12:58] <jimbaker> topi`, i read source code. also we share source code. so some sharing w/ jruby, a little bit w/ groovy
[12:58] <topi`> ok
[13:00] <topi`> hmm, let's see if I get sqlite3 working with Django+jython
[13:01] <topi`> jimbaker: it's somewhat odd that there are floods elsewhere going on, whereas we here in West Coast Finland have experienced very, very dry summer
[13:01] <topi`> the plants are suffering more than usual
[13:01] <topi`> but then again, sunny days are good for sailing :)
[13:02] <daenney> jimbaker: I'm goibg to torture and rebuild that startup script a but
[13:02] <jimbaker> topi`, i do love sailing!
[13:03] <jimbaker> but in colorado, it's limited to our mountain lakes
[13:03] <topi`> I understand. Our house is by the sea :)
[13:03] <topi`> I wouldn't go inland ;)
[13:03] <daenney> I'm surprised you're so concerend with the startup times. stfatubg up the jvm alone takes quire a while already
[13:03] <jimbaker> daenney, that sounds great, i'm glad someone is looking at this issue
[13:04] <jimbaker> daenney, well, there's jvm startup, but we also have probably the least optimized startup imaginable in the jython runtime
[13:04] <daenney> Haha :)
[13:06] <jimbaker> topi`, i know exactly what you mean, i just substitute living right to the mountains for the sea. but my wife and i used to live on the water when we lived on the east coast of the united states
[13:07] <topi`> jimbaker: lots of nice islands on the East coast, like Nantucket ;)
[13:08] <jimbaker> yes, many lazy summer weeks spent there, or on block island or martha's vineyard, by my wife & i
[13:09] <topi`> wouldn't sqlite3 work with jython, since it's written in pure python? I think
[13:09] <topi`> jimbaker: I spent a very lazy summer here on the west coast (we live on an island), with the boy playing in the sand
[13:09] <supersven_> hey, i created a wiki page for intellij project setup: https://wiki.python.org/jython/JythonDeveloperGuide/IntellijNotes
[13:09] <topi`> so no coding for me, just watching the boy do his work
[13:11] <jimbaker> supersven_, i believe i am responsible for those old intellij project files!
[13:11] <supersven_> oh, sorry
[13:11] <jimbaker> no, this is so much better
[13:11] <supersven_> well, they didn't work for me ... :)
[13:12] <jimbaker> they are only from a few years back, intellij has updated
[13:12] <supersven_> and perhaps they went "out-of-sync" with the libs
[13:13] <supersven_> just to mention: this is still a hack, however the clean solution would be to migrate to maven
[13:13] <supersven_> and that would be a lot of work
[13:13] <topi`> hmm, no sqlite3 with jython? am I missing it or is there a reason
[13:13] <jimbaker> supersven_, agreed about maven support & required work
[13:14] <jimbaker> topi`, so the problem is that we need a java version of sqlite3
[13:14] <supersven_> jim, did you get junit tests running in intellij?
[13:15] <topi`> jimbaker: so sqlite3 does have a module in C?
[13:15] <jimbaker> supersven_, i only run tests under ant
[13:15] <jimbaker> so i use intellij as an editor, no more
[13:16] <jimbaker> topi`, so the last time i looked, there was a very interesting compile pipeline that compiled sqlite3 (all C) to mips, then rewrote mips to java bytecode
[13:17] <jimbaker> so in general, i would would recommend something else
[13:17] <topi`> ouch
[13:17] * zz_whg is now known as whg
[13:17] <jimbaker> that already supports jdbc
[13:19] <supersven_> jimbaker, i'm currently fiddling around with directly calling ant tasks as 'run configurations' so that one can launch tests directly from intellij
[13:19] <topi`> there's org.xerial.sqlite-jdbc
[13:19] <jimbaker> topi`, yes, i'm thinking the same
[13:20] <topi`> jip [Finished] dependencies resolved
[13:20] <topi`> yay
[13:20] <jimbaker> supersven_, that sounds great
[13:20] <topi`> where does jip put the .jar?
[13:21] <topi`> I need to add that to my CLASSPATH
[13:21] <supersven_> i hope to shorten test cycles ... let's see how far i get ...
[13:21] <jimbaker> topi`, doesn't jip work with jython's sys.path support to dynamically manage?
[13:21] <jimbaker> i haven't used jip however
[13:22] <topi`> so how do you do it then?;)
[13:22] <jimbaker> but i would imagine the jar is placed under site-packages. pure speculation however
[13:22] <daenney> jip?
[13:22] <topi`> daenney: pip install jip :)
[13:22] <jimbaker> https://pypi.python.org/pypi/jip
[13:23] <topi`> only .eggs in my site-packages...
[13:23] <daenney> Ah
[13:23] <jimbaker> right, right, reminds me i need to push up my clean branch of pip
[13:23] <daenney> Yezzz, you di
[13:24] <daenney> uhg train wifi
[13:24] <jimbaker> as soon as i figure out how to make jython and cpython both happy with crazy unicode corner cases
[13:25] <jimbaker> i guess i could at least push it up so that it works for jython first???
[13:27] <daenney> topi`: pip install jip is pretty broken though :P
[13:34] <topi`> jimbaker: what's your remaining unicode problem?
[13:34] <topi`> I've got a long history in unicode wrestling with py2.x :)
[13:36] <jimbaker> daenney, i just pushed up this branch of pip, https://github.com/jimbaker/pip
[13:37] <jimbaker> doesn't work on cpython, because i need to come up with some scheme that allows for cpython to still work with unicode surrogate escapes, while not having them in jython
[13:38] <topi`> surrogate escapes, ouch
[13:38] <topi`> but there's always two forms of a given unicode char, the canonical form and the normal form
[13:41] <topi`> what's this error??
[13:41] <topi`> File "/home/topi/jython/Lib/socket.py", line 191, in handle_exception
[13:41] <topi`> raise _map_exception(jlx)
[13:41] <topi`> error: [Errno 104] Software caused connection abort
[13:41] <topi`> from my Django log.
[13:41] <topi`> it was running the wsgiref handler.py
[13:44] <jimbaker> topi`, do you have a full stacktrace that you can put in a gist?
[13:49] <topi`> just a traceback...
[13:49] <topi`> http://paste.pound-python.org/show/9EQVa7Jey8R2Rj7OwEff/
[14:04] <jimbaker> topi`, yeah, not terribly informative
[14:25] * enebo (~enebo@c-75-73-8-169.hsd1.mn.comcast.net) has joined #jython
[14:43] * nongeek (~mohsen@ has joined #jython
[14:46] * nongeek hello Folks
[14:46] <nongeek> anybody here for help?
[14:46] <agronholm> ask your questions here
[14:48] <nongeek> OK
[14:49] <nongeek> I know Scala will be replacing for Java, How about Jython?
[14:49] <agronholm> eh?
[14:49] <agronholm> where is scala replacing java?
[14:49] <nongeek> Scala user told it
[14:49] <agronholm> haha
[14:49] <nongeek> Is it wring?
[14:50] <agronholm> yes
[14:50] <agronholm> scala is an alternative, but hardly a replacement
[14:50] <agronholm> it's the same with jython
[14:50] <nongeek> Can you tell me about Jython? I know it is based on Java
[14:50] <agronholm> what do you know about jython?
[14:50] <nongeek> Can I execute my Python code with Jython?
[14:50] <agronholm> most of it, yes
[14:51] <nongeek> why most of and not all?
[14:51] <agronholm> as long as it doesn't use native functionality (C libraries)
[14:51] <agronholm> so anything is out that uses C extensions
[14:51] <nongeek> How about performance
[14:51] <nongeek> Did you test it?
[14:51] <agronholm> CPython is faster for virtually everything
[14:51] <nongeek> faster than Python?
[14:52] <agronholm> CPython is the mainline python
[14:52] <nongeek> I know Python developed by it
[14:52] <agronholm> ?
[14:52] <nongeek> Excuse me, Why you use Jython?
[14:52] <whg> The good news is that if you need threading, Jython has a much rosier outlook.
[14:52] <nongeek> and why a user must use it
[14:52] <agronholm> jython's only advantage is the lack of GIL so it can take advantage of multiple cores in threaded applications
[14:53] <agronholm> nongeek: it's mostly used when you already have to work in a java environment but want to code in python
[14:53] <nongeek> Can you show me a large application that written by it?
[14:53] <agronholm> written in it you mean
[14:53] <nongeek> all linux have Java
[14:53] <nongeek> yes
[14:53] <agronholm> I have one but it's not open source
[14:53] <nongeek> No problem please show me
[14:54] <agronholm> screenshots? or code? I can't show you the code
[14:54] <nongeek> Screenshot
[14:54] <nongeek> I want to see
[14:54] <agronholm> ok, let me find one or take one if I can't find
[14:55] <nongeek> Thank you
[14:55] <agronholm> http://paradoxx.nextday.fi/~alex/Etikettu.png <- a somewhat older screenshot with not as much jython integration as it has today
[14:57] <nongeek> Thank you
[14:57] <agronholm> I'm not sure how this is useful for you though
[14:57] <nongeek> Can I run Python tools like numpy with Jython?
[14:57] <agronholm> unfortunately not
[14:57] <agronholm> numpy makes heavy use of native C code
[14:57] <nongeek> I guess many Python tools not work with it
[14:58] <agronholm> but you can use any java libraries with it
[14:58] <nongeek> Numpy have any java replacement ?
[14:58] <agronholm> I haven't checked
[14:58] <nongeek> Can you take a score to Jython?
[14:59] <nongeek> from 1-100
[14:59] <agronholm> what am I supposed to compare it to?
[14:59] <agronholm> other implementations?
[15:00] <nongeek> With IronPython or Java
[15:00] <agronholm> I've never used ironpython
[15:00] <nongeek> Me too
[15:00] <nongeek> But I guess you know Java
[15:00] <agronholm> yes
[15:00] <nongeek> Compare it with Java or Python
[15:00] <agronholm> in what terms?
[15:01] <nongeek> Performance or useable
[15:01] <agronholm> jython loses in performance to both, especially plain java
[15:02] <agronholm> but python is much nicer than java as a language
[15:02] <nongeek> Thank you Sir
[15:02] <agronholm> java is archaic and clumsy
[15:02] <nongeek> Can you let me to send PM and ask some personal questions?
[15:02] <agronholm> ok
[15:17] * nongeek (~mohsen@ has left #jython
[16:09] * kral is now known as kral|off
[16:27] * lheuer1 (~Adium@f049109059.adsl.alicedsl.de) has joined #jython
[16:28] * lheuer1 (~Adium@f049109059.adsl.alicedsl.de) Quit (Client Quit)
[16:29] * lheuer (~Adium@unaffiliated/lheuer) Quit (Ping timeout: 245 seconds)
[16:35] * lheuer (~Adium@f049109059.adsl.alicedsl.de) has joined #jython
[16:35] * lheuer (~Adium@f049109059.adsl.alicedsl.de) Quit (Changing host)
[16:35] * lheuer (~Adium@unaffiliated/lheuer) has joined #jython
[18:25] <topi`> this is very very odd. I defined url = '/foo' as my first version of the HomeRedir class (that subclasses RedirectView) and now I changed it to something else and it STILL wants to redirect to /foo after Ctrl-c and restart!
[18:25] <topi`> grepping /foo from entire codebase produces nothing. so there must be some cache lying out there
[18:50] * purplefox (~purplefox@host-80-43-245-210.as13285.net) Quit (Ping timeout: 260 seconds)
[19:02] * purplefox (~purplefox@host-80-43-245-210.as13285.net) has joined #jython
[19:11] * purplefox (~purplefox@host-80-43-245-210.as13285.net) Quit (Ping timeout: 245 seconds)
[19:12] <daenney> I'm pretty sure the JVM does some fancy caching stuff but that ought to be cleared when you end its life
[19:17] <topi`> indeed. what about the 'cachedir' in jython.home?
[19:18] * bartelmess (~bartelmes@ has joined #jython
[19:33] <daenney> That only caches packages afaik
[19:34] <daenney> There hasn't been a Jython podcast in a very long time...
[19:38] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[19:39] <topi`> I think I now know. It is the browser which caches the page redirects!
[19:40] <topi`> if it's a permanent redirect, then the browser keeps it
[19:46] * purplefox (~purplefox@host-80-43-245-210.as13285.net) has joined #jython
[19:48] <daenney> jimbaker: So I took a sledgehammer to the script, decided to rewrite most of it. Got the symlink dereferencing working though :)
[19:48] <daenney> It tries to use realpath and gnu readlink if available, else falls backs on python
[19:48] <jimbaker> daenney, sounds awesome
[19:49] <daenney> I also fixed the detection of Java, the old script assumed if JAVA_HOME was set then it had java, might not be the case
[19:50] <daenney> Fixing a few other ways along the way. Oh also, it has some docs now :)
[19:57] <jimbaker> daenney, this is very good stuff, especially the docs part
[19:58] <jimbaker> i looked a bit more into supporting large collections of literals, so far it looks straightforward. should write some code for that now :)
[20:01] <daenney> Well you know how bash docs go, you just add comments :/
[20:02] <daenney> It's not like you can write a doc stanza specifying expected input, output, conditions etc
[20:03] <whg> daenney: Have you seen docco ?
[20:03] <whg> And, more relevant in this case, shocco?
[20:08] <daenney> whg: Yup but I don't really feel like writing that much prose to document a shell script
[20:09] * purplefox (~purplefox@host-80-43-245-210.as13285.net) Quit (Ping timeout: 245 seconds)
[20:09] <whg> daenney: I'm just saying, there *is* finally a way to embed documentation into your script and extract it back out
[20:10] <daenney> True :)
[20:11] <topi`> I did some experimenting with using Java libs vs. Python libs wrt maths. I wrote an is_prime() function, first using python's math and then Java math
[20:11] <topi`> the latter version was about 2x faster...
[20:11] <topi`> but still lagged slightly behind CPython
[20:12] <topi`> the prime number calc function is just stupid, and basically iterates through every odd number and tries to find out if its divisible
[20:13] <topi`> good fodder for benchmarking ;)
[20:18] <topi`> and, running under pypy, the same function is 10x faster than CPython :)
[20:21] <jimbaker> topi`, so you are call is_prime from python to java for each number?
[20:23] <jimbaker> calling
[20:23] <daenney> Don't forget to try Numpy too :)
[20:24] <topi`> this is the loop in is_prime():
[20:24] <topi`> sqrt_n = int(math.floor(math.sqrt(n)))
[20:24] <topi`> for i in range(3, sqrt_n + 1, 2):
[20:24] <topi`> if n % i == 0:
[20:24] <topi`> return False
[20:24] <topi`> the sqrt doesn't need much time to execute, it's the for loop
[20:24] <topi`> maybe I shold use xrange
[20:25] <topi`> if I try to calculate if a number of order 1e15 is a prime, it'll require a fairly big number of loops
[20:27] <topi`> sqrt(1e15) is ~1e8
[20:28] <jimbaker> topi`, yeah, we actually did some work to speed up some simple loops like this
[20:28] <jimbaker> this is the jython-pilot project that shashank worked on
[20:28] <topi`> so that for loop takes 10 million iterations
[20:28] <topi`> should I use xrange() instead?
[20:29] <jimbaker> xrange would help for a large number of iterations, since you don't have to compute that list
[20:29] <jimbaker> but in general, for i in xrange loops can be rewritten into java for loops by using invokedynamic's switchpoints
[20:29] <whg> Actually, were you benchmarking Python 3?
[20:30] <topi`> the execution time is around the same.
[20:30] <topi`> whg: no, python 2
[20:30] <whg> Because I thought CPython actually allocated and created the full list in Python 2
[20:30] <whg> With a number that big, I would have expected weird behavior
[20:30] <jimbaker> whg, range does allocate the full list
[20:30] <topi`> 10 mill list items is peanuts
[20:30] <jimbaker> sure, just extra overhead :)
[20:31] <whg> 1e15 is a whole lot more than 10 mil, right?
[20:31] <jimbaker> whg, slightly ;)
[20:31] <whg> that's the peta range
[20:31] <whg> So that much contiguous memory seems unlikely to be just hanging around for CPython :-)
[20:31] <whg> hence my confusion
[20:31] <topi`> whg: I was looping for the sqrt of that number, so 1e8
[20:31] <whg> Oh, must have misread that part
[20:32] <whg> Thanks
[20:32] <topi`> how much memory does a list of 10 mil integers take?
[20:32] <topi`> at minimum, 40 MBytes
[20:33] <jimbaker> topi`, so the underlying representation in jython for a list is an ArrayList
[20:34] <jimbaker> so 10M references, that's just 4 bytes or 8 bytes each, depending on 32 bit vs 64 bit
[20:34] <topi`> damn, defining this gets me OutOfMemoryError:
[20:34] <topi`> l=range(9000000)
[20:34] <agronholm> do you really need a range that large?
[20:34] <agronholm> would xrange not work?
[20:34] <topi`> I was testing it vis-a-vis xrange
[20:34] <agronholm> ok
[20:35] <jimbaker> plus each int is boxed in jython; forgetting the object header size but not insignificant
[20:35] <topi`> what does boxing mean?
[20:35] <jimbaker> boxing means that there's an object containing the primitive
[20:35] <topi`> right. well, in python, everything is basically boxed.
[20:35] <jimbaker> cpython does the same thing of course
[20:36] <jimbaker> you only see unboxed in say numpy or the array module
[20:36] <topi`> so this is one reason why jython is so much slower than java... all primitives need to be boxed
[20:36] <jimbaker> well, potentially
[20:37] <jimbaker> the jvm is very good about unboxing stuff in its JIT
[20:37] <topi`> hmm
[20:37] <topi`> would that also work with python types?
[20:37] <jimbaker> interestingly, part of that one vm to rull all vms talk is along these lines, to make that easy for dynamic langs like python on the jvm
[20:38] <jimbaker> basically complements invokedynamic very nicely
[20:38] <jimbaker> topi`, so i wanted to share one performance tip for you in terms of writing stuff in java to be used by python
[20:39] <topi`> jimbaker: still waiting for your writeup on ProxyMaker ;)
[20:39] <jimbaker> extend PyObject
[20:39] <topi`> I'll have a writeup on getting Django running under Tomcat :)
[20:39] <jimbaker> topi`, yes, very much on the list here!
[20:40] <topi`> and some rocks on the road... some bugs in django-jython package.
[20:40] <jimbaker> topi`, so i have a project registered for this purpose in pypi, https://pypi.python.org/pypi/expose/0.1
[20:40] <jimbaker> nothing there, just a stub, vapor ware
[20:41] <topi`> isn't expos?? an Apple-registered trademark?;)
[20:41] <jimbaker> but it should be straightforward to make the internal machinery of jython accessible
[20:41] <jimbaker> perhaps, but mine doesn't use the diacritical, so it's ok
[20:41] <topi`> :)
[20:43] <topi`> oh, and also, perhaps I should submit some patches to the twisted guys, since I got it running under Jython quite fine.
[20:43] <jimbaker> topi`, now you're talking!
[20:43] <topi`> by activating the PY3 codepath :)
[20:43] <jimbaker> i still want to add buffer support, but in due time
[20:43] <topi`> however, the mechanism of finding if os.name is 'java' didn't work
[20:44] <topi`> I need to re-inspect the issue, maybe it was my own screwup
[20:44] <jimbaker> isn't the key piece usually os._name ?
[20:44] <jimbaker> (the actual underlying platform)
[20:44] <topi`> yeah, but I wanted to find out whether running under jython or cpython
[20:45] <jimbaker> yeah, so os.name is reliable
[20:45] <jimbaker> having said that, preferred practice seems to be sys.platform.startswith("java")
[20:46] <topi`> yeah. that would otherwise give 'linux' or 'darwin' or whatnot
[20:47] <topi`> ok. Bedtime now.
[20:48] <jimbaker> topi`, ttyl
[20:48] <jimbaker> i will try to get out that post asap!
[20:49] * cameron__ (~thereisno@27-33-1-87.tpgi.com.au) has joined #jython
[20:51] * thereisnospoon_ (~thereisno@27-33-1-87.tpgi.com.au) Quit (Ping timeout: 268 seconds)
[21:05] * swingline (~swingline@cpe-98-144-23-210.wi.res.rr.com) has joined #jython
[21:08] <swingline> hello
[21:09] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Ping timeout: 264 seconds)
[21:09] <swingline> looking for some jython/swing gui help, anyone have experience in this area?
[21:13] * purplefox (~purplefox@host-80-43-245-210.as13285.net) has joined #jython
[21:21] <agronholm> yes
[21:22] <agronholm> swingline: just ask
[21:23] <swingline> how do I pass input from a textfield back to the main jython script?
[21:23] <agronholm> you could just access its .text property to get the text
[21:25] <swingline> ok... would this still work if the submit/OK button closed the GUI window?
[21:26] <agronholm> yes
[21:28] <swingline> ok, thanks. I'll give that a try.
[21:37] * whg is now known as zz_whg
[21:38] * purplefox (~purplefox@host-80-43-245-210.as13285.net) Quit (Ping timeout: 256 seconds)
[21:45] <swingline> the .text property works for me as part of a print command for my button click event, but not after (or do I need to reference it differently after f.dispose()?)
[21:48] <swingline> when I click OK, I want to bring the contents of XXX.text back to the jython program as the contents of a variable to do more processing with
[21:51] <swingline> here's the basic flow: init -> read sensor 1 -> if active, pop GUI to get address of device on that sensor -> bring address back to jython for later -> repeat for all sensors
[21:52] <agronholm> swingline: save it before you dispose of the window
[21:52] <agronholm> you didn't say you were doing that
[21:52] <swingline> sorry
[21:53] <swingline> save it as in assign it to a variable?
[21:53] <agronholm> right
[21:57] <swingline> great, that worked as part of the main script
[21:57] <swingline> now I need to move the wholr GUI generation into a def
[21:58] <swingline> or is a class better?
[21:58] <swingline> (I'm a perl guy at birth...)
[21:58] <swingline> trying to figure out the best way to make it modular and repeatable now...
[22:03] <agronholm> so how is it defined now?
[22:04] <swingline> right now, it is a single script that pops the GUI once and quits
[22:04] <agronholm> do you intend to execute that code more than once in the lifetime of the app?
[22:04] <swingline> yes
[22:05] <agronholm> then a def sounds like it
[22:05] <agronholm> can I see the code?
[22:06] <swingline> sure, but I am taking something that someone else had working and an trying to morph it into what I want...
[22:06] <swingline> it's been a long time since I've been on IRC... how is the best way to get you the code?
[22:07] <agronholm> use a pastebin service
[22:07] <agronholm> gist.github.com is among the best
[22:11] <swingline> this work?
[22:11] <swingline> https://gist.github.com/rblundon/8bf66f643f5d1c6e0fa0
[22:11] <agronholm> don't make it a habit to import java packages
[22:11] <agronholm> import classes instead
[22:11] <agronholm> from javax.swing import JFrame
[22:11] <agronholm> and so on
[22:12] <swingline> got it
[22:12] <agronholm> you can also do stuff like enterButton.enabled = True instead of setEnabled(True)
[22:13] <swingline> ok.. sounds like I should start from scratch maybe..
[22:13] <swingline> I need to step away for a bit, but I appreciate the help and I'll be back on later.
[22:13] <agronholm> you might want to subclass JFrame for this
[22:16] * enebo (~enebo@c-75-73-8-169.hsd1.mn.comcast.net) Quit (Quit: enebo)
[22:23] * bartelmess (~bartelmes@ Quit (Quit: Leaving...)
[23:55] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython


These logs were automatically created by JythonLogBot on irc.freenode.net using a slightly modified version of the Java IRC LogBot.