Thread: Automatic Uploades

  1. #1
    Chad Johnson
    Join Date
    May 2004
    Posts
    154

    Question Automatic Uploades

    I want to implement a feature in my program so that when the user starts the program it automatically looks on the program's web site for program updates (of course the user will be able to turn this on or off).

    What is the best way of doing this? Would it be to have a text file containing the just a string of the latest version number?

    I'd like to have it so it shows all the updates between the user's installed version and the newest version, but not anything before. I probably couldn't do this with just the text file idea, so does anyone have any ideas (besides using a database)? I suppose if I had to, I could just show the entire update history, but I would prefer not to.

    btw, my program just has one branch.

  2. #2
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    You must have some way of knowing what version your current program is running on to compare with what you find on your web site, so either it has to be embedded in your program or you have to store it in a file.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  3. #3
    Chad Johnson
    Join Date
    May 2004
    Posts
    154
    I don't right now, but I easily can. I have a class that holds all runtime program configurations, and I'd just hardcode it into there fo each version I release.

    But what about on the server?

  4. #4
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    Why should the server care? It should only have the most recent version and if that version has changed then the client should retrieve the latest version? If you want some central location to attempt to know what versions are on what clients (I tried to do something similiar once), then you need to store the information on the server (I used a database). Keep in mind that all the server side is is just a guide, as the client side can be rebuilt with the old version, might have crashed during the update, or any other sort of issue may come up.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  5. #5
    Chad Johnson
    Join Date
    May 2004
    Posts
    154
    The server would care because it would have to send the client program a list of updates starting with the version right after the user's current version up till the latest version (I suppose I could use dates instead of version numbers). So that's why the server should care.

    And for the downloading part, I would just have the program download the program and retry a couple times, eventually time out if something went wrong. I'd probably just be a basic socket connection. I might not even worry about that and just let the user download the program themself.

    So, I guess the question now is this: how can I get a list of updates between the date hardcoded in the user's version of the program and the newest version on the server, excluding everything before?

  6. #6
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    I suggest that it is a bad idea to have to sequentially load updates. The latest update should contain all the previous updates (like MS's service packs) so there is no sequencing problem. Thus you only need the latest version.

    Version control can evolve into its own application, I strongly suggest you KISS.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  7. #7
    Chad Johnson
    Join Date
    May 2004
    Posts
    154
    Alright, thanks for the insight.

    Wait a second...

    >>The latest update should contain all the previous updates (like MS's service packs) so there is no sequencing problem. Thus you only need the latest version.

    Can you explain how this works (go into detail a little)?
    Last edited by ChadJohnson; 07-07-2005 at 07:03 AM.

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by mitakeet
    I suggest that it is a bad idea to have to sequentially load updates. The latest update should contain all the previous updates (like MS's service packs) so there is no sequencing problem. Thus you only need the latest version.
    That changed in the later versions of Microsofts operating systems. While there is the occasional big service pack, the operating systems now automatically download updates incrementally. That feature can be disabled although a colleague (who is running XP on an isolated system) commented that the system periodically nags him with a suggestion that he needs to connect to the internet to "ensure his system is up to date".

  9. #9
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by ChadJohnson
    Alright, thanks for the insight.

    Wait a second...

    >>The latest update should contain all the previous updates (like MS's service packs) so there is no sequencing problem. Thus you only need the latest version.

    Can you explain how this works (go into detail a little)?
    Mitakeet overstated the case a bit: recent versions of windows 2000 and windows XP update themselves incrementally.

    MS's service packs are essentially a large download of an install program that (often) contains a large number of updated versions of core operating system components. When you run the install program, it overwrites the programs on your systems with the version for that service pack (although, IIRC, it checks the version number and modification date, and gives you a choice if it appears to be overwriting a new version of a program with an older version). The end result, after running most service packs, is that the whole system is updated to a known end state.

  10. #10
    Chad Johnson
    Join Date
    May 2004
    Posts
    154
    Yea I was only thinking of having it update to the latest version, not incremental updates.

  11. #11
    Banned
    Join Date
    Jun 2005
    Posts
    594
    I would create a 2nd program a update program, which
    could run the first rpogram with a commandline argument
    that runs a function which returns the version number
    to the update program, and let the update program decide
    if it need a upgrade.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. why automatic variables are assigned with garbage values
    By srinivasg in forum C Programming
    Replies: 1
    Last Post: 11-08-2005, 07:14 AM
  2. automatic variables
    By FOOTOO in forum C Programming
    Replies: 5
    Last Post: 03-08-2005, 06:30 PM
  3. Automatic vs. Static Duration
    By JMB in forum C++ Programming
    Replies: 7
    Last Post: 10-14-2002, 07:16 PM
  4. Automatic Time in C++Builder ??
    By Gugge in forum Windows Programming
    Replies: 0
    Last Post: 06-18-2002, 12:58 PM
  5. Automatic <cr> in User Inteface
    By chubaka in forum C Programming
    Replies: 3
    Last Post: 01-14-2002, 01:06 PM