DatebookDB

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

DatebookDB

abm0000abm-2
Can someone give me a sample code for opening the DatebookDB, in plua2,
please ?





------------------------ Yahoo! Groups Sponsor --------------------~-->
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply | Threaded
Open this post in threaded view
|

Re: DatebookDB

Morten Agerlin Petersen (MAP)
--- In [hidden email], discmoko <no_reply@...> wrote:
>
> Can someone give me a sample code for opening the DatebookDB, in
plua2,
> please ?
>

Well for opening DateBook? - Yes
To understand whats read - somehow ;-)

I've been trying to write an application tracking duration of
appointments in Datebook (especially some marked with an "@"), but I
haven't been able to break all the formatting and finish it.

It lists the date, text and duration of your appointments, but it
only works on "normal" appointments. When it comes to recurring
appointments or appointment with alarms, the text is strange or
missing.

Please observe: You have to scroll through ALL of your appointments
to finish the program (or reset your PDA).

If you manage to break more of the formatting, please let me know!

Good luck

Morten

-- P2List datebk.lua
ui.clear()
ui.destroy()
ui.title("Length of Appointments")
io.write("Use down key for next:\n")

f,n = io.open("db:/DatebookDB", "r")

recnr=ui.field(1,20,20, "", nil,nil) ui.nl()
for i = 0,n-1,1 do  
-- Clear screen for every 10th record
if math.mod(i,10)==0 then ui.clear()
ui.title("Length of Appointments")
io.write("Use down key for next:\n")
ui.nl() ui.nl()
 end
ui.settext(recnr,"Reading rec#: " ..i.."/"..n)
f:openrec( i)    
s = f:read("*a")  
if s~=nil then
-- Break the binary formatting:
d = util.unpack('BBBBWWS', s)
 if string.sub(d[7],1,1)~="@" then
if d~=nil then
-- Calculate duration:
v=d[4]/60+d[3]-(d[2]/60)-d[1]

-- Extract the date (perhaps it can be done more directly than this
matematical conversion of a binary number?)
year=1904
month=0
day=0
x=15
bin=d[5]

while x>=0 do
        x=math.floor(math.log(bin)/math.log(2))
        bin=bin-2^x
        if x>=9 then year= year+ 2^(x-9) end
        if 9>x and x>=5 then month= month+2^(x-5) end
        if 5>x and x>=0 then day= day+2^(x-0) end
end --while

io.write(day,"-",month,"-",year)
ui.tab()
 io.write(d[7])
ui.tab()
io.write(v," hours\n")
while ui.event()~=ui.keyDown do end
end

 end
end
collectgarbage()
end  
f:close()






------------------------ Yahoo! Groups Sponsor --------------------~-->
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply | Threaded
Open this post in threaded view
|

Re: DatebookDB

burkemat
--- In [hidden email], "m_agerlin" <map@...> wrote:
>
> Well for opening DateBook? - Yes
> To understand whats read - somehow ;-)
>
> I've been trying to write an application tracking duration of
> appointments in Datebook (especially some marked with an "@"), but I
> haven't been able to break all the formatting and finish it.
>


Check http://palmos.com/dev and search through the knowledgebase.
Both the source code for the datebook application and a document
describing the database format are available.

Matt

P.S. Or, at least, used to be available <g/>






------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply | Threaded
Open this post in threaded view
|

Re: DatebookDB

abm0000abm-2
In reply to this post by Morten Agerlin Petersen (MAP)
Thanks for your help :)

I already got your code in Plua1 and managed to convert it in Plua2 ;)
Very useful !
I will try to understand more formatting, if I manage, i'll post my
code.
note : You have a little bug in your code.
if string.sub(d[7],1,1)~="@" then ....
return an error if the record is empty.

Good work :)

--- In [hidden email], "m_agerlin" <map@...> wrote:

>
> --- In [hidden email], discmoko <no_reply@> wrote:
> >
> > Can someone give me a sample code for opening the DatebookDB, in
> plua2,
> > please ?
> >
>
> Well for opening DateBook? - Yes
> To understand whats read - somehow ;-)
>
> I've been trying to write an application tracking duration of
> appointments in Datebook (especially some marked with an "@"), but
I

> haven't been able to break all the formatting and finish it.
>
> It lists the date, text and duration of your appointments, but it
> only works on "normal" appointments. When it comes to recurring
> appointments or appointment with alarms, the text is strange or
> missing.
>
> Please observe: You have to scroll through ALL of your appointments
> to finish the program (or reset your PDA).
>
> If you manage to break more of the formatting, please let me know!
>
> Good luck
>
> Morten
>
> -- P2List datebk.lua
> ui.clear()
> ui.destroy()
> ui.title("Length of Appointments")
> io.write("Use down key for next:\n")
>
> f,n = io.open("db:/DatebookDB", "r")
>
> recnr=ui.field(1,20,20, "", nil,nil) ui.nl()
> for i = 0,n-1,1 do  
> -- Clear screen for every 10th record
> if math.mod(i,10)==0 then ui.clear()
> ui.title("Length of Appointments")
> io.write("Use down key for next:\n")
> ui.nl() ui.nl()
>  end
> ui.settext(recnr,"Reading rec#: " ..i.."/"..n)
> f:openrec( i)    
> s = f:read("*a")  
> if s~=nil then
> -- Break the binary formatting:
> d = util.unpack('BBBBWWS', s)
>  if string.sub(d[7],1,1)~="@" then
> if d~=nil then
> -- Calculate duration:
> v=d[4]/60+d[3]-(d[2]/60)-d[1]
>
> -- Extract the date (perhaps it can be done more directly than this
> matematical conversion of a binary number?)
> year=1904
> month=0
> day=0
> x=15
> bin=d[5]
>
> while x>=0 do
> x=math.floor(math.log(bin)/math.log(2))
> bin=bin-2^x
> if x>=9 then year= year+ 2^(x-9) end
> if 9>x and x>=5 then month= month+2^(x-5) end
> if 5>x and x>=0 then day= day+2^(x-0) end
> end --while
>
> io.write(day,"-",month,"-",year)
> ui.tab()
>  io.write(d[7])
> ui.tab()
> io.write(v," hours\n")
> while ui.event()~=ui.keyDown do end
> end
>
>  end
> end
> collectgarbage()
> end  
> f:close()
>







------------------------ Yahoo! Groups Sponsor --------------------~-->
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/