<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8413546037263429187</id><updated>2011-04-21T22:32:51.286-07:00</updated><title type='text'>Changing The World One Bit At A Time</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mattmcaughan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8413546037263429187/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mattmcaughan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Matt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8413546037263429187.post-4352688945172026666</id><published>2008-09-02T18:23:00.000-07:00</published><updated>2008-09-05T11:25:25.684-07:00</updated><title type='text'>OpenJMS From C#</title><content type='html'>One of the problems many enteprise programmers struggle with, and see as a barrier to begin using C# on Linux at work, is the lack of support for MSMQ and messaging. The good news is mature messaging exists in Java in the form of JMS implementations. With packages like IKVM, C# coders can take advantage of these Java messaging technologies. &lt;br /&gt;&lt;br /&gt;Starting from a minimal install of Ubuntu 8.04.1, outlined below are the steps required to get a basic JMS installation running under OpenJMS and IKVM.&lt;br /&gt;&lt;br /&gt;Install the Mono runtime and compiler tools for C# 2.0&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;sudo apt-get install mono-runtime mono-gmcs mono-gac mono-jit mono-utils cli-common &lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Download and Unpack IKVM&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;wget http://downloads.sourceforge.net/ikvm/ikvmbin-0.36.0.11.zip&lt;br /&gt;unzip ikvmbin-0.36.0.11.zip&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The IKVM.NET needs the 1.0 runtime&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;sudo apt-get install libmonosystem1.0-cil &lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Download and Unpack JMS&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;wget http://prdownloads.sourceforge.net/openjms/openjms-0.7.7-beta-1.tar.gz&lt;br /&gt;tar -xzvf openjms-0.7.7-beta-1.tar.gz&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now the interesting part, converting OpenJMS Java byte code in to CIL instructions for the Mono C# runtime. This will convert all of the jar files in the openjms lib directory in to one assembly openjms-0.7.7-beta-1.dll to be included in any C# projects. There will be some errors spit out about MANIFEST, PROPERTY, and missing classes. These are not an issue.&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;cd openjms-0.7.7-beta-1/lib&lt;br /&gt;mono ~/bin/ikvm-0.36.0.11/bin/ikvmc.exe -nowarn 0109 \&lt;br /&gt;-nostacktraceinfo -out:openjms-0.7.7-beta-1.dll \&lt;br /&gt;-r:/home/vmuser/bin/ikvm-0.36.0.11/bin/IKVM.OpenJDK.ClassLibrary.dll \&lt;br /&gt;*.jar&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now a quick pause to get OpenJMS running under Java. To demonstrate any C# examples will require a working OpenJMS queue to send to. &lt;br /&gt;&lt;br /&gt;If one is not already installed, a Java runtime environment is needed. OpenJDK from Sun will do and is in the Ubuntu package repositories.&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;sudo apt-get install openjdk-6-jdk&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Then make sure to set the JAVA_HOME environmental variable in the .bashrc file&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;export JAVA_HOME=/usr/lib/jvm/java-6-openjdk&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The OpenJMS server comes with a few queues and topics already configured. To start the service run startup.sh script from the openjms-0.7.7-beta-1/bin directory. To configure other queues, topics and subscriptions edit the file ~/bin/openjms-0.7.7-beta-1/config/openjms.xml. &lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;cd ~/bin/openjms-0.7.7-beta-1/bin&lt;br /&gt;./startup.sh &amp;&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Ok, back to the code example. Below is the source to a simple C# console application that can send a text based message to queue1, a default queue in the OpenJMS server. Place this in a file called Sender.cs and compile. Notice how the Java namespaces and data types are callable from C#. Amazing stuff! &lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;using System;&lt;br /&gt;using javax.jms;   &lt;br /&gt;using javax.naming;&lt;br /&gt;&lt;br /&gt;namespace BlogDemo {&lt;br /&gt;&lt;br /&gt;   public class Sender {&lt;br /&gt;      &lt;br /&gt;      public static void Main(string[] args) {&lt;br /&gt; &lt;br /&gt;         Context context = null;&lt;br /&gt;         ConnectionFactory factory = null;&lt;br /&gt;         Connection connection = null; &lt;br /&gt;         String destinationName = null;&lt;br /&gt;         Destination destination = null;      &lt;br /&gt;         Session session = null;&lt;br /&gt;         MessageProducer sender = null;&lt;br /&gt;         int count = 1; &lt;br /&gt;        &lt;br /&gt;         if(args.Length &lt; 1 || args.Length &gt; 2) {&lt;br /&gt;            System.Console.WriteLine("usage: Sender &lt;dest&gt; [count]");&lt;br /&gt;            return;     &lt;br /&gt;         } &lt;br /&gt;&lt;br /&gt;         destinationName = args[0];&lt;br /&gt;         if(args.Length == 2) {&lt;br /&gt;           count = Int32.Parse(args[1]);&lt;br /&gt;         }&lt;br /&gt;&lt;br /&gt;         try {&lt;br /&gt;&lt;br /&gt;            java.util.Hashtable env = new java.util.Hashtable();&lt;br /&gt;            env.put(Context.__Fields.INITIAL_CONTEXT_FACTORY, &lt;br /&gt;                    "org.exolab.jms.jndi.InitialContextFactory");&lt;br /&gt;            env.put(Context.__Fields.PROVIDER_URL, &lt;br /&gt;                    "tcp://localhost:3035");&lt;br /&gt;         &lt;br /&gt;            context = new InitialContext(env);&lt;br /&gt;            factory = (ConnectionFactory) context.lookup("ConnectionFactory");&lt;br /&gt;            destination = (Destination) context.lookup(destinationName); &lt;br /&gt;            connection = factory.createConnection();&lt;br /&gt;            session = connection.createSession(false, Session.__Fields.AUTO_ACKNOWLEDGE);&lt;br /&gt;            sender = session.createProducer(destination);&lt;br /&gt;            connection.start();&lt;br /&gt;             &lt;br /&gt;            for(int i = 0; i &lt; count; i++) {&lt;br /&gt;               TextMessage message = session.createTextMessage();&lt;br /&gt;               message.setText("Hello " + (i + 1));&lt;br /&gt;               sender.send(message);&lt;br /&gt;               System.Console.WriteLine("Sent: " + message.getText());               &lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;         } catch (JMSException ex) {&lt;br /&gt;            ex.printStackTrace();&lt;br /&gt;         } catch (NamingException ex) {&lt;br /&gt;            ex.printStackTrace();&lt;br /&gt;         } finally {&lt;br /&gt;             &lt;br /&gt;            if(context != null) {&lt;br /&gt;               try {&lt;br /&gt;                  context.close();&lt;br /&gt;               } catch (NamingException ex) {&lt;br /&gt;                  ex.printStackTrace();&lt;br /&gt;               }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            if(connection != null) {&lt;br /&gt;               try {&lt;br /&gt;                  connection.close();&lt;br /&gt;               } catch (JMSException ex) {&lt;br /&gt;                  ex.printStackTrace();&lt;br /&gt;               }&lt;br /&gt;            }&lt;br /&gt;         }&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Move the dependency assemblies in to place, then compile it with gmcs.&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;cp ~/bin/openjms-0.7.7-beta-1/lib/openjms-0.7.7-beta-1.dll ~/bin&lt;br /&gt;cp ~/bin/ikvm-0.36.0.11/bin/IKVM.OpenJDK.ClassLibrary.dll ~/bin&lt;br /&gt;cp ~/bin/ikvm-0.36.0.11/bin/IKVM.Runtime.dll ~/bin&lt;br /&gt;&lt;br /&gt;gmcs -target:exe -out:~/bin/Sender.exe \&lt;br /&gt; -r:IKVM.OpenJDK.ClassLibrary.dll -r:openjms-0.7.7-beta-1.dll \&lt;br /&gt; Sender.cs&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Assuming that OpenJMS is running, submit 100 messages to queue name queue1&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;mono ./Sender.exe queue1 100&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8413546037263429187-4352688945172026666?l=mattmcaughan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattmcaughan.blogspot.com/feeds/4352688945172026666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8413546037263429187&amp;postID=4352688945172026666' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8413546037263429187/posts/default/4352688945172026666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8413546037263429187/posts/default/4352688945172026666'/><link rel='alternate' type='text/html' href='http://mattmcaughan.blogspot.com/2008/09/openjms-from-c.html' title='OpenJMS From C#'/><author><name>Matt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8413546037263429187.post-2219468057947484431</id><published>2008-09-01T12:27:00.000-07:00</published><updated>2008-09-01T14:04:33.299-07:00</updated><title type='text'>Ubutu 8.04.1 Install Notes</title><content type='html'>Constantly having to install Ubuntu at home, for co-workers, or family members. This is a consolidated place to keep and share notes with others. The goal of this mini-guide, is to achieve a minimal Ubuntu installation, with XFCE4 as the window manager. &lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Download the CD from the web site for the server edition, it installs no window manager by default, which will be done later our way&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;mkdir -p /home/vmuser/downloads/iso&lt;br /&gt;cd /home/vmuser/downloads/iso&lt;br /&gt;wget http://releases.ubuntu.com/hardy/ubuntu-8.04.1-server-i386.iso&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Perform a minimal install, no MySQL, Apache, etc...&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Remove apparmor, basically SELinux for Ubuntu&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;sudo /etc/init.d/apparmor stop&lt;br /&gt;sudo update-rc.d -f apparmor remove&lt;br /&gt;sudo apt-get remove apparmor apparmor-utils&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Install OpenSSH for remote access&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;sudo apt-get install openssh-server ssh&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Install XFCE4, with a couple of useful tools&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;sudo apt-get install xfce4 xserver-xorg xfonts-base xfce4-terminal mousepad&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Install Firefox&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;sudo apt-get install firefox&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Install VMware Server 1.0.6&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;sudo apt-get install libxtst6&lt;br /&gt;mkdir -p /home/vmuser/src&lt;br /&gt;cd /home/vmuser/src&lt;br /&gt;tar -xzvf /home/vmuser/downloads/VMware-server-1.0.6-91891.tar.gz&lt;br /&gt;cd vmware-server-distrib&lt;br /&gt;sudo ./vmware-install.pl&lt;br /&gt;cd /usr/lib/vmware/lib&lt;br /&gt;mv libpng12.so.0/libpng12.so.0 libpng12.so.0/libpng12.so.0.bak&lt;br /&gt;sudo ln -sf /usr/lib/libpng12.so.0 libpng12.so.0/libpng12.so.0&lt;br /&gt;mv libgcc_s.so.1/libgcc_s.so.1 libgcc_s.so.1/libgcc_s.so.1.bak&lt;br /&gt;sudo ln -sf /usr/lib/libgcc_s.so.1 libgcc_s.so.1/libgcc_s.so.1&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8413546037263429187-2219468057947484431?l=mattmcaughan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattmcaughan.blogspot.com/feeds/2219468057947484431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8413546037263429187&amp;postID=2219468057947484431' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8413546037263429187/posts/default/2219468057947484431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8413546037263429187/posts/default/2219468057947484431'/><link rel='alternate' type='text/html' href='http://mattmcaughan.blogspot.com/2008/09/ubutu-8041-install-notes.html' title='Ubutu 8.04.1 Install Notes'/><author><name>Matt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
