|
Hi,
i have an array of bytes i need to convert to a Korean string but i don't know how. I tried
char[] chars_array = System.Text.Encoding.GetEncoding(949).GetString(bytes_array).ToCharArray();<br />
korean_string = new String(char_array);
but it ends with square and ! ? characters.
Any idea
|
|
|
|
|
Where does the array of bytes come from? Have you tried different encodings, like UTF-8 or UTF-16?
|
|
|
|
|
Thanks it helped, i just found
char[] array_country = System.Text.Encoding.Unicode.GetString(byte_country).ToCharArray();<br />
<br />
string_country = new String(array_country);<br />
MessageBox.Show(string_country);
works perfectly, the message box show the good string in Korean.
I then add the string to a listview, so is there any option to set to show the Korean characters in the listview?
*edit ok it's resolved the problem came from the font i used in the listview
-- modified at 18:45 Saturday 1st December, 2007
|
|
|
|
|
You may have to change the font that your listview uses to show Korean. There's a universal Arial font that has CJK characters.
By the way, I took your Korean characters and pasted them into a text file in VS2005 and saved it with 'Unicode - Codepage 1200' encoding. After the identifying BOM in the file, I get: 74 C7 C8 D0 AC B9 44 C5.
Cyril Connolly wrote: Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
|
|
|
|
|
Hi, I a have a massive collection based on keys and values containing 500000 items.
the keys are int64 objects and values are strings.
My question is, if there is any collection type that allowes to search the collection keys (like for exapmle: finding the value of item between 1000 to 1002?), because meanwhile i'm storing it in a datatable and using the Select function to retrieve the datarow, which in this case takes a while each time, so if there is any collection which allowes to search, I'm sure it will be mutch faster.
Thanks.
|
|
|
|
|
If you are using .NET 2.0 or higher then try downloading PowerCollections from the codeplex or wintellect site.
http://www.codeplex.com/PowerCollections[^]
It has an OrderedDictionary class that can be used to extract key value pairs in a range, e.g.,
foreach(KeyValuePair<tkey, tvalue=""> pair in dictionary.Range(from, to)) { // (API simplified slightly)
// process pair
}
PowerCollections is dead easy to use. It's just a natural extension of the BCL generic classes.
I don't know what the performance will be like on your data size though.
There is another collection library called C5 that's more advanced but more difficult to use and less well documented.
Kevin
|
|
|
|
|
PowerCollections looks interesting.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Yeah it's quite cool, although I've not needed to use it in anger yet. But I'm aware it's another tool in the box should I need it. There's also the more powerful but more abstract C5 library.
http://www.itu.dk/research/c5/[^]
|
|
|
|
|
I doubt you'll find anything faster and more flexible than a database... that's what they're for.
|
|
|
|
|
hi all,
Any ideas as to why the database is not being updated will be greatly appreciated!
It is driving me mad...and I just can't see what i am doing wrong
string dId = "Golden";
string dCharge = "150";
OleDbConnection connectDb = new OleDbConnection(db);
connectDb.Open();
OleDbCommand update = new OleDbCommand("UPDATE ShippingCharges SET Charge = ? WHERE ShippingID = ?", connectDb);
update.Parameters.Add("@ShippingID", OleDbType.Char).Value = dId;
update.Parameters.Add("@Charge", OleDbType.Integer).Value = dCharge;
update.ExecuteNonQuery();
connectDb.Close();
-- modified at 12:18 Saturday 1st December, 2007
|
|
|
|
|
mocasu wrote: update.Parameters.Add("@ShippingID", OleDbType.Char).Value = dId;
update.Parameters.Add("@Charge", OleDbType.Integer).Value = dCharge;
shouldn't the update command be "Update ShippingCharges set Charge = @Charge where ShippingID = @ShippingID" if you call your updateParameters like that?
|
|
|
|
|
Thanks...but either way the database is not being updated
|
|
|
|
|
The parameters need to be added in the correct order. Even when named.
|
|
|
|
|
Thanks a lot!
As you said, I had just switched the add parameter code and ...voilA!
|
|
|
|
|
|
Does anyone know some great articles or sites on XNA that really explain their code well and have code, so a beginner to XNA can learn something?
- I love D-flat!
|
|
|
|
|
This site has some videos about XNA:
http://www.xnatutorial.com/[^]
If this isn't good enough for you, then try Google.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Are the Microsoft sites not good enough then?
Kevin
|
|
|
|
|
I don't have the membership, soo it's not much use, but they do have some goodies.
- I love D-flat!
|
|
|
|
|
I understand the idea of how to make a bunch of rectangles in random places, but I just can't follow through. You would have rect1 - 25 . You would have Random r . How would I make them draw at random places on a form? Thanks in advance.
- I love D-flat!
|
|
|
|
|
Hi,
in the OnPaint method of the Control/Form you want to draw your shapes in, have a for loop
that generates random x,y,width,height values (all within legal bounds), and call
Graphics.DrawRectangle (or FillRectangle) for each of them.
Alternatively, generate those numbers elsewhere and store them; then have your OnPaint feed
them to Graphics.DrawRectangle.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- 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 PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
How would I select a large amount of (say) rect1 - 25? I saw a post a while back that did something close, but I can't find it. It's like...
(my example)
rect(and a for loop here)<br />
{<br />
<br />
}
... or something like it
-- modified at 11:28 Saturday 1st December, 2007
- I love D-flat!
|
|
|
|
|
Something along these lines:
List< Rectangle> rects=new List< Rectangle>;
Random rand=new Random();
for (int i=0; i< RECT_COUNT; i++) {
int x=rand.Next(xBounds);
int y=rand.Next(yBounds);
int w=rand.Next(widBounds);
int h=rand.Next(heiBounds);
Rect r=new Rectangle(x,y,w,h);
rects.Add(r);
}
...
Graphics g=e.Graphics;
foreach(Rectangle r in rects) {
g.DrawRectangle(r);
}
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- 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 PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Oh. Thanks.
- I love D-flat!
|
|
|
|
|
I want to clip the cursor into any closed figure that have been drawn using graphicspath and have been transformed aswell. I want this to be done in GDI of C#. The default clip property of cursor is limited to clip it under rectangular area.
Sharjeel H Khan
|
|
|
|