Keeper GSPOC (simplistic info manager. Source project

Share your advanced PureBasic knowledge/code with the community.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

Keeper GSPOC (Great Steaming Pile Of Crap) source code project for PB 5.24.

I use this to keep track of serial numbers, logins, passwords, registration data etc using a simple EditorGadget interface that saves it as RTF data and it does what I need. It is the big mother version of SerialMuncher/Password muncher, but without the funny name:(

Still needs polishing, parts updating but it's getting there. Use the hell out of it and provide feedback (if you like) but it's made for my needs.

http://members.westnet.com.au/bangfeast/Files/Keeper.7z
Amateur Radio, D-STAR/VK3HAF
User avatar
electrochrisso
Addict
Addict
Posts: 979
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: Keeper GSPOC (simplistic info manager. Source project

Post by electrochrisso »

I have downloaded it Fang, because I want to look at your sqLite coding, I hope that it is not too steamy. :)
PureBasic Rocks! Even More! And More!
PureBasic 5, Now We're Really Rockin!
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

electrochrisso wrote:I have downloaded it Fang, because I want to look at your sqLite coding, I hope that it is not too steamy. :)
Oh, it's definately steamy ROFL!

Didn't you feel the Murray Darling, the Yarra and all the others lower their banks??? (All the steam production!!)
Amateur Radio, D-STAR/VK3HAF
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

Just finished cleaning up variables, error messages, procedure names etc. Also added in the Import feature.

Only thing left to do is printing and figuring out a nice looking routine to fire up the buttons without having to have three graphics per action.

Can't think of anything else.

Same link as first message.
Amateur Radio, D-STAR/VK3HAF
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Keeper GSPOC (simplistic info manager. Source project

Post by PB »

Fangbeast, I just noticed "not Sydney" in your avatar.
I grew up in Sydney, my boy. What's wrong with it? :twisted:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

PB wrote:Fangbeast, I just noticed "not Sydney" in your avatar.
I grew up in Sydney, my boy. What's wrong with it? :twisted:
Well, you young whippersnappers who think Sydney is the bee's knees and can call us "my boy" because you wear long pants and call them shorts don't realise that drinking your water all these years has fermented your brains:):):)

Melbourne water rules Oz!! And let's face it, Sydney girls are vain!! Our entertainment and transport is better too:):)

Damn, can't think of anything else to insult Sydneites because I am too tired. MUst stp these 1am coding sessions.
Amateur Radio, D-STAR/VK3HAF
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Shield »

Well guys you might want to stop arguing, Perth tops anything anyways. :lol:
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

Shield wrote:Well guys you might want to stop arguing, Perth tops anything anyways. :lol:
Perth?? What's that?? I had a biscuit called Perth once, tasted like Sydney water:):)

HEhehehehehe...

/me falls off the chair laughing
Amateur Radio, D-STAR/VK3HAF
ozzie
Enthusiast
Enthusiast
Posts: 395
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: Keeper GSPOC (simplistic info manager. Source project

Post by ozzie »

Looks like a handy utility - but compilation failed. Then I noticed it was written for PB 5.24. Up here in Qld I'm using 5.31. Qld, of course, has far more interesting politicians, past and present, than any other state.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

but compilation failed. Then I noticed it was written for PB 5.24. Up here in Qld I'm using 5.31.
I'll put 5.31 on and test to see what needs changing. if it's API, i'm more rooted than a constituent's bum at voting time!
Qld, of course, has far more interesting politicians, past and present, than any other state.
Interesting????? What's the difference between a politician and a vampire??? One is a blood sucking, feral, pus ridden undead fiend from hell sucking the life out of us. The other is an innocent vampire that can't help its' nature!!
Amateur Radio, D-STAR/VK3HAF
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

Ozzie, chuck this procedure into this directory, overwriting the old one. It was the

CreateXMLNode(RootXMLNode(*XmlTree)) code that needed an extra parameter to look like this to work under 5.31

CreateXMLNode(RootXMLNode(*XmlTree),"")

XIncludeFile "Modules\Export\_ExportDataItems.pbi" ; Export data data to a standard XML file

Code: Select all

;==========================================================================================================================================================
; Export appointment data to a standard XML file
;==========================================================================================================================================================

Procedure ExportDataItems()

  ;------------------------------------------------------------------------------------------------
  ; Process the current table name and dump the contents to an XML file on disk
  ;------------------------------------------------------------------------------------------------
  
  QueryString.s = "SELECT * FROM Keeper"
  
  If DatabaseQuery(Program\DatabaseHandle,  QueryString.s)
    
    ;----------------------------------------------------------------------------------------------
    ; Process the next returned row
    ;----------------------------------------------------------------------------------------------
    
    While NextDatabaseRow(Program\DatabaseHandle)
      
      ;--------------------------------------------------------------------------------------------
      ; Have we created this XML tree already?
      ;--------------------------------------------------------------------------------------------
      
      If *XmlTree = 0
        
        *XmlTree = CreateXML(#PB_Any)                                                       ; Creates a new empty XML tree identified by the #XML number
        
        *RootXmlNode = CreateXMLNode(RootXMLNode(*XmlTree),"")                                 ; Creates a new XML node and inserts it into the given parent node. 
        
        SetXMLNodeName(*RootXmlNode, #Program)                                              ; Changes the tagname of the given XML node (root in this case)
        
      EndIf
      
      ;--------------------------------------------------------------------------------------------
      ; Creates a new XML node and inserts it into main XML node of the tree.
      ;--------------------------------------------------------------------------------------------
      
      *RowNode = CreateXMLNode(MainXMLNode(*XmlTree),"")
      
      ;--------------------------------------------------------------------------------------------
      ; If the main node was created, dump all the columns using the column names as node names
      ;--------------------------------------------------------------------------------------------
      
      If *RowNode
        
        ;------------------------------------------------------------------------------------------
        ; Get the column names and write them first
        ;------------------------------------------------------------------------------------------
        
        NumberOfColumns.i = DatabaseColumns(Program\DatabaseHandle)
        
        ;------------------------------------------------------------------------------------------
        ; Iterate through the columns
        ;------------------------------------------------------------------------------------------
        
        For ColumnNamesLoop.i = 0 To NumberOfColumns.i -1
          
          CurrentColumn.s = DatabaseColumnName(Program\DatabaseHandle, ColumnNamesLoop.i)
          
          *ColumnNode = CreateXMLNode(*RowNode,"")                                             ; Creates a new XML node and inserts it into main XML node of the tree.
          
          SetXMLNodeText(*ColumnNode, TextToXml(GetDatabaseString(Program\DatabaseHandle,  ColumnNamesLoop.i)))
          
        Next                                                                                ; Next column
        
        ;------------------------------------------------------------------------------------------
        ; Main node wasn't created, exit out of this procedure
        ;------------------------------------------------------------------------------------------
        
      Else
        
        SetInfoBarArea("Headings",  "Error",  "Could not create the export data file.")
        
        ProcedureReturn
        
      EndIf
      
      ;--------------------------------------------------------------------------------------------
      ; 
      ;--------------------------------------------------------------------------------------------
      
    Wend
    
    ;----------------------------------------------------------------------------------------------
    ; 
    ;----------------------------------------------------------------------------------------------
    
    FinishDatabaseQuery(Program\DatabaseHandle)
    
    ;----------------------------------------------------------------------------------------------
    ; 
    ;----------------------------------------------------------------------------------------------
    
    If *XmlTree
      
      FormatXML(*XmlTree, #PB_XML_ReFormat)
      
      SaveXML(*XmlTree, Program\TemporaryDirectory + #Program + "_Export.xml")
      
      FreeXML(*XmlTree)
      
      SetInfoBarArea("Headings",  "Info",  "Data exported to " + Program\TemporaryDirectory)
      
    EndIf
    
    ;----------------------------------------------------------------------------------------------
    ; The database query has failed for some reason
    ;----------------------------------------------------------------------------------------------
    
  Else
    
    SetInfoBarArea("Headings",  "Error",  "The database query failed or was empty. " + DatabaseError())
    
  EndIf
  
  ;------------------------------------------------------------------------------------------------
  ; 
  ;------------------------------------------------------------------------------------------------
  
  TextFileId.i = CreateFile(#PB_Any, Program\TemporaryDirectory + #Program + "_Export.txt")
  
  ;------------------------------------------------------------------------------------------------
  ; 
  ;------------------------------------------------------------------------------------------------
  
  If TextFileId.i <> 0
    
    ;----------------------------------------------------------------------------------------------
    ; 
    ;----------------------------------------------------------------------------------------------
    
    If DatabaseQuery(Program\DatabaseHandle,  "SELECT Title, Information FROM Keeper")
      
      While NextDatabaseRow(Program\DatabaseHandle)
        
        TitleString.s       = KillQuote(GetDatabaseString(Program\DatabaseHandle, 0))
        
        InformationString.s = KillQuote(GetDatabaseString(Program\DatabaseHandle, 1))
        
        WriteStringN(TextFileId.i, "Title: " + TitleString.s)
        
        WriteStringN(TextFileId.i, "")
        
        WriteStringN(TextFileId.i, "Info:  " + InformationString.s)
        
        WriteStringN(TextFileId.i, "")
        
        WriteStringN(TextFileId.i, "")
        
        WriteStringN(TextFileId.i, "----------------------------------------------------------------------------------------------------")
        
      Wend
      
      FinishDatabaseQuery(Program\DatabaseHandle)
      
      MessageRequester("Export finished", "Keeper XML data and text files have been saved in this directory:" + Chr(10) + Chr(13) + Chr(10) + Chr(13) + Program\TemporaryDirectory)
    EndIf
    
    ;----------------------------------------------------------------------------------------------
    ; 
    ;----------------------------------------------------------------------------------------------
    
    CloseFile(TextFileId)  
    
    ;----------------------------------------------------------------------------------------------
    ; 
    ;----------------------------------------------------------------------------------------------
    
  EndIf
  
  ;------------------------------------------------------------------------------------------------
  ; 
  ;------------------------------------------------------------------------------------------------

EndProcedure

Amateur Radio, D-STAR/VK3HAF
User avatar
electrochrisso
Addict
Addict
Posts: 979
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: Keeper GSPOC (simplistic info manager. Source project

Post by electrochrisso »

Fangbeast wrote:
electrochrisso wrote:I have downloaded it Fang, because I want to look at your sqLite coding, I hope that it is not too steamy. :)
Oh, it's definately steamy ROFL!

Didn't you feel the Murray Darling, the Yarra and all the others lower their banks??? (All the steam production!!)
Now I am too scared to look, the irrigation is already lowering the level too much. :lol:
PureBasic Rocks! Even More! And More!
PureBasic 5, Now We're Really Rockin!
ozzie
Enthusiast
Enthusiast
Posts: 395
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: Keeper GSPOC (simplistic info manager. Source project

Post by ozzie »

Compiles OK now under 5.31. Looks good - you've put a lot of work into this, so well done! Can't get it to save anything yet, but I'll follow the code to see what's going on, when I get some time.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

Can't get it to save anything yet, but I'll follow the code to see what's going on, when I get some time.
Just tested it here under pb 5.23 to see how far back I could go, created a dummy record and it saved fine.

There will be a new build uploaded tonight.

1. Simple web gadget based printing added.
2. Print window has PrintNow and Preview job buttons.
3. The dratted control bar now hides the way it was supposed to, and saves state.

Problems:

1. Can't seem to get the password window to set focus to the password field, haven't figured out why yet.

2. Program is not in unicode mode because I had too much trouble when I converted my old database to a uncode one merely by importing it and I don't feel like sitting there for the next six months trying to figure it out.

That's all I can think of for now.
Amateur Radio, D-STAR/VK3HAF
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4644
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Keeper GSPOC (simplistic info manager. Source project

Post by Fangbeast »

Updated source project (with primitive printing) uploaded. Link in first post.
Amateur Radio, D-STAR/VK3HAF
Post Reply