IRC Logs for #circuits Wednesday, 2013-08-07

*** mfdl has joined #circuits01:26
*** mfdl has quit IRC01:58
*** mfdl has joined #circuits02:01
*** mfdl has quit IRC02:02
*** mfdl has joined #circuits02:05
*** mfdl has quit IRC02:30
*** mfdl has joined #circuits02:31
jgiorgino one and nothing is fully secure, that is the only assumption that one can make02:33
*** mfdl has quit IRC02:34
jgiorgias my friend would put it life has few rules and computers have even fewer, to a programmer there are only three rules, 1) the data is always crap, 2) the user is always a moron and 3) nothing is ever private02:34
*** mfdl has joined #circuits02:41
*** mfdl has quit IRC05:56
*** sz0ka has joined #circuits08:50
sz0kaHey guys08:50
sz0kaerm I tried your example for circuits.web, but it seems to fail ..08:51
sz0kahttps://bitbucket.org/circuits/circuits/src/d79d16f63c8511a1087a3036e320c3905f7aa976/examples/web/basecontrollers.py?at=default08:51
sz0kaI', using the same sourcecode..08:51
sz0kaWhen I try to connect to http://127.0.0.1:7777/ (i set my server port to 7777, too) it just doesn't give me an answer - chrome says "the webpage isn't available"08:54
sz0kaokay now I managed to get a "Not Found" .. better than nothing09:07
ninkotechhi sz0ka09:58
ninkotechi will try that for you09:59
ninkotechsz0ka: you should connect to http://127.0.0.1:8000/10:01
ninkotechthat should work10:01
sz0kahey ninkotech, thanks for your response!10:19
sz0kaI got it working now10:19
sz0ka:)10:19
sz0kaBut I came across another issue, could you point me to a document which describes how to match a route like /foo/bar?10:20
sz0kawait I'll provide my not working sourcecode10:20
sz0kahttp://pastebin.com/QZQqeTUe10:21
sz0kathere it is10:21
prologichi sz0ka10:56
prologicwhat seems to be the problem?10:56
prologicsz0ka, to match /foo/bar10:57
prologicclass FOoBar(Controller):10:57
prologic   channel = "/foo/bar"10:57
prologic   ...10:57
prologicsz0ka, also I highly recommend you use the dev branch10:58
prologicas this is the upcoming circuits 2.210:58
ninkotechprologic: i spend few days having fun with pyfilesystem. wrote my first virtual filesystems, exposed them over fuse and ftp.. lots of fun11:03
ninkotechtoday my goal is to try to mix it with circuits11:03
ninkotechtest if they can be used together11:03
prologicshould be okay11:04
ninkotechi hope so :)11:04
ninkotechif yes, i am having my toolbox complete and will start using it11:04
prologiccircuits really is just a component architecture11:04
prologicwith a powerful message passing system11:04
prologiccool :)11:04
ninkotech... still not sure how to make it secure11:05
ninkotechprolly ssl will be best11:06
ninkotechbut message signing out of ssl might be sweet too11:06
ninkotechi will need to pass 10^6-10^7 messages daily11:07
ninkotechi do that now with celery...11:07
ninkotechso i need to keep connections open, as opening them is costly... or  use hashing (signing)11:08
ninkotechprologic: this library is really cool...  i never though writing my own filesystem will be so easy   https://code.google.com/p/pyfilesystem/source/checkout11:09
ninkotechstill i have a problem - how to write bugreports without having google account11:10
prologicheh11:11
ninkotechi will write a nice letter to developers... asking them to move out from that nsa memoryhole11:11
ninkotechmaintaining forks => not fun11:12
prologicheh11:14
ninkotechi had to fix few lines in source, also in proftpdlib (who is also on google)11:15
ninkotechdamn now i dont know how to contribute them11:15
sz0kaprologic: heh thank you, if found it. I like circuits, looks promising :D .. Do you have a couple of minutes for me?11:18
ninkotechsz0ka: he will go sleep soon, he is in australia (21:19 there)11:19
sz0kahehe germany here, so 1326; I've got a class, which refreshs itself every second after sleeping.. now i want it to rebuild with circuits..11:19
ninkotechcz :)11:20
ninkotechsz0ka: thats prolly bad idea11:20
sz0kaneighborhood huh :D?11:20
ninkotechuse events to push events11:20
ninkotechwaht do you refresh?11:20
sz0kasensordata11:20
sz0kafrom my cpu11:20
ninkotechaha11:20
sz0ka:D?11:20
ninkotechi mean, convert that to event, with timestamp11:21
ninkotechand let someone eat that event11:21
ninkotechs/eat/handle/11:21
sz0kahehe .. yeah but i need a trigger which refreshs the data every n seconds11:21
ninkotechseparate thread?11:22
sz0kai found Timer in circuits.core11:22
ninkotechha, so you are ahead of me, lol11:22
sz0kawhoop whoop11:22
ninkotechsz0ka: really install pip install  circuits==dev11:22
sz0kaninkotech: okay will do it right now11:22
ninkotechbest using virtualenv11:22
sz0ka(spawnSense)kq@lap627 ~/code/spawnSense % pip install circuits==dev11:23
sz0ka;D11:23
prologicsz0ka, I'm still here11:24
prologicI have quite a few mins :)11:24
prologicsz0ka, pip install of the dev branch doesn't work yet11:25
prologicnot until 2.2 is released :)11:25
prologicsorry :011:25
prologicbut11:25
sz0kaitt works for me O.o11:25
ninkotechsz0ka: sad, then download sources like i did (heh)  and do python setup.py install11:25
prologicpip install -e hg+https://bitbucket.org/circuits/circuits-dev#egg=circuits11:25
prologicshould work11:25
prologicoh really?11:25
prologichmm11:25
sz0kaw8 a sec11:25
ninkotechsz0ka: having hg clone of current dev is good idea anyway11:26
prologic$ python -c "import circuits; print circuits.__version__"11:26
prologic2.2.011:26
prologicdev branch should say this11:26
sz0kaokay i think I'll install it by git11:26
prologicI agree with ninkotech11:26
ninkotechits hg11:26
prologicwe tend to keep dev branch very stable11:26
prologicand well tested11:26
sz0kasays 2.1 ;D11:26
prologicsorry we use mercurial :/11:26
prologicpip install mercurial11:26
ninkotechsz0ka: ok, sorry for wrong tip... :)11:26
sz0kaprologic: heh okay11:26
prologichg clone https://bitbucket.org/circuits/circuits-dev11:27
prologiccd circuits-dev11:27
prologicpython setup.py develop11:27
ninkotechprologic: at least stable branch should be on github, really :)11:27
ninkotechits really great service for developers11:28
sz0kaokay 2.2 now11:28
prologicyeah but I like bitbucket11:28
prologicand prefer mercurial11:28
prologicI'd like to also have a git clone11:28
prologicbut I can't keep the two in sync11:28
ninkotechi can help you with that maybe11:28
prologicas the different git/hg repos will be different11:28
prologicwell11:28
ninkotechits not that big problem...11:28
prologicunless there's a way to keep the two in sync easily11:28
ninkotechits possible to sync11:29
prologicI'm sticking with bitbucket/mercurial11:29
prologic:)11:29
prologicI find git to be terrribly inconvenient to use11:29
prologicand unintuiative11:29
ninkotechyes, i felt the same way for almost a year11:29
ninkotechbut then it changed... it feels natural now11:29
ninkotechlol11:29
prologicI still feel that way even today11:29
prologicI did start out using git though11:29
sz0kaprologic: okay my understanding now is to create a class for my sensor, give it a channel name, write a "main" class which initializes the sensor object and timer11:29
sz0karegister the sensor on the timer events11:29
ninkotechprologic: very good git tool is tig11:29
sz0kaand i should get the data async, right?11:30
ninkotechncurses interface, fast, nice, easy11:30
ninkotechcolorfull11:30
prologicsz0ka, yeah sounds okay11:30
ninkotechtig really made a difference to me, i rarely use git commands today11:30
prologicso with circuits you have components11:30
prologicand events11:30
prologicand way to pass events/messages around11:30
sz0kaokay != good, what is the "best" way to go?11:30
sz0ka:D11:31
prologicit really depends what you want to do11:31
prologicthere is no right way :)11:31
prologicbut the right way in circuits is to use components and events11:31
ninkotechprologic: he wants to take snapshot of some stats every x seconds11:31
prologicand to separate out logical bits of functionality into small componnets11:31
prologicand keep things loosely coupled11:31
prologicyeah so Timer is good here11:31
ninkotechprologic: i will need this too... :) looking at Timer  class11:32
prologicget it to fire a specific event every x seconds11:32
prologichttps://bitbucket.org/prologic/irclogger does this11:32
prologicit fires an event every 24hrs to rotate log files11:32
prologicit actually fires an event called RotateLogs every 24hrs11:32
prologicor specifically at 00:00 every day11:32
ninkotechnice example... also there is example in examples/timers.py11:34
sz0kaprologic: okay cool, I'll try to get it working :D11:35
sz0kaerm.. how do i fire an event? with self.fireEvent()?11:35
prologicyes11:35
prologicor self.fire for short11:36
prologicso there are two main ways to pass events araround11:36
prologicself.fire11:36
prologicor self.call11:36
sz0kaokay11:36
prologiccall/wait are for synchronous flow control11:36
prologicbut it's still asynchornous underneath11:36
sz0ka:>11:36
sz0kathis11:36
sz0kais11:36
prologicbut in most cases you just want to fire and forget11:36
sz0kaawesome11:36
prologicso self.fire(event, *channels)11:37
sz0kano, for http longpolling i need call :D11:37
prologicalso you do get back a value/promise11:37
prologicin case you need it11:37
sz0kaniceeee!11:37
prologicwell11:37
prologiccircuits.web has a websockets dispatcher11:37
sz0kathis is also nice, but i want to implement "real" longpolling and have no idea of websockets11:38
ninkotechwebsockets dispatcher? please talk about it a bit11:38
ninkotechsz0ka: imho its the transparent way for delivering events, right prologic?11:38
ninkotechor i am not sure what are you talkign about11:39
prologicwell you can do long polling11:39
ninkotechaha, url -> channel dispatcher11:39
prologicit's no problems11:40
prologicjust keep the request open11:40
prologiciirc set response.stream to True11:40
prologicand it won't close11:40
prologicwe had a demo of comet-style long polling once11:40
prologicbut it got a bit ugly :)11:40
prologicoh wait11:41
prologicit's still there11:41
prologicexamples/web/terminal/11:41
sz0kaerm the event i want to fire.. has to be derieved from circuits.Event?11:41
prologicninkotech, yes11:41
prologiccircuits.web maps urls to channels11:41
prologicand why not11:41
prologicuse what youv'e built11:41
prologicthat's why circutis.web - although quite feature rich11:41
prologicis quite a small code base11:41
ninkotechok.  i just was not sure what you mean by 'websocket dispatcher'11:42
prologicsz0ka, correct11:42
ninkotechis it that one?11:42
prologicclass Foo(Event):11:42
prologic    ...11:42
prologicmostly for documentation and naming purposes11:42
sz0kaokay so i could fire an empty class, too? :)11:42
prologicand they typically just take any *args and **kwargs11:42
ninkotechsz0ka: yes11:42
prologicbut you could do other fancy things if you want11:42
sz0kayou really got to write a tutorial xD11:42
ninkotechprologic: btw firing events with parameters is not included in examples11:43
ninkotech(much)11:43
sz0kaor is there an example which shows this?11:43
prologicninkotech, circuits/web/dispatchers/websockets.py11:43
prologicsz0ka, there is a tutorial11:43
prologichttp://circuits-dev.readthedocs.org/en/latest/tutorial/index.html11:44
prologicyes you could fire an empty class11:44
prologicor do something like11:44
prologicself.fire(Event.create("Foo"))11:44
sz0kagreat :D11:44
prologican an event handler like this would handle that:11:44
prologic@handler("foo")11:44
prologicdef _on_foo(self):11:44
prologic   ...11:44
prologicNB: no arguments or kwargs11:45
sz0kacircuits is awesome11:45
prologicbecause no data passed to the event11:45
prologicglad you like it11:45
prologicnext year is our 10th year of development11:45
sz0kaWHAT?11:45
sz0kaI thought it'd be.. not older than two years11:46
sz0kagoogle doesn't seems to know much about you.11:46
prologicheh11:47
prologicthere are very good reasons for that11:47
ninkotechgood!11:47
ninkotechlol11:47
prologica) most folks use Twisted for anything python and async11:47
prologicb) I'm not that good at marketting :)11:47
ninkotechi dont like twisted style11:47
prologicbut yes11:47
sz0kaprologic: You need me!11:47
sz0kaxD11:47
ninkotechits twisted, really11:47
prologiccircuits started out it's live in 200411:47
sz0kaI'm something like the hipster on libs11:48
ninkotechc) you need better tutorials/examples11:48
prologicheh11:48
sz0kaeveryone asks me "hey kai, what should i use for.."11:48
prologicdespite saying all that though11:48
ninkotechwith more explicit instead of implicit behaviour11:48
prologiccircuits is used by quite a number of projects and organizations11:48
prologiceven MIT Media Labs at one point11:48
sz0ka:O!11:48
sz0kafantastic!11:48
prologicyes on the explicit vs. implicit11:48
prologicremember that in circuits implictness is only there for convenience11:49
ninkotechi really liked gevent.... also libuv might be useful... but circuits look more natural and pythonic, conceptual11:49
prologicI showed @handler("foo") earlier11:49
prologicbut you could do:11:49
prologicclass App(Component):11:49
prologic   def foo(self):11:49
prologic      ...11:49
prologic@handler is the more explicit way11:49
ninkotechprologic: those implicit handlers made my head hurt lol11:49
prologicand allows you to do other fancy things you can't normally do11:49
prologicnot when you understand that it's only for convenience11:49
ninkotechi will help you write more examples if i will have time11:49
prologicin the simplest case11:49
prologicthere is also convenience around component registration11:50
prologiceg:11:50
ninkotechits convenient for you, but newbies are confused11:50
sz0kacircuits is btw great in combination with hy ;D11:50
prologictwo components Foo and Bar (for example)11:50
prologicyou can do11:50
prologic(Foo() + Bar()).run()11:50
ninkotechhy?11:50
prologicor more explicitly11:50
prologicfoo = Foo()11:50
prologicBar().register(foo)11:50
prologicfoo.run()11:50
prologicthose are really the only two places of implictness and convenience in circuits11:51
ninkotechomg lisp!11:51
prologicmany in the python community have questioned this11:51
prologicbut it's only conveinence11:51
ninkotechprologic: imho, in examples, you should not use implicit at all11:51
prologicgevent unfortunately patches things11:52
prologicI don't like that approach11:52
prologicalways run into problems doing that11:52
ninkotechi know what you mean11:52
prologicninkotech, in most examples I don't11:52
prologicI made sure in dev branch to rewrite all the examples11:52
prologicto use explicit API(s)11:52
prologicand to document (docstrings) and comment a lot of the examples11:52
prologicI haven't finished all examples yet11:53
ninkotechi will make merge request when i will find some, lol11:53
prologicbut getting there11:53
ninkotechmore heavy comments would also rock (describing why it should be done this way)11:53
ninkotechi mean, in examples11:53
prologichmm11:54
prologicok :)11:54
ninkotechexamples and test cases are very important, as they give idea about possible use cases11:54
prologicI thought I'd done a good job already in improving the examples in the dev branch :011:54
prologicbut maybe not11:54
sz0kaAttributeError: 'Trigger' object has no attribute 'root'11:54
sz0kahuh?11:54
ninkotechyou sure did,... but the work never ends11:54
ninkotechheh11:54
prologicsz0ka, paste your code somewhere11:54
prologicsmells of component not being regsitered11:55
sz0kaOh!11:55
sz0kaheh11:55
prologicninkotech, test cases?11:55
sz0kathis is possible!11:55
prologicthere are over 200 unit tests11:55
ninkotechyes, i often look into unit tests to see what is the library good for11:55
ninkotechoften the project doesnt state it on web11:55
sz0kaprologic: so I have to register my sensor to the timer, correct?11:56
ninkotechthey only say:11:56
ninkotechour PNRI4-NHU is great library!11:56
ninkotech50% of libraries do!11:56
ninkotechthey dont even tell what they are for!11:56
prologicsz0ka, you have to regsiter it somewhere11:56
prologicand then run the component graph11:57
prologici.e: some top level component11:57
prologicso something like11:57
ninkotech(Its getting better those days, but still its hard to see what much of software is good for)11:57
prologic(Sensor() + Timer()).run()11:57
sz0kahttp://pastebin.com/nQE88m4e11:59
sz0kaAttributeError: 'Sensor' object has no attribute '_executing_thread'11:59
prologiclemme have a look11:59
ninkotechprologic: you didnt really explain what this (some+some).run() does.   it its 'obvious' (~implicit) again11:59
prologicok12:00
prologictwo simple mistakes there12:00
sz0kaheh chacka!12:00
prologicTimer is not registered anywhere12:00
prologicand in Sensor12:00
prologicyou did not call super(Sensor, self).__init__()12:00
prologicyou broke the component creation there12:00
prologichence the AttributeError12:00
ninkotechsuch principles should be taken time to document well... :)12:01
sz0kabut where to i have to register the Trigger?12:01
prologicninkotech, it's implicit only12:01
ninkotecheven i am sometimes confused a lot12:01
prologicreally I expect experts in circuits to use it only12:01
prologiconce they're used to it12:01
prologicand type .register() a lot12:01
ninkotechsz0ka: use + Debugger too12:01
prologicso12:01
prologicfoo + bar12:01
prologicis identical to12:01
prologicbar().register(foo)12:02
ninkotechmagic :)12:02
prologicindeed12:02
prologicbut not really12:02
ninkotechthats what pythonistas do not like much :)12:02
ninkotech(magic)12:02
prologiclook at __add__ in circuits.core.components.BaseComponent12:02
ninkotechother that than, circuits are realyl sweet12:02
prologicyes12:02
prologicbut it's not magic :)12:02
prologicit's a simple one liner12:03
ninkotechits even cool12:03
prologicand I will not remove it either :)12:03
prologicit's just too convenient :)12:03
ninkotechbut it feels magical12:03
prologicbut it's really not :)12:03
prologicconsider this12:03
ninkotech(dont even try to understand this, just type (xxxx+xxx).run()12:03
ninkotech)12:03
prologic(A() + B() + C()).run()12:03
prologicand the identical explicit code12:03
prologica = A()12:04
prologicb = B()12:04
prologicc = C()12:04
prologicc.register(b)12:04
prologicb.register(a)12:04
prologica.run()12:04
prologicsee why the convenience is there now? :)12:04
ninkotechprologic: if you would wrote the explicit code into docs (even in comments). i would not be confused that much12:04
ninkotechinto examples*   i meant12:04
ninkotechbut docs would really like it too12:04
prologicahh okay12:05
prologicI do use it in examples12:05
prologicok12:05
prologicnote to self12:05
ninkotech:)12:05
prologicI'll replace with explicit calls12:05
prologicthanks :)12:05
sz0kaprologic: huhm okay i added the debugger12:05
ninkotechno need to really replace if you comment it12:05
ninkotech# this equals to: ......12:06
prologicno I will replace it :)12:06
prologiclike I said it's convenience only12:06
prologicsimple one liner convenience in the code base12:06
prologicso once you've used circuits for a while12:06
prologicyou might ask12:06
prologicI'm tired of doing12:06
prologicfoo.register() all the time12:06
sz0kabut the timer doesn't work.. you said I have to put those in a "root" component?12:06
prologicand I'll say just add them together :)12:06
prologicsz0ka, from your paste you did not register the Timer12:07
prologicdo something like12:07
prologicTimer(...).register(self)12:07
prologicand maybe pass persist=True if you want it to refire every x seconds12:07
sz0kaprologic: nice ty :D12:07
sz0kaDAMN IT WORKS!12:08
sz0ka:OOOOO12:08
sz0kathank you :D12:08
ninkotechsz0ka: can u paste the code again?12:09
ninkotechso i can look?12:09
prologicwell of course it works :)12:09
ircnotifier549ac2b72c9d by prologic: Use explicit API(s) for examples12:09
sz0kaninkotech: sure12:10
sz0kabut it is buggy i think12:10
sz0kait doubles the output12:10
sz0ka{'timestamp': 1375877418.877721, 'sensors': {'Core_0': 33.0, 'Core_1': 41.0}}12:10
sz0ka{'timestamp': 1375877418.879601, 'sensors': {'Core_0': 33.0, 'Core_1': 41.0}}12:10
sz0ka<sensordata_refreshed[*.sensordata_refreshed] ( )>12:10
sz0ka<sensordata_refreshed[*.sensordata_refreshed] ( )>12:10
sz0kabut not really ._12:10
sz0ka.12:10
sz0kahttp://pastebin.com/ntMEkHfy12:11
ircnotifier8951214c4845 by prologic: Help explain stdout = stdout in cat example12:11
prologicit doubles the output12:12
prologicbecause you have two Sensor(s) in the system12:12
prologicyou register Sensor to Triger12:12
sz0ka._.12:12
sz0kaOKAY!12:12
prologicand then you configure Trigger() + Sensor()12:12
prologicand run that12:12
sz0kaso i have to unregister it in ()12:12
prologicno12:12
prologicjust do12:12
prologicTrigger().run()12:12
prologicsince you already register a Sensor to Trigger12:12
prologicbtw - more debugging tools12:13
prologicfrom circuits.tools import inspect, graph12:13
sz0kaOKay now it works12:13
prologicthey both take a root (top level) component12:13
prologicinspect prints all event handlers the system knows about, etc12:13
prologicand graph displays an asci representation of the system12:13
prologicand if you have pydot installed12:13
prologicoutputs a visual represenation as well12:13
prologicfor example12:14
ninkotechah, pydot...12:14
sz0kaprologic: this is so great!12:14
sz0kaOMFG looking forward to the weekend to get into circuits12:14
prologichttp://shortcircuit.net.au/~prologic/tmp/Manager.png12:14
sz0kadafuq, never thought there'd be something like this out the wild12:14
sz0kaTHANK YOU!12:14
prologicthis is the component graph of my wiki12:14
prologicthat powers all my webstie12:14
prologichttps://sahriswiki.org/12:14
sz0kahonestly, you can't imagine how thankfull i am12:14
prologicheh :)12:15
sz0kaprologic: page unavailable12:15
prologicit's only an architecutre library12:15
prologicwith power message passing12:15
ninkotechonly http12:15
prologicno big deal :)12:15
prologicoh yeah try http12:15
prologicI don't have ssl on that12:15
sz0kak cool :D12:16
sz0kaokay I'll now start rebuilding my webapp12:16
sz0kawith circuits12:16
prologichaha12:16
prologiccircuits.web is quite nice12:16
prologiclots of users like it12:16
sz0kai'll send you the bitbucket uri to clone later!12:16
prologiclike jgiorgi12:16
ninkotechwhat did you use before?12:16
prologicwho writes all kinds of web apps for customers in circutis.web12:17
ninkotechi am normally using pyramid and cherrypy :)12:17
prologicI used to use cherrypy a long time ago12:17
sz0kabottle + gevent but i don't wanted to use sleep (monkeypatched or from gevent)12:17
prologicsome circuits.web inspiration came from there12:17
sz0kayeah i used pyramid in a project too12:17
ninkotechyear ago i was looking for servers able to accept large file12:17
sz0kaI never touched cherrypy12:18
ninkotechby HTTP POST12:18
ninkotechmany do12:18
ninkotechlarge = 100MB12:18
prologiccircuits.web can12:18
ninkotechsome do large = up to 2GB12:18
ninkotechbut i needed large = 10GB (when ram is 1 GB)12:18
prologic*nods*12:18
ninkotechi got so angry i almost jumped to javascript12:18
ninkotechlol12:18
prologichaha12:18
ninkotechonly cherrypy supported full http1.112:19
ninkotechand was able to get those files12:19
ninkotechbut i made it switch to PUT -> less problems, no parsing of the file12:19
ninkotechwith circuit i will first stream the file to another server... where it will be buffered and copied to multiple servers...12:21
ninkotechi think it will be easy.... i will prolly use ~ 100KB-5MB  chunks12:23
prologicshould be12:23
prologicwhat I want to do as well12:24
prologicis improve the circuits.io.File component12:24
prologicuse libaio if available12:24
ninkotech??12:24
prologicand threads if not12:24
prologicI think12:24
ninkotechwhat i need to write is 'RemoteFile' class12:25
ninkotechwhich will be file like object12:25
ninkotechbut will open/read/write   data on multiple remote servers12:25
ninkotechincluding seek/tell etc12:25
prologicsure12:26
prologicsounds good12:26
ninkotechi hope to put all logic into circuits so i will not need any other kind of rpc calling12:27
ninkotechi will contribute parts of my code if possible12:28
prologicthat would be good :)12:30
prologicimprovments always welcome!12:30
ninkotechbtw was you paid for developing circuits some $$ ?12:38
ninkotechwere* lol my engrish :)12:39
ninkotechprologic: there is some python libaio  library?12:40
sz0kaprologic: heh okay another question: I've got an api call (JSONController) on /sensors/stream12:41
sz0kathis should return { .. sensordata .. } on sensordata_refreshed event12:41
sz0ka(to the client)12:41
sz0kahow would i do this with circuits?12:42
sz0ka(and how can i send data via the eventsystem, i think you mentioned it befor but can't find it in the backlog)12:42
ninkotechrpc call = firing remote event12:42
prologicwell12:43
prologicput in a circuits.web Server12:43
prologicand use JSONController subclasses12:43
prologicwith appropriate channels for your desired url12:44
prologicin the controller request handler(s)12:44
prologicyou'll want to do something like12:44
prologicx = yield self.call(Blah())12:44
prologicyield x12:44
prologici.e: in case it takes some time to compute whatever blah is handling12:45
prologicbut I see you have another problem though12:45
prologicif you're getting sensor data by polling something12:45
prologicyou should store this somewhere12:45
prologicso a web interface can retrieve it12:45
ninkotechprologic: if i need to run web on port 80 as a 'web' user,  how?12:45
sz0kaprologic: i thought i'd do something like waitForRefreshEvent(); yield12:47
prologicrun as root :)12:47
prologicI have plans to build a DropPriveleges component12:47
sz0kaninkotech: or add yourself to www group12:47
prologicprobably into the circuits.app namespace12:47
ninkotechdropping root would be nice to have feature12:47
sz0kaI think this should also work12:47
prologicnormally in my use cases12:47
ninkotechsz0ka: hmm, i doubt that :)12:47
prologicI reverse proxy to circuits.web12:47
prologicusing lighttpd12:47
prologicor apache, etc12:47
ninkotechprologic: i  know, did that12:47
ninkotecheven 20 years ago, lol12:47
ninkotechbtw use nginx, its best one12:48
ninkotechfor reverse prox12:48
prologicI use lighttpd myself12:48
prologic:)12:48
prologicsz0ka, hmm12:48
prologicthing is circuits isn't going to help you much further here :)12:48
prologicyou're getting into your app design issues12:48
prologicso you have to work out what you want to happen :)12:48
sz0kaheh okay12:49
prologicI recommend you play around with circuits.web a bit12:49
prologicand see what it's like12:49
prologicon one hand you have a timer and sensor12:49
prologicthat continually ties to refresh some data about some sensor12:50
prologicand on the other hand12:50
prologicyou wanta  web interface12:50
prologicthat's a request/response model12:50
prologicso how you combine those is up to you :)12:50
sz0kaprologic: i thought i could do something like waiting for the sensor refresh and than while True: yield self.waitEvent(Event.creater("sensordata_refreshed"))12:51
sz0kaand send the data in the event12:51
prologicsure12:51
prologicno reason why not12:52
sz0kaokay cool12:52
prologicso the basic flow with event waiting is this:12:52
prologicx = self.fire(Foo())12:52
prologicyield self.wait("foo")12:52
prologicyield12:52
prologicor12:52
prologicx = yield self.call(Foo())12:52
prologicyield x12:52
prologicsee examples/primitives/12:53
prologicuse the Debugger lots :)12:53
prologicit'll help you see the event flows12:53
prologicand what's going on when12:53
sz0kaokay that's cool!12:53
sz0kaso foo would be what in my case?12:54
prologicso you can wait for an event by name12:55
prologicmatched by the class (lower case)12:55
prologicor by instnace12:55
prologice.g:12:55
prologice = Foo()12:55
prologicx = self.fire(e)12:55
prologicyield self.wait(e)12:55
prologicyield12:55
sz0kawhy double yield?12:55
prologicI mean12:56
prologicyield x12:56
prologicsorry :)12:56
sz0kaoh ok :D12:56
prologicin case you want to finally return that to some other handler12:56
prologiclet me know if you find any issues with call/wait too12:57
prologicas they're kinda new to circuits12:57
prologicalso you may want to look into writing an event source12:58
prologiclook at circuits/core/pollers.py12:58
prologiccircuits/core/timers.py12:58
sz0kanice :D!!12:58
sz0kathanks again!12:58
prologicand look for "generate_events"12:58
prologicthe core of circuits (whatever is runnning) fires a GenerateEvents every cycle12:59
prologicbasically asking the system of components the question12:59
prologic"who's got new events to generate?"12:59
prologicall the pollers work this way12:59
prologicas do the Timer12:59
prologichttp://codepad.org/SqRw3tNL13:00
prologicthis is how you'd integerate 3rd party event sources into circuits13:00
prologicinotify, gtk, qt, pygame, etc, etc13:00
prologicwhatever you want really13:00
prologicjust be sure not to block :)13:00
prologici inotify (circuits.io.inotify)'s case13:01
prologiccircuits sets up inotify and runs the inotify manager in a thread13:01
prologicand pumps events into circuits when it gets them from the inotify system13:01
ninkotechprologic:  how would file.File  work when used remotely?13:01
prologicnot sure :)13:01
ninkotechis that even possible?13:02
prologiclet me know!13:02
prologicnever tried myself13:02
ninkotechi will...13:02
prologicwell it opens file descriptors on the local side13:02
prologicso yeah not sure13:02
prologicmaybe subclass it13:02
ninkotechi need to virtualize this :)13:02
prologicand override some of it's handlers13:02
prologicso you can do something like13:02
ninkotechand make it work over network13:02
ninkotechthen make it raid like13:02
prologicremote_file = RemoteFile("sftp://user@host/path/to/file")13:03
prologicand still get all the same events13:03
prologicdunno13:03
prologicyou can wrap nearly anything you wnat in a Component13:03
ninkotechwhat if that file is 60 GB and you have ram 600MB ?13:03
prologiccircuits doesn't read the entire file into memory13:03
prologicit streams it13:03
prologicyou get Read events13:04
prologicand finally an EOF event13:04
ninkotechRemoteFile ?13:04
prologicif you coded that up the way I think13:04
prologicyou'd get the same13:04
ninkotechcant find it13:04
prologicyou'd just pass the events over circuits.node connections or something13:04
prologicno13:04
prologicyou're coding up RemoteFile :)13:04
ninkotech??13:04
prologichaha13:04
prologicit doesn't exist yet :)13:04
prologicyou're the one that wants it :)13:05
prologiclol13:05
ninkotechahh, you joker13:05
prologichaha13:05
prologicsorry13:05
ninkotech:D13:05
prologicmaybe you can make RemoteFile wrap pyfilesystem13:05
ninkotechyes, ic now13:05
prologicor some library13:05
ninkotechmy files will be virtual. they will be splitted into parts on different servers on different geolocations13:05
prologica good place to contribute things like this too btw13:05
prologicis circuits.contrib13:06
prologicbecause circuits itself depends on no external libraries to function13:06
ninkotechic13:06
prologicit's there so users can contribute freely13:06
prologicexperiment and share13:06
ninkotech:)13:06
prologichttps://bitbucket.org/circuits/13:07
ninkotechi would rather get some remote file without external deps into core13:07
prologicyeah it's definately possible13:07
prologicif you built it atop circuits.node13:07
prologicit would be really easy13:07
prologicbut I'd still like to greatly improve circuits.node though13:07
ninkotechso you could open it and use it as local file13:07
prologicbetter transports, serialization , etc13:08
prologicexactly :)13:08
ninkotechyes i will try...13:08
prologicand it would be something like13:08
prologicRemoteFile("some_node://path/to/file.txt")13:08
prologicwhere some_node is an identifer to a remote node13:08
prologiccoudl be as simple as that13:08
prologicmaybe13:08
prologicI wish I had more time :(13:09
prologicwork, family, etc13:09
ninkotechi might need to improve node13:09
ninkotechto have pool of connections13:09
prologic*nods*13:09
ninkotechclosed if they exceed 100013:09
ninkotechor something like that13:09
prologicmake that configurable :)13:09
prologicsounds good13:09
ninkotechas i plan to have as many nodes13:09
prologicI'm open to any and all improvements to circuits.node13:10
prologicudp, unix and zmq transports would be nice13:10
ninkotechyes, but first i need to access remote files... i can handle 200 connections i have right now13:10
ninkotech:D13:10
prologicas well as pickle, bson and msgpack serialzations13:10
prologicbut in a way that we can just13:11
prologicplug them in easily13:11
prologicwithout too much bioler plate13:11
ninkotechyou just need to let user subclass    load(s) and dump(s)13:11
ninkotechs/subclass/implement13:11
ninkotechits hot here13:12
prologicyeah13:12
prologicyeah I should get to bed13:12
prologicsz0ka, good luck :)13:12
ninkotechgood night13:12
prologicand welcome to circuits13:12
prologic:)13:12
prologicI'm always around so just ask away13:12
prologicjgiorgi is also pretty good with circuits13:12
prologicand ninkotech is fast learner :)13:12
ninkotechhehe13:12
prologicsz0ka, btw in case docs aren't clear on this13:13
prologicchannels separate components from each other13:13
prologicso if you have two components that listen to the same event13:13
prologicthey can do so independently13:13
prologici.e: running two irc bots in a single process is possible13:13
ninkotechif they are on the same channel, will both get it?13:14
prologicbecause one entire graph (group of components) uses channel "bot1" (example)13:14
prologicand the other group uses "bot2"13:14
prologicninkotech, yes13:14
prologic:)13:14
ninkotechso, its kind of 'bus'13:14
ninkotechfor me13:14
prologicas sz0ka found out when he had two instnaces of the same component in the system13:14
prologicand saw double output :)13:14
prologic*nods*13:14
ninkotechah, right13:14
prologicsepration of concerns13:14
prologicbus13:14
prologicwhatever :)13:14
prologicwe decided on "channel"13:15
ninkotechgn8, you need to rest13:15
prologicyes13:15
prologicgn8 :)13:15
ninkotechdont worry we will survive13:15
ninkotech:D13:15
prologichehe13:15
ninkotechprologic:  this could be used to maintain github page without much work:   http://hg-git.github.io/13:26
ninkotech# on debian:   apt-get install mercurial-git13:27
ircnotifierdf5ccb5bb251 by prologic: Remove unncessary extra parens13:29
ircnotifier9ebd36887730 by prologic: Let's not use a functional style to register components. Confusing :)13:29
ircnotifier314af1201e97 by prologic: Use explicit registration in examples13:29
ircnotifier6576acc558d6 by prologic: Help explain why the EchoServer example is so simple13:29
prologicninkotech, I already use this to track and contribute to git repos at work13:29
prologicand others13:29
prologic-but- if I create a git repo of circuits now13:29
prologicit wil be hard to keep them in sync13:29
prologichggit does not help afaik with keeping a clone of a mercurial repo in git13:30
prologicand vice versa13:30
prologicnot sure13:30
prologicif you find a way though - let me know13:30
prologicif it's possible13:30
sz0kaprologic: gn8 and thank you :D13:30
prologicI'd like it to be as simple as13:30
prologiccd circuits-dev13:30
prologichg pull github13:30
prologicand not have to mess about doing manual cherry picking and patching13:31
prologicanyway yeah13:31
prologicgn8 :)13:31
sz0kaman i hate json xD13:31
sz0kawhere does this exception comes from13:31
sz0kaTHERE IS NO GENERATOR FOR YOU!13:31
sz0kaxD damn13:31
sz0kaprologic: I did .call and returned the result which should be sent as the response event but instead of success I get a type error13:32
ninkotechsz0ka: paste?13:33
sz0kaninkotech: kay w8 :D13:34
sz0kahttp://pastebin.com/gramiNnK13:35
sz0kahttp://pastebin.com/PCWG2hKg13:35
ninkotechsorry for lag, i was OOM14:00
ninkotechi dont really know, sz0ka, sorry14:03
ninkotechits too hot here, i will need to buy some ice14:04
ninkotech3 tons would be enough14:04
jgiorgimy name was mentioned lol14:09
ninkotechyes :)14:13
ninkotechif you can help sz0ka, please try14:13
sz0kaninkotech: heh no problem, we had the 'summerthing' yesterday but now it rained and works for me :>14:21
*** mfdl has joined #circuits14:21
sz0kajgiorgi: yeah i heard you are good in circuits.web, it'd be nice if you'd help me out14:21
sz0ka15:42 <+sz0ka> http://pastebin.com/gramiNnK14:21
sz0ka15:42 <+sz0ka> http://pastebin.com/PCWG2hKg14:21
sz0kait says, that it can't serialize the json14:22
sz0kabut i don't know whx14:22
sz0ka*why ._.14:22
ninkotechbrb14:23
*** 18WAEBZ74 has joined #circuits14:26
*** mfdl has quit IRC14:30
*** mfdl has joined #circuits14:31
*** mfdl has quit IRC14:37
sz0kahttp://programming-motherfucker.com/15:57
sz0ka;D15:57
*** 18WAEBZ74 has quit IRC16:37
*** Osso has joined #circuits21:36
*** Osso has quit IRC22:07
prologicsz0ka:  your pastes have been removed23:39
prologicpaste your code I'll have a look23:39
prologicWhat's the exception and traceback?23:39
prologicpaste that too23:39

Generated by irclog2html.py 2.11.0 by Marius Gedminas - find it at mg.pov.lt!