|
Hi,
running Vista SP1 and Visual Studio 2008, targeting either .NET 3.5 SP1 or .NET 2.0 I get correct values for IndexOf(char) but your phenomena for IndexOf(string).
[ADDED]
Reflector tells me string.IndexOf is using CultureInfo.CurrentCulture.CompareInfo.IndexOf
(and it gets very messy when diving into that)
so it may go wrong in some cultures only, making it more likely to go unnoticed for a long time...
[/ADDED]
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Monday, March 2, 2009 9:02 AM
modified on Sunday, June 12, 2011 8:58 AM
|
|
|
|
|
Yes, it is probably a locale problem. Today I found out that I can solve the problem by applying a Unicode normalization to the strings and then calling IndexOf() with StringComparison.Ordinal as the third argument, so that the method just checks the bytes.
|
|
|
|
|
hi there!
I build one c# application and now I want to add a setup project, so I can have setup for my application. I am selecting all the files from the application and going through all the steps required for creating the setup, and at the end I am getting error: Specified cast is not valid. Does anyone knows how to solve this issue? Please help me, I will really appreciate. Greetings and thanks in advance, Laziale
|
|
|
|
|
Try and run the setup wizard first, you also don't want all the files from your app, only content and primary output.
|
|
|
|
|
I tried just with content and primary output as well, but it gives me the same error, I don't have any idea how I can solve that.
|
|
|
|
|
What is virtual node algorithm or graph embedded ring..?
|
|
|
|
|
Hey,
I've just looked up your questions on Google and there's quite a few hits for you to read. If you want me to write a synopsis for you then get back to me!
Results 1 - 10 of about 1,840,000 for virtual node algorithm. (0.36 seconds)
Results 1 - 10 of about 543,000 for graph embedded ring. (0.30 seconds)
Alan.
|
|
|
|
|
I would appreciate that..
|
|
|
|
|
can u suggets me some website only for delegates where we can find all the details by example
rizvan sivally
|
|
|
|
|
|
The problem is, Image.FromStream likes to reset the position to 0 (somewhere in its scary native methods) and that's exactly what I do not want, since the image in question is simply not located there. Currently I work around this by copying a big part of the stream starting at the point where the image starts to a MemoryStream, but it's taking quite a while and it seems like it shouldn't be needed. This means I have to scan for a pattern that "looks like the header of the next image" which may not always work (what if the data itself contains sometime that looks like a header but isn't?).
I'm sure there is a better way to do this.
I've tried creating a stream that does not support seeking, but Image.FromStream hates that and copies the stream over to a MemoryStream itself so it's effectively equivalent to the "manual" way. Silently ignoring seeks and assignments to Position didn't exactly work so I guess it somehow needs them - would it be ok accept seeks and positions as long as they don't move the position to before a certain value? That sounds a lot like a hack to me - I hope there is a better way.
Last modified: 11mins after originally posted --
|
|
|
|
|
|
That looks very promising, thanks
A bit of a hack IMO but well
|
|
|
|
|
Where are you trying to read from? I've done something like this before, but I had a file set up like this:
[File]
[DataType]
[Length of data]
[stuff]
[DataType]
[Length of data]
[stuff]
[end of file]
[/File]
So I knew how much data I needed to read out of the file, I then like you did, read the data to a memory stream and then used Image.FromStream . If you have any control over the creation of the files you're reading in, then you may want to get it changed so it's similar to what I used, or better yet has some kind of index at the top that tells you where everything is.
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Unfortunately it's just like [data][data][data][data] and they're mostly PNG images, and it can not be changed
|
|
|
|
|
That's a shame, at least Alan's reply can help you out with extracting the image.
As for finding the actual images themselves, the image files should store the length of their contents in their header. So as long as you get the first image right, it should lead on to the next and so on. Removing the need to try and figure it out.
PNG files for example are pretty much an eight bit signature, then the length of the data, a 4-byte code, [the image itself], then a CRC at the very end. See here[^]
Jpegs are similar giving the length of the data inside as well as other information jpeg header[^]
It might be a bit of work to manage each type of image format you're going to come across but it will be worth it in the end right? Right?
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Well I can do that and still fall back to brute force searching for the next image if it fails
|
|
|
|
|
i have want to entertanin one client when second client want to connect then it will not connect i have set the tcplistner.listen(1) also, but when i connect to this i will place the second client to blocking queue.
i dont want to stop the listening socket. but i want to reduce the blocking queue.
i have tested tcplistner.listen(1) and tcpListener.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.MaxConnections, 1);
when i set SocketOptionName.MaxConnections then i get the following exception
{"An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call"}
|
|
|
|
|
I want to connect to a sqlserver instance on another computer in the workgroup network.
----------------------------------
my application: VS.NET 2008-C#
my DB: SQL Server 2000 Personal Edition
my OS: Win XP Profesional sp3
----------------------------------
I have done these steps:
1. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> Connections tab -> tick:
-allow other sql servers to connect remotely to this sql server using RPC
-enforce distributed transactions
2. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> General tab -> Network Configuration... button ->
enabling TCP/IP
3. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> Security tab -> Authentication ->
SQL Server and Windows
4. I created a New Login in target sql server instance:
Name=admin , Password=1001 , SQL Server Authentication , Database=Exam
5. my SqlConnection in application:
"Server=192.168.0.205\\MYSQLSRV; Initial Catalog=Exam; Integrated Security=False; Persist Security Info=False; User ID=admin;Password=1001";
6. I removed anti virus softwares and turned off Windows Firewall.
7. I tested both of my computers to ping to another
But I have an error yet:
an error was occured while establishing a connection to the server. when connecting to sql server 2005, this failure may be caused by the fact under the default settings sql server dose not allow remote connections.
(provider:sql network interfaces, error:26-error locating server/instance specified)
----------------------------------
can any one help me ?
H.R
|
|
|
|
|
|
Hi guys,
i am implementing a RTP application. i have created an RTP class. there are two bytes Header fields, one is Sequence Number(size of 2 bytes) and 2nd is TimeStamp(size of 4 bytes). i want to increment sequence number by 1 and Time Stamp by 160 when i send the packet to the network.
This increment will be done when the bufferfull event is called. i am incrementing with the mentioned values but when i monitor it, it increases randomly. is this the thread problem?
any solution for this problem. i am writing my event handler here of buffer full event.
void m_pWaveIn_BufferFull(byte[] buffer)<br />
{<br />
<br />
byte[] sentData = G711.Encode_aLaw(buffer, 0, buffer.Length);<br />
<br />
sentData = rtpPacket.getRTP_Packet(sentData);<br />
<br />
byte[] seqNo = BitConverter.GetBytes(seq);<br />
byte[] TimeStamp = BitConverter.GetBytes(timStm);<br />
<br />
Buffer.BlockCopy(seqNo, 0, sentData, 2, 2);<br />
Buffer.BlockCopy(TimeStamp, 0, sentData, 4, 4);<br />
<br />
m_pUdpServer.Send(sentData, sentData.Length, m_pTargetEP);<br />
<br />
seq++;<br />
<br />
timStm += 160;<br />
}<br />
<br />
Thanks to All.
|
|
|
|
|
try Interlocked.Increment()
Calin Tatar
|
|
|
|
|
if there are two threads running then you should declare the seq as a volatile int.
When ever a thread is to modify the value it should be locked.
lock(seq);
seq++;
unlock(seq);
btw what sort of RTP application is this??
|
|
|
|
|
Hi
I create a main Form with a splitContainer
In the Left panel I put a Tree View
In the Right panel I like to open diferent forms according to de selected information in the treeview.
Example
Tre view - Item - Customer xxx
When double click on on this customer a new CustomerFor with customer details open in Right panel
If anoter customer yyy is selected a second CustomerForm open in the same panel
A sort of tabContol cold be use to swich between Customer xxx and Customer yyy
I try with MDE but I dont know hot to restrict the opening of the Child forms to the right panel of the splitContainer or anoder object capable of containing Forms.
any clue?
|
|
|
|
|
I do not know of a way to constrain a form within another form. I don't think that it is possible in C#, perhaps someone with more knowledge will respond and let you know.
However, what you can do is build a 'customer' control. Add a new User Control to your project and design it like you would a form. Add this control to the right panel. Then, when the TreeView is clicked, just fill whatever controls you have put on your 'customer' control with the data for that customer.
You can then have a separate form just containing the new control, for occasions when it is more appropriate to display it as a form.
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.”
|
|
|
|