what do i need to do to make this happen?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14

Thread: what do i need to do to make this happen?

  1. #1
    Join Date
    Feb 2013
    Posts
    11

    what do i need to do to make this happen?

    Ok, so here is something that I have been trying to accomplish and am having some problems with figuring out how to do. I have program that I would like to have operating on multiple systems and updating in real-time.

    I have seen software, where the install package goes onto an (acting server) and the drive then mapped to another system leading to the path of the installed program.

    Once the path has been established the user accesses the given folder through the mapped drive and runs the setup within the install directory on the mapped drive. Thus setting up a workstation, while all the data is stored on the (acting server)

    If anyone would have some insight into how this is accomplished it would certainly be helpful in my endevour.

    I am using visual studio 2008 (and also have 2010) for development as well advanced installer for the deployment.
    Thanks in advance

  2. #2
    Join Date
    Feb 2013
    Posts
    11

    Re: what do i need to do to make this happen?

    here is a real life scenerio to help clear up what we are trying to do -

    there are 3 systems at one location.

    1 of these systems will act as the "server" - meaning all the data from a specific xml file will save to a specific location on that system-
    we will call this path as (z)

    the other 2 systems will be working with this xml file through a completed vb project.

    what we want to happen is when either one of the 2 systems make a change to the xml file inside this project..we want the changes to be saved to the z path on the "server" - which will in turn - show the changes made back to the other 2 systems.

    now - most would say that it sounds like a "sql server" is needed - but - we are trying to do this WITHOUT the need for sql server - and are attempting this strictly through coding and mapped drives....is there a way to do this in this manner?? and if so- can someone clarify what needs to happen..and/or- point me in the right direction???

  3. #3
    Join Date
    Aug 2009
    Location
    NW USA
    Posts
    173

    Re: what do i need to do to make this happen?

    Here's a shot. Your program will read the XML file from the file share (z) when it loads. As with any program, you will control when it saves it's data to the file share. The program will also need to periodically check the share for changes. This will be done by simply reloading the xml at a designated time or through an event, like a button. You don't want this refresh, however, if there are changes in the current local dataset.

    Issues:
    User 1 makes a change, saves to z. User 2 makes a change before getting changes. If User 2 saves to z it will overwrite User 1 changes. To make sure this doesn't happen the program, before it saves, would need to load a current copy of the xml on z and compare it to the local data, apply all changes and save.

    A problem with save timing would also need to be addressed. If two users are saving at the same time they could have different copies. To address this the program, on save, when it loads the current copy on z, would delete the xml from z, do the comparison and then save. If a user is attempting to save and the xml does not exist on z then the program knows someone else is saving. Since the time to write the xml could be lengthy (and you don't want a program reading a half written file) it may be better to put a small dummy/flag file in the same folder that the program checks to see if someone else is currently saving.

  4. #4
    Join Date
    Feb 2013
    Posts
    11

    Re: what do i need to do to make this happen?

    thank you for replying to my dilemma - it helped clarify some confusion..

    now here is a bit more of my confusion
    right now in my program i have the loading, reading and saving paths basically set at default (c/program files...yadda yaada yadda

    while this is okay for the host or (stand alone) system-
    it is not configured properly for a workstation.

    so

    my software would have to be deployed with the proper paths in order for it to read, write to z drive

    i am unclear as to where to make these changes within the software.

    here is what the loading path is right now-

    Private Sub WriteToXml()
    If Not File.Exists(Application.StartupPath & "\calendar.xml") Then
    CreateBasicXmlFile()
    End If

    if i understand you correctly what needs to happen here is everywhere in my solution the above is-
    i need to replace that with a path leading to z drive???

  5. #5
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,781

    Re: what do i need to do to make this happen?

    Actually you should be using a Variable in all of those locations for the target path and then somewhere in your program when it first starts you should set the value of that variable to the path you want to write to. This way should you ever need to change it you can change it in one place rather than lots of places and get the same result.

    Also you should be aware that under Windows Vista, Windows 7, Windows 8 as well as newer versions of Windows Server you can not write to the program files folder.

    You should not hard code a path to z drive either especially not if you intend to have others use your program as most will not have a z drive on their system.

    Ideally the target path should use a variable inside the program and that variable should get its value from a settings, config or ini file that is stored on disk there should also be a method inside the program for the user to change this value to point somewhere else if needed.
    Last edited by DataMiser; February 14th, 2013 at 01:54 AM.
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,873

    Re: what do i need to do to make this happen?

    Look at Virtualization. Azure can help you with that
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Feb 2013
    Posts
    11

    Re: what do i need to do to make this happen?

    thank you DataMiser for the informative reply!
    yes - you are right about not setting to program files-as anything above xp is a headache waiting to happen for sure! the client system is windows 7 (64 bit)..so installing to program files in this instance will not work to well LOLLLLL - i dont have that many aspirins!

    the related z path was just an example - z is used waaaaaaay to often so- i actually want to attempt this by designating it to y, as i have not seen many people try to go to y drive. but your instruction to create a way to change this path, should i need to do so on the fly is very good and thank you for that

    in my current solution i have already instilled a refresh for my calendar as well as "concurrency" issues - should one of the 2 systems happen to be making changes to the same calendar block at the same time.

    all that remains is the how to...and am really checking in theory of how and IF this will work -

    this is what i am planning to try:
    taking your advice about the pathing

    okay...
    take the project and aim it to:
    c:/MyCalendar/Calendar.xml - this is where it will install to on all the systems.
    in my coding - direct the saving, reading,writing to:
    y:/MyCalendar/Calendar.xml
    in theory..this should work, no?

    so that these systems will be working on their own instance - yet sharing just the calendar.xml
    Last edited by coding_4_Life; February 14th, 2013 at 07:58 AM. Reason: want to put codein coe bracket

  8. #8
    Join Date
    Feb 2013
    Posts
    11

    Re: what do i need to do to make this happen?

    hi dglienna..thank you for the reply!
    i am fairly new in this realm as i have only been coding now for a few years - and i have seen the azure ads but have not looked at any of them as of yet. i will keep your suggestion in my head and start to take a look at that aspect. but at this time, time is not on my side - so while i am not discounting the suggestion in any way, what needs to happen here is the most direct path to make this happen.

    i know abolutely nothing about azure and so very little about virtualization. i will however, take a look into these two subjects just as soon as i can come up for air! LOLLLLLL

  9. #9
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,781

    Re: what do i need to do to make this happen?

    Yes in theory that should work so long as you are not having issues with 2 people trying to write to the file at the same time. I really do not know a lot about the gotchas of XML I rarely use it in my projects and generally opt for a database or other file type rather than XML. I know a lot of people like to use XML and it is way overused in many cases. I have always saw it as a poor option especially in VB6. There is a lot of overhead with XML, a lot of extra data in the files and the VB6 support for it is less than ideal.

    btw I have never been on a system that had a Z drive mapped. my systems here drive letters run C-M
    Always use [code][/code] tags when posting code.

  10. #10
    Join Date
    Feb 2013
    Posts
    11

    Re: what do i need to do to make this happen?

    okay thanks DataMiser, i will give it my best shot
    will let you know what happened!

  11. #11
    Join Date
    Feb 2013
    Posts
    11

    Re: what do i need to do to make this happen?

    Okay DataMiser -
    I have gotten it up and running, albeit - not in the manner that was expected - but it is working

    there is one fly in the pie though and i am at a loss as to how or if it can be fixed:

    i have a module form in my program that calls on the initialization of a local database.
    the event fires on the loading of the main form.

    on the system that is hosting the program - this works without a problem-
    however, on the other system that is reading the host system-

    you guessed it- it throws an error on loading that the databse is already in use -

    hitting continue through this error will allow the program to function properly-
    but it is kind of tacky for the user to see that error -

    and am wondering if you happen to know how to basically -
    turn this absolute statement on project load into a variable?

    in other words-
    instead of
    InitializeDatabase()

    how would i tell it to check for initializiation and if it is already initialized then skip the initialize ??

    i have tried the basic- if initializeDatabase is true then ----
    but it gave me the golden perevial boot

    i also have tried a IsNot statement and that also ended in failure..
    Last edited by coding_4_Life; February 16th, 2013 at 07:25 AM.

  12. #12
    Join Date
    Aug 2009
    Location
    NW USA
    Posts
    173

    Re: what do i need to do to make this happen?

    This is kind of tacky too but try:
    Code:
    Try
       InitializeDatabase()
    Catch
    ' nothing
    End
    Maybe you won't get the error.

  13. #13
    Join Date
    Feb 2013
    Posts
    11

    Re: what do i need to do to make this happen?

    ahhh, Mur16 - im sure that this will work !
    will give that a try this morning! -
    i am not sure how i could have not thought of that, it has somehow eluded me..

    thank you and i will be back to let you know the result

  14. #14
    Join Date
    Feb 2013
    Posts
    11

    Re: what do i need to do to make this happen?

    thats the ticket Mur16! worked like a charm, THANK YOU SO MUCH

    and on that note - i would also like to thank everyone else that stepped into this with/for me -
    much good advice!

    there is one final "glitch" that is in the works- but i do not think that this can be solved:
    when remoting from the mapped drive - the printing and saving(incidently - my program saves my calendar to excel and prints from xcel)

    while this works properly on the host - it will not save or print through the mapped drive.

    my guess is that it cannot launch xcel in order to complete this function. but - it does work from the host

    like i said - i dont think there is a way to get around this - but if any of you seasoned veterans would like to take a stab at it i am all ears!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center