|
Hi Christian,
Thanks buddy for thinking on my question. Actually i do not understand this question that's why i ask to other if somebody know in real how this could possible in C#.Net so please Please Email me.... Anyways Thanks again
Muhammad Waqas Butt
waqasb4all@yahoo.com
|
|
|
|
|
I'd suggest that if you totally cannot understand my reply, then you should worry about learning some basic programming before considering such a task.
That's not an insult, it's sincere advice. You have to crawl before you walk.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi Buddy ,
I understand what you mean. So it's a fact that i am new in C#.net but i am interested to do GUI based work. Well if you think that i need some extra knowledge so if it possible please refere me some books, code and web sites.
But anyways thanks for you advise...
Muhammad Waqas Butt
|
|
|
|
|
Hi all,
I am trying to get on top of interprocess communication. Most -if not all- of the articles around handle IPC either through a mailbox mechanism or memory mapped file wrappers. The latter is probably best and by far the fastest, but I got the feeling everybody is serializing and deserializing objects to do this.
In my project I have to exchange (an awful lot of) short messages between processes. There is no need for serialization, the message type and structure is known (style 4 msg length bytes, 4 transaction bytes, message payload etc).
The question: would it be possible NOT to do serialization and free the CPU of this burden, but instead write bytes directly to a mem stream in one process and read that same semaphore in another process? Somehow?
Thanks in advance,
Peter Stevens
|
|
|
|
|
Just in case you haven't seen it, there's a really good article posted here called "A C# Framework for Interprocess Synchronization and Communication" By Christoph Ruegg (an Aug 2004 prize winner) that deals with most of the guts work you would need for such a thing.
For what its worth, I'd recommend considering the long-term maintenance and growth of your solution before moving away from binary serialization. If you use a custom method to marshal your data structure you are coupling your IPC code with your message structure and changes in the message structure will likely require changes in the IPC code -- higher long-term maintenance and testing costs. If however you stick with binary serialization, changes in your message structure may not require changes to your infrastructure. Write a loop that shoots 100,000 messages across both IPC mechanisms and you will discover for certain whether you can affort to stay with serialization. But of course I concede that performance easily trumps maintenance in some projects so if this is the case for you just disregard my rambling.
I hope the article has what your need,
CKF
|
|
|
|
|
Many thanks for your replay. I know the risks of moving away from serialization (and standards) but I desperately need the speed. The type of solution is a protocol front-end handling over 100K messages per second on a quad Xeon machine. I was surprised when we were testing how far we could go in opening the message payload for inspection reasons: the performance price for a single extra string operation (such as UrlDecode) costs about 3.000 messages per second less throughput... Imagine.
I've been looking at Christoph's framework, it's a great thing, but it becomes unstable when moving more than 12 Mbit/s (which is around 10.000 msg/sec). The single-process architecture, as it exists today, behaves predictably and inspects and routes up to 180 Mbit/s of message data between components. Also, we've seen some exceptions when either the producer or the consumer dissapears from the process list under load conditions above 5 Mbit/s. Maybe it's synchro-related or the custom queue implementation, I'm not sure.
Anyway, thanks again for thinking along...
Peter.
|
|
|
|
|
NP on the reply, nothing else to do today.
Okay, so you're still in the same situation needing better IPC throughput:
The simple answer to your question is yes... but I need more info; I think I've got stuff lying around that can help... What is your anticipated/desired producer-consumer configuration? Is it one producer many consumers, many to many, one to one, etc. Are all processes expected to be on the same machine (sounds like it)? Also, what is the min, typical, max size of a message?
CKF
|
|
|
|
|
The desired producer/consumer config is one-to-one. The scope of this application (which is part of a larger solution) is a single machine. We conceive several Windows Services that make up the machine solution.
A first one uses sockets to listen for incoming connections and parses streams into atomic messages according to a protocol specification. A second service should handle decryption, a third inspection, and a fourth will be a router that forwards plain-text messages to several back-end machines.
Messages always have a minumum length of 4 bytes length (mapped to an Int32), 4 bytes Transaction Number, 10 bytes of flag fields, and finally the message itself. So theoretically the max length of a message is 4+4+10=18 bytes of headers plus an Int32's MaxValue which would then be 2,147,483,665 bytes. In real life this will not be the case, messages will never exceed 150 bytes, including the header. The typical size will be around 50 bytes.
There is also no need to queue messages within the mem mapped file mechanism as it is already covered with our own queueing mechanism which makes use of IO completion port threading in the background.
Thanks,
Peter
|
|
|
|
|
Hi,
I am writing a web scraping application in C# to download album reviews from allmusic.com. I am using the HttpWebRequest class and need to retrive and parse the HTML for a URL such as http://www.allmusic.com//cg/amg.dll?p=amg&sql=2:THE|JOSHUA|TREE~T10AC
When sniffing the HTTP request, I can see that the class has encoded the URL to replace the pipe characters ("|") with %7C which is not accepted by the allmusic site.
Is there a way to suppress the encoding in this manner?
Thanks,
A.
|
|
|
|
|
Run another pass with the encoded text through the following function:
using System.Text;<br />
<br />
public string fixPipes(string text)<br />
{<br />
char ch = ASCIIEncoding.ASCII.GetChars(new byte[] { 0x7C });<br />
char pipe = '|';<br />
<br />
return text.Replace(ch,pipe);<br />
}
That should do the trick. After that you can post the link to allmusic without problems.
"Every rule in a world of bits and bytes can be bend or eventually be broken"
|
|
|
|
|
Hi,
Thanks for the reply, don't have a problem generating the URL, the problem arises when you use the HttpWebRequest class since it performs the urlencode regardless of the input string (i.e. even though I am passing a URL with pipe characters, when I sniff the outbound HTTP request, you can see that it has transcoded it to %7C).
I need a way to suppress this functionaliy.... any ideas??
|
|
|
|
|
How to use classes from another project without adding this classes to the current project...
Devil Linux
|
|
|
|
|
You load the Dll of used project into your current project. I give to you some code:
Imports System.Reflection
.........
.........
Dim objClass As Object
Dim tType As Type
Dim strFileName As String
Dim strClassName As String
strFileName = "D:\Setup\TaoMenuDong\Test\bin\Test.dll"
strClassName = "Test.Form1"
Dim MyAssembly As [Assembly] = [Assembly].LoadFile(strFileName)
objClass = MyAssembly.CreateInstance(strClassName)
tType = MyAssembly.GetType(strClassName)
Dim PIF As PropertyInfo
PIF = tType.GetProperty("strDuLieu")
PIF.SetValue(objClass, "OK, Don't move, what's your name, bud", Nothing)
Dim Res As String
Res = PIF.GetValue(objClass, Nothing)
MessageBox.Show(Res)
|
|
|
|
|
thankx Mr. nxdess,
but, I want using class from class without uload DLL file.
Devil Linux
|
|
|
|
|
Hi
I'm trying to write some code in C# for displaying a MSChart in Microsoft Word. Ofcourse, I use automation. My code works well with libraries Word 9, MSGraph 8 (of Office 2000). The problem come when I use Office 97 (MSGraph 8, Word 8). After debuging, I see it's because the Object represented for the Chart cannot be casted to the Graph.Chart type. Following is a part of the code:
private object oMissing = System.Reflection.Missing.Value;
Word.Range wrdRng;
Word.InlineShape oShape;
...........
........
object oClassType = "MSGraph.Chart.8";
oShape = wrdRng.InlineShapes.AddOLEObject(ref oClassType, ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing, ref oMissing, ref oMissing);
Graph.Chart chart= (Graph.Chart) oShape.OLEFormat.Object;
The last statement throw an exception System.InvalidCastException with a message : Additional information: Specified cast is not valid.
I also use a similar code for VB6 from address: support.microsoft.com/support/kb/articles/q244/5/89.asp but the result doesn't change
Help me!
Thanks!
|
|
|
|
|
Hi,
I'm a little confused on why I'm getting this error message:
"DataTable already belongs to another DataSet"
Here is the situation….
I'm passing two DataTables to another Form (to generate a crystal report) so they are public in the new Form. This new Form adds both DataTables to a DataSet (to send to the report). The first load of the report Form works fine, the second time around, I get the error message. If I reload the DataTables in the first Form (with the exact data), It works fine each time. I thought the DataSet would be nuked when you close the Form that created it (.Show is used to load report Form)
Could it be that the original DataTables (in first Form) are now in a DataSet, which was created in the second Form? New to programming )
thanks,
Ron
|
|
|
|
|
Add the DataTable to the DataSet only once (perhaps in the code that shows the report) but then pass a reference to the DataSet as parameters to methods or as properties.
Most objects in .NET are references, so passing around the variables is actually passing around a reference to the original object. Only a handful of types - your primitives (numbers and bool), structures, and enumerations - are value types and passed by value, so any changes to them won't change the original.
The problem you're experience is exactly what the error tells you - the DataTable already belongs to another DataSet and cannot be added to another one. Because your code is being executed twice, the table is added (or, rather, you're trying to add) to two different instances of a DataSet .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks Heath,
I add the datatables to the dataset in the first form, this way the datatables are not added every time I load the report Form (like you said).
|
|
|
|
|
i have a string "13255ad27d"
this string it not fixed it might be "1212221121"
but i know that the lenth is fixed = 10
wonna count how many 0,1,2.....9 and A,B,C...F
if string is "1212221121"
A=0
B=0
1=5
2=5
3=0
4=0
do this from 0-9 and A-f
|
|
|
|
|
Here is a nice quick way of doing this:
string text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris ut dui vitae nulla eleifend malesuada. Aliquam semper tortor nec arcu. Donec consequat tincidunt ipsum. Praesent tempor magna nec massa. Curabitur ut tortor. Fusce massa. Pellentesque vulputate, ante quis mattis euismod, magna elit pretium enim, eu varius nisl eros vel nisl. Pellentesque quis enim. Phasellus eu erat. Ut convallis pede quis purus. Aliquam nec diam ut mauris congue suscipit. Nam eleifend congue sapien. Cras vulputate erat id ligula. Suspendisse potenti. Sed laoreet aliquet lorem.";
Hashtable charCounter = new Hashtable();
foreach(char c in text.ToCharArray())
{
if (charCounter.ContainsKey(c))
{
charCounter[c] = (int)charCounter[c] + 1;
}
else
{
charCounter.Add(c, 0);
}
}
foreach(char c in charCounter.Keys)
{
System.Diagnostics.Trace.WriteLine("Char: " + c + " " + charCounter[c]);
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
I add a user control to my project, I then inherit from a TabPage. I add controls to the designer but when I switch between code and designer view i get an error
"Operation not valid due to the current state of the object" Lost many sleepless hours over this. It is now 3.46 am here and i am bit tired hope i wake and see the end of this error.
here is the compile message
'DefaultDomain': Loaded 'c:\winnt\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded.
'createControls': Loaded 'G:\DomesticAndGeneral\DGIWork\createControls\bin\Debug\createControls.exe', Symbols loaded.
'createControls.exe': Loaded 'c:\winnt\assembly\gac\system.windows.forms\1.0.5000.0__b77a5c561934e089\system.windows.forms.dll', No symbols loaded.
'createControls.exe': Loaded 'c:\winnt\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll', No symbols loaded.
'createControls.exe': Loaded 'c:\winnt\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll', No symbols loaded.
'createControls.exe': Loaded 'c:\winnt\assembly\gac\c1.win.c1flexgrid\2.1.20031.104__c9c7ad9c0a5706c9\c1.win.c1flexgrid.dll', No symbols loaded.
'createControls.exe': Loaded 'c:\winnt\assembly\gac\c1.common\1.0.20031.116__e272bb32d11b1948\c1.common.dll', No symbols loaded.
'createControls.exe': Loaded 'c:\winnt\assembly\gac\c1.win.c1input\1.0.20031.0__7e7ff60f0c214f9a\c1.win.c1input.dll', No symbols loaded.
'createControls.exe': Loaded 'c:\winnt\assembly\gac\accessibility\1.0.5000.0__b03f5f7f11d50a3a\accessibility.dll', No symbols loaded.
'createControls.exe': Loaded 'c:\winnt\assembly\gac\system.design\1.0.5000.0__b03f5f7f11d50a3a\system.design.dll', No symbols loaded.
The program '[6432] createControls.exe' has exited with code 0 (0x0).
|
|
|
|
|
Well the code of the User Control might help. At least maybe the contructor and component initialization. It looks like you might have some invalid code in the user control. The designer has to instantiate and load the control in design mode. You need to make sure the code doesn't exception out or set any invalid arguments in the default constructor.
-
Drew
|
|
|
|
|
when i change the inheritance back to a usercontrol it compiles ok and no problems with the symbols but when i inherit from the tabpage it goes looses the symbols and every control i have on the page is an error. with 3000 lines of code a bit much to show unless i can email it?
|
|
|
|
|
Hello one more time (and last time for the time being )
In one of those forms I was talking about on my previous posts, I have a multiline textbox. The user types some text, presses Enter, and some more text. The data is correctly saved, and the form closes. But when I open the form again and display the text in the multiline textbox, it is displayed on a single line with some unreadable characters where line breaks should go.
I know is a problem of LF vs CRLF but my question is why if I take the text from a text box and then set it back, the line breaks are not recgonized. And, any quick way to fix it?
Thanks,
-- LuisR
___________
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
|
|
|
|
|
How are you "saving" this data? It's important that you always use Environment.NewLine which is correctly defined on the platform on which the CLI implementation (.NET is Microsoft's implementation of the CLI).
If you're saving this text using a TextWriter , it should be saved with the correct line-ending.
The encoding could also matter. Make sure that you read and write with the same encoding. If you save using a Unicode encoding and then read the file back in using a 7- or 8-bit encoding like ASCII - or even a multi-byte encoding like UTF8 depending on the characters being encoded - you will notice problems (because the bytes would be 0x0d,0x00,0x0a,0x00, not 0x0d,0x0a).
If you could provide more information, that would also be helpful.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|