My weather maximum city entries (2 Viewers)

ADL

Portal Member
September 25, 2006
25
0
Hi there,
Can someone tell me is MP only allow 20 entries for my weather? I enter 40 cities in my weather using MP setup, It seem OK uder setup window, but after I click OK and run MP, it only take the first 20 cities:eek: , when I go back to MP setup, other 20 entries gone:eek: can I add more cities by editing the xml files?
Thanks
 

rekenaar

Retired Team Member
  • Premium Supporter
  • December 17, 2006
    4,421
    805
    Home Country
    South Africa South Africa
    Seems like the configuration program only saves 20 cities. I will try and investigate further.
     

    Darre

    Portal Pro
    April 21, 2007
    925
    80
    Home Country
    Norway Norway
    Hi

    My guess is the author didn't think anybody would need more then 20 cities.. Thats beyond me at least:mad:

    Darre
     

    rekenaar

    Retired Team Member
  • Premium Supporter
  • December 17, 2006
    4,421
    805
    Home Country
    South Africa South Africa
    Yip, 20 is hardcoded in the config program as well as in the windows plugin. I quickly changed it to 50 and recompiled. Working like a charm now.

    I am not sure if it is worth the effort to submit the changes as a patch on sourceforge if there are only 2 users needing it? What is the general feeling?

    ADL, kec2 - If you send me your email address via PM, I can mail you the two modified compiled files. This will however only last until your next upgrade...
     

    kec2

    Portal Member
    May 17, 2007
    11
    0
    Home Country
    Denmark Denmark
    Hi Rekenaar

    I have also looked at the code. I can only see one reason for having a MaximumCities, and that is because of the lack of a method that gets the number of cities in the config file.

    My feeling is that there should not be a limit. An that it would be wiser to have the weather data in the database insted of the xml config file. For the sake of argument I would say that "MaximumCities=1000;".

    I know that I don't need store 1000 cities or 50 cities for that matter, but such a limit is old fasion, and hardcoding such a value is not bright.
     

    rekenaar

    Retired Team Member
  • Premium Supporter
  • December 17, 2006
    4,421
    805
    Home Country
    South Africa South Africa
    I agree that it should be dynamic. However, I still doubt that there will be more than a handfull of people to benifit from this.

    In my tests, I also changed the config program to skip empty values when writing the xml file.
     

    rekenaar

    Retired Team Member
  • Premium Supporter
  • December 17, 2006
    4,421
    805
    Home Country
    South Africa South Africa
    Just added the if-statement. The code inside the if is already there.
    Weather.cs
    if (cityNameData.Length > 0 && cityCodeData.Length > 0)
    {
    xmlwriter.SetValue("weather", cityName, cityNameData);
    xmlwriter.SetValue("weather", cityCode, cityCodeData);
    xmlwriter.SetValue("weather", citySat, citySatData);
    xmlwriter.SetValue("weather", cityTemp, cityTempData);
    xmlwriter.SetValue("weather", cityUV, cityUVData);
    xmlwriter.SetValue("weather", cityWinds, cityWindsData);
    xmlwriter.SetValue("weather", cityHumid, cityHumidData);
    xmlwriter.SetValue("weather", cityPrecip, cityPrecipData);
    }

    Come to think of it, I think this will create a problem when removing an existing city. The old data will remain in the file. Luckily my change was only on my own PC :)
     

    Users who are viewing this thread

    Top Bottom