EN | NL | FR
Current Wings Quest 130
Rainbow Connection

Palm Dreamspell Program.

Post new topic Reply to topic

Author  Message 
Inch
Dream Deity
Dream Deity
35
Posts: 515
Joined: 13 Feb 2005
Last Visit: 11 Mar 2011
Location: Whangarei, New Zealand
 
Palm Dreamspell Program.
PostPosted: Thu 24 Mar, 2005  Reply with quote

Hey all,

I'm making a dreamspell calendar for my Palm PDA. It doesn't do much at the moment. It'll support PalmOS 3.5 or later. I've searched the net for open source GPL software but can't find anything. Hopefully that means I'll be the first to write a free 13 moon calendar program for Palm . If anyone knows of any other program let me know. I don't really want to re-invent the wheel.

Anyway I'll post screenshots and code sniplets here. It seems there are a lot of programmers on this forum.


back to top
Inch
Dream Deity
Dream Deity
35
Posts: 515
Joined: 13 Feb 2005
Last Visit: 11 Mar 2011
Location: Whangarei, New Zealand
 
PostPosted: Thu 24 Mar, 2005  Reply with quote

Here's what I got so far



I'm going to have to shink the graphics to get more room. I might put it against the side too, will get more room. Any ideas for a name?


back to top
Pantalimon
Crossroads dweller
Astral Explorer
Posts: 311
Joined: 15 May 2002
Last Visit: 26 Jan 2007
Location: UK or maybe the Lucid Crossroads
 
PostPosted: Thu 24 Mar, 2005  Reply with quote

Cool ^^

Palmspell sounds catchy


back to top
Pantalimon
Crossroads dweller
Astral Explorer
Posts: 311
Joined: 15 May 2002
Last Visit: 26 Jan 2007
Location: UK or maybe the Lucid Crossroads
 
PostPosted: Thu 24 Mar, 2005  Reply with quote

If I had to wish for a perfect prog it would be a Dreamspell calendar diary grin

back to top
AstareGod
astareglobe owner
Astral Explorer
Posts: 301
Joined: 15 May 2003
Last Visit: 20 Dec 2008
Location: US
 
PostPosted: Thu 24 Mar, 2005  Reply with quote

I programmed a dreamspell/date converter program and I'll be happy to share my code with you. It's in vb.net, however, and I'm not too sure how to program on palm-based OS's. Let me know if I can help.

back to top
Inch
Dream Deity
Dream Deity
35
Posts: 515
Joined: 13 Feb 2005
Last Visit: 11 Mar 2011
Location: Whangarei, New Zealand
 
PostPosted: Thu 24 Mar, 2005  Reply with quote

Pantalimon:

Awesome name! Sounds very catchy, I like it very much. Palmspell.

AstareGod:

Cool, If it's not to long you could just post it here. I'm using C because I can use freeware software tools. But it's easy enough to convert it.

This is what I'm using at the moment. Hopefully it'll get shorter.

Code:

//Finds the kin for 1904 + day
UInt16 GetKin(UInt32 day)
{
   UInt16 k;
   k = (day + 212 + LeapYears(day)) % 260; //Kin for today
   return k;
}

//Returns the number of leapyears between 1904 and day/
//day is the number of days since 1904.
UInt16 LeapYears(UInt32 day)
{
   UInt32 l, a, b, c;
   
    a = (int)(((double)day - 59.0) / (YEAR_LEN * 4.0));             //Adds a leap year for every 4 years
    b = (int)(((double)day + 1401.0) / (YEAR_LEN * 100.0));       //Subtracts a leap year for every 100 years
    c = (int)(((double)day + 110974.0) / (YEAR_LEN * 400.0));    //Adds a leap year for every 400 years

    l = a - b + c + 1;
   return l;
}


back to top
AstareGod
astareglobe owner
Astral Explorer
Posts: 301
Joined: 15 May 2003
Last Visit: 20 Dec 2008
Location: US
 
PostPosted: Thu 24 Mar, 2005  Reply with quote

here goes! The following code is from the Tzolkin Date Converter v 1.1 programmed by Tony Gulino. It is written in VB.NET 2002.

A couple of tips on the terminology
GIndex - The day of the year. January 1 corresponds to 1. If the current year is a leap year and the date is after Feb 28, the GIndex is subtracted by 1. Today has a GIndex of 83.

MIndex - The day of the 13/28 year. July 26 corresponds to 1. Today has an MIndex of 242.

HIndex - The signature index. For example, today (Yellow Rhythmic Sun) has an HIndex of 240.

MoonIndex - moon number. The Solar moon would be 9 (the tone names are also the same as the moon names).

DayIndex - day of the current moon. Today would be day 18.

ToneIndex - number from 1 to 13 that represents the tone.

TribeIndex - number from 1 to 20 that represents the tribe.

I'm sure you could get the general idea from the code below and just rewrite it in C. If you have Windows 98 or later and the .NET framework v1.1, I can send you the program so you can see more how it uses the following modules. If you need any help with the code, let me know.

Quote:
Module Conversion
Public Structure TzDate
Dim GIndex, MIndex, HIndex, ToneIndex, TribeIndex, MoonIndex, DayIndex As Integer
End Structure

Public Function GenerateTzDate(ByVal GDate As DateTime) As TzDate
Dim NewTzDate As New TzDate()

With NewTzDate
'Get GIndex, MIndex, and HIndex
.GIndex = GetGIndexFromGDate(GDate)
.MIndex = GetMIndexFromGIndex(.GIndex)
.HIndex = GetHIndexFromMIndex(.MIndex, GetMYearDifferenceFromGDate(GDate))

'Get Tone and Tribe Indices
.ToneIndex = GetToneIndexFromHIndex(.HIndex)
.TribeIndex = GetTribeIndexFromHIndex(.HIndex)

'Get Moon and Day Indices
.MoonIndex = GetMoonIndexFromMIndex(.MIndex)
.DayIndex = GetDayIndexFromMIndex(.MIndex)
End With

Return NewTzDate
End Function

Public Function GetGIndexFromGDate(ByVal GregorianDate As System.DateTime) As Integer
Dim GIndex As Integer = GregorianDate.DayOfYear
If System.DateTime.DaysInMonth(GregorianDate.Year, 2) = 29 And GregorianDate.Month > 2 Then
GIndex -= 1
End If

Return GIndex
End Function

Public Function GetToneName(ByVal ToneNumber As Integer) As String
Select Case ToneNumber
Case 1
Return "Magnetic"
Case 2
Return "Lunar"
Case 3
Return "Electric"
Case 4
Return "Self-existing"
Case 5
Return "Overtone"
Case 6
Return "Rhythmic"
Case 7
Return "Resonant"
Case 8
Return "Galactic"
Case 9
Return "Solar"
Case 10
Return "Planetary"
Case 11
Return "Spectral"
Case 12
Return "Crystal"
Case 13
Return "Cosmic"
Case Else
Return "invalid"
End Select
End Function

Public Function GetTribeName(ByVal TribeNumber As Integer) As String
Select Case TribeNumber
Case 1
Return "Dragon"
Case 2
Return "Wind"
Case 3
Return "Night"
Case 4
Return "Seed"
Case 5
Return "Serpent"
Case 6
Return "World-bridger"
Case 7
Return "Hand"
Case 8
Return "Star"
Case 9
Return "Moon"
Case 10
Return "Dog"
Case 11
Return "Monkey"
Case 12
Return "Human"
Case 13
Return "Skywalker"
Case 14
Return "Wizard"
Case 15
Return "Eagle"
Case 16
Return "Warrior"
Case 17
Return "Earth"
Case 18
Return "Mirror"
Case 19
Return "Storm"
Case 20
Return "Sun"
Case Else
Return "invalid"
End Select
End Function

Public Function GetMIndexFromGIndex(ByVal GIndex As Integer) As Integer
Dim MIndex As Integer = GIndex - 206
Do
If MIndex < 1 Then MIndex += 365
If MIndex > 365 Then MIndex -= 365
Loop Until (MIndex > 0 And MIndex < 366)
Return MIndex
End Function

Public Function GetHIndexFromMIndex(ByVal MIndex As Integer, ByVal YearDifference As Integer) As Integer
'Using year signature from 2005: 104
'take MIndex of Jul 26, 2005 (104) and

Dim HIndex As Integer = 104 + YearDifference * 365 + MIndex - 1
Do
If HIndex < 1 Then HIndex += 260
If HIndex > 260 Then HIndex -= 260
Loop Until (HIndex > 0 And HIndex < 261)
Return HIndex
End Function

Public Function GetMYearCodeFromGDate(ByVal GregorianDate As Date) As Integer
Dim MYearCode As Integer

MYearCode = GetHIndexFromMIndex(1, GetMYearDifferenceFromGDate(GregorianDate))
Return MYearCode
End Function

Public Function GetMYearDifferenceFromGDate(ByVal GregorianDate As Date) As Integer
Dim YearDifference As Integer = GregorianDate.Year - 2005

If GregorianDate.Month < 7 Or (GregorianDate.Month = 7 And GregorianDate.Day < 26) Then
YearDifference -= 1
End If
Return YearDifference
End Function

Public Function GetToneIndexFromHIndex(ByVal HIndex As Integer) As Integer
Dim ToneIndex As Integer = HIndex Mod 13
If ToneIndex = 0 Then
ToneIndex = 13
End If
Return ToneIndex
End Function

Public Function GetTribeIndexFromHIndex(ByVal HIndex As Integer) As Integer
Dim TribeIndex As Integer = HIndex Mod 20
If TribeIndex = 0 Then
TribeIndex = 20
End If
Return TribeIndex
End Function

Public Function GetMoonIndexFromMIndex(ByVal MIndex As Integer) As Integer
Dim MoonIndex As Integer = MIndex \ 28 + 1

If GetDayIndexFromMIndex(MIndex) = 28 Then
MoonIndex -= 1
End If
Return MoonIndex
End Function

Public Function GetDayIndexFromMIndex(ByVal MIndex As Integer) As Integer
Dim DayIndex As Integer = MIndex Mod 28
If DayIndex = 0 Then
DayIndex = 28
End If
Return DayIndex
End Function

Public Function GetTribeColorFromTribeIndex(ByVal TribeIndex As Integer) As String
Select Case TribeIndex Mod 4
Case 0
Return "Yellow"
Case 1
Return "Red"
Case 2
Return "White"
Case 3
Return "Blue"
Case Else
Return "Invalid"
End Select
End Function
End Module


back to top
explora
Dream Deity
Dream Deity
36
Posts: 944
Joined: 23 May 2002
Last Visit: 30 Jul 2012
Location: melbourne, australia
 
PostPosted: Thu 24 Mar, 2005  Reply with quote

wow you guys are cool!

it is great to see all these new dreamspell programs coming into existence... SHould be interesting to see how this project develops.

Nick


back to top
Inch
Dream Deity
Dream Deity
35
Posts: 515
Joined: 13 Feb 2005
Last Visit: 11 Mar 2011
Location: Whangarei, New Zealand
 
PostPosted: Fri 25 Mar, 2005  Reply with quote

Hey AstareGod,
I'm not sure I'll be able to use your code. Palm uses dates in the format number of seconds since midnight 1904/01/01.

I will use a format similar to that. Number of days since 1904/07/26. It should make the code very simple.

This is all base 0.

Year = (days - leapYears) / 365
DayOfYear = (Year - int(Year)) * 365
DayOfMonth = DayOfYear Mod 28
Month = int(DayOfYear / 13)

If the month is 13 then it's the Day Out of Time.

What's cool about this, It deals with the leap years automatically, If you are past the leap day in a leap year it will subtract an extra day from the day of year.

Other reason to use this code is that I want to stay away from the gregorian calendar. I want this calendar to work by itself.


back to top
AstareGod
astareglobe owner
Astral Explorer
Posts: 301
Joined: 15 May 2003
Last Visit: 20 Dec 2008
Location: US
 
PostPosted: Fri 25 Mar, 2005  Reply with quote

yep Inchworm! My code depends greatly on the Gregorian calendar, simply because Windows (and .NET) give it a lot of functionality that I can use right out of the box. Eventually I will rewrite my code to work mostly off of moon dates and galactic signatures instead of the Gregorian date. This will probably appear in my version 1.2 of my converter program. I guess I'll work on that sometime over my spring break, then release it on my website...

I wish you the best of luck with your program! I'm glad I could help (even though I didn't help much smile )


back to top
Inch
Dream Deity
Dream Deity
35
Posts: 515
Joined: 13 Feb 2005
Last Visit: 11 Mar 2011
Location: Whangarei, New Zealand
 
PostPosted: Fri 25 Mar, 2005  Reply with quote

Got everything working now. Just need to tidy up the inteface and add things like those daily affirmations thingies to it and the week day and symbol. Any other things I should put it?

Also need to make a better way to navigate dates.



back to top
AstareGod
astareglobe owner
Astral Explorer
Posts: 301
Joined: 15 May 2003
Last Visit: 20 Dec 2008
Location: US
 
PostPosted: Fri 25 Mar, 2005  Reply with quote

Inchworm: in my date converter program, I programmed a duration feature. This allows the user to skip ahead or backwards a duration of:
1 day
7 days (one week)
13 days (one wavespell)
20 days (one harmonic run)
28 days (one moon)
260 days (one Tzolkin cycle)
365 days (one year)

I did this by putting a dropdown box with the above choices and having the user choose a duration, then click Back or Next.

Your program looks great! A little minor issue would be that the "Red" "Resonant" and "Dragon" are not all on the same line, but that's more of a personal preference.


back to top
Inch
Dream Deity
Dream Deity
35
Posts: 515
Joined: 13 Feb 2005
Last Visit: 11 Mar 2011
Location: Whangarei, New Zealand
 
PostPosted: Fri 25 Mar, 2005  Reply with quote

That's a great idea. The dropdown will save a lot of room instead of have lots of different navigation buttons.

Purhaps I should put "Red Resonant Dragon" on the same line. I'll have to drop "Kin xxx" off the front because it wont fit otherwise.

This is the first program I've made for Palm. So the interface side is rather new to me.


back to top
AstareGod
astareglobe owner
Astral Explorer
Posts: 301
Joined: 15 May 2003
Last Visit: 20 Dec 2008
Location: US
 
PostPosted: Fri 25 Mar, 2005  Reply with quote

or perhaps put the kin # right under the Moon day (Solar Moon, Day 19) so that it's to the right of the signature picture. just an idea... I think the kin # is an important feature (I've found uses for it after I added it to my program) so I think you'll be better off leaving it in there, but moving it to the right of the picture.

back to top
Qu
Founder
Site Admin
Qu has successfully completed an LD4all Quest!
46
Chat Mods
Scribes
Posts: 11045
Joined: 05 May 2002
Last Visit: 12 Nov 2019
LD count: lost uhm lots
Location: behind you
 
PostPosted: Fri 25 Mar, 2005  Reply with quote

wow inch you work fast!

i have to get myself a palmtop now grin


back to top
Display posts from previous:
Post new topic Reply to topic

print  

All times are GMT + 2 Hours
Jump to:  


Powered by phpBB
LD4all ~ spreading the art and knowledge of lucid dreaming online since 1996 ~