[Mono-list] Newbie needs help compiling

2005-08-04 Thread Alireza Ghasemi




Hello,
I'm a newbie in .NET and I just want to compile 
Blam! . But I don't know where to begin.Could anybody help me step by step to 
make an executable of Blam! Source code.
I have Mono 1.1.8 for Windows installed on my 
WinXP Pro .
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Problem with Events

2005-08-04 Thread mono-list . 1 . tracyanne
Can anyone see anything wrong with this code. It looks to me to be
correct syntax for defining and raising an event. It compiles without
error, but when I run it I get the following error message


Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object
in [0x1] (at /home/tracy/MonoDevelop/TestEvents/Main.cs:22)
RaiseAnEvent:Run ()
in [0x7] (at /home/tracy/MonoDevelop/TestEvents/Main.cs:11)
MainClass:Main (System.String[] args)

I'm using Mono_1.1.8-2.

// project created on 04/08/2005 at 17:17
using System;

class MainClass
{

public static void Main(string[] args)
{
RaiseAnEvent RAE = new RaiseAnEvent();
RAE.Run();
}
}

class RaiseAnEvent
{
public delegate void InputError(object sender, InputErrorEventArgs e);
public event InputError OnInputError;

public void Run()
{
OnInputError(this, new InputErrorEventArgs("DF", "OI"));
}

}


//Class for passing Input Error messages to the application
class InputErrorEventArgs : EventArgs
{
private string errorMessage;
private string errorSource;

public string ErrorMessage
{
get
{
return errorMessage;
}
}

public string ErrorSource
{
get
{
return errorSource;
}
}

public InputErrorEventArgs(string Message, string Source) : base()
{
errorMessage = Message;
errorSource = Source;
}
}
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Problem with Events

2005-08-04 Thread Jackson Harper
On Thu, 2005-08-04 at 17:30 +1000, [EMAIL PROTECTED]
wrote:
> Can anyone see anything wrong with this code. It looks to me to be
> correct syntax for defining and raising an event. It compiles without
> error, but when I run it I get the following error message

Nothing is ever subscribing to your event, so it is null when you are
trying to invoke it. You need something like:

OnInputError += new InputError (ErrorHandlerFunction); somewhere.

A few general style comments:

1. Normally event handler delegates are named Handler. So
your InputError delegate would be named InputErrorHandler.

2. Normally events names don't start with On. So OnInputError would be
InputError.

3. It's common to wrap the instantiation of an event in a protected
method named On. So you would have a method that looks like
this:

protected void OnInputError (InputErrorEventArgs e)
{
if (InputError != null)
InputError (this, e);
}


Cheers,
Jackson


> 
> Unhandled Exception: System.NullReferenceException: Object reference not
> set to an instance of an object
> in [0x1] (at /home/tracy/MonoDevelop/TestEvents/Main.cs:22)
> RaiseAnEvent:Run ()
> in [0x7] (at /home/tracy/MonoDevelop/TestEvents/Main.cs:11)
> MainClass:Main (System.String[] args)
> 
> I'm using Mono_1.1.8-2.
> 
> // project created on 04/08/2005 at 17:17
> using System;
> 
> class MainClass
> {
>   
>   public static void Main(string[] args)
>   {
>   RaiseAnEvent RAE = new RaiseAnEvent();
>   RAE.Run();
>   }
> }
> 
> class RaiseAnEvent
> {
>   public delegate void InputError(object sender, InputErrorEventArgs e);
>   public event InputError OnInputError;
>   
>   public void Run()
>   {
>   OnInputError(this, new InputErrorEventArgs("DF", "OI"));
>   }
> 
> }
> 
>   
> //Class for passing Input Error messages to the application
> class InputErrorEventArgs : EventArgs
> {
>   private string errorMessage;
>   private string errorSource;
>   
>   public string ErrorMessage
>   {
>   get
>   {
>   return errorMessage;
>   }
>   }
>   
>   public string ErrorSource
>   {
>   get
>   {
>   return errorSource;
>   }
>   }
>   
>   public InputErrorEventArgs(string Message, string Source) : base()
>   {
>   errorMessage = Message;
>   errorSource = Source;
>   }
> }
> ___
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

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


Re: [Mono-list] mcs precise location patch is now in svn.

2005-08-04 Thread Ben Motmans
On 8/2/05, Atsushi Eno <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> My precise location patch for mcs (to report line/column, where it
> used to report incorrect locations) is now checked in svn.
> 
> If any of you found such case that mcs does not report error location,
> please file a bug and/or report it here, with an example.
> 
> Thanks,
> Atsushi Eno

using mcs r47994,
if the column is > 255, it starts counting from 0 again

if you compile the attached file 'Test3.cs', you get the message
Test3.cs(6,13): warning CS0168: The variable `a' is declared but never used
while the location should be (6,255+)

it only shows '255+' when there is an error/warning at column 255

-- Ben
using System;

public class Test3 {
	public static void Main (string[] args)
	{
		int reaylngvaarnaaameethatexcedescolummmntwohundredfiftyfive; int a;
	}
}
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] ByteFX remote clients

2005-08-04 Thread Tom Larsen
Unfortunately there could be any number of reasons why "the other
machine" is not reachable.  Without more information there is little I
can suggest.  I would try making a very simple program that just does a
simple select on a table and work through the software configuration on
both machines until it works.

Tom Larsen

On Wed, 2005-08-03 at 23:06, Tarun R wrote:
> I use ByteFX.Data.MySqlClient to access MySQL databases.
> When I use the Database at the localhost, it works fine.
> When I use the database on a remote server, there is an error which
> says it can't be opened, even if it is the ip of the localhost.
> I use mono-1.1.8-2.
> 
> Help. Thanks.
> 
> 
> __
> ___
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
-- 
Tom Larsen <[EMAIL PROTECTED]>

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


[Mono-list] Add/Remove users

2005-08-04 Thread Arx Henrique
Is possible create/remove/edit linux users with mono?


-- 
"A fé remove montanas, mas eu prefiro a dinamite"
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Mono, Win32 fibers. Almost there...

2005-08-04 Thread Paolo Molaro
On 08/03/05 Bruce Wilkie wrote:
> One final question in hopes someone has an idea.  I've
> gotten fibers to work with both the JIT and Interp

Nice. You can ignore the interp, since we don't maintain it anymore.

> engines.  However, I'm having problems with garbage
> collection.  That is, objects seem to be getting
> collected when the shouldn't.
> 
> Could it be because the stack of the fiber isn't
> registered with the boehm collector?  does that sound
> right?

Yes, that's very likely. How do you allocate those stacks?
You're supposed to use GC_MALLOC (stack_size). If you can't
allocate them yourself, you'll have to change the GC code
so that it knows about the stacks and use GC_push_all_stack ().
See the libgc code for examples of when and how to call it.

lupus

-- 
-
[EMAIL PROTECTED] debian/rules
[EMAIL PROTECTED] Monkeys do it better
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Sqlite version

2005-08-04 Thread Julien Sobrier

Hello,
do you know what Sqlite version is handled by Mono.Data.SqliteClient.dll 
in Mono 1.1.6: 1, 2 or 3?


Thank you
Julien
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Mono linux question

2005-08-04 Thread Paul F. Johnson
Hi,

> > Altough /clr:pure generates 100% pure valid IL code, it will add CRT DLL
> > references using P/Invoke that will not run under Mono because Mono hasn't
> [...]
> 
> It would be good if you created a nice page on the wiki with all
> the relevant info, so we can point people to it: managed c++
> questions are becoming a FAQ.
> It could start like this:
> 
>   Question: Can I use Managed C++ or C++/CLI code with mono?
>   Short answer: Avoid Managed C++ and C++/CLI like the plague.
>   Long answer: Your text here.

To be fair, managed code is being currently discussed for C++0x (the
next version under discussion by the standards people).

For now, it's to be avoided.

TTFN

Paul
-- 
"Some people will do anything for a woman in uniform" - The Doctor -
Unregenerate (Big Finish audio)

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


Re: [Mono-list] mcs precise location patch is now in svn.

2005-08-04 Thread Atsushi Eno
Hi,

> using mcs r47994,
> if the column is > 255, it starts counting from 0 again
> 
> if you compile the attached file 'Test3.cs', you get the message
> Test3.cs(6,13): warning CS0168: The variable `a' is declared but never used
> while the location should be (6,255+)
> 
> it only shows '255+' when there is an error/warning at column 255

Oh, true... so I fixed this bug in svn (r48002).

Thanks,
Atsushi Eno
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] mcs precise location patch is now in svn.

2005-08-04 Thread Atsushi Eno
Hi,

> using mcs r47994,
> if the column is > 255, it starts counting from 0 again
> 
> if you compile the attached file 'Test3.cs', you get the message
> Test3.cs(6,13): warning CS0168: The variable `a' is declared but never used
> while the location should be (6,255+)
> 
> it only shows '255+' when there is an error/warning at column 255

Oh, true... so I fixed this bug in svn (r48002).

BTW, yes, it is a limitation of location reporting that the maximum
precise column number is 255 (to save memory consumption).

Thanks,
Atsushi Eno
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] RE: System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion .cs

2005-08-04 Thread cliff
I think I figured it out. For some reason, the latest mono archive doesn't
fully restore using 7zip (I downloaded it again to verify), although it
'tests' fine. Also, the file mentioned below is in CVS (I was looking in
wrong folder).

Cliff
--
> Hello,
> I get the following error when trying to build mono from scratch, with
> latest source package (not cvs sync):
> make[7]: Entering directory
> `/home/cap/mono/mono/mono-1.1.8/mcs/class/corlib'
> Creating ../../build/deps/basic_corlib_res.dll.response ...
> Creating ../../build/deps/basic_corlib_res.dll.makefrag ...
> Creating ../../build/deps/basic_corlib.dll.makefrag ...
> make[7]: Leaving directory
>`/home/cap/mono/mono/mono-1.1.8/mcs/class/corlib'
> make[7]: Entering directory
> `/home/cap/mono/mono/mono-1.1.8/mcs/class/corlib'
> make all-local
> make[8]: Entering directory
> `/home/cap/mono/mono/mono-1.1.8/mcs/class/corlib'
> make[8]: *** No rule to make target
> `System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs',
needed by `../../class/lib/basic/mscorlib.dll'.  Stop.
> I may be mistaken, but it appears that this file is missing. I check CVS,
not there either.
> Thanks,
> Cliff


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


[Mono-list] Npgsql error

2005-08-04 Thread Fabian Salamanca Dominguez
Hi

I tried to compile a simple C# program and access a Postgresql DB but I got this error in runtime (it compiled with no errors) :

[EMAIL PROTECTED] Mono]$ mcs dbaccess.cs  -r:Npgsql.dll -r:System.Data.dll
[EMAIL PROTECTED] Mono]$ mono dbaccess.exe

Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
in <0x000e1> dbAccess:Main (System.String[] args)



This is the code:

using System;
using System.Data;
using Npgsql;
public class dbAccess
 {
    public static void Main(string[] args)
    {
   string connectionString =
  "Server=localhost;" +
  "Database=opennms;" +
  "User ID=opennms;" +
  "Password=opennms;";
   IDbConnection dbcon;
   dbcon = new NpgsqlConnection(connectionString);
   dbcon.Open();
   IDbCommand dbcmd = dbcon.CreateCommand();
   string sql =
   "SELECT operatingsystem, nodeid " +
   "FROM assets";
   dbcmd.CommandText = sql;
   IDataReader reader = dbcmd.ExecuteReader();
   while(reader.Read()) {
    string operatingsystem = (string) reader["operatingsystem"];
    string nodeid = (string) reader["nodeid"];
    Console.WriteLine("OS: " +

operatingsystem + " " + nodeid);
   }
   // clean up
   reader.Close();
   reader = null;
   dbcmd.Dispose();
   dbcmd = null;
   dbcon.Close();
   dbcon = null;
    }
 }

What am I doing wrong?

Thanks!!!-- Fabian
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Mono linux question

2005-08-04 Thread Paolo Molaro
On 08/03/05 Kornél Pál wrote:
> Altough /clr:pure generates 100% pure valid IL code, it will add CRT DLL
> references using P/Invoke that will not run under Mono because Mono hasn't
[...]

It would be good if you created a nice page on the wiki with all
the relevant info, so we can point people to it: managed c++
questions are becoming a FAQ.
It could start like this:

Question: Can I use Managed C++ or C++/CLI code with mono?
Short answer: Avoid Managed C++ and C++/CLI like the plague.
Long answer: Your text here.

Thanks.
lupus

-- 
-
[EMAIL PROTECTED] debian/rules
[EMAIL PROTECTED] Monkeys do it better
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Npgsql error

2005-08-04 Thread Emil Emilov

Check the lines:
string operatingsystem = (string) reader["operatingsystem"];
string nodeid = (string) reader["nodeid"];

What happens of the results are NULL?
You should check for NULL first.

Then, are you sure that operatingsystem and nodeid are varchars or some other 
type that translate into string?
If not then you would get that exception.

Cheers,
Emil

Fabian Salamanca Dominguez wrote:


Hi

I tried to compile a simple C# program and access a Postgresql DB but I 
got this error in runtime (it compiled with no errors) :


[EMAIL PROTECTED] Mono]$ mcs dbaccess.cs  -r:Npgsql.dll -r:System.Data.dll
[EMAIL PROTECTED] Mono]$ mono dbaccess.exe

Unhandled Exception: System.InvalidCastException: Cannot cast from 
source type to destination type.

in <0x000e1> dbAccess:Main (System.String[] args)



This is the code:

using System;
using System.Data;
using Npgsql;
public class dbAccess
 {
public static void Main(string[] args)
{
   string connectionString =
  "Server=localhost;" +
  "Database=opennms;" +
  "User ID=opennms;" +
  "Password=opennms;";
   IDbConnection dbcon;
   dbcon = new NpgsqlConnection(connectionString);
   dbcon.Open();
   IDbCommand dbcmd = dbcon.CreateCommand();
   string sql =
   "SELECT operatingsystem, nodeid " +
   "FROM assets";
   dbcmd.CommandText = sql;
   IDataReader reader = dbcmd.ExecuteReader();
   while(reader.Read()) {
string operatingsystem = (string) reader["operatingsystem"];
string nodeid = (string) reader["nodeid"];
Console.WriteLine("OS: " +
 operatingsystem + " " + nodeid);
   }
   // clean up
   reader.Close();
   reader = null;
   dbcmd.Dispose();
   dbcmd = null;
   dbcon.Close();
   dbcon = null;
}
 }

What am I doing wrong?

Thanks!!!
--
Fabian




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


--
Emil R. Emilov
---
mailto:[EMAIL PROTECTED]
http://www.emilov.de
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Npgsql error

2005-08-04 Thread Emil Emilov

Also another tip: you don't need to explicitly set connection etc. to null.
Cosider following improvement:

IDbConnection dbcon;
IDbCommand dbcmd;
IDataReader reader;
try {
 dbcon = new NpgsqlConnection(connectionString);
 dbcon.Open();
 dbcmd = dbcon.CreateCommand();
 string sql =
   "SELECT operatingsystem, nodeid " +
   "FROM assets";
 dbcmd.CommandText = sql;
 reader = dbcmd.ExecuteReader();
 while(reader.Read()) {
string operatingsystem = (string) reader["operatingsystem"];
string nodeid = (string) reader["nodeid"];
Console.WriteLine("OS: " +
  operatingsystem + " " + nodeid);
 }
} catch (Exception ex)  {
 // do stuff, rollback transaction
} finally {
 // cleanup, even if error occurs, closing the reader is important because 
while it is open no other reader can be opened
 if (reader!=null) reader.Close();
 if (dbcmd!=null) dbcmd.Close();
 if (dbcon!=null) dbcon.Close();
}

Fabian Salamanca Dominguez wrote:


Hi

I tried to compile a simple C# program and access a Postgresql DB but I 
got this error in runtime (it compiled with no errors) :


[EMAIL PROTECTED] Mono]$ mcs dbaccess.cs  -r:Npgsql.dll -r:System.Data.dll
[EMAIL PROTECTED] Mono]$ mono dbaccess.exe

Unhandled Exception: System.InvalidCastException: Cannot cast from 
source type to destination type.

in <0x000e1> dbAccess:Main (System.String[] args)



This is the code:

using System;
using System.Data;
using Npgsql;
public class dbAccess
 {
public static void Main(string[] args)
{
   string connectionString =
  "Server=localhost;" +
  "Database=opennms;" +
  "User ID=opennms;" +
  "Password=opennms;";
   IDbConnection dbcon;
   dbcon = new NpgsqlConnection(connectionString);
   dbcon.Open();
   IDbCommand dbcmd = dbcon.CreateCommand();
   string sql =
   "SELECT operatingsystem, nodeid " +
   "FROM assets";
   dbcmd.CommandText = sql;
   IDataReader reader = dbcmd.ExecuteReader();
   while(reader.Read()) {
string operatingsystem = (string) reader["operatingsystem"];
string nodeid = (string) reader["nodeid"];
Console.WriteLine("OS: " +
 operatingsystem + " " + nodeid);
   }
   // clean up
   reader.Close();
   reader = null;
   dbcmd.Dispose();
   dbcmd = null;
   dbcon.Close();
   dbcon = null;
}
 }

What am I doing wrong?

Thanks!!!
--
Fabian




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


--
Emil R. Emilov
---
mailto:[EMAIL PROTECTED]
http://www.emilov.de
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Problems running monodevelop (svn) and muine (svn)

2005-08-04 Thread Pieter Baele
Everything builds fine. I am using latest mono (1.1.8.2) in gentoo and
gtk-sharp 2.5.5

Apps running fine: latest f-spot and tomboy
Can someone figure this out?



Trying to start monodevelop:


Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for
MonoDevelop.Gui.Dialogs.SplashScreenForm --->
System.TypeInitializationException: An exception was thrown by the type
initializer for Gtk.Container ---> System.EntryPointNotFoundException:
gtksharp_gtk_container_get_focus_child_offset
in (wrapper managed-to-native)
Gtk.Container:gtksharp_gtk_container_get_focus_child_offset ()
in <0xa> Gtk.Container:.cctor ()--- End of inner exception stack
trace ---

in <0x0> 
in <0xe> Gtk.Bin:.ctor (IntPtr raw)
in <0x0002f> Gtk.Window:.ctor (WindowType type)
in <0x00025> MonoDevelop.Gui.Dialogs.SplashScreenForm:.ctor ()
in <0x00016> MonoDevelop.Gui.Dialogs.SplashScreenForm:.cctor ()--- End
of inner exception stack trace ---

in <0x0> 
in <0x005ac> MonoDevelop.SharpDevelopMain:Main (System.String[] args)






With muine, i've the following error:


(muine:1832): GLib-GObject-CRITICAL **: g_object_get_data: assertion
`G_IS_OBJECT (object)' failed

... [cut]

(muine:1832): GLib-GObject-CRITICAL **: g_object_set_data: assertion
`G_IS_OBJECT (object)' failed

Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.TypeInitializationException: An exception was thrown by the type
initializer for Gtk.Dialog ---> System.EntryPointNotFoundException:
gtksharp_gtk_dialog_get_vbox_offset
in (wrapper managed-to-native)
Gtk.Dialog:gtksharp_gtk_dialog_get_vbox_offset ()
in <0x8> Gtk.Dialog:.cctor ()--- End of inner exception stack trace
---

in <0x0> 
in (wrapper managed-to-native)
System.Reflection.MonoCMethod:InternalInvoke (object,object[])
in <0x0006f> System.Reflection.MonoCMethod:Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)---
End of inner exception stack trace ---

in <0x00104> System.Reflection.MonoCMethod:Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
in <0x00019> System.Reflection.MonoCMethod:Invoke (BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture)
in <0x001d7> System.Activator:CreateInstance (System.Type type,
BindingFlags bindingAttr, System.Reflection.Binder binder,
System.Object[] args, System.Globalization.CultureInfo culture,
System.Object[] activationAttributes)
in <0x00029> System.Activator:CreateInstance (System.Type type,
BindingFlags bindingAttr, System.Reflection.Binder binder,
System.Object[] args, System.Globalization.CultureInfo culture)
in <0x0008f> GLib.ObjectManager:CreateObject (IntPtr raw)
in <0x000c9> GLib.Object:GetObject (IntPtr o, Boolean owned_ref)
in <0xc> GLib.Object:GetObject (IntPtr o)
in <0x00045> Glade.XML:GetWidget (System.String name)
in <0x0015b> Glade.XML:BindFields (System.Object target, System.Type
type)
in <0x00019> Glade.XML:BindFields (System.Object target)
in <0x00016> Glade.XML:Autoconnect (System.Object handler)
in <0x00059> Muine.ErrorDialog:.ctor (System.String s1, System.String
s2)
in <0x0001e> Muine.Global:Error (System.String message)
in <0x0028c> Muine.Global:Main (System.String[] args)






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


Re: [Mono-list] Npgsql error

2005-08-04 Thread Jaroslaw Kowalski

Hi Emil,

Also another tip: you don't need to explicitly set connection etc. to 
null.

Cosider following improvement:

IDbConnection dbcon;
IDbCommand dbcmd;
IDataReader reader;
try {

...

} finally {
 // cleanup, even if error occurs, closing the reader is important because 
while it is open no other reader can be opened

 if (reader!=null) reader.Close();
 if (dbcmd!=null) dbcmd.Close();
 if (dbcon!=null) dbcon.Close();
}


A small tip: Your example is very java-ish. You could reduce the amount of 
code by using C# using() statement which provides automatic cleanup for 
connection, command and reader. I believe that the following is much more 
readable and saves a lot of typing:


=
using (IDbConnection c = new NpgsqlConnection("connectionString"))
{
   c.Open();
   using (IDbCommand cmd = c.CreateCommand())
   {
   cmd.CommandText = "...";
   using (IDataReader reader = cmd.ExecuteReader();
   {
   while (reader.Read())
   {
   }
   }
}
==
--
Jaroslaw Kowalski
http://blog.jkowalski.net/ 


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


Re: [Mono-list] Npgsql error

2005-08-04 Thread Emil Emilov

Cool, a question on that:
What happens if a exception occurs?
I meand close() gets called at the end of the using block, but does it get also 
called when an exception occurs (sort of finally)?
If yes, I'm changing my programming style :)
Another question, how would it look like if you had to catch an exception (i.e. 
to rollback a transaction)?

Thanx :)

Jaroslaw Kowalski wrote:

Hi Emil,

Also another tip: you don't need to explicitly set connection etc. to 
null.

Cosider following improvement:

IDbConnection dbcon;
IDbCommand dbcmd;
IDataReader reader;
try {


...


} finally {
 // cleanup, even if error occurs, closing the reader is important 
because while it is open no other reader can be opened

 if (reader!=null) reader.Close();
 if (dbcmd!=null) dbcmd.Close();
 if (dbcon!=null) dbcon.Close();
}



A small tip: Your example is very java-ish. You could reduce the amount 
of code by using C# using() statement which provides automatic cleanup 
for connection, command and reader. I believe that the following is much 
more readable and saves a lot of typing:


=
using (IDbConnection c = new NpgsqlConnection("connectionString"))
{
   c.Open();
   using (IDbCommand cmd = c.CreateCommand())
   {
   cmd.CommandText = "...";
   using (IDataReader reader = cmd.ExecuteReader();
   {
   while (reader.Read())
   {
   }
   }
}
==


--
Emil R. Emilov
---
mailto:[EMAIL PROTECTED]
http://www.emilov.de
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Re: Mono-list Digest, Vol 4, Issue 5 sender for your account)

2005-08-04 Thread mono-list . 1 . tracyanne
I realised what I was doing wrong. I didn't have the test for null "if
(InputError != null)" in my original code, and as I wasn't at the time
subscribing to the event, it was naturally going to error out.

By the way the code I sent in is pretty much what you'll find on page
309 (Chapter 6 Advanced C# Topics) of Wrox's Professional C#. That's
where i copied it from, for my project.

regards

Tracy Barlow



> Date: Thu, 04 Aug 2005 01:56:52 -0700
> From: Jackson Harper <[EMAIL PROTECTED]>
> Subject: Re: [Mono-list] Problem with Events
> To: mono-list@lists.ximian.com
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain
> 
> On Thu, 2005-08-04 at 17:30 +1000, [EMAIL PROTECTED]
> wrote:
> > Can anyone see anything wrong with this code. It looks to me to be
> > correct syntax for defining and raising an event. It compiles without
> > error, but when I run it I get the following error message
> 
> Nothing is ever subscribing to your event, so it is null when you are
> trying to invoke it. You need something like:
> 
> OnInputError += new InputError (ErrorHandlerFunction); somewhere.
> 
> A few general style comments:
> 
> 1. Normally event handler delegates are named Handler. So
> your InputError delegate would be named InputErrorHandler.
> 
> 2. Normally events names don't start with On. So OnInputError would be
> InputError.
> 
> 3. It's common to wrap the instantiation of an event in a protected
> method named On. So you would have a method that looks like
> this:
> 
> protected void OnInputError (InputErrorEventArgs e)
> {
> if (InputError != null)
> InputError (this, e);
> }
> 
> 
> Cheers,
> Jackson
> 
> 
> > 
> > Unhandled Exception: System.NullReferenceException: Object reference not
> > set to an instance of an object
> > in [0x1] (at /home/tracy/MonoDevelop/TestEvents/Main.cs:22)
> > RaiseAnEvent:Run ()
> > in [0x7] (at /home/tracy/MonoDevelop/TestEvents/Main.cs:11)
> > MainClass:Main (System.String[] args)
> > 
> > I'm using Mono_1.1.8-2.
> > 
> > // project created on 04/08/2005 at 17:17
> > using System;
> > 
> > class MainClass
> > {
> > 
> > public static void Main(string[] args)
> > {
> > RaiseAnEvent RAE = new RaiseAnEvent();
> > RAE.Run();
> > }
> > }
> > 
> > class RaiseAnEvent
> > {
> > public delegate void InputError(object sender, InputErrorEventArgs e);
> > public event InputError OnInputError;
> > 
> > public void Run()
> > {
> > OnInputError(this, new InputErrorEventArgs("DF", "OI"));
> > }
> > 
> > }
> > 
> > 
> > //Class for passing Input Error messages to the application
> > class InputErrorEventArgs : EventArgs
> > {
> > private string errorMessage;
> > private string errorSource;
> > 
> > public string ErrorMessage
> > {
> > get
> > {
> > return errorMessage;
> > }
> > }
> > 
> > public string ErrorSource
> > {
> > get
> > {
> > return errorSource;
> > }
> > }
> > 
> > public InputErrorEventArgs(string Message, string Source) : base()
> > {
> > errorMessage = Message;
> > errorSource = Source;
> > }
> > }
> > ___
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 
> 
> --
> 
> ___
> Mono-list mailing list
> Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 
> End of Mono-list Digest, Vol 4, Issue 5
> ***
> 
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Datawindows

2005-08-04 Thread (Aesux)


Hi,

Perhaps anyone know about the Sybase RAD PowerBuilder, isn't it? Then 
sure you know about the functionality and power of its Datawindow Control.


My question was if there is anything similar usable yet under mono or 
any other GPL development platform, or free at least. Any control or 
widget with similar power to Poweruilder DW?


I know Winforms will have a DataGrid control, but, I don't know about 
its real functionality and power, and I don't know about its timing 
roadmap for use it in production envirnoment.


Thanks in advance,


--

Pere (Aesux)
GNU/Linux 2.6.11-1.1369_FedoraCore4




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


[Mono-list] Gnome and Kde and how the mono project works with them .......

2005-08-04 Thread ted leslie
I have just recently run in to a gtk-sharp issue on
a kde desktop. Went to gnome on the same machine, and all is fine.

It just got me thinking ..
I don't really have a preference to either desk top, i just have been running
KDE for years and years because it probably came up stock on an old distro.

I see obviously direct support for gnome in the mono project, and of course
gtk# appears to be where its at right now for gui with mono apps.

That having been said .. I am about to roll out some mono/gtk# apps
to a pool of about 1000 people working for various fortune 500 companies in
US and fortune 50 companies in Canada.

and I pick the desktop they run, and until now that is KDE.

Since I am doing everything now in mono/gtk# on Linux (for these clients),
(now) and  in time want to have the most optimum desktop environment
for these people,
is it correct to say I should obviously be switching to Gnome
based on the Mono project direction? 

If anyone were to guess..what percentage of mono lead developers/maintainers
use gnome  vs. kde?

As far as I gather, mono/gtk# app. will work fine on both desktops
but with gnome there will be synergy amongst apps (i.e. drag on to)
that KDE will not have? And if this is the case, anyone thought about
that type of support for KDE?

Is there perhaps maybe a bit of hidden politics at work here too?
but I find it odd ... Novell bought SUSE, Novell funds mono (to some extent),
suse distro's default to KDE do they not? (pretty sure 9.0/9.1/9.2 do)?
Since we see Novell funding mono, owning SUSE, and talk of how tight
Gnome and mono may become  what is the outlook/piture of KDE in the future.

Looks like I am switching to Gnome unless my hunch (post) is completely
off base. 

-tl

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


Re: [Mono-list] Gnome and Kde and how the mono project works with them .......

2005-08-04 Thread Harry Holt
Gee, tl, are you sure you want your clients to go through all that
re-training and dealing with the (temporary) productivity loss while
everyone gets acclimated to the new desktop?  Not to mention all the
documentation issues, lots of new configuration file changes, etc.,
that you'll need to deal with.  Why not just stick with KDE?

If you are concerned about being able to integrate your mono
applications smoothly with qt-based interfaces, I would be glad to
offer my services as a technical specialist and programmer to ensure
your users won't have to deal with functionality gaps and kludgy
interfaces to stay with your current environment :-)

[sorry if this is a little off-topic]
Harry Holt


On 8/4/05, ted leslie <[EMAIL PROTECTED]> wrote:
> I have just recently run in to a gtk-sharp issue on
> a kde desktop. Went to gnome on the same machine, and all is fine.
> 
> It just got me thinking ..
> I don't really have a preference to either desk top, i just have been running
> KDE for years and years because it probably came up stock on an old distro.
> 
> I see obviously direct support for gnome in the mono project, and of course
> gtk# appears to be where its at right now for gui with mono apps.
> 
> That having been said .. I am about to roll out some mono/gtk# apps
> to a pool of about 1000 people working for various fortune 500 companies in
> US and fortune 50 companies in Canada.
> 
> and I pick the desktop they run, and until now that is KDE.
> 
> Since I am doing everything now in mono/gtk# on Linux (for these clients),
> (now) and  in time want to have the most optimum desktop environment
> for these people,
> is it correct to say I should obviously be switching to Gnome
> based on the Mono project direction?
> 
> If anyone were to guess..what percentage of mono lead developers/maintainers
> use gnome  vs. kde?
> 
> As far as I gather, mono/gtk# app. will work fine on both desktops
> but with gnome there will be synergy amongst apps (i.e. drag on to)
> that KDE will not have? And if this is the case, anyone thought about
> that type of support for KDE?
> 
> Is there perhaps maybe a bit of hidden politics at work here too?
> but I find it odd ... Novell bought SUSE, Novell funds mono (to some extent),
> suse distro's default to KDE do they not? (pretty sure 9.0/9.1/9.2 do)?
> Since we see Novell funding mono, owning SUSE, and talk of how tight
> Gnome and mono may become  what is the outlook/piture of KDE in the 
> future.
> 
> Looks like I am switching to Gnome unless my hunch (post) is completely
> off base.
> 
> -tl
> 
> ___
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 


-- 

Robbie the Nanobot says:
"Only YOU can prevent gray goo
(NEVER release nanobot assemblers without replication limiting code)"
http://lizardslounge.org
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Gnome and Kde and how the mono project works with them .......

2005-08-04 Thread Jonathan Pryor
On Thu, 2005-08-04 at 22:00 -0400, ted leslie wrote:
> I have just recently run in to a gtk-sharp issue on
> a kde desktop. Went to gnome on the same machine, and all is fine.

It would be useful to know what the issue is.  The goal is to allow
desktop-agnostic applications, by using freedesktop.org standards when
possible.  (This isn't always possible, such as with theme changes and
file & print dialogs, but the apps should work properly, even if they
don't form a coherent whole...)

> Since I am doing everything now in mono/gtk# on Linux (for these clients),
> (now) and  in time want to have the most optimum desktop environment
> for these people,
> is it correct to say I should obviously be switching to Gnome
> based on the Mono project direction? 

As Harry Holt mentioned, you should choose whichever environment is best
suited for your users.  Re-training them may not be cost effective.

Plus, it's always possible that someone will write a Qt# binding layer
to allow better KDE interop.

> If anyone were to guess..what percentage of mono lead developers/maintainers
> use gnome  vs. kde?

100% Gnome, AFAIK (though it would help to define "lead developers").

However, it should be noted that most of mono doesn't depend on Gnome or
KDE -- XML, File I/O, everything that isn't GUI-related is completely
desktop agnostic, so it doesn't matter that lupus (JIT guy
extraordinaire) is running Gnome or FLTK or FluxBox, as the JIT doesn't
change on any of those.

With that being said, all Mono-related Novell-funded resources are going
into Gtk# and System.Windows.Forms, not Qt#.  (Which isn't to say that
KDE isn't getting any resources from Novell, just no resources that are
Mono-related, from what I've seen.)

> As far as I gather, mono/gtk# app. will work fine on both desktops
> but with gnome there will be synergy amongst apps (i.e. drag on to)
> that KDE will not have? And if this is the case, anyone thought about
> that type of support for KDE?

Drag-and-drop should work.  Copy/paste should work.  If they don't work,
then someone isn't adhering to the relevant freedesktop.org standards.

What will differ?  Themes, dialog boxes, HIG conventions (Mac-style
[Cancel][Save] button layout vs. Windows [OK][Cancel] button layout),
and more.

Will those differences matter?  It depends on the training your users
receive.  For example, Microsoft Office tends to have different widgets
and conventions than every other Windows app, yet it does very well. :-)

Training can make up for a lot.  Don't underestimate its importance.

Don't underestimate the harm of Change for Changes sake, either.  Many
users don't like change.

> Is there perhaps maybe a bit of hidden politics at work here too?
> but I find it odd ... Novell bought SUSE, Novell funds mono (to some extent),
> suse distro's default to KDE do they not? (pretty sure 9.0/9.1/9.2 do)?

The missing piece is that Novell bought Ximian, which originally
developed Mono and is a big Gnome developer.

>From the outside, Novell seems to be supporting both Gnome and KDE, but
as far as Mono is concerned Gnome is getting all the support.

> Since we see Novell funding mono, owning SUSE, and talk of how tight
> Gnome and mono may become  what is the outlook/piture of KDE in the 
> future.

You'd have to ask the KDE developers that, and I'm sure they feel the
future of KDE is bright.  Whether they see Mono in their future is
another matter, and whether Mono is part of Gnome's future will cause
flame wars for years to come. :-)

 - Jon


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


Re: [Mono-list] Npgsql error

2005-08-04 Thread Jaroslaw Kowalski

Cool, a question on that:
What happens if a exception occurs?
I meand close() gets called at the end of the using block, but does it get 
also called when an exception occurs (sort of finally)?

If yes, I'm changing my programming style :)
Another question, how would it look like if you had to catch an exception 
(i.e. to rollback a transaction)?


The following code:


using (A a = new A())
{
   code
};


Is equivalent to:

===
A a = null;

try
{
   a = new A();
   /// code
}
finally
{
   if (a != null) ((IDisposable)a).Dispose();
}
===

It's the C# compiler that translates every using() to something like the 
above code. The IDisposable.Dispose method on data providers automatically 
rolls back any open and uncommitted transactions so you don't need to do 
explicit rollbacks.


BTW. I've seen many (MS and other) examples where they don't call Dispose 
the IDbCommand object, even though it implements IDisposable, I'm not sure 
whether it leads to potential resource leaks or not.


--
Jaroslaw Kowalski
http://blog.jkowalski.net/

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


[Mono-list] Datawindows

2005-08-04 Thread mono-list . 1 . tracyanne
I've been Working on a Data Bound DataGrid that is based on Gtk# Widgets
(Scrolled Window, TreeView, ListStore, Cellrenderer). It uses the
WinForms DataGrid paradigm for for consuming Data providers, it's a work
in progress (although it is sufficiently useful for my needs as it is).
You are welcome to the code for it.

I will be developing other DataBound Controls as I go.

Regards

Tracy Barlow

> Date: Fri, 05 Aug 2005 01:01:26 +0200
> From: "(Aesux)" <[EMAIL PROTECTED]>
> Subject: [Mono-list] Datawindows
> To: mono-list@lists.ximian.com
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-15; format=flowed
> 
> 
> Hi,
> 
> Perhaps anyone know about the Sybase RAD PowerBuilder, isn't it? Then 
> sure you know about the functionality and power of its Datawindow Control.
> 
> My question was if there is anything similar usable yet under mono or 
> any other GPL development platform, or free at least. Any control or 
> widget with similar power to Poweruilder DW?
> 
> I know Winforms will have a DataGrid control, but, I don't know about 
> its real functionality and power, and I don't know about its timing 
> roadmap for use it in production envirnoment.
> 
> Thanks in advance,
> 
> 
> -- 
> 
> Pere (Aesux)
> GNU/Linux 2.6.11-1.1369_FedoraCore4

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


Re: [Mono-list] Sqlite version

2005-08-04 Thread Julien Sobrier

Chris Turchin a écrit :

It works with 2.8.16 and 3.1.3 at any rate. I have tested both.

Regards,

--chris


With what version of Mono? I've tried Sqlite 3.0.8 and 
Mono.Data.SqliteClient doesn't recognize the database format.


Thank you
Julien

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


Re: [Mono-list] Sqlite version

2005-08-04 Thread Thomas Zoechling

You have to specify the Version in the Connectionstring:

   string connectionString = "Version=3,URI=file:SqliteTest.db";



Julien Sobrier wrote:


Chris Turchin a écrit :


It works with 2.8.16 and 3.1.3 at any rate. I have tested both.

Regards,

--chris



With what version of Mono? I've tried Sqlite 3.0.8 and 
Mono.Data.SqliteClient doesn't recognize the database format.


Thank you
Julien

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




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