Saturday, July 21, 2007
Solved! "exePath must be specified when not running inside a stand alone exe" Embedding Mono
Currently i'm Embedding Mono in XChat, but it was giving me errors trying to get values from Configuration File
System.ArgumentException: exePath must be specified when not running inside a stand alone exe.
at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000]
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000]
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000]
The Solution is simple: pass the assembly path to mono exec in the first argument for the function mono_jit_exec.
char * boot_assembly = "myAssembly.exe"
...
MonoDomain * dom = mono_jit_init(boot_assembly);
MonoAssembly * masm = mono_domain_assembly_open(dom,boot_assembly);
char *argv [1];
[0] = boot_assembly;
[1] = NULL;
mono_jit_exec (dom, masm, 1,argv);
How to MD5 in .NET & Mono
Simple code:
using System.Security.Cryptography;
//...
private readonly static MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
public static string CreatePasswordMD5(string password)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(password);
bs = md5.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
return s.ToString();
}
//
Usage:
Console.WriteLine(CreatePasswordMD5("p@ssw0rk!"));
Tuesday, July 10, 2007
X-Chat Mono
I have published x-chat-mono
OpenSource API, with this API you can build Managed Plugins compiled with Mono.
Featuring:
- Register and Receive plugin commands
- Send IRC Commands
- Send Prin
Wednesday, July 4, 2007
How to Install Moonlight & Desklets Step by Step UPDATED
(Last Update: Agost 2, 2007; moon SVN revision: 83286)
This guide describes the common installation process for Moonlight, you can get the original one here.
Requirements:
- Mono 1.2.4
- ffmpeg Sources
- Moonlight Sources
- Olive
- Mono Libraries
- Mozilla Development Libraries
- Beryl or Compiz
$svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
$cd ffmpeg
$./configure --prefix=/usr/local
$sudo make install
4. Install additional packages +and dependencies:
- libnspr-dev
- libnss-dev
- firefox-dev
- libmono-system-messaging2.0-cil
- libcairo2-dev
- libgtk2.0-dev
- libasound2-dev
- mono-devel
- libmono-cairo2.0-cil
$svn co svn://anonsvn.mono-project.com/source/trunk/olive olive
$cd olive
$./configure --prefix=/usr
$make
$sudo make install
If you want to check your Olive configuration you can check this using Mono gacutil tool:
$gacutil -l agclr
The output should be:
The following assemblies are installed into the GAC:
agclr, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Number of items = 1
6. Download and Configure Moonlight:
$svn co svn://anonsvn.mono-project.com/source/trunk/moon moon
$cd moon
$./autogen.sh --prefix=/usr
$sudo make install
7. Enable Desktop Effects: Go to System->Preferences->Desktop Effects and enable it, beryl or compiz should work too.
Now you can test the Moonlight Installation running the following command in a terminal:
$mopen
Moolight Launcher should run and show the following information:
Usage is: mopen [args] [file.xaml|dirname]
Arguments are:
--fixed Disable window resizing
--geometry WxH Overrides the geometry to be W x H pixels
--host NAME Specifies that this file should be loaded in host NAME
--transparent Transparent toplevel
--desklet Remove window decoration for desklets use
Even when you can read the message, you need to run a Moonlight Enabled Application to ensure the installation process was successful:
Example: runing glassyclock desklet:
$cd desklet
$make
$cd glassyclock
$make
$mopen --desklet default.xaml
If you can see the beautiful clock, Congratulations!, if you see a black an ugly clock then you have no Desktop Effects/Beryl/Compiz Enabled.
Monday, July 2, 2007
MonoDevelop 0.14 Short Demo
He comenzado a crear unos videos demos de MonoDevelop 0.14 y este es el primero. Aun estoy investigando como agregarle mas resolucion a los videos se ven bastante borrosos.
Ejemplo de Evolution#
Para quien necesite agregar un contacto a Evolution con Evolution#, el codigo es el siguiente.
using System;
using Evolution;
namespace myEvolutionAutomation
{
class MainClass
{
public static void Main(string[] args)
{
Evolution.Book b = new Book();
Contact contact = new Contact();
contact.BlogUrl = "http://johansoft.blogspot.com";
contact.FullName = "ThePumpkin";
contact.Title = "Mr";
Console.WriteLine("Can Open Book?= {0}",b.Open(true));
Console.WriteLine("Can Add contact ={0}",b.AddContact(contact));
b.CommitContact(contact);
}
}
}
Sunday, July 1, 2007
Subscribe to:
Posts (Atom)