|
I'm gonna try using remoting with an IPC channel. I haven't seen any evidence that a given remoting channel is bi-directional.
I'm either just not seeing it, or it doesn't do it. Can anyone tell me which is the case.
If a single IPC channel is not bi-directional, can a given app be both a client and a server?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
To use it bi-directionally you'll need to set the SerializationLevel to full.
Heres how you do that with configuration files:
note that this is for tcp and binary formatting but it's pretty much the same for any formatter and channel (with a few different attributes in the channel def).
client
<system.runtime.remoting>
<application name="xxx">
<client>
<wellknown type="xxx, xxx" url="tcp://127.0.0.1:xxx/xxx/xxx.rem"/>
</client>
<channels>
<channel ref="tcp" port="0">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
server
<system.runtime.remoting>
<application name="xxx">
<service>
<wellknown mode="Singleton" type="xxx, xxx" objectUri="xxx.rem"/>
</service>
<channels>
<channel ref="tcp" port="xxx">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
It can take some fiddling* to get the config files right but it's well worth it for the ease of configuration later on.
* read: days of looking for single wrong cased letters and trying different combinations.
See the way "wellknown" is all lowercase? when done progromatically they do it WellKnown. Because of that i put wellKnown and it took me agood couple of hours dealing with the inadiquate exceptions to find that one ... even had my boss over helping for an hour of that.
Just a note with the IPC channel. It has a bug with remoting events. Now most of the time you shouldn't rmeote events anyway but you'll often want to with IPC as it's obviously on the same machine and so not so bad to do. THe issue is that after your first client disconnects the server will break. heh ... not so good huh? This means for now you'll have to use TCP, but on the bright side if you use the remoting configuration files (and you should ) then its very easy to switch channels.
Heres the link to the connect bug report:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=293769[^]
Edit: forgot it doesn't like xml
|
|
|
|
|
Ya know, if you put a pre tag around that, it'll format...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I did ... and it still ate half of the tags :/
thats when I then switched to using html encoding X(
|
|
|
|
|
Either way, I can't seem to get my head around this remoting stuff.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
hmmm I'll try and put up an article on how I personally do it. I have the little exmaple project I came up with for that bug report which I'll try and pad out with an article. It covers most of the basics and imo impliments some important stuff which is often missing from remoting examples (like shared interfaces and use of config files).
I'll see if I can get round to it tonight (I'll be home in 2 hours) and post it up before I go to bed.
|
|
|
|
|
Many thanks.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hmmm I went through the stuff I have last night and I'm not sure when I'm gonna have time to write it up :/
I do have a very good ebook if you would like to errr borrow it ... I'd highly recommend buying the paperback version if you like it.
COdeporject doesn't have a PM system does it?
|
|
|
|
|
As answer to your question
John Simmons / outlaw programmer wrote: can a given app be both a client and a server
the answer is yes.
I've been home on paternityleave for 5 weeks and bored as I was of Soapseries in the evening;), I started making a chatserver and clients using remoting. I created two objects to expose through remoting - server channel object and client channel object. When I fire up the server, it starts a remoting server and exposes the server channel object. I then created a method in the server channel to allow clients to register with the server. When the client fires, it too sets up its own remoting server and exposes the client channel. Upon client registration, the server retrieves the remoting proxy from the client for bi-directional communication.
Hope that's of some help.
Best of luck!
-Larantz-
|
|
|
|
|
Could you please tell me how can I drag and drop single/multiple rows having multiple cells from a Datagridview1 to another i.e Datagridview2 ?. I have two datagridviews in a Windows application in C#.
With Regards
Tapan
|
|
|
|
|
I just observed an elegant overload of System.Console.Beep in .NET Framework 2.0 BCL which supports musical notes through C#.
http://msdn2.microsoft.com/en-us/library/system.console.beep.aspx[^]
But I find the way to configure musical notes is bit different and a bit more tedious compared to QBasic Play. Has somebody tried this out and any clue on the mapping between Play Notes in QBasic Play and Beep in .NET Framework 2.0. Also, a quick search in Google didn't much give me much examples too. Perhaps this is kind of unexplored jungle yet?
|
|
|
|
|
|
Thank you for the reply illustrating it with an easy-to-grasp example and an elegant quick reference table.
|
|
|
|
|
NP
|
|
|
|
|
I'm not familiar with QBasic, but I've written some code to play notes with System.Console.Beep, and created XML files to contain tunes. For the last few months I've been driving the system admin nuts by having the email server play Westminster chimes.
If there's enough interest I could write an article.
A hard-coded tune:
part1 = new PIEBALD.Types.SpeakerMusicSong
(
"Westminster 1"
,
120
,
PIEBALD.Types.SpeakerMusicEnumerations.Duration.Quarter
) ;
part1.Add
(
PIEBALD.Types.SpeakerMusicEnumerations.Pitch.E
,
PIEBALD.Types.SpeakerMusicEnumerations.Octave.Fifth
,
PIEBALD.Types.SpeakerMusicEnumerations.Duration.Quarter
) ;
part1.Add
(
PIEBALD.Types.SpeakerMusicEnumerations.Pitch.D
,
PIEBALD.Types.SpeakerMusicEnumerations.Octave.Fifth
,
PIEBALD.Types.SpeakerMusicEnumerations.Duration.Quarter
) ;
part1.Add
(
PIEBALD.Types.SpeakerMusicEnumerations.Pitch.C
,
PIEBALD.Types.SpeakerMusicEnumerations.Octave.Fifth
,
PIEBALD.Types.SpeakerMusicEnumerations.Duration.Quarter
) ;
part1.Add
(
PIEBALD.Types.SpeakerMusicEnumerations.Pitch.G
,
PIEBALD.Types.SpeakerMusicEnumerations.Octave.Fourth
,
PIEBALD.Types.SpeakerMusicEnumerations.Duration.Half
) ;
part1.Add
(
PIEBALD.Types.SpeakerMusicEnumerations.Pitch.Rest
,
PIEBALD.Types.SpeakerMusicEnumerations.Octave.Fifth
,
PIEBALD.Types.SpeakerMusicEnumerations.Duration.Quarter
) ;
part1.Play() ;
An XML-based tune:
<SpeakerMusicSong Title="Twinkle Twinkle Little Star" Tempo="104" Beat="Quarter">
<SpeakerMusicNote Pitch="C" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="C" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="A" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="A" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Half" />
<SpeakerMusicNote Pitch="F" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="F" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="E" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="E" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="D" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="D" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="C" Octave="Fifth" Duration="Half" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="F" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="F" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="E" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="E" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="D" Octave="Fifth" Duration="Half" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="F" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="F" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="E" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="E" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="D" Octave="Fifth" Duration="Half" />
<SpeakerMusicNote Pitch="C" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="C" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="A" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="A" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="G" Octave="Fifth" Duration="Half" />
<SpeakerMusicNote Pitch="F" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="F" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="E" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="E" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="D" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="D" Octave="Fifth" Duration="Quarter" />
<SpeakerMusicNote Pitch="C" Octave="Fifth" Duration="Half" />
</SpeakerMusicSong>
Playing an XML-based tune:
System.Threading.Thread tt = PIEBALD.Types.SpeakerMusicSong.FromXML
(
new System.IO.FileInfo ( args [ 0 ] )
).PlayAsync() ;
|
|
|
|
|
PIEBALDconsult wrote: For the last few months I've been driving the system admin nuts by having the email server play Westminster chimes.
Sweet
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I have been experimenting and searching for quite a while, and decided to finally throw in the towel and ask for help. My requirement is to enable our user to create an e-mail, containing formatted body text and an attachment, and have that e-mail be created in his/her default e-mail client. In other words, the user clicks a "Send E-mail" button and the e-mail editing window of their default e-mail client pops open with a "ready-to-send" e-mail waiting there, with attachments and all.
After investigating numerous possibilities, I've realized that this is not going to be as easy as I once assumed it would be. We cannot use the old "mailto" trick because we must pass an attachment. We cannot use the "roll your own e-mail editor" solution because v1 of our application allowed (some) users to open their default email client -- but the technique used is extremely unreliable and Outlook-centric...hence the rewrite.
Ideally the solution will be ignorant of the various e-mail clients with which it might interact. I'd prefer not to have some horrid code like:
if (defaultEmailClient.IsOutlook2007)
{
}
else if (defaultEmailClient.IsThunderbird)
{
}
Again, the core issues are:
1) Must create a new e-mail in the user's default e-mail client.
2) Must be able to specify one or more attachments for the e-mail.
3) The code should not have direct knowledge of the exact e-mail client with which it interacts.
Any help/tips/pointers/etc. regarding this seemingly simple problem would be greatly appreciated.
:josh:
My WPF Blog[ ^]
Without a strive for perfection I would be terribly bored.
|
|
|
|
|
Nevermind me, I found the answer right here[^] on CP.
:josh:
My WPF Blog[ ^]
Without a strive for perfection I would be terribly bored.
|
|
|
|
|
how do i convert java.io.FileInputStream to System.IO.Stream
|
|
|
|
|
AFAIK, you can't. There is no conversion from the java.io.FileInputStream type to the System.Io.Stream type. They're not in the same inheritance tree.
Also, the java version doesn't expose any method for getting the underlying file handle, so there's no way to tell a new instance of the Stream class which handle to use.
|
|
|
|
|
Hi All,
I've been googling on Framework64 pretty much all morning, but I have two questions which I've yet to find an answer for (the answer may well have been in what I read, but my ability to comprehend may not)...
1)If I "compile" my .Net application for x64 processors, it tells me that mscorelib.dll and system.data.dll target a different processor. Is there a way to automagically change all references to use the x64 versions, or do I have to do this for each manually?
2)Running an x64 .Net exe on a 32-bit windows machine generates the message "Not a valid Win32 application". This is pretty much what I expected, but leads me to wonder how this fits in to the whole JIT compiling of .Net apps - possibly my understanding is at fault here, but I believed that a .Net exe isn't actually compiled to native code anyway. Does this mean that there are two types of (do they call it PE?) .net IL code, x86 and x64?
3) Ok, so I said only two questions - but this one just occured: are there any recommended practices which dictate not specifying a specific processor type, and letting the target machine determine what to do? Would this even work?
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
martin_hughes wrote: Is there a way to automagically change all references to use the x64 versions, or do I have to do this for each manually?
As far as I know, there isn't anything that automatically does this for you if you explicitly specify the processor architecture for the compiler.
martin_hughes wrote: but I believed that a .Net exe isn't actually compiled to native code anyway.
That is correct. Any .NET application is actually compiled to IL code. When the application runs, the JIT "finishes" the compilation down to native code. As far as I know there aren't two different types of IL, but there are most likely instructions (meta data) in the IL that tell it what architecture it was compiled for.
martin_hughes wrote: are there any recommended practices which dictate not specifying a specific processor type, and letting the target machine determine what to do? Would this even work?
I believe one of the options is "Any CPU" which generates platform independent code that will run as a native 32-bit or native 64-bit application depending on the architecture.
The only issue is that you can't mix "modes", meaning that if you have 3rd party dependencies that aren't available as 64-bit images you will get a runtime error if you compile as a 64-bit application.
|
|
|
|
|
Magic - thanks Scott.
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
Hi there
i have a asp.net app and i can;t make it work on my machine
IIS is working
SQL server 2000 is on
i have attached the database through visual studio 2003 i have access to it but in thew servers panel i get data source not found
though i can modify my db and i can browse the .aspx files but ofcourse i have no communication with the database,so nothing works...
i 'm fresh to asp and i really need your help
thanks
ninja coding
ninja coding
|
|
|
|
|
You need a basic course in ASP.NET, Your question is very general.
You can start from here http://www.w3schools.com/aspnet/default.asp[^]
there's lot to learn as a beginner.
Any systematic work reflects its significance for a long time. So let's discuss the best...
|
|
|
|