Re: HTSQL 2.0 RC1 -- a Query Language for the Accidental Programmer
On Fri, 21 Jan 2011 21:25 -0800, "rusi" wrote: > On Jan 22, 2:45 am, "Clark C. Evans" wrote: > > Kirill Simonov and myself would like to introduce HTSQL, a novel > > approach to relational database access which is neither an ORM > > nor raw SQL. > > Given the claim htsql is higher level than sql I am interested in > bill-of-materials type (recursive) queries. Rusi, HTSQL 2.0 does not yet support SQL's common table expressions. However, this particular use case, along with CUBE, server-side stored procedures, and related needs is what made us branch from our 1.X production release. Our immediate focus is SQL-92. Once we cover most SELECT patterns and SQL back-ends, we'll be looking at SQL:1999, SQL:2003, and SQL:2008 (as well as proprietary equivalents such as Oracle's CONNECT BY). Best, Clark -- http://mail.python.org/mailman/listinfo/python-list
Re: HTSQL 2.0 RC1 -- a Query Language for the Accidental Programmer
On 01/22/2011 12:25 AM, rusi wrote: On Jan 22, 2:45 am, "Clark C. Evans" wrote: Kirill Simonov and myself would like to introduce HTSQL, a novel approach to relational database access which is neither an ORM nor raw SQL. : We're curious what you think. Thanks -- looks interesting. Given the claim htsql is higher level than sql I am interested in bill-of-materials type (recursive) queries. Currently HTSQL does not support recursive queries. That said, it's certainly within the reach of HTSQL and I could sketch here how the support may look like: We add an operator `closure()` that, given a self-referential link `link`, produces a transitive closure `closure(link)` of the link. For example, take a table `program` with a link `program.part_of`. Then `program.closure(part_of)` is a plural link mapping a program to its super-programs, which you can use just like a regular plural link, for instance, in aggregate expressions. To return, for each program, a list of its super-programs: /program{code, /closure(part_of){code}} To return all sub-programs of a specific program 'xxx': /program?exists(closure(part_of).code='xxx') Compare that with /program{code, part_of.code} /program?part_of.code='xxx' I think it would be a modest improvement over a SQL alternative. I'm adding it to the roadmap right now, but don't hold your breath -- Q4 this year or early next year is a realistic ETA. I expect the implementation to be at least moderately painful and, obviously, it could only work with those backends that support WITH RECURSIVE. Thanks, Kirill -- http://mail.python.org/mailman/listinfo/python-list
Re: HTSQL 2.0 RC1 -- a Query Language for the Accidental Programmer
On Jan 22, 10:20 pm, Kirill Simonov wrote: > On 01/22/2011 12:25 AM, rusi wrote: > > > On Jan 22, 2:45 am, "Clark C. Evans" wrote: > >> Kirill Simonov and myself would like to introduce HTSQL, a novel > >> approach to relational database access which is neither an ORM nor raw SQL. > > : > >> We're curious what you think. > > > Thanks -- looks interesting. > > > Given the claim htsql is higher level than sql I am interested in > > bill-of-materials type (recursive) queries. > > Currently HTSQL does not support recursive queries. That said, it's > certainly within the reach of HTSQL and I could sketch here how the > support may look like: > > We add an operator `closure()` that, given a self-referential link > `link`, produces a transitive closure `closure(link)` of the link. > > For example, take a table `program` with a link `program.part_of`. Then > `program.closure(part_of)` is a plural link mapping a program to its > super-programs, which you can use just like a regular plural link, for > instance, in aggregate expressions. > > To return, for each program, a list of its super-programs: > > /program{code, /closure(part_of){code}} > > To return all sub-programs of a specific program 'xxx': > > /program?exists(closure(part_of).code='xxx') > > Compare that with > > /program{code, part_of.code} > /program?part_of.code='xxx' > > I think it would be a modest improvement over a SQL alternative. > > I'm adding it to the roadmap right now, but don't hold your breath -- Q4 > this year or early next year is a realistic ETA. I expect the > implementation to be at least moderately painful and, obviously, it > could only work with those backends that support WITH RECURSIVE. O well... I was hoping for some some quick-queries (one-liners?) to probe firefox's bookmarks (which are in sqlite) -- http://mail.python.org/mailman/listinfo/python-list
Need GUI pop-up to edit a (unicode ?) string
I'm in need for a graphical pop-up that will display a (unicode ?) string in a field, allow the user to change it and return the modified string. Maybe also keep the original one displayed above it. Something like this: +-+ | Please confirm or edit the following string | | | | Original_example_string | | | | +---+ | | | Original_about_to_be_changed | | | +---+ | | | | OK | | | +-+ I've never used any kind of graphical interface programing before, so I don't have a clue where to start. This would, however, be the *only* GUI part in the app at this point. >From what I can see the solution lays with PyQT, but the docs I find are courses that aim to teach the whole GUI tool. I only need a little pop-up to alow a user to edit part of a filename, for instance. I'm using Python 2.6.x on various Linux platforms (mainly openSUSE and Mint) and on Windows. Windows support is not important, in this case. -- When in doubt, use brute force. -- Ken Thompson -- http://mail.python.org/mailman/listinfo/python-list
Re: Need GUI pop-up to edit a (unicode ?) string
On 01/22/2011 03:22 PM, Rikishi42 wrote: I'm in need for a graphical pop-up that will display a (unicode ?) string in a field, allow the user to change it and return the modified string. Maybe also keep the original one displayed above it. Something like this: +-+ | Please confirm or edit the following string | | | | Original_example_string | | | | +---+ | | | Original_about_to_be_changed | | | +---+ | | | | OK | | | +-+ I've never used any kind of graphical interface programing before, so I don't have a clue where to start. This would, however, be the *only* GUI part in the app at this point. From what I can see the solution lays with PyQT, but the docs I find are courses that aim to teach the whole GUI tool. I only need a little pop-up to alow a user to edit part of a filename, for instance. I'm using Python 2.6.x on various Linux platforms (mainly openSUSE and Mint) and on Windows. Windows support is not important, in this case. If that is all you need, I suggest Tkinter. Nice and easy, comes built into Python. Looks like you need two labels, an entry, and a button. When I was learning Tkinter I used http://effbot.org/tkinterbook/. Hope it helped, ~Corey -- http://mail.python.org/mailman/listinfo/python-list
RE: Namespaces
> What is namespace? And what is built-in namespace? > -- > http://mail.python.org/mailman/listinfo/python-list http://lmgtfy.com/?q=python+namespace -- http://mail.python.org/mailman/listinfo/python-list
Re: Need GUI pop-up to edit a (unicode ?) string
On Sat, Jan 22, 2011 at 12:22 PM, Rikishi42 wrote: > > I'm in need for a graphical pop-up that will display a (unicode ?) string in > a field, allow the user to change it and return the modified string. > > Maybe also keep the original one displayed above it. > > > Something like this: > +-+ > | Please confirm or edit the following string | > | | > | Original_example_string | > | | > | +---+ | > | | Original_about_to_be_changed | | > | +---+ | > | | > | OK | > | | > +-+ > > > I've never used any kind of graphical interface programing before, so I > don't have a clue where to start. > This would, however, be the *only* GUI part in the app at this point. > > >From what I can see the solution lays with PyQT, but the docs I find are > courses that aim to teach the whole GUI tool. I only need a little pop-up to > alow a user to edit part of a filename, for instance. > > > I'm using Python 2.6.x on various Linux platforms (mainly openSUSE and Mint) > and on Windows. Windows support is not important, in this case. If windows doesn't matter to you, just use Zenity. Here's a python function wrapping zenity that does what you want: import commands def confirm_or_edit(s): zenity = 'zenity' mode = '--entry' text = "--text='Please confirm or edit the following string:'" title = "--title='confirm or edit'" entry = "--entry-text='%s'" % s cmd = ' '.join([zenity, mode, text, title, entry]) status, output = commands.getstatusoutput(cmd) if status: raise Exception("Couldn't run zenity") return output There's also a full-blown API for zenity, but this should do what you want. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: Best way to administer code updates to server daemon
On Jan 21, 9:27 pm, Paul Rubin wrote: > Maybe there are other ideas possible too. I don't know of any off-hand but there are probably virtual network drivers that sit between your server and the network stack that can keep a connection open. It seems like it'd be a common enough need that someone's figured out an easy way to handle it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
[Code Challenge] WxPython versus Tkinter.
WxPython versus Tkinter (A code battle to the death!) by Rick Johnson. I have in many threads declared that Tkinter (and TclTk) is currently --and has been for a decade-- the wrong choice for Python's stdlib GUI. Throughout the 90's Tkinter was fine. However we have been in the 21st century for more than a decade and Tkinter is no longer relevant. Many people have argued (weakly) that Tkinter is still valid. However their arguments have been mostly baseless opinions that sadly lack vision for the future. In this thread i intend to slay my enemies with cold hard facts based on code. It is time to put your code where your mouth is (or you foot). This will be an open challenge to *anyone* in this community, in the world, and *even* the great Guido van Rossum himself! It is now time for you (python community) to prove the worth of Tkinter or accept its demise at my hands! Some of you may think this sounds like an impossible challenge. How can one man defend his position against the entire world! Yes, it would seem impossible for one man to face an entire community in open challenge! And in most cases only a fool would challenge the world. However, i have not one ounce of fear within me while facing these odds because my position is the correct position. My position is based on facts and NOT friendship, truth and NOT tantrums, and finally vision NOT vengance! I am on the correct side of history! It is time to prove once and for all how dated and worthless Tkinter is compared to wxPython. Yes, WxPython is not as advanced as i would like it to be for a 21st century GUI library. However compared to Tkinter, Wx is light years ahead! Wx is our best hope to move Python into the 21st century. So now is the time for all you naysayers, trolls, and minions to face me in mortal combat within the arena of truth and righteousness. Ready your minds and wield your text editors for we shall battle for the glory of Python! And when i have slayed the fools with their own foolishness then ye all shall be enlightened! So PUT UP OR SHUT THE HELL UP! --- Challenge 1: (Simple Directory Viewer) --- Create a simple Directory Viewer GUI. You CANNOT use a treectrl! The point of this challenge is to show that Tkinter has no support for a true ListCtrl widget. However the Wx::ListCtrl is fully featured! For wxPython the code is simply wielding a few built in classes. For Tkinter no such ListCtrl functionality exists. You CAN create the functionality yourself (and i know this because i HAVE created it!) however it involves tons of work and still can't hold a candle to the wx::ListCtrl --- Requirements: --- How the user navigates to a folder is not important but you must display the list of files/folders in two view modes with icons; 1. Display files in both ReportView and ListView. * Reportview: ...scrollable vertical list with three columns. * Listview: ...scrollable horizontal-ly wrapping list. Note: If you do not understand the view modes just run my code for an example. But the user must be able to switch between these two modes easily. How the switching is done is unimportant -- I simply used two buttons. 2. Columns * Minimum of three cols; Name, Size, and Type (reportview). * the "Name" column must include an icon AND label (both views). * columns must be sortable by the user (reportview). * columns must be sizable by the user (reportview). 3. Items * All must be editable in place (no popup editing allowed!). * All items must be selectable/deselectable by user. * All items must be delete-able by the user. That is the challenge. Step forth and battle if you can! - WxPython code: - https://sites.google.com/site/thefutureofpython/home/code-challenges I await any challengers... -- http://mail.python.org/mailman/listinfo/python-list
Re: Best way to administer code updates to server daemon
Carl Banks writes: > I don't know of any off-hand but there are probably virtual network > drivers that sit between your server and the network stack that can > keep a connection open. > > It seems like it'd be a common enough need that someone's figured out > an easy way to handle it. I don't see big conceptual obstacles to making a network stack itself be able to package up the internal state of a TCP or even SSL connection, and hand it off to another computer over a LAN, so that you could have graceful turnover of live connections. They could even cross-update info about the connection for hardware failover. I woder if (e.g.) Erlang OTP already does something like that. I worked on a device with such a feature a while back, based on very special purpose hardware and software and a special (hardware) communication bus for the purpose, but with some careful coding it can probably be done with stock hardware and ethernet. -- http://mail.python.org/mailman/listinfo/python-list
Re: Need GUI pop-up to edit a (unicode ?) string
On 2011-01-22, Corey Richardson wrote: > On 01/22/2011 03:22 PM, Rikishi42 wrote: >> >> I'm in need for a graphical pop-up that will display a (unicode ?) string in >> a field, allow the user to change it and return the modified string. >> > If that is all you need, I suggest Tkinter. Nice and easy, comes built > into Python. Looks like you need two labels, an entry, and a button. > When I was learning Tkinter I used http://effbot.org/tkinterbook/. I had to add Tkinter, which was not isntalled on my machine. But it looks easy enough, I'll definitively look into it. Thanks ! -- When in doubt, use brute force. -- Ken Thompson -- http://mail.python.org/mailman/listinfo/python-list
[ANN] Oktest 0.6.0 released - a new-style testing library
Hi all, I released Oktest 0.6.0. http://pypi.python.org/pypi/Oktest/ http://packages.python.org/Oktest/ Oktest is a new-style testing library for Python. :: from oktest import ok ok (x) > 0 # same as assert_(x > 0) ok (s) == 'foo'# same as assertEqual(s, 'foo') ok (s) != 'foo'# same as assertNotEqual(s, 'foo') ok (f).raises(ValueError) # same as assertRaises(ValueError, f) ok (u'foo').is_a(unicode) # same as assert_(isinstance(u'foo', unicode)) not_ok (u'foo').is_a(int) # same as assert_(not isinstance(u'foo', int)) ok ('A.txt').is_file() # same as assert_(os.path.isfile('A.txt')) not_ok ('A.txt').is_dir() # same as assert_(not os.path.isdir('A.txt')) See http://packages.python.org/Oktest/ for details. NOTICE!! Oktest is a young project and specification may change in the future. New features in this release Oktest supports Tracer class which can be mock or stub of function or method. Example to create fake object:: ## create fake objects from oktest.tracer import Tracer tr = Tracer() foo = tr.fake_obj(m1=100, m2=200) # method name and return-value bar = tr.fake_obj(m3=lambda self, x: x+1) # method name and body ## call fake methods ok (bar.m3(0)) == 1 ok (foo.m2(1,2,3)) == 200# any argument can be passed ok (foo.m1(x=123)) == 100# any argument can be passed ## check results ok (repr(tr[0])) == 'm3(0) #=> 1' ok (repr(tr[1])) == 'm2(1, 2, 3) #=> 200' ok (repr(tr[2])) == 'm1(x=123) #=> 100' There are several ways to check results:: from oktest.tracer import Tracer tr = Tracer() obj = tr.fake_obj(meth=9) ok (obj.meth(1, 2, x=3)) == 9 ## check results ok (repr(tr[0])) == 'meth(1, 2, x=3) #=> 9' ## or ok (tr[0].list()) == [obj, 'meth', (1, 2), {'x': 3}, 9] ## or ok (tr[0])== [obj, 'meth', (1, 2), {'x': 3}, 9] ## or ok (tr[0].receiver).is_(obj) ok (tr[0].name) == 'meth' ok (tr[0].args) == (1, 2) ok (tr[0].kwargs) == {'x': 3} ok (tr[0].ret)== 9 Example to trace method call:: class Foo(object): def m1(self, x): return x + 1 def m2(self, y): return y + 1 obj = Foo() ## trace methods from oktest.tracer import Tracer tr = Tracer() def dummy(original_func, *args, **kwargs): #return original_func(*args, **kwargs) return 100 tr.fake_method(obj, m1=dummy, m2=200) ## call methods ok (obj.m1(1)) == 100 ok (obj.m2(2)) == 200 ## check results ok (tr[0]) == [obj, 'm1', (1,), {}, 100] ok (tr[1]) == [obj, 'm2', (2,), {}, 200] Example to trace function call:: def f(x): return x+1 def g(y): return f(y+1) + 1 ## trace functions from oktest.tracer import Tracer tr = Tracer() f = tr.trace_func(f) g = tr.trace_func(g) ## call functions ok (g(0)) == 3 ## check results ok (tr[0]) == [None, 'g', (0,), {}, 3] ok (tr[1]) == [None, 'f', (1,), {}, 2] Example to fake method call:: class Foo(object): def m1(self, x): return x + 1 def m2(self, y): return y + 1 obj = Foo() ## fake methods from oktest.tracer import Tracer tr = Tracer() def dummy(original_func, *args, **kwargs): #return original_func(*args, **kwargs) return 100 tr.fake_method(obj, m1=dummy, m2=200) ## call method ok (obj.m1(1)) == 100 ok (obj.m2(2)) == 200 ## check results ok (tr[0]) == [obj, 'm1', (1,), {}, 100] ok (tr[1]) == [obj, 'm2', (2,), {}, 200] Example to fake function call:: def f(x): return x*2 ## fake a function def dummy(original_func, x): #return original_func(x) return 'x=%s' % repr(x) from oktest.tracer import Tracer tr = Tracer() f = tr.fake_func(f, dummy) ## call function ok (f(3)) == 'x=3' ## check results ok (tr[0]) == [None, 'f', (3,), {}, 'x=3'] Have a nice weekend! -- regards, makoto kuwata -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
On 1/22/2011 7:07 PM, rantingrick wrote: Near the beginning of this thread, I gently challenged you to produce a concrete, practical proposal for an stdlib addition that could be critiqued and improved. When you asked for problems with wxwidgets/wxpython, I gave some. Still waiting. So PUT UP OR SHUT THE HELL UP! -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Which non SQL Database ?
On Sat, 04 Dec 2010 16:42:36 -0600, Jorge Biquez wrote: > Hello all. > > Newbie question. Sorry. > > As part of my process to learn python I am working on two personal > applications. Both will do it fine with a simple structure of data > stored in files. I now there are lot of databases around I can use but I > would like to know yoor advice on what other options you would consider > for the job (it is training so no pressure on performance). One > application will run as a desktop one,under Windows, Linux, Macintosh, > being able to update data, not much, not complex, not many records. The > second application, running behind web pages, will do the same, I mean, > process simple data, updating showing data. not much info, not complex. > As an excersice it is more than enough I guess and will let me learn > what I need for now. Talking with a friend about what he will do (he use > C only) he suggest to take a look on dBase format file since it is a > stable format, fast and the index structure will be fine or maybe go > with BD (Berkley) database file format (I hope I understood this one > correctly) . Plain files it is not an option since I would like to have > option to do rapid searches. > > What would do you suggest to take a look? If possible available under > the 3 plattforms. > > Thanks in advance for your comments. > > Jorge Biquez Well, two NoSQL databases that I have some experience with are MongoDB and CouchDB. The choice among them depends on your application. CouchDB is an extremely simple to set up, it is all about the web interface, as a matter of fact it communicates with the outside world using HTTP protocol, returning JSON objects. You can configure it using curl. It is also extremely fast but it doesn't allow you to run ad hoc queries. You have to create something called a "view". This is more akin to what people in the RDBMS world call a "materialized view". Views are created by running JavaScript function on every document in the database. Results are stored in B*Tree index and then modified as documents are being inserted, updated or deleted. It is completely schema free, there are no tables, collections or "shards". The primary language for programming Couch is JavaScript. The same thing applies to MongoDB which is equally fast but does allow ad hoc queries and has quite a few options how to do them. It allows you to do the same kind of querying as RDBMS software, with the exception of joins. No joins. It also allows map/reduce queries using JavaScript and is not completely schema free. Databases have sub-objects called "collections" which can be indexed or partitioned across several machines ("sharding"), which is an excellent thing for building shared-nothing clusters. Collections can be indexed and can be aggregated using JavaScript and Google's map/reduce. Scripting languages like Python are very well supported and linked against MongoDB, which tends to be faster then communicating using HTTP. I find MongoDB well suited for what is traditionally known as data warehousing. Of course, traditional RDBMS specimens like MySQL, PostgreSQL, Firebird, Oracle, MS SQL Server or DB2 still rule supreme and most of the MVC tools like Django or Turbo Gears are made for RDBMS schemas and can read things like the primary or foreign keys and include that into the application. In short, there is no universal answer to your question. If prices are a consideration, Couch, Mongo, MySQL, PostgreSQL, Firebird and SQL Lite 3 all cost about the same: $0. You will have to learn significantly less for starting with a NoSQL database, but if you need to create a serious application fast, RDBMS is still the right answer. You may want to look at this Youtube clip entitled "MongoDB is web scale": http://www.youtube.com/watch?v=b2F-DItXtZs -- I don't think, therefore I am not. -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
From: "rantingrick" > > WxPython versus Tkinter (A code battle to the death!) > > by Rick Johnson. > > I have in many threads declared that Tkinter (and TclTk) is currently > --and has been for a decade-- the wrong choice for Python's stdlib > GUI. Throughout the 90's Tkinter was fine. However we have been in the > 21st century for more than a decade and Tkinter is no longer relevant. > Many people have argued (weakly) that Tkinter is still valid. However > their arguments have been mostly baseless opinions that sadly lack > vision for the future. > > In this thread i intend to slay my enemies with cold hard facts based > on code. It is time to put your code where your mouth is (or you > foot). This will be an open challenge to *anyone* in this community, > in the world, and *even* the great Guido van Rossum himself! It is now > time for you (python community) to prove the worth of Tkinter or > accept its demise at my hands! > > Some of you may think this sounds like an impossible challenge. How > can one man defend his position against the entire world! Yes, it > would seem impossible for one man to face an entire community in open > challenge! And in most cases only a fool would challenge the world. > However, i have not one ounce of fear within me while facing these > odds because my position is the correct position. My position is based > on facts and NOT friendship, truth and NOT tantrums, and finally > vision NOT vengance! I am on the correct side of history! > > It is time to prove once and for all how dated and worthless Tkinter > is compared to wxPython. Yes, WxPython is not as advanced as i would > like it to be for a 21st century GUI library. However compared to > Tkinter, Wx is light years ahead! Wx is our best hope to move Python > into the 21st century. > > So now is the time for all you naysayers, trolls, and minions to face > me in mortal combat within the arena of truth and righteousness. Ready > your minds and wield your text editors for we shall battle for the > glory of Python! And when i have slayed the fools with their own > foolishness then ye all shall be enlightened! > > So PUT UP OR SHUT THE HELL UP! > > > --- > Challenge 1: (Simple Directory Viewer) > --- > > Create a simple Directory Viewer GUI. You CANNOT use a treectrl! The > point of this challenge is to show that Tkinter has no support for a > true ListCtrl widget. However the Wx::ListCtrl is fully featured! For > wxPython the code is simply wielding a few built in classes. For > Tkinter no such ListCtrl functionality exists. You CAN create the > functionality yourself (and i know this because i HAVE created it!) > however it involves tons of work and still can't hold a candle to the > wx::ListCtrl > > --- > Requirements: > --- > > How the user navigates to a folder is not important but you must > display the list of files/folders in two view modes with icons; > > 1. Display files in both ReportView and ListView. > > * Reportview: >...scrollable vertical list with three columns. > > * Listview: >...scrollable horizontal-ly wrapping list. > > Note: If you do not understand the view modes just run my code for an > example. But the user must be able to switch between these two modes > easily. How the switching is done is unimportant -- I simply used two > buttons. > > 2. Columns > * Minimum of three cols; Name, Size, and Type (reportview). > * the "Name" column must include an icon AND label (both views). > * columns must be sortable by the user (reportview). > * columns must be sizable by the user (reportview). > > 3. Items > * All must be editable in place (no popup editing allowed!). > * All items must be selectable/deselectable by user. > * All items must be delete-able by the user. > > That is the challenge. Step forth and battle if you can! > > - > WxPython code: > - > > https://sites.google.com/site/thefutureofpython/home/code-challenges I have downloaded that simple program, launched it, and I've tested it with JAWS screen reader. It was fully accessible out of the box. Have you done something special for making it accessible for screen readers? (I guess not). Can be the same thing done with Tkinter? Octavian -- http://mail.python.org/mailman/listinfo/python-list