|
Use image column.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
hello
having problem trying to unregister remoting channel (.NET 2.0/XP) - error:
<br />
System.Net.Sockets.SocketException : Only one usage of each socket address (protocol/network address/port) is normally permitted<br />
On server side, I created the channel by:
<br />
TcpChannel oTcpChannel = new TcpChannel(AppContext.DefaultRemotingInterfacePort); ChannelServices.RegisterChannel(oTcpChannel, true);<br />
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Util.MyRemoteObj, "TcpRemoteObj", WellKnownObjectMode.Singleton);<br />
Then I try to close and restart channel (as part of application re-initialization rountine - this means process never actually exited and that would be undesirable)
<br />
ChannelServices.UnregisterChannel(oChannel);<br />
TcpChannel oChTcp = (TcpChannel)oChannel; oChTcp.StopListening(null);<br />
I have no clue how to get around this at the moment - I Googled a bit seems like many people are running into this problem but no solution yet. Many suspected OS (or .NET) failed to release socket on UnregisterChannel until application/process exit. But I don't want to exit the app, just want to reinitialize remoting as part of re-init routine.
Any suggestion? Many thanks!
dev
|
|
|
|
|
i am making a program wherein i have a replica of a keyboard. The user will tap any key on the keyboard on what he would like to type. He can select the input language to English,Japanese Hiragana and Japanese Katakana. I'm using Sendkey.Sendwait to send the character tapped by the user to the textbox. My problem is when I select Hiragana or Katakana for the input language and type, sometimes the characters that I type will disappear. It will appear when the user will tap again a key to the keyboard. Please help me...
below is a snippet of my code...this will just display the alphabets...when the letter is tap...
if (m_LastStr!=null && m_LastStr.EndsWith(" ")) // added for the correction asked by anand
{
SendKeys.SendWait(m_LastStr + "\n");
SendKeys.Flush();
m_LastStr = null;
}
if (((Button)sender).Text[0] > 'A' && ((Button)sender).Text[0] < 'Z') // to handle shift effect
{
m_LastStr = m_LastStr + ((Button)sender).Text.ToLower();
SendKeys.SendWait(m_LastStr);
}
else
{
m_LastStr = m_LastStr + ((Button)sender).Text;
SendKeys.SendWait(m_LastStr);
}
SendKeys.Flush();
|
|
|
|
|
How to generate XML report using SQL Server Reporting Services?
|
|
|
|
|
|
|
I am working with Digital Elevation Models, and some of these are very large and very slow to access.
The files currently are in text format 10,000 rows and 8000 columns , and I was considering that as all items the file contains are positive numbers (ranging from 0 being sealevel to 4000 being highest peak) there must be a much better format to store these for file size and access speed.
What would you suggest as the best file format for this -two bytes for each number, or singles, or doubles or....? The key thing is fast access to the array of data in the file.
Thanks for any suggestions.
|
|
|
|
|
Hi,
a binary file will provide access much much faster than anything text-oriented.
use BinaryWriter/BinaryReader for this.
Warnings with binary files:
- you are responsible for consistent file contents; from the outside, it looks like just a collection of bytes, there is no way to recognize its structure;
- portability is limited to systems that have the exact same data representation; e.g. x86 stores multibyte values in "little-endian" mode (least sighificant byte first), other systems may use
"big-endian" hence not correctly interpret the same file.
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text, and PictureBoxes for pictures, not drawings.
modified on Friday, June 10, 2011 12:27 PM
|
|
|
|
|
Binary, as Luc said. And you should probably use short (Int16) values.
Also, can you read and write a group of them at a time?
|
|
|
|
|
For the simplest code you could use two bytes for each value:
value = data[0] + data[1] * 256;
You only need 12 bits to store each value (0 to 4095), so for the smallest file size you could pack two values in three bytes:
Bit usage:
11111111 11112222 22222222
pack:
data[0] = (byte)value1;<br />
data[1] = (byte)(((value1 >> 8) << 4) + (value2 & 15));<br />
data[2] = (byte)(value2 >> 4);
unpack:
value1 = data[0] + ((data[1] >> 4) << 8);<br />
value2 = (data[1] & 15) + (data[2] << 4);
Despite everything, the person most likely to be fooling you next is yourself.
modified on Wednesday, January 14, 2009 12:34 AM
|
|
|
|
|
As people have mentioned, binary packed 16 bits per datapoint. Keep in mind your raw data is around 150MB.
You could have a fiddle with the Bitmap classes if you are uncomfortable with packing data yourself - treating them as a heightmap. May give performance benefits if GDI doesnt have a problem with the image size.
|
|
|
|
|
Thanks all for the suggestions, the bitmap idea could be very helpful as it would maintain the structure of the file.
I don't know if the code to get a pixel value from a bitmap is efficient. As the file only has to be created once write speed is not relevent, but read time critical.
|
|
|
|
|
Reanalyse wrote: Smallest and fastest way
Usually the two requirements go in the opposite direction.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
I am trying to use an ActiveX object in my c# application. The ActiveX object is installed in my pc and works properly in my c++ application. but when i tried to drag and drop the ocx from the toolbox to a winform in my c# application, an error poped up and said the ocx wasn't registered properly. so i tried to use reflection for dynamically innovating it't members and properties.
firstly, i created a class inherited from AxHost.
The type of ocx has been created as follow:
ocxType = Type.GetTypeFromCLSID(new Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx")); // guid of the ocx object registered in my pc
then in order to use the methods of this ocx, i used Type.Invokemember to do the job.
ocxType.InvokeMember("MethodName", BindingFlags.InvokeMethod, null, this.GetOcx(), null); // "MethodName" is coming from the description documtation of the ocx object
I tested the program and it executed successfully.
However, when i tried to invoke the properties, unknown name exception was thrown all the time. but what confused me the most is that invoking the event in this way seemed not working at all.
so here are my questions:
what is the proper way to use the Ocx object in C# application?
Are there any disadvantages of invoking members of ocx in this way?
How can I bind all the information including event?
Thank you soo much for all the help,
angral
modified on Tuesday, January 13, 2009 8:59 PM
|
|
|
|
|
I am not at all sure that this will cure your problems, but a long time ago I had troubles using an ActiveX object. If my memory serves I used the VS commandline tool 'aximp'.
While you are waiting for someone who really knows what to do, you might look up the help for this tool.
Sorry I couldn't be more help.
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
Thanks Henry,
that AXIMP.exe is a very handy tool.
I will experiment it right away.
Cheers
angral
|
|
|
|
|
Is there a way to insert a video\animation into a c# application that is officially supported by the .net framework (meaning I won't be dependent on a third-party component)?
|
|
|
|
|
|
Hi All,
Im currently studying the asp.net tutorials for Data access . Ie datasets, datatables and SQL stuff as per the following link.
http://www.asp.net/learn/data-access/tutorial-01-cs.aspx[^]
However I find that much of the tutorials centre on using the help wizard to do things for you rather than being able to hard code it yourself.
Does someone know of any other sites which enables you to learn the above by hard coding rather than relying on the wizard. Thanks
Best Regards
modified on Tuesday, January 13, 2009 7:54 PM
|
|
|
|
|
Dig further; there are TONS of places, including here, that show you how to hard code this stuff.
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|
Hi.
In my app I have a ListView (in Detail view) with owner drawn items/subitems. It works fine except when the user double clicks the vertical line between the column headers to resize the column. The column width becomes all wrong. So I need some way to give autoresize the width of the subitems, but I haven't found any. The only solution I have thought of is to catch a double click on the headers and handle the resize myself, but since the double click event is not sent for column clicks this solution will be messy. So, does anyone know a less ugly solution to this problem?
modified on Wednesday, January 14, 2009 3:28 PM
|
|
|
|
|
Hello
I new to Programming so please bare with me
I am trying to write a Theatre Booking system in C# but I hit a slight problem.
The Problem is that the seating argument that is used in the theatre has Row A-H with 15 seats and J-P with 18 seats. On The form there is a separate Box for row letter and a separate box seat number When the Operator selects a seat location eg (A5) I want to be able to run a check on it to see whether it is valid. For example seat A5 would return no value because it is a possible combination as for A17 I want it to return a value “Seat Not Possible”. How do I go about this?
I thought of using a statement like [ “If (TB1 <= 7 & TB2 < = 15) Return Message “Seat Choice Valid” else Return Message “Invalid Choice of seats” // “If (TB1 >= 7 & TB2 <= 18 Return Message “Seat Choice Valid” else Return Message “Invalid Choice of seats” ]. Would this work ?
Problem Here is I than need to assign all the row letters to number for example A=1, B=2, C=3 ect How would I do this, could I use an array to assign Values or can I use multiple If statements. I thought about using an If statement similar too [ “IF (TB1 = A) do A = 1;” // “else If (TB1 = B) do B = 2” // else “IF (TB1 = C) do C = 3;” // “else If (TB1 = D) do D = 4” ect ]. Would this work ?
I would appreciate any help on this matter as I have come to a dead end.
|
|
|
|
|
tswright1041 wrote: [ “IF (TB1 = A) do A = 1;” // “else If (TB1 = B) do B = 2” // else “IF (TB1 = C) do C = 3;” // “else If (TB1 = D) do D = 4” ect ].
I'm going to say no because that would be an assignment operator not a comparator operator, use == this isn't VB
|
|
|
|
|
I think the ideal solution here is to not give them the ability to choose an invalid seat combination in the first place. Something like a dropdown that has the Box Rows and a dynamic dropdown for the Box Seats that only populates with valid seat numbers.
|
|
|
|
|
Or have a Dictionary<char,Hashset<int>>
if ( dic [ row ].Contains [ number ] ) ...
|
|
|
|