|
reza assar wrote: i know bun unfortunately i can`t derive from desired class because it force me to change all of the project
Sounds like the requirements and specs changed after development started. You really have to plan ahread for these things.
reza assar wrote: in addition i am looking for a better solution
You don't have one. Extension methods cannot be attached to a property of a type, only to the type itself.
|
|
|
|
|
hi!
I have a listview , which contains some records with checkbox.
I have also a linkbutton for select all, delete and so on.
my query is, when i click on select all(link button) all checkbox has select.
please help me.
i use this code, but not work :
protected void lnkSelect_Click(object sender, EventArgs e)
{
foreach (ListViewDataItem lvItem in lstView.Items)
{
CheckBox check = (CheckBox)lvItem.FindControl("chksel");
if (check != null && check.Checked)
{
check.Checked = true;
}
}
}
thanx & regards
|
|
|
|
|
Message Closed
modified 23-Nov-14 5:55am.
|
|
|
|
|
hi!
I use your code ,listViewItem.checked but (.checked) is not populated.
|
|
|
|
|
|
Hi...
In my application , we are using sql server for data store . For our test case , we want insert dump datas . but datas has in the format of file is .adi and .adt format file ( When i search in google its sybase database ) . we need to get data from that format file to sql server . Please help me welcomes ur idea and helps
Thanks
|
|
|
|
|
I'd install a sybase database engine on a virtual machine, restore the database from those files, and then look for a migration tool from sybase to SQLServer (I do not know if it exists...)
Good luck!
|
|
|
|
|
Thanks for reply
not have sybase migration software.. if u have these software download URL , please send me .. Its most helpful to us ..
|
|
|
|
|
Thanks for reply
not have sybase migration software.. if u have these software download URL , please send me .. Its most helpful to us ..
|
|
|
|
|
I have CheckBoxList. I am binding data to checkbox List from DataBase. How can I Get Listitem value using Javascript.
|
|
|
|
|
You do realize that you have posted a JavaScript question in the c# Forum, don't you?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi All,
I am working on developing a application (Windows Application) where in the application gets the content (majorly flash content) from a content server and takes the snapshot and gets the RGB data out into a buffer at x fps. This buffer is then passed to a display stack which handles the off-screen rendering.
I am using IECore as the renderer. I am able to capture the snapshot of the web content and save it as bmp file (shown below).
To get the content
AxWebBrowser web = new AxWebBrowser();
web.SetBounds(0, 0, 1024, 600);
web.Navigate2(ref URL, ref oNull, ref oNull, ref oNull, ref oNull);
Application.Run();
private Graphics grp;
private IntPtr hdc;
private IViewObject vw;
private IHTMLDocument2 doc;
public void Capture()
{
doc = (IHTMLDocument2)web .Document;
web.SetBounds(0, 0, width, height);
image = new Bitmap(width, height);
grp = Graphics.FromImage(image);
_RECTL bounds;
bounds.left = 0;
bounds.top = 0;
bounds.right = width;
bounds.bottom = height;
hdc = grp.GetHdc();
vw = doc2 as IViewObject;
vw.Draw(1, -1, (IntPtr)0, (IntPtr)0, (IntPtr)0,
(IntPtr)hdc, ref bounds, (IntPtr)0, (IntPtr)0, 0);
grp.ReleaseHdc(hdc);
image.Save(fileName);
image.Dispose();
}
}
I am hopefule that we will have some mechanism to extract the RGBA data out of it. But I am not getting the clue of handling the mouse events. here the rendering is happening to a memory and not to a window (off-screen rendering).
The display sdk (a C dll) requires the application to register a call back funtion to get the mouse related data. The information that I will get is the left down/up, move and x and y co-ordinates.
Now, what I want to know is, how to register a call back function and how to pass the mouse information to the IE Core so that it responds as if it was clicked on a normal window.
Any help is appreciated. Please do the needful.
Regards,
HalliHaida
|
|
|
|
|
There is a problem with reading large TCP data transfer.
Server on one end serializes some class object with BinaryFormatter and send it to the client over TCP. Serialized object in MemoryStream may take about 2Mb in size.
In the client I've got 1Mb byte[] array to read to with asynchronous NetworkStream.BeginRead and all the data is concatenated to MemoryStream object which is used as parameter passed to every BeginRead .
If more data available to read from server NetworkStream.DataAvailable that byte[] array is added to MemoryStream, otherwise deserialization happen and MemoryStream is set to 0 length for next transfer.
The problems are:
- data sent != data recieved in size
- synchronization failure
Server sent say 1.6Mb byte[] to client.
Client gets it in chunks of upto 1Mb which are added to MemoryStream for deserialization in case NetworkStream.DataAvailable == false
1) Instead of 1.6Mb byte[] array client reads 1Mb+1Mb+1Mb+0.9Mb = 3.3Mb and deserializes correct object.
2) Sometimes after 1Mb+1Mb it gets NetworkStream.DataAvailable == false thus deserialization fails, but 3ms later it reads remaining data 1Mb+0.9Mb and deserialization is successfull
3) Sometimes after immediatly 3-5ms after 1) it gets more data from server say 1Mb+0.3Mb chunks and tries to deserialize them again with a failure of course since the data is somewhat extraneous and I do not know who is sending it
If I set to 0 length MemoryStream in case of deserialization failure 3) is handled but 2) becomes invalid.
If I do not set to 0 length MemoryStream after deserialization failure, then after 3) any other deserialization attempt will be invalid since MemoryStream will contain that extraneous data in the beggining.
Also 1Mb+1Mb+1Mb+0.9Mb might be different as 1Mb+0.3Mb+0.5Mb+0.3Mb or 1Mb+0.7Mb for the same 1.6Mb transfers from the server.
Чесноков
|
|
|
|
|
Don't attempt to send such large chunks across the network. Break the stream up into smaller sizes (I find 4K blocks tend to be about right). Reading is easy with the following method:
internal static object DeserializeFromNetworkStream(IFormatter formatter, NetworkStream ns)
{
using (MemoryStream ms = new MemoryStream())
{
byte[] buffer = new byte[4096];
while (true)
{
int read = ns.Read(buffer, 0, buffer.Length);
if (read > 0)
{
ms.Write(buffer, 0, read);
continue;
}
ms.Seek(0, SeekOrigin.Begin);
break;
}
return formatter.Deserialize(ms);
}
} Serializing the object is just as easy:
private static void SerialiseToNetworkStream<T>(NetworkStream ns, IFormatter formatter, T data)
{
using (MemoryStream ms = new MemoryStream())
{
byte[] buffer;
formatter.Serialize(ms, data);
buffer = ms.GetBuffer();
int offset = 0;
int size = 4096;
int remaining = buffer.Length;
while (remaining > 0)
{
if (size > remaining)
{
size = remaining;
}
ns.Write(buffer, offset, size);
offset += size;
remaining -= size;
}
}
}
|
|
|
|
|
What is the reason for 4k limit?
I'm using asynchronous RW when sending and reading data, does it apply?
I had another 3rd party component which sends packets of about 400k.
You may recieve those packets at a maximal rate, say, up to 20 times per second.
If you do it with 4k and blocking read, reading operations takes too much time due to those chinking and you're limited to say 5 requests per second.
If you use as much as 400k or more you're in time to achieve that 20 times per second capture.
In other words with 4k limit reading those 400k takes 200ms as with 400k+ limit you can get them at 50ms.
Чесноков
|
|
|
|
|
4K works for me - you can up the limit as you see fit; I didn't say this had to be the one you chose. I wouldn't use too large a size though - if there's a problem, it's quicker to detect it with a smaller size than a larger one.
|
|
|
|
|
Message Closed
modified 23-Nov-14 5:56am.
|
|
|
|
|
That is error prone, suppose scenario 4) when some extraneous data was recieved.
The better is to use some custom header before serialized data.
Чесноков
|
|
|
|
|
In order to handle this situation correctly, you need a more sophisticated communications protocol between the server and client. In my case, from the server, I put an MD5 hash at the beginning of the message, along with a length, and then the message itself. When the receiver receives the message, it then calculates the MD5 hash on the received data. If they match, it then sends an ACK to the sender. If not, it sends a NACK and then the sender resends the message. The overall message itself can be as long as it needs to be.
You can define ACK and NACK however you want, I use the text ACK and NACK for mine, so if I want to look at the raw ethernet packets in ethereal or something like that, I can easily track what is happening.
I also do this for a UDP broadcast, except that there is no response from the clients. This ensures that the clients only act on known good messages from the server.
David
|
|
|
|
|
|
If that works for you, great. We've had problems in the past with unreliable network connections which caused real problems with larger buffer sizes, but if you can guarantee this is not a problem for you then great.
|
|
|
|
|
What were the problems? How small buffer size resolved the issue in your case?
Чесноков
|
|
|
|
|
Basically, they were to do with clients who had infra-red connections (don't ask). The smaller buffer size meant that we received drop out notifications straight away. Granted, we had multi-gigabyte files that were being transferred - the drop out allowed us to trigger reconnects to alternate servers.
|
|
|
|
|
How to check Stream contains valid BinaryHeader to avoid deserialization exceptions such as Binary stream '0' does not contain a valid BinaryHeader ?
Чесноков
|
|
|
|
|
Could you post some code ??? so we can see what your trying to do. ?
With great code, comes great complexity, so keep it simple stupid...
|
|
|
|