469,898 Members | 1,853 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

recommendations for personal journaling application

Hi. I've been sort of standing back on the sidelines reading this list
for awhile, and this is my first posting. So a little about myself and
my skill level. My name is Bryan. I'm new to Python and have very
little experience. I've gone through a few of the tutorials. I
understand the different data-types, basic syntax, functions and
function definition, basic iteration, and calling from modules.

I might be getting ahead of myself, but I think the best way for me to
learn things is by having a goal and working towards it. My goal is to
create a personal command line journaling application. I would like to
store all the entries in one file, have them searchable by keywords,
date, topic, etc... I think I would like to use "/*" type commands. For
instance, you call the application from a terminal window and start
with a generic prompt. You would type '/ne /t "topic"' to begin a new
entry and assign the topic; '/d' to set a date. You should be able to
use the slash commands while editing as well. For instance while
writing in an entry you could isolate a phrase or word with /k "phrase
to be marked as searchable keyword" / to mark the enclosed text as a
searchable keyword/keyphrase.

So what I'm interested in is how this would work. Is this 'event
driven' in nature? Would I define the bulk of these slash commands in a
function and then call it at the end of the script? What would be a
good module to look at for the text processing and searching aspects?
Anyways, I'm not sure how you would create a program that would
"listen" for commands and then parse them accordingly. I think for
starters I will sketch out on paper the slash commands I need, and try
to break apart the general operations into pseudo code. How would you
all approach this?

Thank you all and I hope I'm not biting off too much at once...

Oct 8 '06 #1
4 1168
Hi!

Donnie Rhodes wrote:
So what I'm interested in is how this would work. Is this 'event
driven' in nature? Would I define the bulk of these slash commands in a
function and then call it at the end of the script? What would be a
good module to look at for the text processing and searching aspects?
For implementing the commandline interface, have a look at the getopt
module.

If you store your data in a flat text file, you might use string.find()
or the re module to do the searching. The re module can search case
insensitive and is more versatile.

But maybe you want let your script create some SQL statements and use
the pysqlite module to store and search the data.

Kind regards,
Karsten.

Oct 8 '06 #2
Ant

Donnie Rhodes wrote:
....
>
Thank you all and I hope I'm not biting off too much at once...
Not if you break it up into pieces. Look at the things you want to do,
and in the first instance, create a function for each. Then you can
start to fill in the blanks, and if neccessary ask back here for advice
on each bit.

For example, your skeleton script may look something like:

def main():
options = get_options()
text = fetch_body()
entry_data = parse_text(text, options)
store_entry(entry_data)

def get_options():
pass

def fetch_body()
pass
....

if __name__ == "__main__":
main()

Ideas for the various parts:

get_options() - getopt or optparse modules (the former is simpler to
start with);

fetch_body() - just read from sys.stdin (that way you can also pipe
text into it from a file or the output from another program as well);

parse_text() - regexes could suffice if the flags and what they are
supposed to do is simple, otherwise a grammar parsing module could be
useful such as pyparsing (http://pyparsing.wikispaces.com/);

store_entry() - I'd probably go with XML for the storage format if you
really want to store the entries in a single text file, as you can
structure it well, there are good tools in python 2.5 for building xml
(xml.etree.ElementTree) and you could implement a fast search engine
using SAX. Otherwise a database may be a better option (e.g. sqlite).

Oct 8 '06 #3

"Donnie Rhodes" <da****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
keyword/keyphrase.
>
So what I'm interested in is how this would work. Is this 'event
driven' in nature?
I would call it line-input driven -- a special case that is easier to
program.
Would I define the bulk of these slash commands in a
function and then call it at the end of the script?
I would consider a dict mapping command letters to functions.

tjr

Oct 8 '06 #4
before you use re there is a quote I have seen on different boards to
remember. So you have a problem and you want to use re now you have
two problems.!!!! It was someone from thescripts.com that helped me
realise how to fix my program without re. (sorry if I have thier
website name somewhat wrong.
https://sourceforge.net/project/show...kage_id=202823
Donnie Rhodes wrote:
Hi. I've been sort of standing back on the sidelines reading this list
for awhile, and this is my first posting. So a little about myself and
my skill level. My name is Bryan. I'm new to Python and have very
little experience. I've gone through a few of the tutorials. I
understand the different data-types, basic syntax, functions and
function definition, basic iteration, and calling from modules.

I might be getting ahead of myself, but I think the best way for me to
learn things is by having a goal and working towards it. My goal is to
create a personal command line journaling application. I would like to
store all the entries in one file, have them searchable by keywords,
date, topic, etc... I think I would like to use "/*" type commands. For
instance, you call the application from a terminal window and start
with a generic prompt. You would type '/ne /t "topic"' to begin a new
entry and assign the topic; '/d' to set a date. You should be able to
use the slash commands while editing as well. For instance while
writing in an entry you could isolate a phrase or word with /k "phrase
to be marked as searchable keyword" / to mark the enclosed text as a
searchable keyword/keyphrase.

So what I'm interested in is how this would work. Is this 'event
driven' in nature? Would I define the bulk of these slash commands in a
function and then call it at the end of the script? What would be a
good module to look at for the text processing and searching aspects?
Anyways, I'm not sure how you would create a program that would
"listen" for commands and then parse them accordingly. I think for
starters I will sketch out on paper the slash commands I need, and try
to break apart the general operations into pseudo code. How would you
all approach this?

Thank you all and I hope I'm not biting off too much at once...
Oct 8 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Robert Schneider | last post: by
14 posts views Thread by Lester Manry | last post: by
23 posts views Thread by craig | last post: by
1 post views Thread by Billy Biro | last post: by
3 posts views Thread by Stinky Pete | last post: by
1 post views Thread by Cramer | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.