|
Happy New Year ! to all.
Just wondering if someone would give me a bit of guidance on this.
I need to signal various points of code execution from a windows service to a monitoring application on the same machine.
This is apart from those handled by "Service controller class".
I have had a look at tcp sockets, .net remoting and named pipes, but that all seems like overkill.
As i am simply looking for a boolean flag, no messages or data transfer as such.
Has anyone found a simple way of doing this,i know i must be missing something ?
Thanks in advance.
|
|
|
|
|
IPC generally isn't a simple thing. If you want to signal state from one process to another then you have to send some sort of message but it doesn't have to be a big one.
Two simpler options than the ones you listed are shared file IO (see the System.IO[^] namespace) and MSMQ (see the MessageQueue[^] class). If you want quick and easy, I suggest you look into the MSMQ option; it boils down to just a few lines of code for both sending and receiving messages.
|
|
|
|
|
Thanks for that, i will investigate the message queue alternative i think.
I had thought about using an XML file but it seems like that could introduce possible problems.
It is reliability i am after.
|
|
|
|
|
Hi,
I'm experimenting with the new System.Threading.Parallel methods like parallel for and foreach.
They seem to work nicely but I need a way to increase the number of concurrent threads that are executed which are 8 (I have a quad core).
I know there is a way I just can find the right property.
Gilad.
P.S. Please don't write that more threads won't give better output, I already have got a bunch of those.
|
|
|
|
|
Well, I believe (but don't quote me on that), that you can create a new TaskManager and give it a parameter maxConcurrentThreads (or such)
Is that what you're looking for?
-- edited to not be an answer --
modified on Friday, January 1, 2010 6:30 PM
|
|
|
|
|
Well... this is kinda tricky..
in the System.Threading 2008CTP you could see the TaskManager and it actually had properties for Threads-Per-Cpu under
System.Threading.Tasks.TaskManager.Current.Policy.IdealThreadsPerProcessor
but for some reason it wasn't possible see the default taskManager nor to access those values (read-only) or create a TaskManager of your own.
In the 2010 beta there is no TaskManager... hmmm... I couldn't find any similar object that might do the same job.
What is going on???
|
|
|
|
|
Aaah breaking API changes! They do not make me happy.
I'm sorry, but I really have no clue then..
|
|
|
|
|
You can use an overload that takes a ParallelOptions parameter and set its MaxDegreeOfParallelism property. However, the default TaskScheduler uses the thread pool to decide the number of running threads, so you're not really in control.
If you use Tasks instead, you can pass TaskCreationOptions.LongRunning , which spawns a new thread every time.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
quote:
var query = from item in source.AsParallel().WithDegreeOfParallelism(10)
where Compute(item) > 42
select item;
In cases where a query is performing a significant amount of non-compute-bound work such as File I/O, it might be beneficial to specify a degree of parallelism greater than the number of cores on the machine.
from:
MSDN[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
hi I'm trying to code a telnet server in c# i know how to create simple shell by redirecting stdin,stdout over a socket but I would like to be able get the user to log in using a username and password how would i do this, i know i could do this by before the cmd.exe is executed i could ask user for username and password and then execute the shell but is there a better way to do this?
|
|
|
|
|
Please read the forum guide line before you ask any question in forum.
Your question is nothing related with asp.net
[Edit] I am sorry. I thought I am replying in ASP.NET Forum [/Edit]
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
modified on Saturday, January 2, 2010 3:28 AM
|
|
|
|
|
Abhijit Jana wrote:
Your question is nothing related with asp.net
Sorry... Not an ASP.NET
|
|
|
|
|
I am sorry !! I thought I am replying in ASP.NET forum
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
hi so can anyone get back to me on this question?
|
|
|
|
|
|
kindly post your error description.
And Secondly post this message in ASP.net forum.
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
I am not sure about why you have deleted your message.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I need to create something which is like an Add friend function in my website which works like this:
1) User types in name of the person he wants to search in the search field and clicks enter
2) on the same page, the search result will come out with an "add friend" button beside every name
3) when the user clicks the "add friend" button, he will be brought to another page (or pop up with a message box?) with a text message field to send to the friend, and a submit button to submit the friend request.
4) over at the Friend's page, he will be able to view the add friend request and decide whether to accept or deny the friend request.
How do i go about doing this? any one help or provide me some guide or advice please?
Any help will be appreaciated. Thanks!
|
|
|
|
|
I have no clue at all.
Maybe you should try the ASP.NET forum?
|
|
|
|
|
Hi,
Is there any difference in the following with regards to security?
private int _orderId;
public int OrderId
{
get { return _orderId; }
set { _orderId = value; }
}
...and...
public int OrderId { get; set; }
When should we use the one and not the other?
Regards
|
|
|
|
|
.NET Enthusiast wrote: Is there any difference in the following with regards to security?
No. The only difference is compiler will generate the backing field for automated properties.
.NET Enthusiast wrote: When should we use the one and not the other?
If you want more control over the getter and setter, you need to use the first one. For example, when OrderId is set, you need to fire an event. Something like,
private int _orderId;
public int OrderId
{
get { return _orderId; }
set { _
orderId = value;
PropertyChanged();
}
} In all other cases, automated properties are just fine.
Best wishes,
Navaneeth
|
|
|
|
|
Thanks Navaneeth
|
|
|
|
|
In addition to the already correct answer you have, when using automatic properties you must have both a getter and setter. If you wish to have a read only property you have to mark the setter as private. If using your own backing field you only have to provide the getter.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I have recently updated to Vis 2008 and after converting some of my code that utilizes the axmediaplayer the code no longer works properly.
I have an event handler for the AXmediaplayer called wmp:
this.wmp.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(this.player_PlayStateChange);
Which in the 2005 code triggers this event:
private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
MessageBox.Show("PLAY STATE = " + e.newState);
// There is more here
}
When converted to Vis 2008 the event is no longer triggered.
|
|
|
|
|
Problem solved.
You need to reload the COM components for the Windows Media Player after conversion.
|
|
|
|