Information manager/organizer with tags question.

2007-11-11 Thread andrei . avk
Hello,

I would like to write an information manager/organizer type of app but
first I'd like to ask if there is something like that already
existing. I asked on yahoo questions but did not get a response. I
also searched freshmeat but even though they have plenty of projects
that are tangentially related, I was unable to find anything close
enough.

What I'm thinking about is this: a database with an interface that
stores records by tags and allows filtering and sorting by these tags.
When I enter a new record, I enter a title and any number of tags.
Interface would have a filter by: pull down menu separated in two
sections, favorite tags and recent tags. To the right of that would be
a button to add another filter, which would create a new pull down
menu to filter current results further. Then there would be a search
field where you'd type in a word and it would show a list of all
matching tags;  then you would click on one of the tags to add it to
last filter menu's 'recent' list. Interface would be two-pane with an
option to switch to single pane, where one pane is a list of matching
records and the other is current record.

List of matching records would be sortable by clicking on column
titles.

Going into the record would bring up a screen with title and body text
of the record, if the record is a file it'd show title, list of tags
and a button that opens that file. (unless it's a text file that can
be viewed and edited there).

The idea is to have a central hub of all information, that is very
easy to search and locate not only the exact document you're looking
for but also a specific subset of documents, including all of the ones
you do need and excluding ones that you do not, which allows you to
work with them as a set without the need to specifically select each
and every one you need.

For the first version it'd be enough to have plain text body field.
Later I'd like to have a rich document format, probably html.

Later I'd also like to add an option for matching synonymous words to
tags. If you search for certainty, it would match assurance tag if the
option is on.

For instance, if I wanted to find this message, I'd search for Usenet
posts, tag, my name (as author). I would know that I only made one
Usenet post about tags. If I made unrelated posts about html tags, for
instance, I'd filter by 'information manager', and then I'd find this
post and more posts that I might make about this. If I wanted to
include possible replies, I'd remove my name from filters. Then I
could sort by date to see latest posts.

The reason for this idea is that right now I keep my information, or
at least most of it, in an outliner program called treepad. It's a
tree-like view program where you make a hierarchical structure similar
to file system, where each 'file' is a text entry field. This is
reasonably useful but is limited to only one possible subset, i.e. you
could put all posts under 'Usenet posts/info manager/a, b, c' but it's
impossible to filter it further or to combine it with some subset of a
different topic. Many chunks of information belong to multiple topics
and you can't always remember if you filed under one or the other.
Therefore I think this tag-based approach would be much more flexible.

I have experience with doing a few simple apps in Tkinter and also a
db driven site in TurboGears. I'm not sure what framework I should use
for this. I generally would prefer gtk because of responsiveness and
nice looks, but it may be a bit tough since I never did any gtk
development at all. Should I prototype in Tkinter? Would Django be
better suited for this or TurboGears?

Of course there isn't any need to do anything if there is already an
app that does this. Please tell me if it does, or if there is
something very close that could have this set of features added
easily. I was thinking about wikis, in fact. I might be best off
starting with a wiki done in TurboGears and going from there. I'd get
html markup pages right away, with links, nice formatting.. TG has
many components that could be useful for this app.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Information manager/organizer with tags question.

2007-11-12 Thread andrei . avk
On Nov 12, 2:24 pm, Aaron Watters <[EMAIL PROTECTED]> wrote:
> On Nov 11, 5:44 pm, [EMAIL PROTECTED] wrote:
>
> > Hello,
>
> > I would like to write an information manager/organizer type of app but
> > first I'd like to ask if there is something like that already...
>
> Your outline sounds like a killer app, and I don't know of anything
> like
> it (especially for free).  However, I have to plug nucular as a
> possible
> back end data store that may make it easier for you to implement the
> app you outlined.  Please have a look:
>
>  http://nucular.sourceforge.net
>
> See the "demos" for examples of what you can do with it very easily.
>-- Aaron Watters
>
> ===http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=unsuspecting+v...

Sounds interesting and thanks for reply but I need something that will
work in windows also.. -andrei

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Information manager/organizer with tags question.

2007-11-13 Thread andrei . avk
On Nov 13, 12:42 pm, Wildemar Wildenburger
<[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hello,
>
> > [snip outline of an information editor]
>
> Maybe the Literary Machine?
> http://sommestad.com/lm.htm>
>
> It is a bit weird at first, and Windows only (altough I have had it
> running under wine once). But it is actually really well designed and
> very powerful.

I installed it and looked at flash demos, however, I have a couple of
questions.. is there a way to filter by several keywords? Is there a
way to sort by keywords? Is there a way to add a new keyword to a
topic
that isn't in the list of keywords?



>
> Or, if it ever comes out (I've been waiting for it for YEARS now),
> perhaps Ceryle would fit the bill:
>
> http://www.altheim.com/ceryle/wiki/>

This is also interesting.. the biggest two issues for my purposes is
that it doesn't have a UI geared for the usage I was thinking of. I
was thinking of something along the lines of Treepad, which is an
incredible program because it makes operations so easy and quick to
do. ceryle seems like emacs to treepad's (and my intended program's)
vim. It just occured to me that I might want to try to hack vim into
doing this.. I'll have to think about that. It's also a little
alarming
that they didn't get it out in years. This is a very bad sign. It
looks
bloated imho.

My idea is that several key actions should be incredibly easy to do,
i.e.:
1. add keyword - already a field on screen, just click and type
2. add existing keyword out of favorites list - click a toolbar button
3. sort by keyword - popup already on screen
4. filtering by two / three keywords is the most common usage scenario
and
therefore should be possible in 3 clicks - one for each keyword.

Otherwise, if these actions are buried somewhere, you will simply not
use
them often enough to make the whole thing consistently searchable by
the
tags. You will think "oh wait I can search for that tag and that other
one"
and then you will think "did I add keywords to that item?".

I'd like to try to make it possible to have tags as an integral and
inherent
part of each and every doc. Otherwise they'll end up like webpage tags
-
a bit of help with adding weight to full search.

I don't mean to criticize these programs, they're very interesting and
I'm
glad you brought them to my attention. I'm not sure I understood the
first
one properly, it may be that it is possible to do what I'm thinking of
in it,
I just didn't spot that in the interface. Please help if that is the
case!

However they seem to have different focus and that's important because
both
are closed, at least now, so it's not the case I was thinking of of
some
light simple wiki system where I'd have to add a few features.

Again, thanks for your response! -andrei

>
> There once was some code to download, but I couldnt get it to compile.
> The guy who writes the software is a really approachable, nice guy.
> Maybe if you contact him and politely prod him into finally getting the
> thing out, nobody will ever need to write any information manager anymore.
>
> /W


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Information manager/organizer with tags question.

2007-11-13 Thread andrei . avk
On Nov 13, 12:42 pm, Wildemar Wildenburger
<[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hello,
>
> > [snip outline of an information editor]
>
> Maybe the Literary Machine?
> http://sommestad.com/lm.htm>
>
> It is a bit weird at first, and Windows only (altough I have had it
> running under wine once). But it is actually really well designed and
> very powerful.

I installed it and looked at flash demos, however, I have a couple of
questions.. is there a way to filter by several keywords? Is there a
way to sort by keywords? Is there a way to add a new keyword to a
topic
that isn't in the list of keywords?



>
> Or, if it ever comes out (I've been waiting for it for YEARS now),
> perhaps Ceryle would fit the bill:
>
> http://www.altheim.com/ceryle/wiki/>

This is also interesting.. the biggest two issues for my purposes is
that it doesn't have a UI geared for the usage I was thinking of. I
was thinking of something along the lines of Treepad, which is an
incredible program because it makes operations so easy and quick to
do. ceryle seems like emacs to treepad's (and my intended program's)
vim. It just occured to me that I might want to try to hack vim into
doing this.. I'll have to think about that. It's also a little
alarming
that they didn't get it out in years. This is a very bad sign. It
looks
bloated imho.

My idea is that several key actions should be incredibly easy to do,
i.e.:
1. add keyword - already a field on screen, just click and type
2. add existing keyword out of favorites list - click a toolbar button
3. sort by keyword - popup already on screen
4. filtering by two / three keywords is the most common usage scenario
and
therefore should be possible in 3 clicks - one for each keyword.

Otherwise, if these actions are buried somewhere, you will simply not
use
them often enough to make the whole thing consistently searchable by
the
tags. You will think "oh wait I can search for that tag and that other
one"
and then you will think "did I add keywords to that item?".

I'd like to try to make it possible to have tags as an integral and
inherent
part of each and every doc. Otherwise they'll end up like webpage tags
-
a bit of help with adding weight to full search.

I don't mean to criticize these programs, they're very interesting and
I'm
glad you brought them to my attention. I'm not sure I understood the
first
one properly, it may be that it is possible to do what I'm thinking of
in it,
I just didn't spot that in the interface. Please help if that is the
case!

However they seem to have different focus and that's important because
both
are closed, at least now, so it's not the case I was thinking of of
some
light simple wiki system where I'd have to add a few features.

Again, thanks for your response! -andrei

>
> There once was some code to download, but I couldnt get it to compile.
> The guy who writes the software is a really approachable, nice guy.
> Maybe if you contact him and politely prod him into finally getting the
> thing out, nobody will ever need to write any information manager anymore.
>
> /W


-- 
http://mail.python.org/mailman/listinfo/python-list


Open a file with default handler app?

2008-03-11 Thread andrei . avk
Hi, I searched for this on google and in this group, but my awesome
google-fu powers failed me. Is there a way to open any file using
default program that'd open it? In other words, to do the same action
as double-clicking in windows explorer? And secondly, is there a way
to do the same thing for linux that'd work across all desktop
environments and distributions, or at least in all major ones? What
I'm trying to do here is to have records (or items) in my app where
you could attach any kind of file and open it from there by clicking
'open'. Then it would go and do something like os.system("launch %s" %
filename). So any way to do this except for keeping your own
dictionary of file types and relevant apps? thx, -ak
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Open a file with default handler app?

2008-03-12 Thread andrei . avk
On Mar 11, 11:50 pm, [EMAIL PROTECTED] wrote:

>
> Hey there,
> I've had to do the same things for a program that I'm writing. The
> following command should do the trick:
>
> os.startfile("yourfilehere")
>
> from the os module. Hope this helps!

That's perfect, thanks a ton++!
-- 
http://mail.python.org/mailman/listinfo/python-list


escape string to store in a database?

2008-03-12 Thread andrei . avk
Hi, I'd like to store chunks of text, some of them may be very large,
in a database, and have them searchable using 'LIKE %something%'
construct. These pieces of text may have single and double quotes in
them, I tried escaping them using re module and string module and
either I did something wrong, or they escape either single quotes or
double quotes, not both of these. So that when I insert that text into
a db record, this causes an error from the database. What's the
accepted way of dealing with this? I have a workaround currently where
I encode the string with b64, and then unencode it when searching for
a string, but that's a dumb way to do this. For my app, searching
quickly is not very crucial, but would be nice to have.. thanks, -ak
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: a Roguelike in Python

2008-03-12 Thread andrei . avk
On Mar 12, 8:25 am, [EMAIL PROTECTED] wrote:
> Seeing the 7DRL start up recently, i wanted to see what one was made
> of. Python is the language i'm most familiar with so i searched for
> some code to look at, but i couldn't find any. Can anyone direct me to
> the right place?
>
> I did some searching on what it would take to write a roguelike in
> python and it looked like the curses module would work perfectly, but
> it looks to me like it doesn't work in windows? I tried to import it
> and it says 'No Module named _curses'
>
> Sorry if all this sounds a bit noobish, it's only cause i am.

I made a very small basic roguelike, except that in it you control
the monsters instead of the hero. It uses curses so no worky in
windows.
Here:

http://silmarill.org/nodes/I,_monster_game.html

I later modified this game to control the hero and sometimes to ask
you multiple-choice questions from biology and other fields of
knowledge,
and based on your right/wrong answer it either makes a Hit for your HP
or gives you a small reward. If there's interest i can post that
updated
game too. Both are kind of buggy though.. -ak
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: escape string to store in a database?

2008-03-13 Thread andrei . avk
 On Mar 12, 8:32 pm, Carsten Haese <[EMAIL PROTECTED]> wrote:
> On Wed, 2008-03-12 at 18:18 -0700, [EMAIL PROTECTED] wrote:
> > These pieces of text may have single and double quotes in
> > them, I tried escaping them using re module and string module and
> > either I did something wrong, or they escape either single quotes or
> > double quotes, not both of these. So that when I insert that text into
> > a db record, this causes an error from the database. What's the
> > accepted way of dealing with this?
>
> The accepted way of dealing with this is to use parameter binding:
>
> conn = somedbmodule.connect(...)
> cur = conn.cursor()
> cur.execute("insert into sometable(textcolumn) values (?)",
>             (stringvar,) )
>
> (Note that the question mark may have to be replaced with %s depending
> on which database module you're using.)
>
> For background information on parameter binding see, for 
> example,http://informixdb.blogspot.com/2007/07/filling-in-blanks.html.
>
> HTH,
>
> --
> Carsten Haesehttp://informixdb.sourceforge.net

Thanks for the reply, Carsten, how would this work with UPDATE
command? I get this error:

cmd = "UPDATE items SET content = ? WHERE id=%d" % id

self.cursor.execute(cmd, content)
pysqlite2.dbapi2.ProgrammingError: Incorrect number of bindings
supplied. The c
rrent statement uses 1, and there are 0 supplied.

Sqlite site doesn't give any details on using parameter bindings in
UPDATE command, I'm
going to look around some more.. -ak
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: escape string to store in a database?

2008-03-14 Thread andrei . avk
On Mar 14, 1:36 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Thu, 13 Mar 2008 19:55:27 -0700 (PDT), [EMAIL PROTECTED] declaimed
> the following in comp.lang.python:
>
>
>
> > Thanks for the reply, Carsten, how would this work with UPDATE
> > command? I get this error:
>
> >         cmd = "UPDATE items SET content = ? WHERE id=%d" % id
>
>                 cmd = "update items set content = ? where id = ?"
>
> >     self.cursor.execute(cmd, content)
>
>                 self.cursor.execute(cmd, (content, id))
>
> would be the preferred method...

Thanks very much - this works perfectly -ak

>
> --
>         Wulfraed        Dennis Lee Bieber               KD6MOG
>         [EMAIL PROTECTED]               [EMAIL PROTECTED]
>                 HTTP://wlfraed.home.netcom.com/
>         (Bestiaria Support Staff:               [EMAIL PROTECTED])
>                 HTTP://www.bestiaria.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: replace string in a file

2008-03-15 Thread andrei . avk
On Mar 15, 3:54 pm, Unknown <[EMAIL PROTECTED]> wrote:
> Hi,
> I've got this code :
>
> cb = open("testfile", "r+")
> f = cb.readlines()
> for line in f:
>     rx = re.match(r'^\s*(\d+).*', line)
>     if not rx:
>         continue
>     else:
>         serial = rx.group(1)
>         now = time.time()
>         today = time.strftime('%Y%m%d00', time.localtime(now))
>         todayVal, serialVal = long(today), long(serial)
>         if todayVal <= serialVal:
>             todayVal = serialVal + 1
>         else:
>             todayVal += 1
>         line = string.replace(line, serial, "%d" %todayVal)
>         cb.write(line + "\n")
>         print 'Updated serial from "%s" to "%d"' % ( serial, todayVal )
>         break      
> cb.close()
>
> I was expecting to replace the old value (serial) with the new one
> (todayVal). Instead, this code *adds* another line below the one found...
>
> How can I just replace it?
>
> Thanks for your help :-)

What you want to do is either 1. load everything up into a string,
replace
text, close file, reopen it with 'w' flag, write string to it. OR if
file is too big, you can read each line, replace, write to a temp
file,
then when done move the file over the old one.

I think there are technical reasons why file-reading and iteration api
are not very suitable for reading and writing at the same time. I
think
you'd have to set the filepointer back one line (it can be manipulated
by giving it bytes ahead/back, so that would be difficult in itself),
then delete the line and then write new string. It may be even harder
than
that, I'm sure someone can explain this much better, but you're far
better
off with using one of the 2 methods above.. HTH, -ak
-- 
http://mail.python.org/mailman/listinfo/python-list