|
Capnbigboobies posted:Edit: also http://www.pyside.org/docs/pyside/contents.html
|
# ? Jan 5, 2012 18:36 |
|
|
# ? May 9, 2024 05:53 |
|
Has anyone in here created a blog using the Blogofile framework from start to finish? I am so close to finalizing my blog, but pagination is completely abstruse without any shred of useful documentation. The prospect of having a blog that's completely static motivates me to keep pressing on, though.
|
# ? Jan 8, 2012 21:08 |
|
A sprawling open-ended question: I was using Plone for my personal website for many years. Can't say it was a great experience but it's a powerful system and when it worked, it was great. But now I've fled my (managed) site host for by own machine at Linode, and was wondering whether I should look at another CMS. Stuff I like / want: - Python based: for when I have to debug it and also when I have to occasionally write some custom stuff. - Humane / understandable nested urls: e.g http://www.outlier.me/work/biology/2011 - A decent selection of themes: because I have no artistic talent Pinax? Any other Python-centric CMS?
|
# ? Jan 8, 2012 22:06 |
|
Take a look at Kotti. It doesn't offer a lot in the way of fluff, but it has as about as solid a foundation you could hope for.
|
# ? Jan 9, 2012 05:54 |
|
Is pyside or pyqt something that actually works with Lion and the new QT yet?
|
# ? Jan 9, 2012 11:34 |
|
outlier posted:A sprawling open-ended question: I was using Plone for my personal website for many years. Can't say it was a great experience but it's a powerful system and when it worked, it was great. But now I've fled my (managed) site host for by own machine at Linode, and was wondering whether I should look at another CMS. Plone was, and I'd argue still is, a great solution for big corporate or government websites where there is going to be a shitload of content and a need for a well defined workflow. I couldn't imagine torturing myself for using it with a personal website and a blog though. Although heck, these days, for big coprorate or govt websites, I'd probably use Alfresco as a back end, if not just to try and ingrain myself deeper into the company with a lucrative business process contract (Ie "making the company your bitch") and build the front end with Django and some sort of CMS that handles CMIS
|
# ? Jan 9, 2012 11:40 |
|
Haystack posted:Take a look at Kotti. It doesn't offer a lot in the way of fluff, but it has as about as solid a foundation you could hope for. Hadn't heard of this before - I'll look into it. I see it's using Pyramid, which I've been interested in for a while. duck monster posted:(Plone) I couldn't imagine torturing myself for using it with a personal website and a blog though. Don't I know it. I've lost months of my life wrangling that shambling beast of a thing. But at the time I adopted it, there weren't a lot of choices and the Plone koolaid was very persuasive. Which leads me to another question: I need to write readers for a few bioinformatic formats I have to work with. Actually I have already written a few of these readers by hand, which was about as fun as expected. So I was considering going with a proper, third party parsing library. The code would initially be for my own use, but I certainly have an eye on redistribution and wider use, which means the external library has to be ... reliable. No crappy installs, would like it to have some longevity. Pyparsing is the obvious choice. But I'm uneasy with the way it reads a whole file in at once. Are there strong competitors? I've found nothing but a lot of one-man projects. nonathlon fucked around with this message at 16:31 on Jan 9, 2012 |
# ? Jan 9, 2012 15:55 |
|
Amateur programmer here. Been reading about Design by Contract lately and I feel like it's a real elegant method of guaranteeing and checking for specifics in your documentation in one fell swoop, especially when coupled with other testing to fill the gaps invariant, pre and post can't do. I was gonna try and use the implementation written for PEP 316 - http://www.wayforward.net/pycontract/ - and was wondering if anyone had some experience with it. Mainly looking to see if anyone had a horrible time with it and would recommend against it.
|
# ? Jan 10, 2012 05:31 |
|
outlier posted:Hadn't heard of this before - I'll look into it. I see it's using Pyramid, which I've been interested in for a while. Is it a binary or xml type format?
|
# ? Jan 10, 2012 05:40 |
|
Check out Lepl
|
# ? Jan 10, 2012 05:58 |
|
duck monster posted:Is it a binary or xml type format? Plaintext. Good old "I'll invent a format myself" plaintext.
|
# ? Jan 10, 2012 10:03 |
|
outlier posted:Plaintext. Good old "I'll invent a format myself" plaintext. fasta? http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/python/fasta_n/
|
# ? Jan 10, 2012 10:11 |
|
Zombywuf posted:fasta? http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/python/fasta_n/ God, no. Were it that simple. I'd just use BioPython. I've got a bunch of semi-obscure phylogeny programs (no names, don't want to get in trouble) that write their results in their own plaintext formats. As far as these things go, they're not too bad - they have clearly marked sections and named fields - but they're still sufficiently unlike anything else that a custom parse is necessary. The trees themselves aren't too bad, except they annotate internal nodes in peculiar ways, so that has to be interpreted correctly. I'd like to process a whole bunch of these files into a more sane format, i.e. one that can be used by other programs, and vice versa. So again a custom parse is required.
|
# ? Jan 10, 2012 12:18 |
|
I am using a Python blogging CMS called Blogofile. The CMS uses a YAML header where the database layer is posted, including the title of the post. My problem is that I can't write blog titles with quotes around them, so a title like "The dog hasn't pooped on the lawn; it wasn't him" turns into the same. With Blogofile/Python/YAML, instead, the quotes are removed by the parser and taken to just mean that the title is a string, so I get The dog hasn't pooped on the lawn; it wasn't him. I tried wrapping the double quotes with single quotes, but this clashes with the apostrophe quotes inside the title and gives me this: code:
Do you have any suggestions about how I could render a quote article the way I want to?
|
# ? Jan 10, 2012 14:08 |
|
ufarn posted:I am using a Python blogging CMS called Blogofile. The CMS uses a YAML header where the database layer is posted, including the title of the post. My problem is that I can't write blog titles with quotes around them, so a title like "The dog hasn't pooped on the lawn; it wasn't him" turns into the same. With Blogofile/Python/YAML, instead, the quotes are removed by the parser and taken to just mean that the title is a string, so I get The dog hasn't pooped on the lawn; it wasn't him. code:
Edit; re-reading it I think I misunderstood, I'm not sure what you can do to fix that if you're just entering it into the CMS pages, unless what I suggested above actually works. The Gripper fucked around with this message at 14:22 on Jan 10, 2012 |
# ? Jan 10, 2012 14:18 |
|
The Gripper posted:You could enclose the string in triple-quotes, e.g. As for how the data is entered, it's a .markdown document with a YAML header like so code:
I guess I'll just have to eschew the wrapping quotes for the time being or create a boolean is_quote field to wrap quotes around the title.
|
# ? Jan 10, 2012 14:54 |
|
ufarn posted:Yeah, I tried the triple quotes, but Python/YAML/Blogofile doesn't seem to support it. It's worth mentioning that this is a somewhat broken CMS by default that needs some tweaks to begin with, so I am not surprised.
|
# ? Jan 10, 2012 15:21 |
|
The Gripper posted:That's fairly lovely, having the CMS parse it again seems like it'd be removing one of the handy features of YAML outright. Does it remove any escape sequences when you enter it? You could try "This is a \x22Test\x22" which would unescape to This is a "Test", but if "This is a \"Test\"" doesn't work then this might not either. It just feels like too many chefs are involved in the parsing of the title, but at least I have a way to display it now. (Also, thanks.) ufarn fucked around with this message at 15:37 on Jan 10, 2012 |
# ? Jan 10, 2012 15:34 |
|
quote:Which leads me to another question: I need to write readers for a few bioinformatic formats I have to work with. Yay. Parsing. outlier posted:Plaintext. Good old "I'll invent a format myself" plaintext. Oh. You're hosed for parsing libraries in general - most handwritten formats don't fit well into LL(n)/LR(n) grammars, and are frequently unnameable to (unambiguous) tokenization. Unless the language was designed with a parser in mind, it is frequently easier to hand-roll the parser over hand-bodge the parser library/tools. If the files are very small, you might get far with a packrat parser (what with it being scannerless), and there are some recursive descent libraries for python that may help more than hinder you too. Packrat parsing is backtracking + memorisation over a recursive descent parse, so it has a bounded runtime, but /heavy/ memory requirements. Stream parsing support is generally quite poor in libraries, if you need it you're forced to hand write bits. outlier posted:Pyparsing is the obvious choice. But I'm uneasy with the way it reads a whole file in at once. Are there strong competitors? I've found nothing but a lot of one-man projects. Oh, large files too?. If you want to use a library and want to avoid reading the file at a time, my suggestion would be *mutliple* layers of tokenization (effectively). If your format is block orientated (i.e if it's a bunch of records concatenated together), you can pull the blocks out of the file one at a time, before passing that string to a parsing library. (i'd look at packrat/pegs) I hope your format is block orientated
|
# ? Jan 10, 2012 15:34 |
|
duck monster posted:Is pyside or pyqt something that actually works with Lion and the new QT yet? I am testing this today. I will post a trip report. edit: sip installs, qt installs, pyqt 4.9 bugs out and dies in qtnetwork on an ssl error edit: previously forgotten qt installation is loving things up. joy tef fucked around with this message at 18:11 on Jan 10, 2012 |
# ? Jan 10, 2012 17:05 |
|
So, I recently started picking up Panda3D for use with Python as I like making games. I'm building a first person shooter that has a minecraft-like terrain generator. I am using a perlin noise function to generate my terrain and it creates a float value between 0 and 1. I'm hitting a bottleneck on how much geometry I can load into the scene at once because I currently have to load the entirety of the terrain into memory. I want to knock that poo poo off and use a flat file or database instead. The problem with just using a flat file (via, say, pickle for example) is that if I create a world that is 500blocks x 500blocks x 50blocks, then my pkl file is nearly 400mb in size. To read back out of this, I experience a considerable amount of delay while I open the file to load it into memory and the game freezes each time I load and unload the external file. I began thinking about using MySQL as that solves almost all of my problems. I can look up a specific x,y,z value extremely quickly. However, I plan on doing a py -> exe when this is done and I don't want the end user to have to install and configure a MySQL database for a game. I began looking for some nosql solutions but it seems there are a lot out there, so I figured I would ask what others would suggest based on the following requirements: - Create a flat file that requires no 3rd party database service to be running on the end user's computer (like I would with MySQL) - Create small-ish flat files (under 100mb each) - Have indexing or a method of looking up values without having to load the entire file into memory. Any suggestions on anything that might suit my needs?
|
# ? Jan 10, 2012 18:04 |
|
sqlite3 is built in
|
# ? Jan 10, 2012 18:12 |
|
Awesome! This sounds exactly like what I'm looking for!"sqlite page' posted:SQLite is a C library that provides a lightweight disk-based database that doesn’t require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Some applications can use SQLite for internal data storage. It’s also possible to prototype an application using SQLite and then port the code to a larger database such as PostgreSQL or Oracle.
|
# ? Jan 10, 2012 18:24 |
|
There are some notable things that can trip you up in sqlite3 - unicode handling (everything str becomes unicode so use BLOBs or conn.text_factory=str), auto-commit shenanigans (controllable with isolation_level=None), and those bits where you pass in a string instead of a one element tuple of a string i.e. ("foo",) vs ("foo")
|
# ? Jan 10, 2012 18:38 |
|
tef posted:I am testing this today. I will post a trip report. continued: after cleaning everything up and installing the prepackaged qt sdk from the website into /Developer/Qt pyqt behaved when configured thus: python configure.py -q /Developer/Qt/Desktop/Qt/474/gcc/bin/qmake -k but now I have a PyQt4 but no PyQt4.QtGui . I think i'm going to have to build qt from source.
|
# ? Jan 10, 2012 19:17 |
|
Winkle-Daddy posted:So, I recently started picking up Panda3D for use with Python as I like making games. I'm building a first person shooter that has a minecraft-like terrain generator. I am using a perlin noise function to generate my terrain and it creates a float value between 0 and 1. I'm hitting a bottleneck on how much geometry I can load into the scene at once because I currently have to load the entirety of the terrain into memory. I want to knock that poo poo off and use a flat file or database instead. How are you going about culling? In theory you could maybe use some sort of sparse octree boxel thingo to compress the crap out of the data by culling self-similar nodes into a higher representation or whatever, if that makes any sense, that also removes a tonne of strain from your renderer , because theres a lot less backfaces etc to worry about rendering. I'm currently very obsessed with these octree things. They are super neato structures. e: Oh yeah, and keep in mind how Minecraft does it by just loading and unloading nearby chunks as need be. duck monster fucked around with this message at 20:19 on Jan 10, 2012 |
# ? Jan 10, 2012 20:15 |
|
^^^ Yeah, I'm building 4x4x4 chunks and will load/unload them based on the players current position. At least, that's the theory once I get the chunk generator working tef posted:There are some notable things that can trip you up in sqlite3 - unicode handling (everything str becomes unicode so use BLOBs or conn.text_factory=str), auto-commit shenanigans (controllable with isolation_level=None), and those bits where you pass in a string instead of a one element tuple of a string i.e. ("foo",) vs ("foo") Hmmm, I'm having some issues as a total python and sqlite noob. Here's my code: code:
code:
|
# ? Jan 10, 2012 22:58 |
|
Use cursor.fetchone()/ cursor.fetchall():
|
# ? Jan 10, 2012 23:00 |
|
Thanks! I knew it was something dumb. e: God I love Python: edit 2: I'm getting a weird error, 'TypeError: 'NoneType' object is unsubscriptable' I think this is happening because the DB inserts haven't finished before I try building the next chunk. Does that sound about right? Is there an easy way to assure it's finished building? edit 3: Nope, I was wrong, that has nothing to do with it. I'll try to figure out how to solve this on my own, otherwise it'll be a massive code dump. Winkle-Daddy fucked around with this message at 00:12 on Jan 11, 2012 |
# ? Jan 10, 2012 23:04 |
|
tef posted:If you want to use a library and want to avoid reading the file at a time, my suggestion would be *mutliple* layers of tokenization (effectively). Good suggestion. The packrat stuff is new to me, so I'll explore that. quote:I hope your format is block orientated Formats. And they are. Kind of ...
|
# ? Jan 11, 2012 10:48 |
|
I'm having some more sqlite and python issues. Hopefully this is an easy one!code:
self.xm = self.cursor.fetchone()[0] TypeError: 'NoneType' object is unsubscriptable I assume it's because a null value is being returned, but I thought 'None' was the keyword to catch that exception? edit: Maybe I'm not able to reuse the cursor like that? Winkle-Daddy fucked around with this message at 18:48 on Jan 11, 2012 |
# ? Jan 11, 2012 18:46 |
|
It's None or a Tuple that fetchone() returns. You are doing fetchone()[0] to get the first element of the tuple. You should be doing x=....fetchone(); if x is not None: blah =x[0] ....
|
# ? Jan 11, 2012 18:49 |
|
tef posted:continued: works now so that's install sip with python configure.py; make etc install qt somewhere using the prepackaged installer, and python configure.py -q /Developer/Qt/Desktop/Qt/474/gcc/bin/qmake -g , etc for pyqt.
|
# ? Jan 11, 2012 18:52 |
|
tef posted:It's None or a Tuple that fetchone() returns. You are doing fetchone()[0] to get the first element of the tuple. Awesome, thanks! (God, I'm missing PHP right now)
|
# ? Jan 11, 2012 18:57 |
|
Winkle-Daddy posted:Awesome, thanks! (God, I'm missing PHP right now) Well you wouldn't have been able to do function_call()[0] in php so I can see how the power may be a little overwhelming
|
# ? Jan 11, 2012 18:59 |
|
tef posted:Well you wouldn't have been able to do function_call()[0] in php so I can see how the power may be a little overwhelming Hmmm, so based on your advice, I rewrote my function to look like this: code:
|
# ? Jan 11, 2012 19:26 |
|
Winkle-Daddy posted:Hmmm, so based on your advice, I rewrote my function to look like this: It's been awhile since I messed with this, but each time you call fetchone() it advances to the next row in the db. So... On this line: code:
code:
To fix this, at the beginning assign self.cursor.fetchone() to a variable and then test that variable for None-ness. Thermopyle fucked around with this message at 19:35 on Jan 11, 2012 |
# ? Jan 11, 2012 19:32 |
|
Since I'm not wanting to increment but save the result of my query to a variable each time, can I get around this by declaring a new cursor variable each time? e.g. code:
|
# ? Jan 11, 2012 19:35 |
|
Winkle-Daddy posted:Since I'm not wanting to increment but save the result of my query to a variable each time, can I get around this by declaring a new cursor variable each time? Have you considered saving the result of your query to a variable each time instead?
|
# ? Jan 11, 2012 19:52 |
|
|
# ? May 9, 2024 05:53 |
|
Winkle-Daddy posted:Hmmm, so based on your advice to be clearer code:
|
# ? Jan 11, 2012 19:53 |