recommendations for personal journaling application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Donnie Rhodes

    #1

    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...

  • Karsten W.

    #2
    Re: recommendations for personal journaling application

    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.

    Comment

    • Ant

      #3
      Re: recommendations for personal journaling application


      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(ent ry_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.Elem entTree) and you could implement a fast search engine
      using SAX. Otherwise a database may be a better option (e.g. sqlite).

      Comment

      • Terry Reedy

        #4
        Re: recommendations for personal journaling application


        "Donnie Rhodes" <daddyb@gmail.c omwrote in message
        news:1160330083 .041100.127480@ e3g2000cwe.goog legroups.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



        Comment

        • Eric_Dexter@msn.com

          #5
          Re: recommendations for personal journaling application

          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...

          Comment

          Working...