MealMaster: Decoding text file format to database

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
infratec
Always Here
Always Here
Posts: 7582
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: MealMaster: Decoding text file format to database

Post by infratec »

Hi Fangbeast,

I updated my code above again.

With the memory stuff, I gave up :oops:
All took longer than the ReadString() stuff.

But I included a fileseek for the details, wich should be faster and easier for the disk.

I fixed also a small bug for the ingredients.

Bernd
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: MealMaster: Decoding text file format to database

Post by Fangbeast »

Moderator, Please remove this post, outdated.
Last edited by Fangbeast on Mon Jan 14, 2013 1:44 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: MealMaster: Decoding text file format to database

Post by Fangbeast »

Moderator, Please remove this post, outdated.
Last edited by Fangbeast on Mon Jan 14, 2013 1:44 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
infratec
Always Here
Always Here
Posts: 7582
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: MealMaster: Decoding text file format to database

Post by infratec »

Hi Fangbeast,

in general, I would only improve the import/reading procedure.
Than think about a good database structure.
Maybe relational with own tables for categories, titles ...
But it can be that this is to oversized.

After you have a database, write your program arround it.

Or take the same database structure as KRecipe
http://krecipes.sourceforge.net/

Than you can simply ...

Or take a look at http://thinkle.github.com/gourmet/

But I still think it make sense to create a 'standalone single file' program.
Without the need of installing or using something else.

And with PB you have the chance to be available on all major OSs.

Bernd
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: MealMaster: Decoding text file format to database

Post by yrreti »

?? This is good stuff :D

Although it is a little pain to find usable ico's
Why don't you move this topic to the Application Section?
It may not be complete yet, but it's getting there.
I know one thing. When it's done, it will make my wife pretty
happy. :wink: Perhaps then she won't mind me spending so much
time programming? :lol:

yrreti
infratec
Always Here
Always Here
Posts: 7582
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: MealMaster: Decoding text file format to database

Post by infratec »

Oh,

do you have a PC in your kitchen :?:

Normally not.
What can you use in a kittchen ?

A netbook ? Than it's ok, a 'normal' OS.
A Pad ?

Hm, than you have to implement a webserver, so that the recipes
can be accessed by a browser.
Or Fred has to port PB to android. :mrgreen:

Bernd
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: MealMaster: Decoding text file format to database

Post by Fangbeast »

Moderator, Please remove this post, outdated.
Last edited by Fangbeast on Mon Jan 14, 2013 1:45 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: MealMaster: Decoding text file format to database

Post by Fangbeast »

Moderator, Please remove this post, outdated.
Last edited by Fangbeast on Mon Jan 14, 2013 1:45 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: MealMaster: Decoding text file format to database

Post by yrreti »

My Quote:
I know one thing. When it's done, it will make my wife pretty happy. Perhaps then she won't mind me spending so much time programming?
Fangbeast Quote:
And just who do you think is the cause of my doing this???
She who must not be named, constantly tearing out recipes, getting me to scan to pdf and sort them??? I am doing this program in my self defence!
:lol: :lol: :lol: Looks like we've got the same problem, although thank goodness she has her own laptop.
But you sure have gotten a nice start on the program, and I like the interface you made too. When it gets finished, I can see a real
need for this. Especially when you can go online and download, or even add your own recipes to it.

infratec
do you have a PC in your kitchen
She does thank goodness! I can't complain much though, she's a great cook! :D

yrreti
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: MealMaster: Decoding text file format to database

Post by Fangbeast »

Moderator, Please remove this post, outdated.
Last edited by Fangbeast on Mon Jan 14, 2013 1:45 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: MealMaster: Decoding text file format to database

Post by electrochrisso »

I have still got to make time to check out what you have done so far Fangbeast, just let me know where you might need some help, and keep up the good work. :)
PureBasic! Purely the best 8)
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: MealMaster: Decoding text file format to database

Post by Fangbeast »

Moderator, Please remove this post, outdated.
Last edited by Fangbeast on Mon Jan 14, 2013 1:45 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: MealMaster: Decoding text file format to database

Post by yrreti »

Hi Fangbeast
I'm sorry to hear that you are still indisposed. :( We all hope that you can beat your illness too.
As to your program. I like the program idea 'your wife' influenced you to start, and it would be
nice to be able to finish it. But do it as you are able too. I'm sure others here could help you too.
:idea: What would be nice is to have a Project Topic added in the main list, where some could work
together on a project, offer suggestions, or to help complete it. I do not know very much about using
sqlite, and wouldn't probably venture that way. Although you can learn about using sqlite from what
others add.
But here is some code that you can use for 'any program' that gives you the program version info that
you were looking for.
In your programs code, at the top, enter this code:

Code: Select all

ver$="2.5"; you need to put the version # you want here.
;Create includes directory in Compiler Home directory, and use #PB_Compiler_Home as below.
IncludeFile #PB_Compiler_Home + "includes\cdt.pb"
vcdt$="Version: "+ver$+Chr(10)+Chr(10)+"Creation Date & Time: "+Chr(10)+cdt$;I use this with a MessageBox
In your programs main window, add this hot key, or just put vcdt$ in your version box w/o the Chr(10)'s.
(I just use the hot key method: Ctrl Alt v to open a MessageBox)

Code: Select all

;Put your #name of window here in place of #main_Window
AddKeyboardShortcut(#main_Window, #PB_Shortcut_Control|#PB_Shortcut_Alt|#PB_Shortcut_V, #CtrlAltv) ;vcdt$ view version date time
Create a directory in your purebasic folder called includes.
Compile the following code as CompileDateTime.exe and place in your purebasic folder.
**** Directions for setting up as a tool are in the code. ****
This program creates the file cdt.pb in your \includes directory
(parts of this code was from others in this forum)

Code: Select all

;This program creates a Date Time file called cdt.pb, which can be included in your programs compiled exe 

; Compile program With the name CompileDateTime.exe. To configure, click Tools > Configure Tools > Click New
; Now edit to something similar:
; Commandline: 'Browse' to "CompileDateTime.exe" (mine is:  D:\PureBasic\CompileDateTime.exe )
;no args needed
;Working Directory: D:\PureBasic\
;Name: "CompileDateTime"
; Event To trigger the tool: Before Create Executable
; check Wait until tool quits  and to prevent an annoying console from popping up every save, I have Run Hidden checked
;

;EnableExplicit  ;I removed as too much hassle.

#C12HOUR = 12 ; silly constants, trying to pretend to be a clock!
#C24HOUR = 24

Procedure$ GetDate()  
Protected Result$, gMonth, gDay$, gYear$, monthNames$
gMonth     = Month(Date())
gDay$       = Str(Day(Date()))
gYear$      = Str(Year(Date()))
monthNames$ = "January|February|March|April|May|June|July|August|September|October|November|December"

; give each day ending with 1, 2, 3, 4... 23,24 etc their proper ordinal suffix
Select gDay$
Case "1", "21","31"
  gDay$ + "st"
Case "2","22"
  gDay$ + "nd"
Case "3","23"
  gDay$ + "rd"
Default
  gDay$ + "th"
EndSelect
Result$ = StringField(monthNames$, gMonth, "|") + " " + gDay$ + ", " + gYear$
ProcedureReturn  Result$
EndProcedure

Procedure$ GetTime(const)
; depending on user settings, should this date be displayed as a 24 hour clock, or 12 hour?
; format 12 hour clock...
Protected gHour,gHour_n,gMeridiem$,gTime$
gHour.i = Hour(Date())

If const = #C12HOUR ; this is my crappy time conversion function which will add meridiem if the 12 hour clock is used
  If gHour>= 13
    gHour_n.i = gHour.i - 12
    gMeridiem$ = "PM"
  Else
    If gHour.i = 0
      gHour_n = 12
    EndIf
    gHour_n.i = gHour.i
    gMeridiem$ = "AM"
  EndIf
  gTime$ = Str(gHour_n.i) + ":" + FormatDate("%ii:%ss",Date()) + " " + gMeridiem$
  ProcedureReturn gTime$
ElseIf const = #C24HOUR
  gTime$ = FormatDate("%hh:%ii:%ss",Date())
  ProcedureReturn gTime$
EndIf
EndProcedure

pp$=GetPathPart(ProgramFilename())
;Debug pp$
If Right(pp$,1)<>"\"
  pp$+"\"
EndIf

pp$=pp$+"includes\";now place this in includes dir

gtdate$=GetDate()
gttime$=GetTime(#C12HOUR)

dat$="last modified: " + gtdate$ + " at " + gttime$

CreateFile(1,pp$+"cdt.pb")
WriteString(1,"cdt$="+Chr(34)+dat$+Chr(34))
CloseFile(1)
yipes time flies got to go.
hope this is useful to you

yrreti
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: MealMaster: Decoding text file format to database

Post by Fangbeast »

Moderator, Please remove this post, outdated.
Last edited by Fangbeast on Mon Jan 14, 2013 1:46 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: MealMaster: Decoding text file format to database

Post by Fangbeast »

Moderator, Please remove this post, outdated.
Last edited by Fangbeast on Mon Jan 14, 2013 1:46 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Post Reply