« first day (1406 days earlier)      last day (2743 days later) » 
06:00 - 19:0019:00 - 21:00

7:14 PM
btw, I have one question
how to start an animation when you press Enter?
now I do it like:
<UserControl.InputBindings>
    <KeyBinding Command="{Binding NextCommand}" Key="Enter"
                CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}">

    </KeyBinding>
</UserControl.InputBindings>
and in .fs:
    let animation = ((param :?> UserControl).FindResource("opacityAnimation")) :?> Storyboard
    animation.Begin()
but it looks ugly
 
7:42 PM
@Alex so close and yet so far:
 
hello guys
 
<VisualBrush x:Key="Test1" Stretch="None" TileMode="Tile" Viewbox="0, -10, 35, 40" ViewboxUnits="Absolute" Viewport="0, 0, 30, 40" ViewportUnits="Absolute">
            <VisualBrush.Visual>
                <Path Stroke="#222120" StrokeThickness="1" Data="M20,10 15,20 5,20 0,10, 5,1 15,1 20,10
                                          M35,20 30,30 20,30 15,20 20,10 30,10 35,20
                                          M35,1 30,10 20,10 15,1 20,-10 30,-10z" />
            </VisualBrush.Visual>
        </VisualBrush>
 
hi alex
 
hey
 
hi maverik
need a help
 
7:43 PM
explain in detail & with code without asking us to give you code behind solution and we'll see what we can do :)
 
i want to read a file by chunk
with byte array
and then convert it to string
 
why not just read it as string to begin with?
 
then concat the strings
and to byte aray again4
and to create a new file
 
also, you may want to write in one long sentence - SO will start throttling you
I see no logical reason to do what you're doing - tell us the actual problem you're trying to solve
 
well i want to send the file chunk over udp to another machine
 
7:45 PM
@Maverik You're getting there, Maverik :)
 
yea Alex but took forever to make this :(
but i finally figured out wth is ViewBox & ViewPort in visual brush
 
I can imagine. Look at all that
 
far too much math going on in my head
 
as the file size is large,iam chunking it in byte,sending it to udp,receiving it,and constructing the file again
but for that,i was first testing,if i convert byte to string,and then string to byte
weather the file remain same
but im getting corrupted file
 
For very large files, StreamReader.ReadLine is recommended
But for text files
Binary is different
 
7:48 PM
string pdfFileName = @"D:\abc.pdf";
fileList = new List<string>();
byte[] buffer = File.ReadAllBytes(pdfFileName);

string data = System.Text.Encoding.ASCII.GetString(buffer);
byte[] b = Encoding.ASCII.GetBytes(data);
File.WriteAllBytes(@"D:\abcd.pdf", b);
 
@ShofiqulAlam This might be what you need: stackoverflow.com/a/2030865/177416
 
i want to read and convert it back alex
and i need to end the data over udp
baicallyi want to read pdf,or image file
 
Haven't done much with that
 
actually all i want ,read a line by chunk,and convert it back
 
Years ago had a Java/Flex app that read images and converted them
You've got two things to deal with:
 
7:51 PM
i can concat all the byte array and it work
works
 
1. Read a file
2. Convert it to something
 
but when i convert byte array to string and string to byte array
it doent
 
What kind of file is it you're reading?
 
pdf,jpeg,png
 
OK. Binary data
Why are you reading these files? Is it that you just want to convert them, or are you extracting something from them?
 
7:53 PM
Shofiqul Alam: you don't need to convert to text just to check if it worked
use a checksum
 
no,after checking,ill send chunk by chunk over udp to another machine
and receive all the chunk from there and then convert it to file again
 
Mate - we got it the first time
there's NO NEED to do all that
read the bytes in chunk - send them over - dump to file
there's no need for conversions
 
yeah not sure why are you turning anything into a string. just send the bytes
 
and it's very naive to think that if you can read strings version of file on both ends that you haven't corrupted the file
even something as simple as killing the BOM mark (that you cannot see in text normally) will corrupt the file
also your naive approach assumes it's going to ASCII encoded - 90% of the time you'll be wrong
 
ok got it
 
7:57 PM
and god forbid if you have mixed byte order files -- then you're in for some real pain!
 
i wanted to convert it to string so that i can add ome information before byte array to develop e custom protocol
like file chunk number,length,etc
thought string would be easier
 
blindly sending bytes is your safest bet for data trasnfer
you can send a separate frame for the purpose
 
you see udp is not reliable
 
i don't mean any offense, but if you are in here asking questions, there is like a 0% chance you have the ability to create a better file sending system
 
if you must confirm that file made it safely at the end - do a SHA1 on both ends - if they match, you've made it
 
7:59 PM
packet can come in diorder
 
Yea Sohifqul Alam - we know
 
i'm sure you could find a package off the shelf that will do what you want a million times better
 
disorder
 
you've chosen to drop to that level - so you have to deal with all that
you could just use something higher order like WCF Streams
or gRPC
 
so i wanted to send the chunk number before every byte array chunk
 
8:00 PM
you're doing exactly what tcp does
you're reinventing the wheel
 
yes
but i cant use tcp
 
so create a class
public class DataChunk
{
   int chunkNumber;
   byte data;
}
 
ok then
serialize the datachunk ?
and send it over network
 
yeah
 
and deserialize again?
 
8:01 PM
sure - but reinventing the wheel is a bad idea
 
@Maverik agreed. trying to write this system yourself is silly
 
i know,but tcp is not an option right now
 
why not?
 
because udp is much faster
 
even if you make it work with best case scenario, all the edge cases will screw you
 
8:01 PM
much?
what are you doing that makes udp much faster?
 
as per my understanding, UDP is only ever really required when doing real time multiplayer gaming
TCP is fine for 95% of other situations
 
even more these days
 
yes i know
 
99.9% of the times tcp isn't to blame
 
but later we might send the bytes through a sip server
 
8:03 PM
its your thick protocol that slows it down
 
and our sip server doesnt have tcp support
 
ah the swiss knife solution
right well - i guess you have it all figured out
so our short answer is - don't convert
 
great
 
read bytes - transmit bytes - write bytes
and hope it works - otherwise SO won't be of any real help
 
but if i serialize a class
it wont be a problem right?
 
8:04 PM
>.>
it'll be exact same problem
bytes are bytes
doesn't matter what they represent - if you don't get this, you're not ready to do over the socket coding
 
If you want to protect against send errors, you checksum and resend on mismatch. But TCP already does that.
 
you should do a lot more reading in byte streaming
 
yeah,ok thanks,
let me dig on that
 
sure, good luck
you're in for a lot of hurt!
 
was hoping for a readymade olution
solution
 
8:06 PM
key things to remember -- Byte order -- this will kill your streaming if you get it wrong
encodings - getting it wrong will kill your data
 
avoid those two if you can and let some established system work it out
 
thanks
 
np and no - you're about to reinvent tcp in your own implementation
 
8:11 PM
@ShofiqulAlam you may want to dig into RTP protocols spec to see how it does its job over UDP and it should give you a good headstart
 
ok,ill look at it
im now uing Convert.ToBase64String
and Convert.FromBase64String
and it working perfectly
is there any corner cases in this method?
ive just read 6 image file,3 pdf file,all worked like charm
 
we've already given you all the information we can
there's not much point in repeating everything
 
0
Q: Listbox scroll viewer - default scroll to bottom

Lukáš KotenI have a listbox which has to be scrolled to bottom automatically. In my application, I have to detect if some items were already visibled to user and to do some business logic if so. I am using virtualization here which calls item (vm) properties only if it is visible. For auto scroll, i am us...

 
06:00 - 19:0019:00 - 21:00

« first day (1406 days earlier)      last day (2743 days later) »