| |
| |
| |
|
Page: 1 2
Comments:
<0> hi <0> im trying to use FileStream to copy a string.... but it supports only byte[]... so what can i do? <1> convert the string to a byte[] ? :) <0> how? <1> you have to select encoding mode, well, there's an encoding cl*** which does it <1> if you want utf8 you use that cl*** etc <1> lemme check the actual cl*** names <2> System.Text.Encoding <1> right <2> it has a static property <2> for utf8, ascii, unicode (16) <1> right <0> the FileStream only gets byte or byte[] <0> i want to use a string to hold the data <1> so System.Text.Encoding.ASCII.GetBytes(mystring); will return a byte[] <0> and this byte[] is the same string?
<1> well depends on the contents ;) <1> but yeah <0> FileStream.Read(...) gets only the byte[] so you tell me to convert my string to byte[] and give that to the filestream? <2> yes. <0> ill try :) <0> thanks <0> i started to write a foreach loop O_o <1> ziv4: what i was trying to say was that if the string contains say russian, some letters might not "survive" the conversion to byte[] if you use ASCII <2> might -> will <2> ascii cuts off the top 128 <1> if that is a concern, consider using UTF8 (you'll need to convert it back FROM utf8 when reading the string) <2> or "Default <2> which uses the system encoding <0> ok <0> i use hebrew <1> youll most likely want to use utf8 then <1> that'll work <3> need TcpClient help! <3> http://www.pastebin.ca/319371 DownloadArticle() creates/executes the Thread, Transfer() is what happens in the thread <3> Stream.Read() causes a blocking calls exception <4> meeeh. is there some version of an event that if signaled twice will also trigger two consequtive .wait()s ? <2> you mean like a Semaphore <2> ;) <4> that might as well be what i mean yes <4> well i use an event from one thread to tell the other thread that something is available <4> however, if the other thread cant eat those away fast enough it locks up waiting :P <2> why not just eat all there is <2> after you get an event <2> and wait again and do the same. <4> i needto know how many there is <2> you don't? <2> how do you know what to do <4> weeell, im not explicitly keeping track of it <4> althought i dont see how a semaphore would work here <2> you can trigger a semaphore multiple times. <4> but you normally get and release semaphores dont you <2> you cna use it both ways <2> both mutex and event is based on semaphore. <4> hm im just curious if im doing something else stupid here now anyhow x) <4> wasnt working even if i "triggered" the event manually with a timeout <2> :) <4> but i guess i should look into using a semaphore anyhow.. <4> because well. what happens in this case: <4> 1. thread 1: event.Set(); <4> 2. thread 1: event.Set(); <4> 3. thread 2: waits.. <4> 4. thread 2: waits.. <4> will #4 hang? <4> AutoResetEvent <2> sorry. <2> busy. <4> that's ok <4> ah race condition in updating a variable...... forgot some locking somewhere i guess <4> regarding the 1.2.3.4: YES, will hang:P <2> 3,4 will hang obviously <2> why shouldn't it? <2> Only one of them will trigger <2> if you trigger it again <2> the other <4> 3 wont hang, 4 will <2> if you only set it twice
<2> the 3'rd will block <4> thread 1 sets it twice, then nothing waits, then the 1st wait (3) by thread 2 will obviously not hang <4> but as it is reset by 3, 4 wil hang <2> oh yes <2> but I meant <2> multiple can WAIT <2> it just can only be triggered once. <4> sure <4> but in this case only one thread was waiting <4> and would be waiting <2> thats why you normally use a semaphore <2> when multiple are involved <2> as it can be triggered a lot of times. <4> yes im looking into that now <2> it's 2.0 btw. <2> semaphore. <4> yep <4> hmmm <4> ok so ".Release()" acts as setting it then? <4> trying to wrap my head around this <4> http://pastebin.ca/319507 <4> im not sure why that works, but it does (when i uncomment the second release) <2> Read the help file? :) <4> hehe <4> yeeees well i think i had it understood backwards <4> thinking of it as a critical section instead <2> it can go either way. <4> aaaargh. snow again outside :( <4> it's winter and spring every second day here now :\ <2> heh <2> it's weird here too <2> this morning I was walking in direct sunlight. <2> It's almost dark now <2> raining <4> ah, well its snowing here now.. yesterday was sun and spring <0> hello <1> hi <0> i want to know if there is anything in .net that find a pattern in strings <0> like XX:XX:XX <1> regexp <0> works good? <1> yes <0> perfect :) <0> thx <0> it return indexes? <1> it can yes <0> great :) <1> http://www.regular-expressions.info/dotnet.html <0> can i say thx again to you? <5> Hello, wondering if anyone could point me to a irc client in c# that have ssl implemented, since i would like to see how they do it ;) <1> ziv4: well... ok :P <0> so THX so much :) <0> i was going to spend some time to make this thing <0> but if it exists why should i? <1> ziv4: especially since the regexp stuff is pretty fast <1> and simple <5> LordCrc you dont by any change have a anwser to my question? ;) <1> Nozz: nope, dont know of any irc client code, especially in c# <5> sad <5> i found a few libs that do it well <5> none of em have ssl support tho <5> which is what i wanna look at <0> source of c# irc client with ssl option... sounds too much specific to me <5> :P <0> i cant understand the language of regex <0> \d is for any number? <1> digit <1> ie 0 or 4 <1> you want to extract an ip address written in hex? <0> single character <0> no <1> oh <1> just a guess :) <0> im extracting time from something
Return to
#csharp or Go to some related
logs:
#stocks #freebsd #winxp sd4hider Cyberwarper #computers #beginner #nhl hamsek
6teenz
|
|