Re: [Mono-list] Bug related to operator += and instance fields
Hello, Bug is filed at http://bugzilla.ximian.com/show_bug.cgi?id=54742 Thanks -Ravindra >>> "Rodolfo Campero" <[EMAIL PROTECTED]> 2/22/2004 2:51:34 AM >>> Hello everybody, I've found a bug, but I'm not sure about how to report it (I mean I can't find a suitable subject and other info): The following source code compiles but its execution results in incorrect behavior: using System; namespace Test { public class A { public static void Main () { A a = new A (); a.Test (); } public void Test () { A a = new A (); // the following is the problematic line _intValue += a.Value + a.Value / 2; Console.WriteLine (_intValue); } private int _intValue; public readonly int Value = 100; } } The actual result is 50 but I think it should be 150. I need someone to give me instructions about the affected product (Mono/Compilers or Mono/Runtime or ...) and a suitable subject if possible, or to tell me that this is not a bug and I'm plain wrong :-) If someone can file the bug report for me it's ok too. TIA, Rodolfo _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] C# Hexadecimal Escape Char Anomalies???
I realize this is a C# issue but can one create "binary strings" in C# using string="\xff\x00\x00\xff" used by C/Python? Why do my 0xff's get translated to 0x3f's??? Thanks - mdf = using System; class SimpleTest { public static void Main(String[] args) { String bobo = "\xFF\xFF"; System.Console.Write(bobo); } } bash-2.05a$ mono simple.exe | od -x 000 3f3f 002 bash-2.05a$ cat pypy test="\xff\xff\xff\xff" print test bash-2.05a$ python pypy | od -h 000 000a 005 -- | Matthew Franz [EMAIL PROTECTED] | | http://www.io.com/~mdfranz | ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Status report
Last Week: - Checked in another set of test cases for mbas - Compiled the problems in mbas in a doc - Started working on properties This week: - keep working on properties - Will start working with attributes if possible. Regards. Anirban. ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Socket code.
On Mon, 2004-02-23 at 02:21, Jonathan Gilbert wrote: > >Interesting, this code will work as long as the check at the bottom is > >1448, any other number and it croaks??? The buffer can be any size > >presumably larger than 1448 and it will work. > > Note (to original poster) that if you want to read up to the end of the > stream, you should actually check 'len' against '0': > > if (len < 0) > error_occurred(); > if (len == 0) > end_of_stream_occurred(); > > You shouldn't assume that the underlying transport will always be able to > deliver chunks of the same size. The 1448 here has most likely to do with > the sending computer's TCP/IP stack. Perhaps it ties the TCP packet size > into the MTU to decrease fragmentation & increase performance (this is > fairly common, as I understand). Assuming this is the case, your problem is > simply evidence that, unlike my 'ReadFully' function, > 'NetworkStream::Read()' does not try to completely read the requested > buffer. Instead, it does one read attempt and then immediately returns. So, > you're limited to the size that 'Socket::Receive()' will give you. > > In short, any positive value from 'Socket::Receive()' indicates that there > could be additional data waiting; a return value of 0 indicates that the > connection was shut down in that direction (thus indicating the > end-of-stream). Simply getting a smaller value than you requested does not > indicate that the end of the stream has been reached. This is distinctly > different from file I/O. > Well I do check for len > 0, here is the entire function, I also understand about the TCP packet size not being consistent but what I don't understand is why this actually works only like this? Seems like a bug in the stream code. private string read (NetworkStream stream, TcpClient c) { int len; string s; StringBuilder buf = new StringBuilder(); do { byte[] bytes = new byte[5]; len = stream.Read(bytes, 0, (int)5); if (len > 0 ) { s = Encoding.ASCII.GetString(bytes,0,len); buf.Append(s); } if (len < 1448) break; } while (len > 0); return buf.ToString(); } If I take the if (len < 1448) out it doesn't work. If I change the 1448 to something else, it doesn't work. -- George Farris <[EMAIL PROTECTED]> ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Socket code.
At 11:59 AM 22/02/2004 -0800, you wrote: >On Sun, 2004-02-22 at 01:17, Michal Moskal wrote: >> On Sat, Feb 21, 2004 at 04:31:00PM -0800, George Farris wrote: >> > I have some socket code that looks something like this: >> > >> > byte[] bytes = new byte[1448]; >> > do { >> >len = sock.Read(bytes, 0, (int)1448); >> >s = Encoding.ASCII.GetString(bytes); >> >buf.Append(s.Substring(0,len)); >> > >Interesting, this code will work as long as the check at the bottom is >1448, any other number and it croaks??? The buffer can be any size >presumably larger than 1448 and it will work. Note (to original poster) that if you want to read up to the end of the stream, you should actually check 'len' against '0': if (len < 0) error_occurred(); if (len == 0) end_of_stream_occurred(); You shouldn't assume that the underlying transport will always be able to deliver chunks of the same size. The 1448 here has most likely to do with the sending computer's TCP/IP stack. Perhaps it ties the TCP packet size into the MTU to decrease fragmentation & increase performance (this is fairly common, as I understand). Assuming this is the case, your problem is simply evidence that, unlike my 'ReadFully' function, 'NetworkStream::Read()' does not try to completely read the requested buffer. Instead, it does one read attempt and then immediately returns. So, you're limited to the size that 'Socket::Receive()' will give you. In short, any positive value from 'Socket::Receive()' indicates that there could be additional data waiting; a return value of 0 indicates that the connection was shut down in that direction (thus indicating the end-of-stream). Simply getting a smaller value than you requested does not indicate that the end of the stream has been reached. This is distinctly different from file I/O. Jonathan ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Bug related to operator += and instance fields
On 02/21/04 Rodolfo Campero wrote: >public void Test () >{ > A a = new A (); > // the following is the problematic line > _intValue += a.Value + a.Value / 2; [...] > The actual result is 50 but I think it should be 150. This is fixed in cvs. Thanks for the report. lupus -- - [EMAIL PROTECTED] debian/rules [EMAIL PROTECTED] Monkeys do it better ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] To draw or not to draw that is the question :)
Hello, > I've explored GTK and I saw that drawing in Gtk.DrawingArea involves using > Gdk.Drawable which in turn requires learning some of Pango (?)... I guess > Pango implements what I think it is the functionality of System.Drawing, no? Gdk implements the drawing primitives, it is fairly low-level. Pango is a text-setting facility that you can use to render. > Now, I'am confused what library I should use to "draw"... > Should I use System.Windows.Forms (with Mono-wine or something?) or should I > use GTK and use that Pango thing? Gdk for now. I have a patch that lets you use Cairo (it was posted to the gtk-sharp-list) to draw, which is simpler to use than Gdk. In the future we will integrate System.Drawing and/or Cairo into Gtk# so it will be a familiar API. > I dont know what is being made in this direction so I dont know what to do > > Another question is what should I use to do image manipulation (resize, > chopping, do thumbnails, etc) in a server (in ASP.NET for example) without > installing the whole X package ? Work is underway to have a complete System.Drawing implementation. CVS should let you do this. Miguel. ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
RE: [Mono-list] Docs as plain HTML
> Do you or anyone have a monodoc.dll for windows? > > I could "try" to create a SWF app. I say try because I've written more GTK# > apps than SWF. Monodoc really does not have any strange dependencies, so it should work just fine on Gtk#/Windows. ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] monodoc missing docs + Monodevelop question
> I have mono, mcs, gtk-sharp and monodoc from CVS, all compile fine, and > can be used. I still have two small problems: > > * monodoc: everything compiles fine, and monodoc works but the > documentation for some assemblies is now missing, like the Gnome subtree > in the docs. Normally, just compiling and installing was sufficient to > get the complete reference. This is a miss-match: you need to cvs update your monodoc. ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Gdk: Text drawing on pixmap
Hello, > I have an application that draws rectangles, lines, etc on a pixmap. > The Gdk.Pixmap class is ideally suited for that purpose, as it has > methods for drawing lines, rectangles, images on the pixmap. > > Now I also need to draw text on the image. Pixmap however does not > have a method for drawing text, so is there possibly another way I > can get text on the pixmap? Look at the mlist source code (on the Gtk# wiki), it shows how to do this. Or the list.cs widget in monodoc, that is another example. ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Socket code.
On Sun, 2004-02-22 at 01:17, Michal Moskal wrote: > On Sat, Feb 21, 2004 at 04:31:00PM -0800, George Farris wrote: > > I have some socket code that looks something like this: > > > > byte[] bytes = new byte[1448]; > > do { > > len = sock.Read(bytes, 0, (int)1448); > > s = Encoding.ASCII.GetString(bytes); > > buf.Append(s.Substring(0,len)); > Interesting, this code will work as long as the check at the bottom is 1448, any other number and it croaks??? The buffer can be any size presumably larger than 1448 and it will work. do { byte[] bytes = new byte[50]; len = stream.Read(bytes, 0, (int)50); if (len > 0 ) { s = Encoding.ASCII.GetString(bytes,0,len); buf.Append(s); } if (len < 1448) break; } while (len > 0); return buf.ToString(); -- George Farris <[EMAIL PROTECTED]> ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Socket code.
On Sun, Feb 22, 2004 at 01:51:18PM -0500, Jonathan Pryor wrote: > Yes, GetString(byte[]) exists, but it's equivalent to this: > > string GetString (byte[] bytes) > { > return GetString (bytes, 0, bytes.Length); > } > > So this is only valid if `bytes' is full. Otherwise (when you've read > fewer than `bytes.Length' bytes) the end of your string will contain > garbage data. The `GetString (bytes, 0, len)' fixes this, so GetString > will only convert valid data. Just a remark: arrays are initialized to zero or null (just checked IL reference), so it's not exactly garbage. -- : Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++ : When in doubt, use brute force. -- Ken Thompson :: UL$ C++ E--- a? ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Socket code.
Right, I did go and read up on GetString and you are of course correct. On Sun, 2004-02-22 at 10:51, Jonathan Pryor wrote: > Below... > > On Sun, 2004-02-22 at 13:06, George Farris wrote: > > > > Shouldn't it be: > > > > > > s = Encoding.ASCII.GetString(bytes, 0, len); > > > buf.Append(s); > > > > > > > Well the docs on GetString say it can be just a byte[]. > > Yes, GetString(byte[]) exists, but it's equivalent to this: > > string GetString (byte[] bytes) > { > return GetString (bytes, 0, bytes.Length); > } > > So this is only valid if `bytes' is full. Otherwise (when you've read > fewer than `bytes.Length' bytes) the end of your string will contain > garbage data. The `GetString (bytes, 0, len)' fixes this, so GetString > will only convert valid data. > > - Jon -- George Farris <[EMAIL PROTECTED]> ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Socket code.
Below... On Sun, 2004-02-22 at 13:06, George Farris wrote: > > Shouldn't it be: > > > > s = Encoding.ASCII.GetString(bytes, 0, len); > > buf.Append(s); > > > > Well the docs on GetString say it can be just a byte[]. Yes, GetString(byte[]) exists, but it's equivalent to this: string GetString (byte[] bytes) { return GetString (bytes, 0, bytes.Length); } So this is only valid if `bytes' is full. Otherwise (when you've read fewer than `bytes.Length' bytes) the end of your string will contain garbage data. The `GetString (bytes, 0, len)' fixes this, so GetString will only convert valid data. - Jon ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Re: [Mono-devel-list] Regression: Attribute.GetCustomAttribute nolonger returns attributes from base classes
El dom, 22-02-2004 a las 19:28, Gert Driesen escribió: > Its working fine again, thanks a lot !!! Is there a test in mono cvs that > will detect this issue in the future, or do you want me to rewrite my test > case to use NUNit ? Jackson told me that was the cause of some NUnit regressions. I'll check if there's a test exactly like this and add it if not present. Thanks. -Gonzalo ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Socket code.
On Sun, 2004-02-22 at 01:17, Michal Moskal wrote: > On Sat, Feb 21, 2004 at 04:31:00PM -0800, George Farris wrote: > > I have some socket code that looks something like this: > > > > byte[] bytes = new byte[1448]; > > do { > > len = sock.Read(bytes, 0, (int)1448); > > s = Encoding.ASCII.GetString(bytes); > > buf.Append(s.Substring(0,len)); > > Shouldn't it be: > > s = Encoding.ASCII.GetString(bytes, 0, len); > buf.Append(s); > Well the docs on GetString say it can be just a byte[]. The interesting thing is the length which only works as 1448 which is a number I found by printing out the len variable. If I set the byte[] to say 1, sock.read (which should really be named stream.read as it's a NetworkStream) always returns anywhere from 0 to 1448 bytes but never more. I also tried the example from the .NET docs and it doesn't work either. It reads up to 1448 bytes and the stops. The code is here: http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemnetsocketsnetworkstreamclassreadtopic.asp?frame=true -- George Farris <[EMAIL PROTECTED]> ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] monodoc missing docs + Monodevelop question
Hi, I have mono, mcs, gtk-sharp and monodoc from CVS, all compile fine, and can be used. I still have two small problems: * monodoc: everything compiles fine, and monodoc works but the documentation for some assemblies is now missing, like the Gnome subtree in the docs. Normally, just compiling and installing was sufficient to get the complete reference. * Compiling MonoDevelop I get: ./Dock/Docker.cs(14) error CS0246: Cannot find type `GtkSharp.ExposeEventArgs' ./Tree/TreeView.cs(67) error CS0246: Cannot find type `GtkSharp.EditedArgs' ./Tree/TreeView.cs(249) error CS0246: Cannot find type `GtkSharp.TestExpandRowArgs' While I think GtkSharp.ExposedEventArgs, EditedArgs and TestExpandRowArgs code is included and public accessible from within gtk-sharp.dll. Kris -- Kris Luyten uiml.net: http://lumumba.luc.ac.be/kris/projects/uiml.net/ ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] IDE for mono/linux
El sÃb, 21-02-2004 a las 15:33, Sergio Blanco Cuaresma escribiÃ: > El sÃb, 21-02-2004 a las 14:55, Patrik Olterman escribiÃ: > > If anyone is interested I have an IDE that is working ok called eZsharp > > its a simple editor with syntax highlighting and a compile and run > > fuction it can be downloaded with > > It doesn't work for me (I have installed the gtksourceview version of > your svn): Works fine for me. $ svn co http://www.olterman.se:8080/repos/mono $ cd mono/ezsharp $ ./ezsharp.exe you should run the ezsharp.exe (not eZ) -- Jonathan HernÃndez aka jBilbo :: http://jhernandez.gplurv.org miembro del LUG GPLURV :: http://www.gplurv.org Linux User #280862 :: http://counter.li.org/ GnuPG key ID: 348EAC17 :: pgp.escomposlinux.org signature.asc Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente
Re: [Mono-list] IDE for mono/linux
El sáb, 21-02-2004 a las 14:55, Patrik Olterman escribió: > If anyone is interested I have an IDE that is working ok called eZsharp > its a simple editor with syntax highlighting and a compile and run > fuction it can be downloaded with It doesn't work for me (I have installed the gtksourceview version of your svn): - ./eZsharp.exe ** (:13301): WARNING **: Missing method Init in assembly ./eZsharp.exe typeref index 5 The application failed because: System.NullReferenceException: A null value was found where an object instance was required in (unmanaged) eZsharp.Hilite:.ctor () in <0x0002b> eZsharp.App:Main (string[]) Unhandled Exception: System.NullReferenceException: A null value was found where an object instance was required in <0x00119> eZsharp.App:Main (string[]) - And I cannot compile (maybe the compilation needs something else): - mcs ezsharp.cs -r:System.Drawing -r:gdk-sharp -r:gtk-sharp -r:gtk-sharp -r:gtksourceview-sharp ezsharp.cs(86) error CS0103: The name `GtkSourceView.Init' could not be found in `eZsharp.Hilite' Compilation failed: 1 error(s), 0 warnings - Sergio. -- [aka Marble] Web Personal <> http://www.marblestation.com Registered LiNUX user #140941 <> http://counter.li.org/ Socio #3274 de HispaLinux <> http://www.hispalinux.es Miembro de GPL URV <> http://www.gplurv.org GnuPG key: 0x0ED2CF9D <> hkp://pgp.escomposlinux.org signature.asc Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente
Re: [Mono-list] Socket code.
On Sat, Feb 21, 2004 at 04:31:00PM -0800, George Farris wrote: > I have some socket code that looks something like this: > > byte[] bytes = new byte[1448]; > do { > len = sock.Read(bytes, 0, (int)1448); > s = Encoding.ASCII.GetString(bytes); > buf.Append(s.Substring(0,len)); Shouldn't it be: s = Encoding.ASCII.GetString(bytes, 0, len); buf.Append(s); Passing some random junk (ergh.. does new byte[] clear memory?) to encodoer doesn't seem good idea. -- : Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++ : When in doubt, use brute force. -- Ken Thompson :: UL$ C++ E--- a? ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list