Welcome Guest
Log In | Register )
You last visited December 7, 2016, 8:59 pm
All times shown are
Eastern Time (GMT-5:00)

Parsing

Topic closed. 91 replies. Last post 12 years ago by Sedertree.

Page 4 of 7
PrintE-mailLink
Developer's avatar - logo2 small.jpg
Somerset
United Kingdom
Member #9710
December 17, 2004
184 Posts
Offline
Posted: January 25, 2005, 2:54 pm - IP Logged

Thinking back when I made my converter, you will find it hard to tell if its a powerball/bonus or normal lottery number.

This really got me for a few days, until I wrote a list of rules for each draw so the parser knows pri to parsing which line is the extra ball.

Good luck, it took me a week when I did it but can convert anything I find now.

    Developer's avatar - logo2 small.jpg
    Somerset
    United Kingdom
    Member #9710
    December 17, 2004
    184 Posts
    Offline
    Posted: January 25, 2005, 3:02 pm - IP Logged

    O by the way in real use may code snippit would be inline and return a value, what I mean is its a function so it should return a value not a msgbox

    So in the real world use it somthing like this

    Private Sub Command1_Click()
    If Len(SplitString(Text1.Text)) <> 0 Then MsgBox SplitString(Text1.Text)
    End Sub

    Function SplitString(WhatString As String)
    Dim SplitStr() As String
    Dim SplitCount As Double
    Dim TheResult As String

    Dim I As Double
        SplitCount = 0
        TheResult = ""
       
    If SplitCount <= 0 Then SplitStr = Split(WhatString, " ", 20, vbTextCompare): SplitCount = UBound(SplitStr)
    If SplitCount <= 0 Then SplitStr = Split(WhatString, ",", 20, vbTextCompare): SplitCount = UBound(SplitStr)

        For I = 0 To SplitCount ' Loop through each split
            If IsDate(SplitStr(I)) Then TheResult = TheResult & " " & Val(SplitStr(I))
            If IsNumeric(SplitStr(I)) Then TheResult = Val(SplitStr(I)) & " " & TheResult
        Next I

        SplitString = TheResult
       
    End Function

      Avatar
      East Jordan, MI
      United States
      Member #2
      June 1, 2001
      675 Posts
      Offline
      Posted: January 25, 2005, 3:31 pm - IP Logged

      Developer,

      That's definately some good advice as I prepare to start the actual conversions.  Thanks for the tips.

        Avatar

        United States
        Member #986
        January 5, 2003
        280 Posts
        Offline
        Posted: January 25, 2005, 6:39 pm - IP Logged

        George, Expert Lotto's import wizard is awesome for importing database files.

          Developer's avatar - logo2 small.jpg
          Somerset
          United Kingdom
          Member #9710
          December 17, 2004
          184 Posts
          Offline
          Posted: January 28, 2005, 6:52 pm - IP Logged

          Another tip you may find usefull, use replace to get rid f all the rubbish in many files.

          Heres one I made earlier

          Function RemoveSpecialChrs(WhatString As String) As String
          Dim sConts As String
                  sConts = WhatString
                  sConts = Replace(sConts, vbBack, vbCrLf)
                  sConts = Replace(sConts, vbTab, " ")
                  sConts = Replace(sConts, vbCrLf, vbCrLf)
                  sConts = Replace(sConts, vbLf, vbCrLf)
                  sConts = Replace(sConts, vbVerticalTab, vbCrLf)
                  sConts = Replace(sConts, vbFormFeed, vbCrLf)
                  sConts = Replace(LCase(sConts), "    ", " ")
                  sConts = Replace(LCase(sConts), "  ", " ")
                  sConts = Replace(LCase(sConts), "  ", " ")
                  sConts = Trim(sConts)
                  RemoveSpecialChrs = sConts
          End Function
          Function RemoveChrs(WhatString As String) As String
          Dim sConts As String
                  sConts = WhatString
                  sConts = Replace(LCase(sConts), " ", " ")
                  sConts = Replace(LCase(sConts), " ", " ")
                  sConts = Replace(LCase(sConts), "", ",")
                  sConts = Replace(LCase(sConts), " ,", ",")
                  sConts = Replace(LCase(sConts), "", " ")
                  sConts = Replace(LCase(sConts), ",", " ")
                  sConts = Replace(LCase(sConts), "[", " ")
                  sConts = Replace(LCase(sConts), "]", " ")
                  sConts = Replace(LCase(sConts), "{", " ")
                  sConts = Replace(LCase(sConts), "}", " ")
                  sConts = Replace(LCase(sConts), "£", " ")
                  sConts = Replace(LCase(sConts), "$", " ")
                  sConts = Replace(LCase(sConts), "!", " ")
                  sConts = Replace(LCase(sConts), "%", " ")
                  sConts = Replace(LCase(sConts), "^", " ")
                  sConts = Replace(LCase(sConts), "&", " ")
                  sConts = Replace(LCase(sConts), "*", " ")
                  sConts = Replace(LCase(sConts), "(", " ")
                  sConts = Replace(LCase(sConts), ")", " ")
                  sConts = Replace(LCase(sConts), "+", " ")
                  sConts = Replace(LCase(sConts), "-", " ")
                  sConts = Replace(LCase(sConts), "=", " ")
                  sConts = Replace(LCase(sConts), "    ", " ")
                  sConts = Replace(LCase(sConts), "  ", " ")
                  sConts = Replace(LCase(sConts), "  ", " ")
                  sConts = Trim(sConts)
                  RemoveChrs = sConts
          End Function
          Function RemoveLetters(WhatString As String) As String
          Dim sConts As String
                  sConts = WhatString
                  sConts = Replace(LCase(sConts), "q", "")
                  sConts = Replace(LCase(sConts), "w", "")
                  sConts = Replace(LCase(sConts), "e", "")
                  sConts = Replace(LCase(sConts), "r", "")
                  sConts = Replace(LCase(sConts), "t", "")
                  sConts = Replace(LCase(sConts), "y", "")
                  sConts = Replace(LCase(sConts), "u", "")
                  sConts = Replace(LCase(sConts), "i", "")
                  sConts = Replace(LCase(sConts), "o", "")
                  sConts = Replace(LCase(sConts), "p", "")
                  sConts = Replace(LCase(sConts), "a", "")
                  sConts = Replace(LCase(sConts), "s", "")
                  sConts = Replace(LCase(sConts), "d", "")
                  sConts = Replace(LCase(sConts), "f", "")
                  sConts = Replace(LCase(sConts), "g", "")
                  sConts = Replace(LCase(sConts), "h", "")
                  sConts = Replace(LCase(sConts), "j", "")
                  sConts = Replace(LCase(sConts), "k", "")
                  sConts = Replace(LCase(sConts), "l", "")
                  sConts = Replace(LCase(sConts), "z", "")
                  sConts = Replace(LCase(sConts), "x", "")
                  sConts = Replace(LCase(sConts), "c", "")
                  sConts = Replace(LCase(sConts), "v", "")
                  sConts = Replace(LCase(sConts), "b", "")
                  sConts = Replace(LCase(sConts), "n", "")
                  sConts = Replace(LCase(sConts), "m", "")
                  sConts = Replace(LCase(sConts), "    ", " ")
                  sConts = Replace(LCase(sConts), "  ", " ")
                  sConts = Replace(LCase(sConts), "  ", " ")
                  sConts = Trim(sConts)
                  RemoveLetters = sConts
          End Function

            Developer's avatar - logo2 small.jpg
            Somerset
            United Kingdom
            Member #9710
            December 17, 2004
            184 Posts
            Offline
            Posted: January 28, 2005, 6:53 pm - IP Logged

            Almost made it for you now

            So when will it be ready then?

            Jamie

              Todd's avatar - Cylon 2.gif
              Chief Bottle Washer
              New Jersey
              United States
              Member #1
              May 31, 2000
              23267 Posts
              Online
              Posted: January 28, 2005, 7:33 pm - IP Logged

              Developer,

              Only the first Replace() function needs to contain the lcase() function.  After that is executed, the sConts is all lower-case, so there's no point to waste CPU cycles by continuing to execute lcase().

               

              Check the State Lottery Report Card
              What grade did your lottery earn?

               

              Sign the Petition for True Lottery Drawings
              Help eliminate computerized drawings!

                Avatar
                East Jordan, MI
                United States
                Member #2
                June 1, 2001
                675 Posts
                Offline
                Posted: January 29, 2005, 2:15 am - IP Logged

                Dang Jamie,



                That's enough to choke a horse. lol



                I've coded in high gear for a few days now (in my spare time of course). A lot of things have come together and the app is looking and running very well. I have a somewhat anal attention to detail so I always seem to find "little" things that need tweaked. Either for speed, program flow or aesthetics.



                I re-coded the ST filters last night. A discovered how the original programmer set the values for those filters. This will come in handy at a later time.



                I haven't finished with the converter yet. With your code posted here, I'll be able to make short work of converting "difficult" drawfiles when the time comes.



                While I'm thinking about it. I have a special place on the About form for recognizing individuals who have made outstanding contributions of their time. If you're interested, PM or email me and I'll make sure you are included on the contributing developers list.



                Tonight I am adding a little something to the distribution chart. I am color coding the histograms based on whether the digits are <, > or = to the expected pr's. I'll put up a legend for the color codes.



                Back to work,

                  Todd's avatar - Cylon 2.gif
                  Chief Bottle Washer
                  New Jersey
                  United States
                  Member #1
                  May 31, 2000
                  23267 Posts
                  Online
                  Posted: January 29, 2005, 9:21 am - IP Logged

                  Another speed tip:  When you're using whole numbers, always use either Integer or Long data types, not Double or some other real number data type.  Computers handle integers substantially faster.

                   

                  Check the State Lottery Report Card
                  What grade did your lottery earn?

                   

                  Sign the Petition for True Lottery Drawings
                  Help eliminate computerized drawings!

                    Developer's avatar - logo2 small.jpg
                    Somerset
                    United Kingdom
                    Member #9710
                    December 17, 2004
                    184 Posts
                    Offline
                    Posted: January 30, 2005, 4:11 pm - IP Logged

                    Yes Todd is right about the Lcase() thing

                    So I have revamped it for you Sedertree

                    Function RemoveSpecialChrs(WhatString As String) As String
                    Dim sConts As String
                            sConts = LCase(WhatString)
                            sConts = Replace(sConts, vbBack, vbCrLf)
                            sConts = Replace(sConts, vbTab, " ")
                            sConts = Replace(sConts, vbLf, vbCrLf)
                            sConts = Replace(sConts, vbVerticalTab, vbCrLf)
                            sConts = Replace(sConts, vbFormFeed, vbCrLf)
                            sConts = Replace(sConts, "    ", " ")
                            sConts = Replace(sConts, "  ", " ")
                            RemoveSpecialChrs = Trim(sConts)
                    End Function
                    Function RemoveChrs(WhatString As String) As String
                    Dim sConts As String
                            sConts = LCase(WhatString)
                            sConts = Replace(sConts, " ", " ")
                            sConts = Replace(sConts, " ", " ")
                            sConts = Replace(sConts, "", ",")
                            sConts = Replace(sConts, " ,", ",")
                            sConts = Replace(sConts, "", " ")
                            sConts = Replace(sConts, ",", " ")
                            sConts = Replace(sConts, "[", " ")
                            sConts = Replace(sConts, "]", " ")
                            sConts = Replace(sConts, "{", " ")
                            sConts = Replace(sConts, "}", " ")
                            sConts = Replace(sConts, "£", " ")
                            sConts = Replace(sConts, "$", " ")
                            sConts = Replace(sConts, "!", " ")
                            sConts = Replace(sConts, "%", " ")
                            sConts = Replace(sConts, "^", " ")
                            sConts = Replace(sConts, "&", " ")
                            sConts = Replace(sConts, "*", " ")
                            sConts = Replace(sConts, "(", " ")
                            sConts = Replace(sConts, ")", " ")
                            sConts = Replace(sConts, "+", " ")
                            sConts = Replace(sConts, "-", " ")
                            sConts = Replace(sConts, "=", " ")
                            sConts = Replace(sConts, "    ", " ")
                            sConts = Replace(sConts, "  ", " ")
                            sConts = Replace(sConts, "  ", " ")
                            RemoveChrs = Trim(sConts)
                    End Function
                    Function RemoveLetters(WhatString As String) As String
                    Dim sConts As String
                            sConts = LCase(WhatString)
                            sConts = Replace(sConts, "q", "")
                            sConts = Replace(sConts, "w", "")
                            sConts = Replace(sConts, "e", "")
                            sConts = Replace(sConts, "r", "")
                            sConts = Replace(sConts, "t", "")
                            sConts = Replace(sConts, "y", "")
                            sConts = Replace(sConts, "u", "")
                            sConts = Replace(sConts, "i", "")
                            sConts = Replace(sConts, "o", "")
                            sConts = Replace(sConts, "p", "")
                            sConts = Replace(sConts, "a", "")
                            sConts = Replace(sConts, "s", "")
                            sConts = Replace(sConts, "d", "")
                            sConts = Replace(sConts, "f", "")
                            sConts = Replace(sConts, "g", "")
                            sConts = Replace(sConts, "h", "")
                            sConts = Replace(sConts, "j", "")
                            sConts = Replace(sConts, "k", "")
                            sConts = Replace(sConts, "l", "")
                            sConts = Replace(sConts, "z", "")
                            sConts = Replace(sConts, "x", "")
                            sConts = Replace(sConts, "c", "")
                            sConts = Replace(sConts, "v", "")
                            sConts = Replace(sConts, "b", "")
                            sConts = Replace(sConts, "n", "")
                            sConts = Replace(sConts, "m", "")
                            sConts = Replace(sConts, "    ", " ")
                            sConts = Replace(sConts, "  ", " ")
                            sConts = Replace(sConts, "  ", " ")
                            RemoveLetters = Trim(sConts)
                    End Function

                      Developer's avatar - logo2 small.jpg
                      Somerset
                      United Kingdom
                      Member #9710
                      December 17, 2004
                      184 Posts
                      Offline
                      Posted: January 30, 2005, 4:32 pm - IP Logged

                      This will blow you away then, some ideas I have been playing with for my next software release

                      I am re-making my lottery program http://www.lsa-lottery-software.com but taking a much more hard lined approch to it.

                      I want the program to generate the following statistics



                      1. Percents versus totals in true perspective to one another

                      2. Analyzing trends through graphs and comparing with other trends found in selected date ranges

                      3. Histogram's showing symmetric, skewed right, skewed left, bell-shaped, and the variability in the data

                      4. Comparing means to medians and standard deviation's

                      5. Using percentiles to determing the best numbers in groups

                      6. Probability with Statistics, Estimating, Predicting and quality checking of all these against past results making tweaks as needed.

                      7. Reports measuring the above results variability against the next draws results and then self tweaking algo.

                      8. Starting with a Hypothesis Test and working through comparing samples of various sizes.

                      I need help any one got any source code or tips on implementing all the above into my next release.

                      Jamie

                        Developer's avatar - logo2 small.jpg
                        Somerset
                        United Kingdom
                        Member #9710
                        December 17, 2004
                        184 Posts
                        Offline
                        Posted: January 30, 2005, 5:49 pm - IP Logged

                        Ok a double was not the best choice but using a Double in that function will not effect its preformance in any way

                        Look at the function it will only loop 6 maybe seven times before it ends.

                        Try it speed test against other datatypes

                        If you wanted to choose the best type use Byte, but I have tested many times and simple routines such as the one I posted are not effected to that level of preformance

                        Double 64-bit should be used when high accuracy is needed
                        Integer 16-bit, only use if accuracy in numbers is not that important
                        Byte takes 8-bit, very fast good for loops and data transferrs
                        Single 32-bit When you need fractional numbers
                        Long takes 32-bit use Long variables instead of Integers to increase performance

                        I have added timer code just to prove my point

                        Private Sub Command1_Click()
                        If Len(SplitString(Text1.Text)) <> 0 Then MsgBox SplitString(Text1.Text)
                        End Sub

                        Function SplitString(WhatString As String)
                        Dim SplitStr() As String
                        Dim SplitCount As Double
                        Dim TheResult As String
                        Dim TimeIn As Date
                        Dim Timeout As Date

                        TimeIn = Timer

                        Dim I As Double ' byte ,long, Integer
                            SplitCount = 0
                            TheResult = ""
                           
                        If SplitCount <= 0 Then SplitStr = Split(WhatString, " ", 20, vbTextCompare): SplitCount = UBound(SplitStr)
                        If SplitCount <= 0 Then SplitStr = Split(WhatString, ",", 20, vbTextCompare): SplitCount = UBound(SplitStr)

                            For I = 0 To SplitCount ' Loop through each split
                                If IsDate(SplitStr(I)) Then TheResult = TheResult & " " & Val(SplitStr(I))
                                If IsNumeric(SplitStr(I)) Then TheResult = Val(SplitStr(I)) & " " & TheResult
                            Next I

                            SplitString = TheResult
                           
                            Timeout = Timer
                        MsgBox Timeout - TimeIn

                        End Function

                          Avatar
                          East Jordan, MI
                          United States
                          Member #2
                          June 1, 2001
                          675 Posts
                          Offline
                          Posted: January 30, 2005, 9:42 pm - IP Logged

                          Jamie,



                          I'm not much for the pick-5 + games but your app is really something to behold. Very nice work......



                          I've been working today on the graphs. Decided to up the number of draws the user can check for frequency. I had to make the up/down number of draws go in increments of ten. I can't have the program telling someone that two digits have the same occurrence, but one is higher than the expected probability and the other isn't. Don't want to deal with fractional probabilities. Don't think users want to know that a digit is hitting at 2.5% over the expected probability. Better to make it 2% or 3% by limiting the increment value.

                          Before the night is over, I am going to fix the .max/.min values to correspond to the number of draws being tested. It's easy to hardcode these for P-3 and P-4 at 1k and 10k respectively. The problem comes when the drawfile isn't that long to begin with. After you pass the number of draws the histograms (now color-coded) begin showing all the frequencies as < the pr's.

                          If all else fails, I'll just up the max by 100 or 200 draws. I feel that digit frequency is better tracked in the short term anyway, since I'm only dealing with ten digits. Frequencies for all digits go off the histograms at 100 draws. It's individual position frequencies that could use the additional data.



                          Hope this gives you some ideas on how to do the pr's.

                            Developer's avatar - logo2 small.jpg
                            Somerset
                            United Kingdom
                            Member #9710
                            December 17, 2004
                            184 Posts
                            Offline
                            Posted: January 31, 2005, 3:07 pm - IP Logged

                            Thank you for the kind words regarding my program, and it has taken years to make it as it is today.

                            Will the program your creating be sold as shareware? It's just that I also own http://www.planet-shareware.com and could help you out with promotions and things, the site is getting about 10,000 unique IP hits a week and is just 12 months old.

                            Also if you need a hand with any code in your program just email me what your working on, I will soon make it do what you want , been making programs in VB for far two many years now, it is a shame its all .Net now (must sit down for a week with it), but thats a whole other subject.

                            With regards to fixing values Max / Min DON'T DO IT, I know its a pain but make it dynamic, trust me you will be amazed at the variations of draw statistics. I put a roof of 2700 draws in memory at any one point for calculations, you would think thats plenty. Nope last week I had an email saying a run time error had occurred, so I looked in to it and LSA had exceeded that 2700 draw calculation buffer and crashed.

                            After a day rewriting the algo to do away with this limit I got it working again. The moral of this story why its young and not two much source make it right, in time it will save you hours of work. The down side - at the time of writing the source it takes hours of work.

                            What are u using for the graphs? Might be able to help you with that two

                            Jamie

                              Avatar
                              East Jordan, MI
                              United States
                              Member #2
                              June 1, 2001
                              675 Posts
                              Offline
                              Posted: February 1, 2005, 1:42 pm - IP Logged

                              Jamie,



                              Officially, I'm considering offering the prog as donation-ware. I don't want to fix a pricetag to it at this time. I would be happy to receive at least a dollar whenever someone wins when using it. I think in the long-term the compounded return would exceed shareware purchases. A fixed pricetag may turn off some potential buyers who may not find it 100% to their liking. I think I've been to planet-shareware recently. The website is not up as of this writing.



                              My software has a steep learning curve, even though I try to make it as user-friendly as I can. Not everyone understands pr's and how to best set up their selection parameters. Hopefully, the new setup wizard I'm planning on including will bring those less-inclined into the fold.



                              I have .net also and haven't got too much further than just firing it up. The interface reminds me very much of an html editor ie; arachnophilia or macromedia contribute. I've heard that you can convert vb code to .net with some kind of conversion wizard. Also I've heard that the process is quite lengthy. I too will have to "sit down" with it someday and do some exploring.



                              I don't have a cap on the number of draws that can be loaded into memory. Although there is a variable minimum that must be used in order for the core selection system to work properly. It all depends on the drawfile being used. The min/max values I spoke of were just for the frequency charts.



                              I use a static "stacked array" of picture boxes for my histograms. It's easy to color and then .visible them as needed. Right now they are at 50x255 twips. I'm currently stacking them, but don't think I'm going to have enough room on the form to show the frequencies I'll need before I run out of space on the form, especially for the Pick-4. I've made the form as high as the mainform. I still may only be able to display about 120 or so ticks on the histogram if I stick with 50x255.



                              I'm still stacking and the process is tedious. I'm up to 50 ticks right now. When I get this done I'll experiment with 25x255 twips. I want to keep the borders on the picture boxes. I tried using without and didn't like to look. The colors just looked too flourescent.



                              I didn't originally have that many pictureboxes in each array. Now adding to them is a pain. I have to create a new picturebox for each tick. I'm about ready to delete them all and start over with one stack and create the subsequent arrays from the first one.



                              Also I'm working on speed. The Pick-4 is really slowing things down as far as showing the pictureboxes. I'm working on doing the lengthy processes (opening files, populating list/text boxes etc.) all at form load instead of each time an option is selected. It's taking about 3 or 4 seconds for the chart form to load, but the payoff is worth it once you start working within the form.



                              I don't know why I repopulated these things each time an option was selected. I think originally I planned for the user to be able to switch between gametypes/drawfiles on the fly. Better to just work with the drawfile that is loaded on the mainform.



                              Your offer of assistance is most welcomed and appreciated. I'm, no doubt, not as adept in VB as you but my assistance is yours for the asking as well. Maybe we could exchange project source. Not so much for working on each others projects. More as an exchange of ideas, etc.



                              ..../George