|
I didn't say you couldn't change it. I said it was a very bad idea TO change it.
|
|
|
|
|
when we create a block inside text editor, by pressing any key, that block disappears,
while existing block, if suddenly u press DEL key, content of that block get detroyed.
i dont want this, i want to have a block remain persist. pay attention i am talking only
about text editor not data manippulate or SQL server or....... just inside of text editor.
|
|
|
|
|
Sorry, but i really don't understand you question...
You don't wan't to destroy the selected text by pressing del or any other key? Is this right? What do you mean with a "block" inside text editor?
But i really don't get what have this with C# together or with SQL server... really strange
|
|
|
|
|
ok, let me explain more
when u r typing a text, if press DownArrow while holding the Shift key, a block will be generated.
BLOCK in text means a selected portion of text ok? after creating a block, if u press for example
uparrow or home or..... that portion of text(BLOCK) will get unselected. i dont want this. i want
that block still stay selected.
|
|
|
|
|
Please don't repost questions so quickly. The original question is only a couple of threads below, and it's not very considerate of you reposting just to bump your post up.
|
|
|
|
|
Did you have a question?
Edit:
Wait, wait, what...? You want a read-only section of a text file? Because you're a clumsy typist? Spend more time doing it, slow down, pay attention to what you're doing. Haste makes waste.
P.S. And you know about undo, right?
modified on Monday, August 30, 2010 11:03 PM
|
|
|
|
|
faraz34 wrote: when we create a block inside text editor, by pressing any key, that block disappears,while existing block, if suddenly u press DEL key, content of that block get detroyed.i dont want this
If it's a RichTextBox , than this can be prevented with the SelectionProtected [^] property. You'd use the SelectionStart and SelectionLength properties to define the part that you want to protect, and than you set the SelectionProtected property to true.
Hope this helps, and my apologies for the rude answers
I are Troll
|
|
|
|
|
I have some collection with object.
Each object need to do some mission.
Is it ok to run all the mission in this way ? ( using parallel and Thread together )
Is this will be efficient ?
Parallel.ForEach(ElementsCollection, element => element.Mission() );
public void Mission()
{
new Thread( new ParameterizedThreadStart( Mission_) ).Start( this );
}
|
|
|
|
|
Message Closed
modified 23-Nov-14 5:59am.
|
|
|
|
|
I know, but using Parallel with in this way will create fester code ?
|
|
|
|
|
Yanshof wrote: will create fester code ?
It may 'fester'[^] but it won't be faster.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Can you pls explain why this will not be faster ?
10x.
|
|
|
|
|
Creating a thread is expensive process and unless the task is very long running, creating and destroyng the thread can often take longer than the task itself.
Once all your cores are busy with threads, any others have to be switched around by the OS. This it does quite efficiently but it means that some threads aren't actually doing anything until they alloted some processor time to do it. This switching can actually make an application run slower if too many threads are created.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
But using Parallel will 'cost' less than using Thread ?
Is using Parallel will cost less then create new thread and using it ?
( if i assume that the machine that the application will run on is dual core )
Using parallel does not require some 'content switch' ?
|
|
|
|
|
Hello,
My C# application checks an on-line database for currency when it starts up. If the most current version is not being used, it forces a download of the current version (or shuts down) and places the new .exe file in the System32 folder and then closes the application. Now, when the application is run again, it "sees" that the update has been downloaded but is not installed (So far so good.. . Question is this...how do I shut the program down once it is running (or do I have to?) and also force the new executable to run to update the application? I like the way that Adobe PDF reader does this. Can I duplicate this process with my application? Thank you...Pat
|
|
|
|
|
The only scheme I can think of to accomplish such things would be using two EXE files: one is your actual application, the other small one contains the logic to close the app, download/install the new version, and launch it again.
BTW: I don't expect an automatic install, I'd rather hope the new files overwrite existing files and no renewed install is involved at all.
Remark: Are you sure you want to put your stuff in system32? that will probably go wrong on modern Windows editions (Vista, Win7) due to security, and possibly also on 64-bit Windows (Win7 often is 64-bit).
|
|
|
|
|
Thank you for your insight, Luc. No..I am not sure about the System 32 thing. On my Win XP system, it seems like that was the place to put these. That can be easily changed. Thank you for your advice. Re: the second EXE....I am not sure just what that would look like in code, or how to call it, or from where. If you have some kind of template or flow that can get me started, I would appreciate that. I wish I knew how Adobe does it. It's very clean and really fully automatic. That is what I am trying to duplicate here. Thank you for your help.
Best Regards, Pat
|
|
|
|
|
I don't have a simple code example around. There are many programs that update themselves, FireFox is one example. One EXE can call another through Process.Start() .
I suggest you learn to use Google and search for some articles. Maybe this one[^] is OK, I don't know, I haven't read it.
|
|
|
|
|
Hi,
I didn't setup such a system myself, but I'm aware of an application that has this feature. It's source code is available, thus you can watch for it and try to adapt it to your needs.
This application is called EveHQ ; it's related to a MMORPG, and you can watch for the source code @ evehq.battleclinic.com[^].
The relevant project is named EveHQPatcher inside the solution. If you use part of this code, don't forget to give credits to the original developper (and maybe contact him before doing so).
I hope it will help you solve your problem.
Kind regards.
|
|
|
|
|
Thank you Phil. The funny thing is that I actually have all the components working except for the final install. I suppose, technically, I could set up a simple message box that points to the location and tells the user to do the install by clicking on the downloaded setup file when he attempts to restart the application, but I wanted to make it all happen automatically when the program was restarted. A suggestion was made about running an exe inside of an exe, but I do not really understand that and I have no sample of how to do it. I will definitely look into your suggestion though, and I appreciate your time. Thank you.
Best Regards, Pat
|
|
|
|
|
You're welcome Pat
|
|
|
|
|
Hi,
First write code to check for new version of your binaries in your main application.
When your main application starts, check for new version of binaries.
And checks every half and hour or whatever u like, whether any new version of binaries are available or not.
If there is any new version of binaries are available than download and install it.
While installing new binaries, prompt the user that New binaries are available and your application is going to close, after installing new binaries start your main application.
I hope you got cleared.
I am not surfing codeproject regularly, So if u want any more information get back to me at sunil.gohel@hotmail.com
Regards,
Sunil G.
modified on Monday, August 30, 2010 9:19 AM
|
|
|
|
|
Hello Sunil,
Thank you for your advice here. OK, I have reached this point in the application. The application recognizes the new file is available and downloads it to a folder...then shuts down. So, how do I make the application do the install after it is restarted? I suppose I am looking for a piece of code that will run the new exe file but only after the application has shut itself down, and then (would be nice) perhaps even relaunch after the update has been installed.
In short, how do I accomplish this
<<<<<'after installing new binaries start your main application.'>>>>>
in C# code?
Thank you, Pat
|
|
|
|
|
Hi,
There should be 2 exes one is your main exe and 2nd should be the exe which checks new version download it and install.
When new version binaries are successfully downloaded prompt the user accordingly and shuts your main exe through 2nd exe, after successfully installation of new binaries call your main exe through 2nd exe.
I hope u got cleared
Regards,
Sunil G.
|
|
|
|
|
I use the following for my one EXE updating solution. It may not follow best practices, but it works.
The idea is that you rename your current exe to a temp file, rename your new exe to your "normal" filename, then restart the process. You can rename the exe while its running, but you don't delete it. Instaed, you delete the "old" exe during your next update (or after the restart) and that way its no longer loaded in memory.
void UpdateAndRestart()
{
string myNewExeLoc = @"C:\My Folder\myNewExe.new";
string myCurrentExe = System.Reflection.Assembly.GetExecutingAssembly().Location;
string myBakExe = myCurrentExe + ".bak";
if (System.IO.File.Exists(myBakExe))
System.IO.File.Delete(myBakExe);
System.IO.File.Move(myCurrentExe, myBakExe);
System.IO.File.Move(myNewExeLoc, myCurrentExe);
System.Diagnostics.Process newP = new System.Diagnostics.Process();
newP.StartInfo.FileName = myCurrentExe;
newP.StartInfo.Arguments = "/updated"
newP.Start();
System.Environment.Exit(0);
}
Edit:
I should note that I use a System.Threading.Mutex to make sure that only one version of my program is running at a time, so I can be sure that when I delete the old filename that there isn't still a version loaded in memory. I also check for the "/updated" argument on startup and deconflict any issues with the Mutex if the other version still hasn't unloaded (to mitigate race-condition errors).
|
|
|
|