C# a Step by Step Beginners Tutorial

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • didacus
    Junior Member
    • Jul 2012
    • 2

    #46
    I am very interested, will you continue with your tutorial?
    Thank you

    Comment

    • Escapee
      Junior Member
      • Feb 2009
      • 51

      #47
      didacus will you continue with your tutorial?


      I'm not sure, it takes up many hours of 'free' time to write it.

      the next logical step would be to write the "My Bets" module and that would take a couple of days coding and probably a day or two to write into a tutorial.
      Not sure I can spare that sort of time at the moment.


      I don't mind answering questions but I think the Bets Module will have to wait at least a few weeks.

      Comment

      • Rui Rodrigues
        Junior Member
        • Mar 2011
        • 3

        #48
        Originally posted by Escapee View Post


        Rui Rodrigues

        "NullReferenceException was unhandled - Object reference not set to an instance of an object"
        Have you completed upto step 73 ?
        because the null reference problem is caused by not redirecting MenuTree.usrmsg

        have a look at step 73, your form1.cs constructor should contain the redirection code
        Code:
        c_MenuTree.MsgRedirect( this.UsrMsg );
        I'm less certain, but this may also be the cause of your lock( e_mData.varsLock ) problem.

        Sorry for not replying sooner. Have been stuck in the Hospital for a few days with high fevers Now I'm back.

        Thank you. Yep the problem was not having completed a few more steps in advance, that solved part of it. And had to add "using BetfairAPI.BFExchange" to CMarketData.cs

        All working now!

        Now I'll try to catch up with you guys.

        Comment

        • Rui Rodrigues
          Junior Member
          • Mar 2011
          • 3

          #49
          Escapee, thank you so very much for what you´ve done so far. Hope you won´t leave us hanging

          Got everything working just fine and now will study and explore possibilities. Have one question though (so far), sometimes I get prices like 42 and the real price is 4.2 but other times all is fine, what could be the problem? decompressing prices? parsing the markets string?

          thanks in advance.

          Comment

          • maxxim
            Junior Member
            • Jan 2010
            • 7

            #50
            Hello! Please help me, why this exception pops up?

            Last edited by maxxim; 26-07-2012, 09:18 PM.

            Comment

            • Escapee
              Junior Member
              • Feb 2009
              • 51

              #51
              Rui Rodrigues
              "Got everything working just fine and now will study and explore possibilities. Have one question though (so far), sometimes I get prices like 42 and the real price is 4.2 but other times all is fine, what could be the problem? decompressing prices? parsing the markets string?"

              Hmmm, not sure why that should be unless its a coincidence caused by the X-Matching Bots synthetic prices ( see this thread )

              is it consistent ? ( i.e. does it give 42 every refresh ? ) if so then in the UpdateMarketPricesCompressed() function, put a break point in and examine the contents of the data in BackPricesArr or LayPricesArr after these statements have executed.
              Code:
                                  string[] BackPricesArr = runnerArr[1].Split( '~' );
                                  string[] LayPricesArr = runnerArr[2].Split( '~' );
              If it still looks like an error with the decimial point could you post up the data and a screen shot of betfairs prices


              maxxim
              "Hello! Please help me, why this exception pops up?"
              The error would indicate that there is something in that field ( rDataArr[3] ) that is not a number.
              Next time it happens, examine the contents of rDataArr[3].
              If you still can't work it out then post up the content of runnerArr[0] and rDataArr[3] when it happens.

              Comment

              • Drifter
                Junior Member
                • Mar 2009
                • 30

                #52
                Would I be right in thinking that in order to cycle through a group of events, it would just be necessary to change the mID in the call public bool GetMarket(ref GetMarketResp marketResp, int mID) [and other related calls] in CBetfairAPI class?

                What I would look to do is build an array of eventID's which the refresh code cycles through repeatedly. I have something similar in my own code, though it lacks the threading and event handling.

                So far I haven't tried to display this data (essentially from all correct scores events on a class of football match, eg Premiership, bundesliga etc.), choosing to just do a bunch of calculations in the background and display text strings of the results - but your approach makes me think a few logic tweaks in your interface code could do it. Do you have any comments on this approach?

                Comment

                • Escapee
                  Junior Member
                  • Feb 2009
                  • 51

                  #53
                  Drifter

                  If I understand you correctly ?! You could do it that way but, imho, its a bit hmmmmm...... wrong.

                  If I understand you correctly, I visualised the whole structure in a couple of minutes but conveying it to you is the hard part !

                  Its considered 'wrong approach' in that in a nutshell: its losing 'Object Orientation' double quick time and misusing resources.

                  I think you're thinking about it wrong.


                  then I tried to explain it, wrote a few lines, failed to be consise and explanitory, deleted, rinse and repeat 5 times, 30 minutes got nowhere.....


                  try this, think of the current model as 3 components:
                  1) a MENU ( could be a ListBox etc )
                  2) a MARKET ( including market refresh, display, and any bets & automated betting )
                  3) a FORM ( an 'object' holder, its holding the market and the menu )

                  now change that word component to OBJECT
                  think of the current model as 3 OBJECTS

                  The current model in this tutorial the MENU object reuses the MARKET object because its simple and it replicates betfairs web page.
                  The maket object is mounted on the form, but doesn't have to be.

                  1) Create a usercontrol class and mount all the stuff related to a single market on it. The Market Mem, the Refresh, the display, all of it.
                  This is called "UCM"

                  2) use a TableLayOutPanel or any of 50 standard controls to hold and display your multiple "UCM"s

                  3) Now change your MENU object so that it creates a new "UCM" MARKET object instead of reusing the same one.

                  4) Once you can do it all manually you just have to write a small thread to control the MENU and the rest just takes care of itself.


                  if you understand what I'm imagining then you have converted the tutorial model of 1-1-1 objects to 1-1-many objects.


                  so simple to do so hard to explain.

                  over an hour on this I got to stop.
                  Last edited by Escapee; 31-07-2012, 12:05 AM.

                  Comment

                  • AzureGulf
                    Junior Member
                    • May 2012
                    • 5

                    #54
                    Originally posted by Escapee View Post
                    Drifter

                    if you understand what I'm imagining then you have converted the tutorial model of 1-1-1 objects to 1-1-many objects.
                    Hi Escapee

                    Very neat concept, but how does the user see each of the "new UCM Market objects"?

                    BTW, I've finally written my first small database using Entity Framework (EF) adapted around your earlier Menu foundation so that Prices and Amounts Available for Runners can be persisted ...

                    (EF is a very neat product - I'm using its Model First methodology in EF 4 and SQL Server Compact Edition 4.0)

                    I know that this has been a (major) digression from your tutorial, but please be assured that I am keeping up with your posts and often refer to them as part of my ongoing but slow learning process - looking forward to whatever comes next

                    Comment

                    • Escapee
                      Junior Member
                      • Feb 2009
                      • 51

                      #55
                      AzureGulf
                      Very neat concept, but how does the user see each of the "new UCM Market objects"?




                      here's a real world example of a 1-1-Many->Many model

                      Football Fixtures have many markets, goal of program is to Autobet on the OverUnder Markets for each fixture, many fixtures concurrently.

                      Object Model = FORM-LISTBOX-FIXTURE-OUMARKET, in a 1-1-Many-Many configuration.

                      a Fixture Object hosts an array of Market Objects which are related, so we are going to mount the refresh and automated betting threads at the Fixture Object Level.

                      1) a Listbox instead of a MenuTree to hold all todays Fixtures

                      2) a Fixuture Object and all encapsulated sub objects are mounted on a UserControl ( what I refered to in previous post as the 'UserControlMarket' UCM for a single CorrectScore Market. But in this case it holds 1 Fixture->many Markets )
                      Here is the UserControl Fixture Object (UCF)


                      3) a TableLayoutPanel to hold and display multiple UCF objects.
                      This will just scroll the UCF objects like a DataGridView when there is not enough screen real estate to display all of them.
                      So now our form looks like this


                      when you wire it all together you get something like this, which can automatically bet on 100's of markets simultainiously.

                      ( reduced in size so as not to give away all the secrets )



                      And its all done using the same 'model' as outlined in this tutorial

                      hope that helps.


                      If its still a bit to much, I'm always on the look out for interesting and mutually benefitial collaborations

                      Comment

                      • maniw4
                        Junior Member
                        • Oct 2010
                        • 3

                        #56
                        Thanks Escapee. Dont know why the "Last Updated" is showing the wrong time, i must have botched a step somewhere!

                        free image hosting


                        EDIT
                        I found the problem with the time - my System Locale was set wrong.
                        Last edited by maniw4; 01-08-2012, 09:00 PM.

                        Comment

                        • Escapee
                          Junior Member
                          • Feb 2009
                          • 51

                          #57
                          maniw4
                          nice one. its good to see so many people have completed the project so far.
                          I couldn't see anything wrong with your 'last updated', it looks fine to me.

                          Comment

                          • osa_dev
                            Junior Member
                            • Jul 2012
                            • 3

                            #58
                            Originally posted by Escapee View Post
                            Rui Rodrigues
                            [I]


                            maxxim
                            "Hello! Please help me, why this exception pops up?"
                            The error would indicate that there is something in that field ( rDataArr[3] ) that is not a number.
                            Next time it happens, examine the contents of rDataArr[3].
                            If you still can't work it out then post up the content of runnerArr[0] and rDataArr[3] when it happens.
                            I got the same problem. It is because local decimal sign was set to ',' instead of '.'

                            Btw great tutorial, thank you for your time spent on us newbies

                            Comment

                            • maniw4
                              Junior Member
                              • Oct 2010
                              • 3

                              #59
                              Originally posted by Escapee View Post
                              maniw4
                              nice one. its good to see so many people have completed the project so far.
                              I couldn't see anything wrong with your 'last updated', it looks fine to me.
                              Hi Escapee,
                              The actual time was 6pm in the evening and it was 8 hours behind. My Locale was set wrong to gmt-8.

                              Anyway i think there may be another issue because when i click on some races the wrong information is brought back. i've only seen this with AUS/NZ races on todays race card - see attached pics.

                              I'll dig in to this a bit more and see if i can give you some more info.

                              pic1
                              [IMG][/IMG]

                              pic2
                              [IMG][/IMG]

                              Comment

                              • maniw4
                                Junior Member
                                • Oct 2010
                                • 3

                                #60
                                Hi Escapee,

                                following my earlier post, i did a debug of the program to investigate the problem with the AUS/NZ horse racing. All i can see is that your program is displaying the correct values returned from Betfair, which means for some reason Betfair is sending random stuff for the AUS/NZ races.

                                I selected one race the 3:13 Canb(AUS) and looked into the marketResp variable in the LoadNewMarket function - all the information was incorrect for the race and there were no runners! When i logged into my normal Betfair account i could see the race information, there were 7 runners.

                                Perhaps there is another interface for the AUS/NZ racing. Maybe i need some funds in the AUS wallet to get the correct info back from Betfair.

                                Anyway, your program is working correctly as far as i can tell.

                                Comment

                                Working...
                                X