|
Alright, thank you!
- Jacob
|
|
|
|
|
Hope some bright minds could figure and help me with this:
I'd like to use kadmin to change password on another linux server FROM a c# programming language on windows server. I wonder if there is some mechanism/setup for these two servers to talk to each others. Or is there something like LDAP for Active Directory?
Will never thank enough.
|
|
|
|
|
Step 1) learn what LDAP is[^]
Step 2) look for a SSH library[^] (maybe on code project? hmmm...)
Step 3) If you know any *nix you should be able to take it from there
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Hi to all,
I am using .net 2.0 framework and I would like to port my c++Builder classes to C#. I need to know if in the .net 2.0 framework or upper versions there are native ( managed) function like :
CreateCaret, Destroycaret, SetCaretPos ShowCaret and HideCaret.
Of course I don't want to use the User32.dll via PInvoke.
Thanks to all
Joss
|
|
|
|
|
JossGP wrote: Of course I don't want to use the User32.dll via PInvoke.
You can set the caret pos in a textbox, the rest, I don't think so.
native and managed are opposite to each other, although I understood what you meant.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian,
I have just readed your suggestion some time ago, and when I searched in google I used this sentence : 'createcaret +C#':
As you probably just know, I didn't find anything that don't use the importing from user32.dll function.
What seem to me unbelievable is that in versions 2.0 and upper microsoft has not thought about to implement these functions.
That's why I post the question in this form. Just in case some one had found something accidentally or for necessity.
thanks in advance for your help
Joss
|
|
|
|
|
I think the thing is, people using C# kind of expect to use p/invoke for this sort of stuff. It's not hard, or fragile, so MS has no incentive to add this stuff.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Today I looked at the contents of a Microsoft Document (*.doc) at school, and it seemed like it was encoded. This did not surprise me, since Microsoft would probably not want the file to be edited outside of the original application.
However, when I found myself a book on Microsoft Office, it stated that Word saved files in a "binary format". Does this "binary format" mean encoded text? Or is it another method of saving, since pictures can be saved as well.
If this method of saving is different from saving a regular text file(right now for example, to save the contents of a dataGridView I extract all the contents first, seperate them using dividers such as "~", and write the entire string to a text file, so my save file looks something like "cell1~cell2~cell3~cell4..."), how can I programmatically do this?
Thanks in advance.
|
|
|
|
|
System.IO has Binary file access
Also the MS Office formats arn't 100% locked. MS has released classes to open/save/view office files. They also have classes to automate/control office applications from .NET much like a VBA does. You can even embed MS Word, Powerpoint, and Excel into your C# applications.
A quick google.com search shows most of the results without me posting them in here.
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
The history behind office documents is that they are binary files for quick saving and reading.
Back in the old days when memory was at a premium and word documents were large(and are even larger now), it was quicker to append changes in some cases rather than re-write a whole file on saving.
Google or Wiki this area and you will find a more accurate rendition than I can give.
With regards to working out the layout of office documents - I think Microsoft may have made this informaton available as I heard that the documentation for Word is truly massive - so good luck
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
How can I write my own binary file? Is it more efficient than the method I mention in the post (with the dataGridView)?
|
|
|
|
|
The binary Office files contain pointers within them so they are more akin to databases (from my limited guesswork).
Creating a binary file is neither here nor there - you will be the person who knows if you need to create a binary file.
You may find XML is a better format for saving data from a datagrid.
XML is a bit bloated but it is easy to read and with LINQ you can even query it directly.
If it is of any help to you in my 20 years of IT experience I have never come across any need to create, or access programatically, a binary file - that does not mean that you may not need to though.
As this is beyond my current knowledge I suggest you google and read up on binary files - then why not post an article on your findings.
Good luck.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
GuyThiebaut wrote: You may find XML is a better format for saving data from a datagrid.
I'll second that.
GuyThiebaut wrote: I have never come across any need to create, or access programatically, a binary file
I've had to support systems that do.
|
|
|
|
|
PIEBALDconsult wrote: GuyThiebaut wrote:
I have never come across any need to create, or access programatically, a binary file
I've had to support systems that do. [Dead]
You have my condolences
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
To answer your questions:
1) In my other post I gave this answer (look up info about System.IO )
2) No, binary read/write in .NET hasn't been optimized by the MS crew as much as text files and XML files. The processing required to deserialize a binary file at times can lose the any speed advantage you'd gain.
Back in the day we has direct access to the system memory and could read/write it's contents to a file and .NET runs in a virtual machine where you don't have direct access to the system hardware. Otherwise your access to it is "managed" though the .NET virtual machine.
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
That Asian Guy wrote: a "binary format"
As in "one of an infinite variety of binary formats". Word uses one binary format, Excel uses another, etc. (and even that's simplified).
Even your example shows that simply saying "saving a regular text file" gives very little information on the format of the data: CSV, XML, and HTML are all "text files".
The difference between text and binary files (in essence) is that if I have a (one byte) numeric value 1 and store it in a text file, the actual value written out (after a ToString) is 49 (the ASCII code of the character '1'); but with a binary file I can write out the value 1 directly.
This can save space because saving the string "123" to a text file requires three bytes, whereas saving the numeric value 123 requires only one byte.
There are usually other differences as well, most notably the translation between NewLine and CarriageReturn/LineFeed, but those tend to be platform-specific.
|
|
|
|
|
Alright I see, thanks people!
|
|
|
|
|
I'm new to writing services and I'm having some trouble figuring out a way to write configuration settings so the service would be able to read it.
I decided to write a separate configuration application with its own namespace. I tried loading the setting by declaring and assigning a new instance of the settings from the other project. Problem is... it doesn't load from the other project, it loads a new instance of those settings for the current project (which makes sense, really -wouldn't want other applications accessing my settings).
My question is, how should I get past this security feature. Is there something built into the ApplicationSettingsBase type that I'm not aware of? Should I save to and load from a static config file? Should I use an INI instead?
Any thoughts would be appreciated.
|
|
|
|
|
I decided to serialize the object i was using to keep my configuration settings and save it to a static xml file. This seems like the simplest method to me.
To reiterate my original question:
Does anyone have any tips on the best practice for setting up a configuration tool for another application? I did some digging and can't quite find anything.
Although... an idea just struck me.
What if I call the config tool from the same executable that the service is run through? I'll have to try this out later since I've already got this working.
|
|
|
|
|
If I fire up a few threads and then want to stop execution in my main thread untill those threads are finished.
What is the most correct way to wait for those threads?
I've always been cheeting and use a dumb loop which checks some condition and then sleeps x ms if the condition was not met.
But I guess thats far from optimal.
(Although thats what I read that lock{}/monitor.tryenter does internally.)
pseudo sample of what I do:
void Foo()
{
perform some async tasks
wait untill all of them are done // whats the best way to achive this part?
return
}
|
|
|
|
|
|
I know how to use async callbacks.
But what I need is to block the execution just like in my sample:
foo()
{
start async tasks
wait for all threads //<-- that part
return processed result
}
|
|
|
|
|
You could call the Thread.Join[^] method on each thread you start, this will block the calling thread until all threads are finished.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
My standard model for multithreading (in a windows app) is to create a a wait form. You can put a progress bar or a label or whatever you want to use. For my threads I use the System.ComponentModel.BackgroundWorker . I'll briefely explain the basics.
My code will create the BackgroundWorker and set up the method it will need to run.
BackgroundWorker myWorker = new BackgroundWorker();
myWorker.DoWork += new DoWorkEventHandler(myWorker_DoWork);
The method passed in looks like this
private void myWorker_DoWork(object sender, DoWorkEventArgs e)
{
}
My WaitForm accepts the BackgroundWorker as a parameter to the constructor.
My WaitForm accepts the background worker as an input parameter. You can set up the worker in the WaitForm to handle progress changed events to modify the message and even a progress bar in the wait form. Also, you will want to set the RunWorkerCompleted event and make it close the WaitForm.
Then, append this below the first block of code.
WaitForm waiting = new WaitForm(myWorker);
waiting.ShowDialog();
By using ShowDialog you are forcing the current thread to wait until the dialog is done. Because the worker is working the dialog won't close until myWorker_DoWork completes.
Also, this is another good approach which I have used on a few applications.
Broken Bokken
You can't carry out a ninja-style assasination dressed as an astronaut. It's the luminous fabric; too visible. - Tripod
The story of your fighting is a poem of two words: YOU SUCK.
|
|
|
|
|
This is not what I want to do.
Im starting up some slow remote task async and I need the result from all of them before the method can return its result.
So Im not asking how to show forms or anything, just whats the correct way to wait for the result of all of them while still inside the method that fired up the async tasks.
|
|
|
|