Do they belong to you? Claim these comments.
_Alan_
Is this you? Claim Profile »
1 month ago
in Moonlight 2 Preview 2 - Miguel de Icaza on Miguel de Icaza's blog
I'm sure you realise that moonlight is a browser plugin which enables you to view silverlight content on the web, so a browser is kind of a prerequisite if you want to use moonlight. So what you probably meant to ask is 'When will the moonlight plugin support $INSERT_BROWSER_HERE' ?
1 month ago
in Moonlight 2 Preview 2 - Miguel de Icaza on Miguel de Icaza's blog
Yup, small testcases would be great for this. It sounds like it could be my area too ;) Either file a bug or send a quick email to the moonlight mailing list with the testcase + description.
2 months ago
in Innovation - Miguel de Icaza on Miguel de Icaza's blog
It's hard to refute a claim that you're not innovating if you don't reference the word 'innovate' in your rebuttal ;)
3 months ago
in Monday Mystery: Poetry Showing up on my Surveys. - Miguel de Icaza on Miguel de Icaza's blog
Nah, i just wrote the one on this blogpost to keep with the theme ;) I've no idea who actually wrote them all. Fair play to them though.
5 months ago
in Cartoon Network's Kid's MMO and Mono. - Miguel de Icaza on Miguel de Icaza's blog
Windows and Mac actually.
5 months ago
in openSUSE 11.1 - A Disappointment on Ivan Zlatev
You have to blacklist the new ath5k module before madwifi will be allowed load and take over your wireless. I got stung with this one.
7 months ago
in Take this Apple fanboys (or how sad this world is) on Ivan Zlatev
Copy protection is mandatory on blu-ray discs, even for homemade movies. Or at least that was true the last time I read up on it.
7 months ago
in Take this Apple fanboys (or how sad this world is) on Ivan Zlatev
"At least pretty much all monitors and projectors sold now are HDCP compliant..."
So what? I bought a nice TV 3 years ago, why should I have to fork out another few hundred/thousand euro to buy another TV to replace my perfectly good TV just so I can watch my legally purchased content? There are plenty of HD TVs out there without HDMI support.
So what? I bought a nice TV 3 years ago, why should I have to fork out another few hundred/thousand euro to buy another TV to replace my perfectly good TV just so I can watch my legally purchased content? There are plenty of HD TVs out there without HDMI support.
7 months ago
in Take this Apple fanboys (or how sad this world is) on Ivan Zlatev
Yay! Now i don't have to watch the content that I bought with my hard earned cash :D What a time saver!
9 months ago
in Mono 2.0 is out! - Miguel de Icaza on Miguel de Icaza's blog
Just build your application as normal, copy the resulting compiled file to Linux/MacOS and run it. Voila, you're done. The only thing you have to be careful about is calling native windows libraries through P/Invoke and hardcoding in windows-isms like hardcoding paths like C:\MyFolder
9 months ago
in Stream.CopyStream - Miguel de Icaza on Miguel de Icaza's blog
Ah, see that's where i think where we differ. That's just a simple myStream.Write (otherStream). It's completely different to a TeeStream or SplitStream as i described earlier ;) I did say that a writing the contents of one stream to another was easy, but i didn't think that's what was being asked in the original question. Maybe i'm wrong there.
9 months ago
in Stream.CopyStream - Miguel de Icaza on Miguel de Icaza's blog
Well, if all you're looking for is:
stream2.Write(stream1), then that's trivial enough to implement. However if you want something more along the lines of giving you three identical copies of the same stream so you can independently read from the copies and progress the initial stream, then it's a lot harder.
byte[] bytes = GetData();
MemoryStream a = new MemoryStream(bytes);
MemoryStream b = new MemoryStream(bytes);
MemoryStream c = new MemoryStream(bytes);
If you want a CopyStream that essentially does the above except using a Stream as the base rather than a byte[] as the base, the task is very difficult.
stream2.Write(stream1), then that's trivial enough to implement. However if you want something more along the lines of giving you three identical copies of the same stream so you can independently read from the copies and progress the initial stream, then it's a lot harder.
byte[] bytes = GetData();
MemoryStream a = new MemoryStream(bytes);
MemoryStream b = new MemoryStream(bytes);
MemoryStream c = new MemoryStream(bytes);
If you want a CopyStream that essentially does the above except using a Stream as the base rather than a byte[] as the base, the task is very difficult.
1 reply
Atif Aziz
Alan, I don't see why it would this would be difficult to implement CopyStream having Stream as a source and target. Here's my implementation that I use in projects:
http://gist.github.com/12956
In general, though, this only useful for low latency and small streams. In environments where scalability is key, copying may be best performed using async I/O (BeginRead-BeginWrite).
http://gist.github.com/12956
In general, though, this only useful for low latency and small streams. In environments where scalability is key, copying may be best performed using async I/O (BeginRead-BeginWrite).
9 months ago
in Stream.CopyStream - Miguel de Icaza on Miguel de Icaza's blog
Well, a TeeStream class wouldn't be that complex. A lot of the complexity that i saw in a class which allowed copying a stream an arbitrary number of times, with each copy having the ability to progress the initial stream would be gone. The implementation would be just read-once, write many. No threadin concerns there.
Something like:
public class TeeStream : Stream
{
public TeeStream (IEnumerable<Stream> destinationStreams)
{
}
}
would be fairly easy to implement. Something like that should already be in the BCL I suppose. There's no real reason why not.
Something like:
public class TeeStream : Stream
{
public TeeStream (IEnumerable<Stream> destinationStreams)
{
}
}
would be fairly easy to implement. Something like that should already be in the BCL I suppose. There's no real reason why not.
9 months ago
in Stream.CopyStream - Miguel de Icaza on Miguel de Icaza's blog
How could System.IO.Stream ever implement CopyStream? It'd be a nightmare to implement!
The problem is that the Stream in question could be *anything*, i.e. a NetworkStream. By reading data from this stream (in order to make a copy) you will render the initial stream unusable because you've already read the data out, and you cannot rewind it. What you end up with is a single usable version of the stream instead of two.
If you want to be able to 'Copy' a stream, you have to do it manually. You need to read all the data from the initial stream as a byte[], then instantiate all the MemoryStreams you want from this byte[].
Suppose you wanted to implement Stream.CopyStream, you could create a class like
public class StreamSplitter : Stream
{
public StreamSplitter (Stream initialStream)
{
// Do stuff
}
public Stream GetCopy()
{
// Do stuff
}
}
Internally the StreamSplitter will read from the initial stream and store the data in a byte[]. GetCopy will then return a MemoryStream type class based on this byte[]. This class would have the ability to tell the StreamSplitter to get more data from the initial stream and make it available to all the copies which have been created.
The problem is that any copy can initiate this request for more data at any time. This is a pain in the ass for thread synchronisation with regards to the initial stream. Then you have more threading problems when you try making this new data available to the existing copies. All i can say is that there's no way i'd ever implement something like that ;)
The problem is that the Stream in question could be *anything*, i.e. a NetworkStream. By reading data from this stream (in order to make a copy) you will render the initial stream unusable because you've already read the data out, and you cannot rewind it. What you end up with is a single usable version of the stream instead of two.
If you want to be able to 'Copy' a stream, you have to do it manually. You need to read all the data from the initial stream as a byte[], then instantiate all the MemoryStreams you want from this byte[].
Suppose you wanted to implement Stream.CopyStream, you could create a class like
public class StreamSplitter : Stream
{
public StreamSplitter (Stream initialStream)
{
// Do stuff
}
public Stream GetCopy()
{
// Do stuff
}
}
Internally the StreamSplitter will read from the initial stream and store the data in a byte[]. GetCopy will then return a MemoryStream type class based on this byte[]. This class would have the ability to tell the StreamSplitter to get more data from the initial stream and make it available to all the copies which have been created.
The problem is that any copy can initiate this request for more data at any time. This is a pain in the ass for thread synchronisation with regards to the initial stream. Then you have more threading problems when you try making this new data available to the existing copies. All i can say is that there's no way i'd ever implement something like that ;)
1 reply
migueldeicaza
Alan,
In that case, you would not use CopyStream, it is a perfectly fine restriction to say that the stream is consumed after CopyStream is finished.
There is nothing preventing a "TeeStream" (like the Unix Tee command) to duplicate the contents as it goes and composing the above described operation using this.
But many times I do not care about keeping a copy, and I do not care about chunked output, or if its network or not, I just want to move the bytes from the source to the destination. And I have seen various broken versions of this loop, or versions that are too optimistic and have never been properly tested.
In that case, you would not use CopyStream, it is a perfectly fine restriction to say that the stream is consumed after CopyStream is finished.
There is nothing preventing a "TeeStream" (like the Unix Tee command) to duplicate the contents as it goes and composing the above described operation using this.
But many times I do not care about keeping a copy, and I do not care about chunked output, or if its network or not, I just want to move the bytes from the source to the destination. And I have seen various broken versions of this loop, or versions that are too optimistic and have never been properly tested.
1 year ago
in Phalanger on Mono (part 2) on Zac Bowling's Blog
[quote]
There are also a few typedefs in the headers that compile to two different sizes between 32bit and 64bit platforms so I have to declare two versions of the same p/invoke calls on some occasions and use one or the other if the code is running on 32bit or 64bit.
[/quote]
Well, one trick is to have a native wrapper library which exposes a single API which does not have a change in size between 32bit/64bit platforms and then that native library will interop with your existing C++ code.
The size of 'long' in your C++ code will be the same as in the wrapper library, so you'll have no troubles interoping there, and your wrapper library will just expose it as int32_t or int64_t as required, so you are guaranteed fixed size variables.
Then, the C# code P/Invokes your wrapper library on all platforms, so you only need 1 set of p/Invokes in C# and you don't need runtime detection.
Alternatively, if you don't care about windows64 support, just represent a 'long' as an IntPtr in your C# code and you support all 32bit windows systems and all platforms with sizeof(pointer) == sizeof(long). Which is everything except win64.
Hope that makes sense.
There are also a few typedefs in the headers that compile to two different sizes between 32bit and 64bit platforms so I have to declare two versions of the same p/invoke calls on some occasions and use one or the other if the code is running on 32bit or 64bit.
[/quote]
Well, one trick is to have a native wrapper library which exposes a single API which does not have a change in size between 32bit/64bit platforms and then that native library will interop with your existing C++ code.
The size of 'long' in your C++ code will be the same as in the wrapper library, so you'll have no troubles interoping there, and your wrapper library will just expose it as int32_t or int64_t as required, so you are guaranteed fixed size variables.
Then, the C# code P/Invokes your wrapper library on all platforms, so you only need 1 set of p/Invokes in C# and you don't need runtime detection.
Alternatively, if you don't care about windows64 support, just represent a 'long' as an IntPtr in your C# code and you support all 32bit windows systems and all platforms with sizeof(pointer) == sizeof(long). Which is everything except win64.
Hope that makes sense.
2 years ago
in Compile Mono SVN Head on Windows on Ivan Zlatev
Woo, after 2 long hard days of trying and failing, i finally managed to compile mono for windows on windows. Only worked when i did exactly as he did, with the exact same paths. Cygwin is a monster :(
Was it you and Jo that sent all the poems? See the Supercomputing thread for more evidence.