[Mono-dev] Casting bug with generic collections

2007-09-24 Thread Michi Henning
I would have put this into bugzilla, but it wouldn't let me, so I'm 
reporting it here...

The code below compiles and runs fine with VS 2005 and prints a.

With Mono 1.2.4, I get a cast exception:

Unhandled Exception: System.InvalidCastException: Cannot cast from 
source type to destination type.
  at System.Collections.Generic.Dictionary 
2+KeyColleciton[System.String,System.String].System.Collections.ICollection.CopyTo
 
(System.Array , Int32 ) [0x0]

Here is the code:

System.Collections.Generic.Dictionarystring, string d = 
new System.Collections.Generic.Dictionarystring, string();
d[a] = b;
System.Collections.ICollection keys = d.Keys;
object[] keyArray = new object[d.Count];
keys.CopyTo(keyArray, 0);
System.Console.WriteLine(keyArray[0]);

Cheers,

Michi.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] What's with bugzilla?

2007-09-24 Thread Michi Henning
I just tried to create a new bug in bugzilla and found that I had to 
create a Novell account,
which I did.

When I then tried to submit the bug, I was told that access policies 
don't allow me to do that.

Is bugzilla defunct, or just broken?

Thanks,

Michi.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] C bindings VS C++ bindings (Gtk# vs. Kimono?)

2007-09-24 Thread Andrés G. Aragoneses [ knocte ]
Andreas Färber escribió:
 Am 21.09.2007 um 16:27 schrieb Andrés G. Aragoneses [ knocte ]:
 
 What factual arguments would you arise for this decision?  
 (Remember, we
 want stability, maintainability[3], and portability[1], and we don't
 want a Gnome VS KDE flamewar. Thanks)
 
 Licensing can also influence the decision - Gtk# LGPL vs. Qyoto GPL  
 (not even dual-licensed).

Hugh, yes, unfortunately right now we depend on license issues :-/

Thanks for your answer.

Andrés  [ knocte ]

-- 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Linq status

2007-09-24 Thread pablosantosluac
Hi!

I was wondering which is the current Linq status in mono.

 I've downloaded and compiled the olive project, and now I have the
System.Data.Linq assembly but I was wondering how should I write a Linq
sample in mono.

I didn't find a sample or test in the code to start up with.

I tried this one from msdn, but I guess I'm doing something wrong because I
wasn't able to compile it.

using System;
using System.Linq;
using System.Collections.Generic;

class app {
  static void Main() {
string[] names = { Burke, Connor, Frank,
   Everett, Albert, George,
   Harris, David };

IEnumerablestring query = from s in names
   where s.Length == 5
   orderby s
   select s.ToUpper();

foreach (string item in query)
  Console.WriteLine(item);
  }
}


I'm just interested in in-memory queries.

Any suggestions?

Thanks,

pablo


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Question on the C-C# translation of WinApi MSG struct.

2007-09-24 Thread StApostol
Thanks, this makes perfect sense!

On 9/22/07, Mike Edenfield [EMAIL PROTECTED] wrote:


 The Windows API almost always passes structures like this as
 pointers.  PeekMessage() and all of the GetMessage() calls
 pass an LPMSG parameter, for example.  The only thing the
 unmanaged code inside Windows knows about are the field
 defined in the header, which are accessed as x number of
 bytes past the pointer value.  As long as any additional
 information is at the end of the structure, Windows will
 ignore it.

 In fact, Windows uses this fact itself when new features
 come out, by adding fields to the end of key structures and
 internally using sizeof(blah) to figure out what fields are
 available.

 The only thing you would need to watch out for is anything
 that tries to take the size of a struct MSG, but I don't
 know of any Windows API call that does so.

 -- Mike

 Still using IE? Get Firefox!
 http://www.spreadfirefox.com/?q=affiliatesid=6492t=1

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] C bindings VS C++ bindings (Gtk# vs. Kimono?)

2007-09-24 Thread Andrés G. Aragoneses [ knocte ]
Mirco Bauer escribió:
 On Fri, 2007-09-21 at 16:49 +0200, Andrés G. Aragoneses [ knocte ]
 wrote:
 Brandon Perry escribió:
 I much prefer the Qyoto/Kimono bindings for cross-platform because of
 it's elegance and it looks much better IMHO on Windows than Gtk#. I
 haven't run into /too many/ bugs (just a couple, they might have even
 been resolved by now) with the Qyoto/Kimono bindings. Those are really
 the only reasons why I prefer Qyoto/Kimono over Gtk#.
 Thanks for your answer.

 Those bugs you found, have to be fixed upstream (Qt) or on the binding 
 itself?

 BTW, what do you use for creating interfaces with Kimono? Do you use a 
 general QT designer that generates XML that can be consumed by any 
 binding? (If not, we have here an advantage for Gtk#: Stetic in MD.)
 
 And don't forget glade, since glade3 it's fun to make GUIs :)
 
 Our company develops business applications using C# / Gtk# / Glade# /
 gettext.
 GTK+/GTK# gives us a permissable license (LGPL), a _very_ stable ABI/API
 (didn't break since GTK+ 2.0, and today we are at 2.12) and workable
 release cycles.
 Gettext integrates very well on windows using Mono.Posix.dll, glade also
 supports I18N through gettext out of the box.

We've also researched about the best portable I18N method, and we have 
discarded Mono.Posix until bug 
https://bugzilla.novell.com/show_bug.cgi?id=MONO82850 is closed 
(actually not a bug, but a RFE).


 Theming is indeed a bit strange/ugly in GTK+, not well documented, but
 is very flexible.
 
 Gtk# builds on windows lack behind Gtk# on linux, like there is no Gtk#
 2.10 installer for windows yet. This is not really a GTK+ nor GTK#
 issue, but a porting/community issue. GTK# is an official GTK+ binding
 but there are no official windows ports/builds. Paco is doing them as
 good and often as he can (and they are _very_ good), but there is
 sometimes lag.

Perhaps it's a porting/community issue, but it's an issue that affects 
companies and thus it comprises the stability of the whole choice.


 In total I am very happy what GTK# gives us (the company) and it works
 very well.
 
 I have no experience with QT neither Kimono.

Thanks for your answer.

Regards,

[ knocte ]

-- 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Linq sample?

2007-09-24 Thread pablosantosluac
Hi!

I was wondering which is the current Linq status in mono.

 I've downloaded and compiled the olive project, and now I have the 
System.Data.Linq assembly but I was wondering how should I write a Linq 
sample in mono.

I didn't find a sample or test in the code to start up with.

I tried this one from msdn, but I guess I'm doing something wrong because I 
wasn't able to compile it.

using System;
using System.Linq;
using System.Collections.Generic;

class app {
  static void Main() {
string[] names = { Burke, Connor, Frank,
   Everett, Albert, George,
   Harris, David };

IEnumerablestring query = from s in names
   where s.Length == 5
   orderby s
   select s.ToUpper();

foreach (string item in query)
  Console.WriteLine(item);
  }
}


I'm just interested in in-memory queries.

Any suggestions?

Thanks,

pablo

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Replicating System.Web.Script.Serialization bugs

2007-09-24 Thread R. Tyler Ballance
I discovered that whilst consuming Facebook's API data in JSON  
format, that both .NET 2.0 and Mono (from trunk) have the exact same  
System.Web.Script.Serialization bug when dealing with empty value  
fields in the JSON key/value string, for example:


{some_key : }

Which is handled properly as an empty value by Python and Javascript  
alike, barfs inside the stronger-typed C#, when you try to serialize  
it to a long value (for example), throwing the following exception  
on both .NET and Mono


Unhandled Exception: System.Exception:  is not a valid value for  
Int64. --- System.FormatException: Input string was not in the  
correct format: s.Length==0.
  at System.Int64.Parse (System.String s, NumberStyles style,  
IFormatProvider fp) [0x0]
  at System.ComponentModel.Int64Converter.ConvertFromString  
(System.String value, System.Globalization.NumberFormatInfo format)  
[0x0]
  at System.ComponentModel.BaseNumberConverter.ConvertFrom  
(ITypeDescriptorContext context, System.Globalization.CultureInfo  
culture, System.Object value) [0x0]


[full stack trace from attached test code at the bottom of this email]


Ideally this would just *not* be serialized out, leaving the object's  
property that maps to some_key empty/uninitialized, but instead the  
application that consumes and deserializes the JSON will explode,  
especially if the JSON provider (Facebook in my case) provides fields  
such as this as optional.


As I mentioned to sontek in the IRC channel, it certainly seems like  
I'm screwed in this case, since we are compatible with Microsoft's  
bugs :( So the bigger question is, what work around or recourse do I  
have in this case? I have kicked around the idea of adding a  
Mono.Script.Serialization to trunk that would essentially just apply  
a series of patches to System.Web.Script.Serialization, but I'd  
rather avoid that route as it doesn't tend to grow well, but I don't  
see a really decent workaround except to implement a magic property  
for EVERY single optional JSON key (which in some calls can be up to  
about 50 keys) to do a Convert.ToInt64 if there's a string on get {},  
otherwise return a null (this sucks, and I don't want to implement it  
for every frakking deserializable attribute that could need to be  
deserialized as anything but a string)


I've attached my test case, but I have a sense someone is going to  
point out that the emperor has no clothes, and that I am indeed  
screwed :-P



Cheers






JsonTest.cs
Description: Binary data


Unhandled Exception: System.Exception:  is not a valid value for  
Int64. --- System.FormatException: Input string was not in the  
correct format: s.Length==0.
  at System.Int64.Parse (System.String s, NumberStyles style,  
IFormatProvider fp) [0x0]
  at System.ComponentModel.Int64Converter.ConvertFromString  
(System.String value, System.Globalization.NumberFormatInfo format)  
[0x0]
  at System.ComponentModel.BaseNumberConverter.ConvertFrom  
(ITypeDescriptorContext context, System.Globalization.CultureInfo  
culture, System.Object value) [0x0]


  --- End of inner exception stack trace ---

  at System.ComponentModel.BaseNumberConverter.ConvertFrom  
(ITypeDescriptorContext context, System.Globalization.CultureInfo  
culture, System.Object value) [0x0]
  at System.ComponentModel.TypeConverter.ConvertFromString  
(ITypeDescriptorContext context, System.Globalization.CultureInfo  
culture, System.String text) [0x0]
  at System.ComponentModel.TypeConverter.ConvertFromInvariantString  
(ITypeDescriptorContext context, System.String text) [0x0]
  at System.ComponentModel.TypeConverter.ConvertFromInvariantString  
(System.String text) [0x0]
  at  
System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType  
(System.Type type, System.Object obj) [0x0]
  at  
System.Web.Script.Serialization.JavaScriptSerializer.ConvertToObject  
(IDictionary`2 dict, System.Type type) [0x0]
  at  
System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType  
(System.Type type, System.Object obj) [0x0]
  at  
System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType 
[JsonObject] (System.Object obj) [0x0]
  at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize 
[JsonObject] (System.String input) [0x0]

  at JsonTests.JsonTest.Main (System.String[] args) [0x0]






PGP.sig
Description: This is a digitally signed message part
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] More ODBC questions: AutoCommit and BeginTransaction

2007-09-24 Thread Mads Bondo Dydensborg
fredag 21 September 2007 skrev Amc Gmail:
 Hi, Mads,
 
 it seems to be you are right and i am also getting ugly transaction
 state errors from db2 odbc with mono. i wrote quick dirty patch :) to
 fix OdbcTransaction.cs and it would be great if you can try it (diff
 and svn diff attached, use any for your convenience). unfortunately i
 can't even compile it before mid-october and so sorry (in advance) if
 that code has any bugs.

Hi Amc.

I just tried your patch, and it works very nicely. There was a small problem 
in getting it to compile, because your patch actually exposes a bug, IMHO, in 
the existing codebase. Please find attached a patch against current svn.

To the ODBC maintainer: Please review this patch for inclusion in mono. I 
believe it solves two things:
- setting autocommit back to on (default for ODBC), when leaving a transaction
- actually throws, if the isolationlevel of a transaction can not be set 
through the odbc driver.

Regards,

Mads


 
 i hope it would help :)
 -- amc
 
 
 On 9/21/07, Mads Bondo Dydensborg [EMAIL PROTECTED] wrote:
  mandag 03 September 2007 skrev Mads Bondo Dydensborg:
  Hi again.
 
  I still can not resolve this question. But I did discover, that there is 
no
  public way to change the autocommit mode through the mono stack, meaning,
  that if one uses a transaction, one can never return to autocommit mode.
 
  Is this really the right way to do things?
 
  Regards
 
  Mads
 
 
   Hi all
  
   I am not posting a bug, because I have no idea if this is a bug. Perhaps
  this
   is the intended way:
  
   For ODBC connections, the default mode is autocommit: Each statement 
is
   followed by an commit, done by the driver, client side. This can be 
disabled
   programmatically.
  
   When an ODBC transaction is created in mono, we change the attributes in
   OdbcTransaction.cs:
  
51 internal OdbcTransaction(OdbcConnection conn,
   IsolationLevel isolationlevel)
52 {
53 // Set Auto-commit (102) to false
54 OdbcReturn
   ret=libodbc.SQLSetConnectAttr(conn.hDbc, 
OdbcConnectionAttribute.AutoCommit,
   IntPtr.Zero, 0);
  
   We have to do that, obviously, but my question is wheter mono should
   reestablish the state of autocommit upon completion of the transaction?
   Currently it does not, but is this to be expected? I think, from my 
reading
   that it is, but would very much like a confirmation.
  
   Currently I am not able to check out the behavoiur using MS .NET.
  
   Thanks,
  
   Regards
  
   Mads
  
   --
   Med venlig hilsen/Regards
  
   Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo
  Dydensborg
   Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 
77
  34
  
   ___
   Mono-devel-list mailing list
   Mono-devel-list@lists.ximian.com
   http://lists.ximian.com/mailman/listinfo/mono-devel-list
  
  
 
 
 
  --
  Med venlig hilsen/Regards
 
  Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo 
Dydensborg
  Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 
77 34
 
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 



-- 
Med venlig hilsen/Regards

Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77 34
Index: OdbcTransaction.cs
===
--- OdbcTransaction.cs	(revision 86248)
+++ OdbcTransaction.cs	(working copy)
@@ -51,9 +51,7 @@
 		internal OdbcTransaction(OdbcConnection conn, IsolationLevel isolationlevel)
 		{
 			// Set Auto-commit (102) to false
-			OdbcReturn ret=libodbc.SQLSetConnectAttr(conn.hDbc, OdbcConnectionAttribute.AutoCommit, IntPtr.Zero, 0); 
-			if ((ret!=OdbcReturn.Success)  (ret!=OdbcReturn.SuccessWithInfo)) 
-throw new OdbcException(new OdbcError(SQLSetConnectAttr,OdbcHandleType.Dbc,conn.hDbc));
+SetAutoCommit(conn, false);
 			// Handle isolation level
 			int lev=0;
 			switch (isolationlevel)
@@ -76,12 +74,24 @@
 default:
 	throw new NotSupportedException();
 			}
-			libodbc.SQLSetConnectAttr(conn.hDbc, OdbcConnectionAttribute.TransactionIsolation, (IntPtr) lev, 0);
+			// mbd: Getting the return code of the second call to SQLSetConnectAttr is missing from original code!
+			OdbcReturn ret = libodbc.SQLSetConnectAttr(conn.hDbc, OdbcConnectionAttribute.TransactionIsolation, (IntPtr) lev, 0);
 			if ((ret!=OdbcReturn.Success)  (ret!=OdbcReturn.SuccessWithInfo)) 
 throw new OdbcException(new OdbcError(SQLSetConnectAttr,OdbcHandleType.Dbc,conn.hDbc));
 			this.isolationlevel=isolationlevel;
 			connection=conn;
 		}
+
+// Set Auto-commit (102) connection attribute
+// 

Re: [Mono-dev] What's with bugzilla?

2007-09-24 Thread Andreas Färber

Am 24.09.2007 um 10:47 schrieb Michi Henning:

 I just tried to create a new bug in bugzilla and found that I had to
 create a Novell account,
 which I did.

 When I then tried to submit the bug, I was told that access policies
 don't allow me to do that.

 Is bugzilla defunct, or just broken?

You may need to re-confirm your email address.

Andreas
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Remoting Question

2007-09-24 Thread Phil
Is .NET Remoting in Mono compatible with Microsoft's implementation?
And if not, how about BinaryFormatter?

Thanks!

- Phil
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Remoting Question

2007-09-24 Thread pablosantosluac
It is fully compatible.

Mono remoting is one of the nicest thing you'll find for Unix development. 
Binary serialization outperforms the MS implementation.

pablo

- Original Message - 
From: Phil [EMAIL PROTECTED]
To: mono-devel-list@lists.ximian.com
Sent: Monday, September 24, 2007 4:36 PM
Subject: [Mono-dev] Remoting Question


 Is .NET Remoting in Mono compatible with Microsoft's implementation?
 And if not, how about BinaryFormatter?

 Thanks!

 - Phil
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Remoting Question

2007-09-24 Thread Glen Ford
Be aware there are bugs in the Soap implementation, I am in the middle
of a bunch of test cases.



On 9/24/07, Phil [EMAIL PROTECTED] wrote:
 Is .NET Remoting in Mono compatible with Microsoft's implementation?
 And if not, how about BinaryFormatter?

 Thanks!

 - Phil
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Remoting Question

2007-09-24 Thread Mirco Bauer
On Mon, 2007-09-24 at 16:42 +0200, pablosantosluac wrote:
 It is fully compatible.

With Mono 1.2.5 it's now fully compatible.

The Dictionary (generic) collection wasn't compatible in  1.2.5

 
 Mono remoting is one of the nicest thing you'll find for Unix development. 

I agree, it's like sweet strawberries on vanilla ice cream.

 Binary serialization outperforms the MS implementation.

Not sure about that one, my custom (fast) serializer is faster :)

 
 pablo

-- 
Regards,

Mirco 'meebey' Bauer

PGP-Key ID: 0xEEF946C8

FOSS Developer[EMAIL PROTECTED]  http://www.meebey.net/
PEAR Developer[EMAIL PROTECTED] http://pear.php.net/
Debian Developer  [EMAIL PROTECTED]  http://www.debian.org/


signature.asc
Description: This is a digitally signed message part
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Linq sample?

2007-09-24 Thread Robert Jordan
pablosantosluac wrote:
 Hi!
 
 I was wondering which is the current Linq status in mono.
 
  I've downloaded and compiled the olive project, and now I have the 
 System.Data.Linq assembly but I was wondering how should I write a Linq 
 sample in mono.
 
 I didn't find a sample or test in the code to start up with.
 
 I tried this one from msdn, but I guess I'm doing something wrong because I 
 wasn't able to compile it.

Compile it with gmcs -langversion:linq

Robert


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Linq sample?

2007-09-24 Thread Kevin Kubasik
As I understand it, we support the query language rewrite, and the
core classes for querying  objects in the manner specified in your
last mail. The problem is our compiler doesn't default to all that new
jazz yet, just add -langversion:linq to your compiler options and it
should work.


On 9/23/07, pablosantosluac [EMAIL PROTECTED] wrote:
 Hi!

 I was wondering which is the current Linq status in mono.

  I've downloaded and compiled the olive project, and now I have the
 System.Data.Linq assembly but I was wondering how should I write a Linq
 sample in mono.

 I didn't find a sample or test in the code to start up with.

 I tried this one from msdn, but I guess I'm doing something wrong because I
 wasn't able to compile it.

 using System;
 using System.Linq;
 using System.Collections.Generic;

 class app {
   static void Main() {
 string[] names = { Burke, Connor, Frank,
Everett, Albert, George,
Harris, David };

 IEnumerablestring query = from s in names
where s.Length == 5
orderby s
select s.ToUpper();

 foreach (string item in query)
   Console.WriteLine(item);
   }
 }


 I'm just interested in in-memory queries.

 Any suggestions?

 Thanks,

 pablo

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list



-- 
Cheers,
Kevin Kubasik
http://kubasik.net/blog
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Linq sample?

2007-09-24 Thread Kevin Kubasik
Oops, appears we crossed streams...

err... yeah

-Kevin Kubasik

On 9/24/07, Robert Jordan [EMAIL PROTECTED] wrote:
 pablosantosluac wrote:
  Hi!
 
  I was wondering which is the current Linq status in mono.
 
   I've downloaded and compiled the olive project, and now I have the
  System.Data.Linq assembly but I was wondering how should I write a Linq
  sample in mono.
 
  I didn't find a sample or test in the code to start up with.
 
  I tried this one from msdn, but I guess I'm doing something wrong because I
  wasn't able to compile it.

 Compile it with gmcs -langversion:linq

 Robert


 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list



-- 
Cheers,
Kevin Kubasik
http://kubasik.net/blog
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Linq sample?

2007-09-24 Thread pablosantosluac
Thanks Robert,

One more question: now it compiles but I can't run it.

I'm using Mono JIT compiler version 1.2.5 (/trunk/ r84774)

And I get:
Unhandled Exception: System.InvalidProgramException: Invalid IL code in 
app:Main (): IL_: ldc.i4.8

I guess I'm still doing something wrong...

Thanks

pablo

- Original Message - 
From: Robert Jordan [EMAIL PROTECTED]
To: mono-devel-list@lists.ximian.com
Sent: Monday, September 24, 2007 5:12 PM
Subject: Re: [Mono-dev] Linq sample?


 pablosantosluac wrote:
 Hi!

 I was wondering which is the current Linq status in mono.

  I've downloaded and compiled the olive project, and now I have the
 System.Data.Linq assembly but I was wondering how should I write a Linq
 sample in mono.

 I didn't find a sample or test in the code to start up with.

 I tried this one from msdn, but I guess I'm doing something wrong because 
 I
 wasn't able to compile it.

 Compile it with gmcs -langversion:linq

 Robert


 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Linq sample?

2007-09-24 Thread Kamil Skalski
2007/9/24, pablosantosluac [EMAIL PROTECTED]:
 Thanks Robert,

 One more question: now it compiles but I can't run it.

 I'm using Mono JIT compiler version 1.2.5 (/trunk/ r84774)

 And I get:
 Unhandled Exception: System.InvalidProgramException: Invalid IL code in
 app:Main (): IL_: ldc.i4.8


Looks like a bug in compiler or runtime. You should produce a small
sample triggering this error and post to bugzilla.

-- 
Kamil Skalski
http://nazgul.omega.pl
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Linq sample?

2007-09-24 Thread pablosantosluac
Well, I guess I'm doing something wrong or using an old mono runtime, 
because the sample is very simple. Does it work for you?

Another question: is Linq performace good?


using System;
using System.Linq;
using System.Collections.Generic;

class app {
  static void Main() {
string[] names = { Burke, Connor, Frank,
   Everett, Albert, George,
   Harris, David };

IEnumerablestring query = from s in names
   where s.Length == 5
   orderby s
   select s.ToUpper();

foreach (string item in query)
  Console.WriteLine(item);
  }
}




- Original Message - 
From: Kamil Skalski [EMAIL PROTECTED]
To: pablosantosluac [EMAIL PROTECTED]
Cc: mono-devel-list@lists.ximian.com; Robert Jordan [EMAIL PROTECTED]
Sent: Monday, September 24, 2007 5:25 PM
Subject: Re: [Mono-dev] Linq sample?


 2007/9/24, pablosantosluac [EMAIL PROTECTED]:
 Thanks Robert,

 One more question: now it compiles but I can't run it.

 I'm using Mono JIT compiler version 1.2.5 (/trunk/ r84774)

 And I get:
 Unhandled Exception: System.InvalidProgramException: Invalid IL code in
 app:Main (): IL_: ldc.i4.8


 Looks like a bug in compiler or runtime. You should produce a small
 sample triggering this error and post to bugzilla.

 -- 
 Kamil Skalski
 http://nazgul.omega.pl 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Remoting Question

2007-09-24 Thread Andrés G. Aragoneses [ knocte ]
Mirco Bauer escribió:
 Binary serialization outperforms the MS implementation.
 
 Not sure about that one, my custom (fast) serializer is faster :)

Does your serializer work on CF2.0?

Regards,

Andrés  [ knocte ]

-- 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Compiling-Error

2007-09-24 Thread Michael Schöndorfer
Hi!

I was installing Olive when this error occured:

make[5]: Entering directory
`/home/ubuntu/Desktop/olive/class/System.Data.Linq'
MONO_PATH=../../class/lib/net_3_5:$MONO_PATH gmcs   -d:NET_1_1 -d:NET_2_0
-d:NET_3_5 -langversion:linq -debug+ /noconfig /r: System.dll /r:
System.Core.dll /r:System.Data.dll /r:System.Transactions.dll /r:
System.Xml.dll  -target:library
-out:../../class/lib/net_3_5/System.Data.Linq.dll  @
System.Data.Linq.dll.sources
System.Data.Linq/Table_T.cs(97,16): error CS0246: The type or namespace name
`IQueryProvider' could not be found. Are you missing a using directive or an
assembly reference?
Compilation failed: 1 error(s), 0 warnings
make[5]: *** [../../class/lib/net_3_5/System.Data.Linq.dll] Error 1
make[5]: Leaving directory
`/home/ubuntu/Desktop/olive/class/System.Data.Linq'
make[4]: *** [do-all] Error 2
make[4]: Leaving directory
`/home/ubuntu/Desktop/olive/class/System.Data.Linq'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/ubuntu/Desktop/olive/class'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/ubuntu/Desktop/olive'
make[1]: *** [profile-do--net_3_5--all] Error 2
make[1]: Leaving directory `/home/ubuntu/Desktop/olive'
make: *** [profiles-do--all] Error 2

I installed Mono 1.2.4 from the sources with the --with-moonlight flag.

Please help me

Thanks in advance!
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Remoting Question

2007-09-24 Thread pablosantosluac
Yes, a custom one is even faster, but, by default, I've measured the mono 
one to be quite faster than the ms one.

On Mon, 2007-09-24 at 16:42 +0200, pablosantosluac wrote:
 It is fully compatible.

With Mono 1.2.5 it's now fully compatible.

The Dictionary (generic) collection wasn't compatible in  1.2.5


 Mono remoting is one of the nicest thing you'll find for Unix development.

I agree, it's like sweet strawberries on vanilla ice cream.

 Binary serialization outperforms the MS implementation.

Not sure about that one, my custom (fast) serializer is faster :)


 pablo
- Original Message - 
From: Mirco Bauer [EMAIL PROTECTED]
To: pablosantosluac [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; mono-devel-list@lists.ximian.com
Sent: Monday, September 24, 2007 5:13 PM
Subject: Re: [Mono-dev] Remoting Question


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Linq status

2007-09-24 Thread Marek Safar
Hi Pablo,
 I was wondering which is the current Linq status in mono.
   
LINQ is currently under development and some pieces are already working.

  I've downloaded and compiled the olive project, and now I have the
 System.Data.Linq assembly but I was wondering how should I write a Linq
 sample in mono.
   
Exactly the same as you would do for Microsoft .NET. Our libraries and 
compliers
should be compatible.

 I didn't find a sample or test in the code to start up with.

 I tried this one from msdn, but I guess I'm doing something wrong because I
 wasn't able to compile it.
   
You probably forget to pass -langversion:linq option This option is only 
temporary (to disable not
very stable features) and will very likely be removed in the next Mono 
release.

I also recommend you to use SVN HEAD version as LINQ is under 
development and SVN
contains more features than Mono 1.2.5.* release.

Marek

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Linq sample?

2007-09-24 Thread Marek Safar
Hi,
 Well, I guess I'm doing something wrong or using an old mono runtime, 
 because the sample is very simple. Does it work for you?
   
Yes, it does. Please use SVN HEAD.
 Another question: is Linq performace good?
   
We are currently not in the position where we can focus on LINQ performance.

As far as I know nobody have tested Mono LINQ performance yet.

Marek
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Compiling-Error

2007-09-24 Thread Marek Safar
Hello Michael,

 I was installing Olive when this error occured:

 make[5]: Entering directory 
 `/home/ubuntu/Desktop/olive/class/System.Data.Linq'
 MONO_PATH=../../class/lib/net_3_5:$MONO_PATH gmcs   -d:NET_1_1 
 -d:NET_2_0 -d:NET_3_5 -langversion:linq -debug+ /noconfig /r: 
 System.dll /r:System.Core.dll /r:System.Data.dll 
 /r:System.Transactions.dll /r:System.Xml.dll  -target:library 
 -out:../../class/lib/net_3_5/System.Data.Linq.dll  
 @System.Data.Linq.dll.sources
 System.Data.Linq/Table_T.cs(97,16): error CS0246: The type or 
 namespace name `IQueryProvider' could not be found. Are you missing a 
 using directive or an assembly reference?
 Compilation failed: 1 error(s), 0 warnings
 make[5]: *** [../../class/lib/net_3_5/System.Data.Linq.dll] Error 1
 make[5]: Leaving directory 
 `/home/ubuntu/Desktop/olive/class/System.Data.Linq'
 make[4]: *** [do-all] Error 2
 make[4]: Leaving directory 
 `/home/ubuntu/Desktop/olive/class/System.Data.Linq'
 make[3]: *** [all-recursive] Error 1
 make[3]: Leaving directory `/home/ubuntu/Desktop/olive/class'
 make[2]: *** [all-recursive] Error 1
 make[2]: Leaving directory `/home/ubuntu/Desktop/olive'
 make[1]: *** [profile-do--net_3_5--all] Error 2
 make[1]: Leaving directory `/home/ubuntu/Desktop/olive'
 make: *** [profiles-do--all] Error 2
You have to get SVN HEAD of mono/mcs as well, particularly 
mcs/class/System.Core/*

Marek

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Compiling-Error

2007-09-24 Thread Marek Safar
Hello,
 Sorry for my unknowledge, do i have to download mcs from svn and 
 compile it or copy the class-directory to any my mono-directory?
You have to compile and install System.Core.dll assembly.

See http://www.mono-project.com/Compiling_Mono for more details

Marek

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Remoting Question

2007-09-24 Thread Mirco Bauer
On Mon, 2007-09-24 at 17:55 +0200, Andrés G. Aragoneses [ knocte ]
wrote:
 Mirco Bauer escribió:
  Binary serialization outperforms the MS implementation.
  
  Not sure about that one, my custom (fast) serializer is faster :)
 
 Does your serializer work on CF2.0?

Didn't test that, but it has a build profile for .NET 1.1 (default)
and .NET 2.0

It's binary based serialization, extending StreamReader/Writer.

My version is based on FastSerialization, which you can find on code
project:
http://www.codeproject.com/csharp/FastSerialization.asp

there are also other custom (optimized) serializers:
http://www.codeproject.com/dotnet/FastSerializer.asp
http://www.codeproject.com/csharp/RawSerializer.asp
http://www.codeproject.com/csharp/OpenNxSerialization.asp

I will release my source later (needed by smuxi). I am still not sure
which one is really the fastest now, I should do some benchmarking :)

 Regards,
 
   Andrés  [ knocte ]
 
-- 
Regards,

Mirco 'meebey' Bauer

PGP-Key ID: 0xEEF946C8

FOSS Developer[EMAIL PROTECTED]  http://www.meebey.net/
PEAR Developer[EMAIL PROTECTED] http://pear.php.net/
Debian Developer  [EMAIL PROTECTED]  http://www.debian.org/


signature.asc
Description: This is a digitally signed message part
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] DataQuery.cs Bug #327048

2007-09-24 Thread Marek Safar
Hello Kevin,
 Another small patch, this one for a class called DataQuery. Its
 basically a bare-bones implementation of IQueryable, IQueryProvider,
 and IEnumerable. This is not only great for debugging, but can make
 code far more readable and concise.
   
Please check http://www.mono-project.com/Coding_Guidelines for coding 
guidelines.

I cannot see any tests for your new functionality.

Thanks
Marek

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] DataQuery.cs Bug #327048

2007-09-24 Thread Kevin Kubasik
I completely forgot, I'll attach a file with the nunit TestFixture
when I get home and can access it. The tests are not complete, and
this class actually depends on classes that I have not implemented
yet, or have not tested (at all) yet.

I will try to get a more complete patch with its dependencies and
current tests sometime tomorrow. I might need some help fleshing out
the tests to be more complete, as they are only testing pretty generic
usages of each method.

It is also worth noting that the tests only work on the MS
implementation as I do not have a working DataContext.

Thanks for the review! I'll also clean up the code styling!

On 9/24/07, Marek Safar [EMAIL PROTECTED] wrote:
 Hello Kevin,
  Another small patch, this one for a class called DataQuery. Its
  basically a bare-bones implementation of IQueryable, IQueryProvider,
  and IEnumerable. This is not only great for debugging, but can make
  code far more readable and concise.
 
 Please check http://www.mono-project.com/Coding_Guidelines for coding
 guidelines.

 I cannot see any tests for your new functionality.

 Thanks
 Marek




-- 
Cheers,
Kevin Kubasik
http://kubasik.net/blog
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] IIF Bug in Mono.Data.SqlExpressions/Parser.jay

2007-09-24 Thread Joel Reed
The following code works on MS.NET but not mono svn head (as of 9/24/07):

  DataTable dt = new DataTable();
  dt.Columns.Add(SurveyImage, Type.GetType(System.String), 
  IIF(LMSurvey, 'g1.gif', 'g2.gif'));


1) The attached file Iif.testcase.diff adds a test case for
this. OK to apply?


2) I first tried fixing this by adding this code to BoolExpr

Index: class/System.Data/Mono.Data.SqlExpressions/Parser.jay
===
--- class/System.Data/Mono.Data.SqlExpressions/Parser.jay   (revision 86284)
+++ class/System.Data/Mono.Data.SqlExpressions/Parser.jay   (working copy)
@@ -118,6 +118,10 @@
$$ = new Negation ((IExpression)$2);
}
| Predicate
+   | SingleColumnValue
+   {
+   $$ = new BoolOperation(Operation.EQ, (IExpression)$1, new 
Literal (true));
+   }
;
 
 Predicate


But this broke alot of test cases (about 8). I think Parser.jay needs more 
surgery to fix
these test cases. For example, this line in CalcFunction

  SUBSTRING PAROPEN Expr COMMA NumberLiteral COMMA NumberLiteral PARCLOSE

Doesn't seem correct. Expr is defined as BoolExpr | ArithExpr. But SUBSTRING
doesn't work on a BoolOperation or ArithmeticOperation afaik. It works now 
because
ArithExpr can also be a Value. Come to think of it, shouldn't NumberLiteral 
actually
be ArithExpr? I'll have to try that on MS.NET...

Anyway, not wanting to make lots of changes to this file without checking in 
here first,
I instead made this change:

Index: class/System.Data/Mono.Data.SqlExpressions/Parser.jay
===
--- class/System.Data/Mono.Data.SqlExpressions/Parser.jay   (revision 86284)
+++ class/System.Data/Mono.Data.SqlExpressions/Parser.jay   (working copy)
@@ -269,11 +269,19 @@
| VAR   { $$ = AggregationFunction.Var; }
;
 
-CalcFunction
+IifFunction
: IIF PAROPEN BoolExpr COMMA Expr COMMA Expr PARCLOSE
{
$$ = new IifFunction ((IExpression)$3, (IExpression)$5, 
(IExpression)$7);
}
+   | IIF PAROPEN SingleColumnValue COMMA Expr COMMA Expr PARCLOSE
+   {
+   $$ = new IifFunction (new BoolOperation(Operation.EQ, 
(IExpression)$3, new Literal (true)), (IExpression)$5, (IExpression)$7);
+   }
+   ;
+
+CalcFunction
+   : IifFunction
| SUBSTRING PAROPEN Expr COMMA NumberLiteral COMMA NumberLiteral 
PARCLOSE
{
long arg1 = (long) $5;


Which does the job - but seems rather ugly to me. Any comments? Anyone 
interested in 
this quick fix or me taking the first route  fixing up the rest of this file?

jr
Index: class/System.Data/Test/Mono.Data.SqlExpressions/DataColumnExpressionTest.cs
===
--- class/System.Data/Test/Mono.Data.SqlExpressions/DataColumnExpressionTest.cs	(revision 86284)
+++ class/System.Data/Test/Mono.Data.SqlExpressions/DataColumnExpressionTest.cs	(working copy)
@@ -8,6 +8,21 @@
 	public class DataColumnExprTest
 	{
 		[Test]
+		public void TestDataColumnExpr0 ()
+		{
+			DataTable table = new DataTable ();
+			table.Columns.Add (Col_0.Value, Type.GetType (System.Int32));
+			table.Columns.Add (Col_1, Type.GetType (System.Int32));
+			table.Columns.Add (Result, Type.GetType (System.Int32), IIF(Col_0.Value, Col_1 + 5, 0));
+
+			DataRow row = table.NewRow ();
+			row [Col_0.Value] = 0;
+			row [Col_1] = 10;
+
+			table.Rows.Add (row);
+			Assert.AreEqual (0, (int)table.Rows[0][2], #1);
+		}
+		[Test]
 		public void TestDataColumnExpr1 ()
 		{
 			DataTable table = new DataTable ();
Index: class/System.Data/Mono.Data.SqlExpressions/Parser.jay
===
--- class/System.Data/Mono.Data.SqlExpressions/Parser.jay	(revision 86284)
+++ class/System.Data/Mono.Data.SqlExpressions/Parser.jay	(working copy)
@@ -118,6 +118,10 @@
 		$$ = new Negation ((IExpression)$2);
 	}
 	| Predicate
+	| SingleColumnValue
+	{
+		$$ = new BoolOperation(Operation.EQ, (IExpression)$1, new Literal (true));
+	}
 	;
 
 Predicate
Index: class/System.Data/Mono.Data.SqlExpressions/Parser.jay
===
--- class/System.Data/Mono.Data.SqlExpressions/Parser.jay	(revision 86284)
+++ class/System.Data/Mono.Data.SqlExpressions/Parser.jay	(working copy)
@@ -269,11 +269,19 @@
 	| VAR		{ $$ = AggregationFunction.Var; }
 	;
 
-CalcFunction
+IifFunction
 	: IIF PAROPEN BoolExpr COMMA Expr COMMA Expr PARCLOSE
 	{
 		$$ = new IifFunction ((IExpression)$3, (IExpression)$5, (IExpression)$7);
 	}
+	| IIF PAROPEN SingleColumnValue COMMA Expr COMMA Expr PARCLOSE
+	{
+		$$ = new IifFunction (new BoolOperation(Operation.EQ, (IExpression)$3, new Literal (true)), (IExpression)$5, (IExpression)$7);
+	}
+	;
+
+CalcFunction
+	: IifFunction
 	| SUBSTRING PAROPEN Expr COMMA NumberLiteral COMMA