IRC Logs for #circuits Saturday, 2013-08-17

*** tokyopancake has joined #circuits11:52
tokyopancakehi11:53
tokyopancakeanyone around?11:53
tokyopancakeI'm new here, and to circuits.11:55
tokyopancakeI'm stuck on a few concepts, if anyone could help me?11:55
prologicSure11:57
prologicwe're around11:57
prologichopefully you're talking about circuits the python framework though :)11:57
tokyopancakelol, what do people confuse it with?11:57
prologicelectronic circuits11:57
prologic:)11:57
prologiccircuits baords11:57
tokyopancakeah, make sense:)11:57
prologicwe get those sorts of questions every now and again11:58
prologiceven though there's an #electronics channels11:58
prologic:)11:58
prologicanway11:58
prologicI'm James11:58
prologichow can I help you?11:58
tokyopancakeHi james, I'm jeroen11:58
tokyopancakeso, I've deployed a linode with Nginx and uwsgi, with circuits11:58
tokyopancakeand I've got something running, through a tutorial11:58
prologicoh yes11:58
prologicby Karl Blessing no doubt11:59
prologic:)11:59
prologicI knew/know him11:59
tokyopancakeit seems really cool, and I like how the events are handled with the query's etc.11:59
tokyopancakelet me check..11:59
tokyopancakehttp://kbeezie.com/?11:59
prologicyeap11:59
prologicthat's him :)11:59
prologichonestly though11:59
tokyopancakeyeah thats a great tutorial11:59
prologicI would proxy it with nginx11:59
prologicrather than use uwsgi11:59
tokyopancakeman, uwsgi was doing my head in11:59
prologicmainly because circuits is an event driven system11:59
prologicand everything is async11:59
prologicso you loose all the benefits if you do wsgi with circuits.web11:59
tokyopancakehmm12:00
tokyopancakeyou have to be quite slow with me12:00
prologiclike for example12:00
prologicyour app can no longer participate in timers12:00
prologicor connections to other things via sync sockets12:00
prologicetc etc12:00
tokyopancakehmm12:00
prologicbecause wsgi forces circuits.web to run in a single cycle per request12:00
prologicessentialyl running the entire system once per request coming in from apache/nginx12:00
prologicetc12:00
tokyopancakeright12:00
prologicso it doesn't stay up and running like it would if you proxied12:00
tokyopancakeso it's inefficient?12:00
prologicwell not inefficient per say12:01
prologicbut you loose the benefits12:01
tokyopancakeso how would I go about setting it up without uwsgi?12:01
prologicbetter ihmo to proxy to a running circuits.web backend12:01
prologic(not using circuits.web.wsgi.Application)12:01
prologicand to load balance against multiple backends12:01
tokyopancakelol12:01
prologicjust with a standard proxy setup12:01
tokyopancakeYou're way over my head, but I'm making notes12:01
prologicyou know you're usualy mod_proxy (apache) style config12:02
prologicProxyPass / http://127.0.0.1:8000/12:02
tokyopancakeyeah12:02
prologicProxyPassReverse / http://127.0.0.1:8000/12:02
prologicfor example12:02
prologicsimple as12:02
prologicany nginx/apache proxy config examples will work12:02
tokyopancakeok12:02
prologicyou're just proxying requests to circutis.web web server then12:02
tokyopancakehmm12:03
prologicI run all my websites like this12:03
prologicusing lighttpd12:03
prologichttp://shortcircuit.net.au/12:03
prologichttp://prologic.shortcircuit.net.au/12:03
prologichttp://sahriswiki.org/12:03
prologicall run circuits.web apps12:03
prologicwith lighttpd in front doing proxying12:03
tokyopancakenice12:03
prologicalso12:03
prologichttp://ccav.terranova.org.au/ (work project)12:03
tokyopancakewait but you're the author of circuits?12:04
prologicof course :)12:04
tokyopancakewow12:04
tokyopancakenice one:)12:04
tokyopancakeI have to be honest with you12:04
prologicnext year is out 10th year of development12:04
tokyopancakeI've got 3 years of experience with Python, from a 3d animation background12:04
prologicahh nps12:04
tokyopancakeand I jumped into webdev 10 days ago through codecademy12:04
prologiceveryone is capable of learning :)12:05
tokyopancakeso all this stuff is new to me12:05
prologiccool12:05
prologicwell circuits.web is certainly nice to use12:05
tokyopancakeyeah it seems really cool12:05
prologicand it shoudln't confuse you too much12:05
tokyopancakethe question I have though..12:05
prologicoh I forgot12:05
prologichttp://circuitsweb.com/12:05
prologichttp://circuitsframework.com/12:05
prologicthese two are also pwoered by circuits.web too :012:05
prologichaha12:05
tokyopancake:)12:05
tokyopancakeso I;m writing this download page with user verification12:06
tokyopancakethat either gets the users email, or if there's a cookie and the right signals, enters a download page, or comes with a confirmation page.12:06
tokyopancakeanyway, I've already written it in a DownloadPage class, with different methods checking for cookies and what not, I ran it through the CGIHTTPServer locally12:07
tokyopancakeso now I'm adapting it to circuits12:07
prologicoh ic12:07
prologicso this is something you've already written before knowing circuits?12:07
tokyopancakeyeah12:07
prologicso you're questions are more around hwo to port this cgi-style app to circutis.web?12:07
tokyopancakeyeah kinda12:08
prologicsure no worries12:08
prologicask away12:08
tokyopancakethe main thing I ran into was12:08
tokyopancakein my cgi script I used the sys.stdout.write.12:08
tokyopancakeand I can see circuits uses a return statement in the Controller class12:08
prologicyes this is right12:08
tokyopancakebut any methods I make inside a controller object becomes a .. page?12:08
prologicyou just retunr some data from your controller(s)12:09
prologicyes that is also correct12:09
prologicany non _ (underscore) prefixed method12:09
tokyopancakeis there a way to make methods inside a Controller object that are hiddden from circuits?12:09
prologicgets exposed to the web12:09
tokyopancakeah so that's quite a pythonic way then12:09
prologicyes12:09
prologicdef _foo(self): ...12:09
prologicis not exposed to the web12:09
tokyopancakethat's really nice12:09
tokyopancakeso that should be quite easy to adapt12:09
tokyopancakeand then, my other question..12:10
tokyopancakeI want the user at some point to be sent a download..12:10
prologicalso if you inherit from BaseController12:10
prologicnohting gets exposed automatically12:10
tokyopancakeah12:10
prologicjust fyi :)12:10
tokyopancakecool :)12:10
prologicthere are always explicit and implciit mechanisms in circuits12:10
prologicjust to satify both crowds12:10
tokyopancakeI noticed a method in the Controller called sent_download?12:10
prologicI'm lazy12:10
prologicso I prefer many implicit things12:10
prologicthat work well12:10
tokyopancakethat makes sense12:11
prologicyes there is12:11
prologicreturn self.serve_download()12:11
prologicand friends12:11
tokyopancakeah yes12:11
prologicthey are as simple as they look12:11
prologicunderneath they start streaming the data to the client12:11
prologicasynchronsouly12:11
tokyopancakethat's cool12:11
tokyopancakehmm12:12
tokyopancakeI had another question12:12
prologicbtw there are tests that cover almost every aspsect of circuits and circuits.web12:12
prologicas well as many many examples12:12
prologicso if you don't find something int he docs12:12
tokyopancakereally?12:12
prologiclook first in examples/12:12
prologicthen in tests/12:12
prologicalso12:12
prologicif you're not using it12:12
tokyopancakeah you mean in the site-pacakges12:12
prologicI highly reocmmend the dev branch12:12
prologichg clone https://bitbucket.org/circuits/circuits-dev12:12
prologicor12:12
prologicpip install -e hg+https://bitbucket.org/circuits/circuits-dev#egg=circuits12:13
prologicmainly because we do very slow/long releases12:13
tokyopancakecool12:13
prologiclack fo time, etc12:13
prologicfamily, wife, daughter, work, etc12:13
tokyopancake:)12:13
tokyopancakeit's appreciated james12:13
prologicand it's hard to get devs interested12:13
prologicwhen there's twisted, tornado, etc12:13
prologicand the python web framework market is well quite satuarted :)12:13
prologicas is the async market12:13
tokyopancakewell.. not for the noobie webdev like me12:14
tokyopancakeI was watching a django tutorial yesterday12:14
prologictoo complicated? :)12:14
tokyopancakelol, are you kidding12:14
prologicall this MVC crap12:14
tokyopancakeI started laughing out loud12:14
prologicabstractions are good12:14
prologicbut some frameworks have a steep learning curve12:15
prologicto say the least12:15
tokyopancakeI'm sure it serves a purpose12:15
prologicand the abstractions often don't buy you much12:15
tokyopancakebut for my little site it does not make sense at all12:15
prologiceven for lage sites it hardly makes sense too sometimes12:15
prologicMVC whilst a good pattern in general12:15
prologicis over used ihmo12:15
prologicwith circuits and circuits.web12:15
prologicwe try to keep things as simple as possible12:15
prologicwith as little boilerplate as possible12:15
tokyopancakeyeah12:16
prologicthat's why the circuits.web hello world is 6 or 7 lines of code or so12:16
prologichttp://circuitsweb.com/12:16
prologicsorry 5 lines12:16
tokyopancakewhat's the things you wanna do with circuits next?12:16
tokyopancakeis there big things that bother you about it, you wanna fix?12:16
prologicwell for the 2.2 release12:17
prologicI wants to make all tests pass reliably12:17
prologicon our CI (continus integration system)12:17
prologicget more tests written so we have better test coverage12:17
prologicas well as fix a few obscure bugs12:17
prologicthat's short-term hopefully at some point this year12:17
tokyopancakeyeah man12:17
prologicmedium term / long term12:17
prologicimprove the distributed computing aspsects of circuits (circuits.node)12:18
prologicimplement more networking protocols12:18
prologicbig things? no not really12:18
tokyopancake:)12:18
prologica lack of more protocols does bother me a bit though12:18
prologicand it's hard to integrate with other libraires12:18
prologicthat all do their own sync or socket managemnet12:19
tokyopancakeso circuits is a side project for you, next to work?12:19
prologicthere seems to be no library for python anywhere12:19
prologicthat implements protocols12:19
prologicand just the parsing and understanding of said protocols12:19
prologicthere are one or two12:19
prologicbut not many12:19
prologiccircuits.web in fact used such a library12:19
tokyopancakei see12:19
prologicfor the http server protocol12:19
prologicbut it would be nice12:19
prologicbecause then circuits could then just wrap any protocol easily12:20
tokyopancakeyou're going over my head again james :)12:20
prologicdata comes in -> protocol parser interprets it -> event comes out12:20
prologichaha12:20
tokyopancakewhat kinda data are we talking about here12:20
prologiccircuits is no side proejct12:20
prologicI've been working on it for 9 years now12:20
prologicnext year is out 10th year of development12:21
tokyopancakesorry I don't mean to offend12:21
prologichttp://www.ohloh.net/p/circuits12:21
tokyopancakeI mean you've got a regular job next to this?12:21
prologichere are our ohloh stats12:21
prologicyes :)12:21
prologicdoesn't anyone :)12:21
tokyopancakehaha12:21
tokyopancakethats cool man12:21
prologicwe like new users btw :012:22
prologichelps improve docs and the codebase12:22
prologicand helps get the word out about circuits :)12:22
tokyopancakeyeah man12:23
tokyopancakeI'm glad Karl wrote that tutorial though12:23
tokyopancakecause I was getting sucked down the django rabbit hole for a few hours12:23
tokyopancakeand it wasn't pretty12:23
tokyopancakeanyways12:24
tokyopancakethanks for your help12:24
tokyopancakeI'm gonna try to implement it now12:24
tokyopancakewill let you know how it goes12:24
prologicno problems at all :)12:24
tokyopancake:)12:24
prologicremember to please upgrade to the dev branch though12:24
prologicwe lack the resources to support old versions of circuits very well :)12:24
tokyopancakesure I will12:25
tokyopancakejames?14:14
tokyopancakeI've almost implemented it with circuits14:15
tokyopancakebut I keep running into some errors14:15
tokyopancakeI've got about 6 hidden methods passing data around14:15
tokyopancakeand it seems, sometimes..14:15
tokyopancakemy server spits back 'uwsgi application not found'14:16
tokyopancakeand at other times, it does show my website.14:16
tokyopancakeit seems whenever it runs into an error in the python code, instead of spitting back the error it just tells me the application can't be found14:16
tokyopancakein the process I noticed it gives me an error when I alter the __init__ on a Controller object?14:17
tokyopancakeis that right?14:17
prologicwhat do the nginxs error logs say?14:23
prologicdo you see a python traceback?14:23
prologicbest if you test with the circutis.web server itself14:23
prologicbefore running it through nginx + uwsgi14:23
prologicalso I still recommend you switch to14:23
prologicngginx + proxy -> circuits.web app14:24
tokyopancakeah good point let me check those logs14:25
prologicthing is14:26
tokyopancakethe nginx does have anything in the error log14:26
prologicif you cause an error somewhere14:26
tokyopancakeso I bet it's a uwsgi error14:26
prologicwhere the circuits.web error handling can't capture it14:26
prologicthen yeah things will break horribly14:26
prologiclike I said14:26
prologicit's easier and better ihmo14:27
tokyopancakeso am I allowed to overload the __init__ with a new variables?14:27
prologicto use circuits.web's builtin server14:27
prologicand test locally using that14:27
prologicthen when you're ready for deployment14:27
tokyopancakeI'm gonna try to set that up14:27
prologicuse mod_proxy14:27
prologicand setup reverse proxy to your app14:27
tokyopancakeI'm just happy I've got something running at the moment14:27
prologicyou are allow to customize __init__ sure14:27
prologicbut remember to call the super __init__14:27
prologice.g:14:27
prologicclass Foo(Controler):14:27
prologic   def __init__(self, *args, **kwargs):14:28
tokyopancakeaaah14:28
tokyopancakethere we go14:28
prologic      super(Foo, self).__init__(*args, **kiwargs)14:28
prologicif you don't things will break14:28
tokyopancakecheers for that14:28
prologicnps14:28
prologickinda important :)14:28
tokyopancakehaha :)14:28
prologicI should maybe put a big red box on the circuits docs14:28
prologicstating this :)14:28
prologicno circuits component will work without it being properly initailized14:29
tokyopancakefor sure14:29
tokyopancakehmmm16:25
tokyopancakeI just found something else16:25
tokyopancakeor maybe I didn't16:26
tokyopancakelol16:26
*** tokyopancake has quit IRC19:50
*** tokyopancake has joined #circuits20:13
tokyopancakehi20:32
tokyopancakeI've got my script converted into circuits almost fully working20:33
tokyopancakeI've got an auto-download starting with the serve_download method20:33
tokyopancakeand it sends it over, but it seems to corrupt the file?20:33
tokyopancakeit's a png, when I download it through my circuits site it's corrupt, and when I download through ftp it's fine20:34
tokyopancakeI've set the chown on the file and folder both to www-data20:34
tokyopancakeany clues?20:34
jgiorgidefine corrupts the file, what's the problem? have you tried cat'ing the first couple hundred bytes to look at the headers20:52
tokyopancakehmm good point, let me do that20:57
tokyopancakeit starts out with ?PNG20:59
tokyopancakeand then starts into weird characters very quickly20:59
tokyopancakeit's a png file I'm hosting, so that makes sense20:59
tokyopancakeit corrupts the file as in, osx tells me it can't open the file because it thinks it's corrupt21:00
tokyopancakeI wish I could make it more clear21:00
tokyopancakecould it be anything to do with Binary and ASCII transfers?21:00
tokyopancakethat's what it feels like21:00
tokyopancakebut I'm a total n00b21:00
tokyopancakehold on21:05
tokyopancakeso it starts out with a load of crazy characters21:05
tokyopancakeand then goes into an XML form of 10 lines starting with21:05
tokyopancakeXML:com.adobe.xmp<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.1.2">21:05
tokyopancakemy mac tells me 'The file could not be opened. It may be damaged or use a file format that Preview doesn't recognize21:06
tokyopancakeI tried zipping it up21:18
tokyopancakeand it downloads21:18
tokyopancakebut when I unzip it21:18
tokyopancakeit unzips the png as a myFile.zip.cpgz file..21:18
tokyopancakeany help appreciated21:18
tokyopancakeI saw you post on your website21:43
tokyopancakehttp://justingiorgi.me/?p=1521:43
tokyopancakeand set the content-type to application/octet-stream21:43
tokyopancakeand the content-disposition to attachment21:43
tokyopancakebut this doesn't fix it21:43
tokyopancakehmm21:49
tokyopancakeI set it to application/zip21:49
tokyopancakeand changed back to the png with application/png21:50
tokyopancakenone of it seesm to work21:50
tokyopancakethink it might be a setting on my server21:50
tokyopancakeanway21:50
tokyopancakeenough of a monologue21:50
tokyopancakegoodnight chaps21:50
tokyopancakecool I fixed it22:26
tokyopancakeI set the header manually, then opened the file with open(filePath, 'rb'),22:27
tokyopancakein a myFile variable22:27
tokyopancakethen I just did return myFile22:27
tokyopancakestill not sure why the serve_download corrupts it22:27
tokyopancakeI'll talk to james about it tomorrow!22:27
tokyopancakenight night22:27
tokyopancakeciao22:27
*** tokyopancake has quit IRC22:30

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