Infragistics JQuery controls

Mono 3.0 released. New improvements include asynchronous programming, Mac OS X and iOS support, ASP.NET MVC 4, Entity Framework and more

Mono 3.0 released On 10/22/2012 Miguel de Icaza blogged about the latest release of the Mono .NET project.  As you may already know, the Mono project is an open source port of the Microsoft .NET framework which allows cross platform support for .NET applications with support for such systems as Linux and Mac OS X / iOS. The Mono 3.0 release includes improved support for asynchronous programming which was introduced in .NET 4.5.  These improvements help developers to create fast, responsive applications.  The ability to keep the user interface of an application responsive while executing time consuming tasks is extremely important as applications are moving to smart phones and tablets.  The release also includes improvements that will strengthen Mono's support for Mac OS X and iOS development. Developers can also look forward to added support to Microsoft's open sourced stacks which includes technologies like: ASP.NET MVC 4, ASP.NET WebPages, Entity Framework, Razor View Engine, and System.Json. You can read about other improvements to the garbage collector and more here: Miguel de Icaza's blog post http://tirania.org/blog/archive/2012/Oct-22.html The offical Mono project's release notes http://www.mono-project.com/Release_Notes_Mono_3.0  kick it on DotNetKicks.com        


Learning ILAsm, the backbone of .NET

Who cares about ILAsm or x86 assembly language anyway? I'm sure a lot of you are wondering why anyone would care about learning ILAsm.  It's not like you ever see it unless you disassemble an application.  ILasm or MSIL is the human readable translation of Microsoft .NET intermediate language.  ILAsm is a lot like classic assembly language.  It is a low level programming language that allows you to write programs one instruction at a time with a very minimal syntax.  I've explained the benefits of learning assembly language in my previous post, Why Learn Assembly Language.  In a nutshell, if you learn .NET at the low level of IL, you will have an understanding of what makes any .NET language tick.  You will have the knowledge to disassemble any .NET binary and debug your software at the instruction level.   This post is my first tutorial on writing code in ILAsm.  I hope you'll join me and become proficient in this language of kings.  You will have an edge over the competition and it will change the way you look at high level coding.  Enough talking, let us code! How to compile ILasm If you are a .NET developer, you most likely have an ILasm compiler on your computer which by the way is appropriately named ILasm.exe.  Simply launch the Visual Studio Command Prompt, navigate to the folder that you create your IL files and issue the following command. ilasm.exe is fine if you like to write code in notepad and drop out to a command prompt to write your code.  I myself prefer an IDE.  Visual Studio is an amazing IDE but for some reason the people over at Microsoft didn't see it fit to add support for ILasm into the product.  Never fear!  There is a free, open source alternative that is nearly identical to Visual Studio and it allows you to create and compile IL projects with syntax highlighting that works on Linux, Windows, and Mac OSX!  What is this application you ask? MonoDevelop   "Hello... World?" I know, I know, it's a tired, worn out cliche but far be it from me to interrupt the order of the programming gods and illustrate a programming language without starting with the infamous "Hello World!" example. //import the mscorlib assembly to give us access to Console and other basic classes .assembly extern mscorlib{} //define our assembly .assembly HelloAssembly { //define the version of this assembly .ver 1:0:0:0 } //define the executable module .module helloworld.exe //defin our main method .method static void main() cil managed { //set up the stack. In ILAsm, all values are placed on the stack and then manipulated. //here we will allocate memory for one value to be on the stack at a given time .maxstack 1 //define the main entry point to the application .entrypoint //load the emphamis phrase on the stack ldstr "Hello ILAsm!" //print the string from the stack to the console call void [mscorlib]System.Console::WriteLine(string) //return to end the program ret } If you have never seen asm or ILasm, I can imagine how strange this code snippet may look.  As I've stated before, ILasm is a very cryptic, low level language.  Let's breakdown the application. We start by importing the mscorlib library which contains much of the base .NET classes.  As the comments state, this library gives us access to the System.Console object.   Next, we define the assembly for our program.  All .NET executables are called assemblies.  Here we name our assembly as well as set a version number.  After we define our assembly, we define the executable module.  This is required in any ILasm application.   Now it's time to define our main method that performs the loading and printing of the string.  We start by defining the maxstack, that is, the maximum number of values that can be held in memory at a given time.  In ILAsm, you push values on the stack, perform operations on the values or use them as parameters to methods.  Since we have a maxstack of one, that means we can have only one piece of data to work with at any given time.  We use ldstr to load a string onto the stack.  If we were to load another string on the stack directly after the first ldstr call, the application will simply push the first value out of memory and the new string will be available to access. Finally, we call the WriteLine method on the System.Console object and we tell it to use the current string on the stack as it's input source.   So now you can load a string onto the stack and display it.  It's pretty interesting, although very limited as well.  How about we work with more than one value?  Let's try adding two numbers! Sum it up //reference to mscorlib .assembly extern mscorlib {} //define our assembly .assembly MiniCalculator { //the assembly version number .ver 1:0:0:0 } //create the required module .module MiniCalculator.exe //define our main method .method static void main() cil managed { //we plan to work with two integers this time .maxstack 2 //the main entry point to our application .entrypoint //load a string of instructions on the stack ldstr "OK. Class is in session. Who can tell the class what is the sum of 2 + 2? That's right, the answer is " //display the instructions to the user call void [mscorlib]System.Console::Write (string) //put the number 2 on the stack. Currently the previously loaded string, and the //number 2 are both on the stack. ldc.i4 2 //when we move another integer to the stack, this pushes the string off //now we have two instances of the number 2 on the stack ldc.i4 2 //add will add the two numbers on the stack and store the result add //lets tell the computer to look for an int on the stack and print it to the console call void [mscorlib]System.Console::Write (int32) //return to exit the application ret } We start the application as before by importing mscorlib, defining our assembly and module, and creating the method to perform our work.  We then load a string on the stack and use Console's WriteLine method to display the string.  We then load two integers onto the stack, pushing the string off of the stack.  We call add whichs adds the two integers and stores the result on the stack.  We use Console's WriteLine once again to display the answer. This concludes part one of my ILasm tutorial series. Please check back soon for my next installment in which we will tackle data types, loops, and classes! Until next time.. ~/Buddy James kick it on DotNetKicks.com  


How to configure mono 2.10, .NET 4.0 and ASP.NET MVC to run on an Ubuntu Apache web server.

The challenge... As per my previous post [post title here], I wanted to configure mono on my recently installed Ubuntu machine.  Specifically, I wanted to be able to use the latest .NET functionality as well as ASP.NET MVC integration with Apache.  In this post, I plan to provide the steps and resources in which I took to accomplish my goals. Let's start with the Ubuntu machine.... The Ubuntu desktop specifications The machine in which I've installed Ubuntu is an OLD machine that I had laying around the house.  My Android has more horsepower than this old Dell, however, Ubuntu 10.4 seems to operate at a perfectly acceptable capacity.  I plan to "refresh" my Linux skills and look for spare RAM to add to this machine before I upgrade to Ubuntu 12.04.  The recommended minimum requirements for Ubuntu 12.04 are as follows; [For installing] The minimum memory requirement for Ubuntu 12.04 is 384 MB of memory for Ubuntu Desktop. Note that some of your system's memory may be unavailable due to being used by the graphics card. If your computer has only the minimum amount of memory, the installation process will take longer than normal; however, it will complete successfully, and the system will perform adequately once installed. [For upgrading] While the minimum memory requirement for 32bit is 384 MB, a minimum of 512 MB is needed for the 64bit installation. On systems with only the bare minimum amount of memory, it is also strongly recommended to use the "Install Ubuntu" option as it uses less memory than the full live session. Ubuntu Desktop System Requirements for 12.04 LTS What's with all the aPtitude? As much as I love aptitude, I'm quite annoyed by the time it takes for source repositories to list packages as "stable".  I understand that this has nothing to do with the package manager itself and that the Ubuntu version carries more of the blame, even so, I wanted to simply apt-get install mono-complete, I would be stuck with mono 2.4.  Since I wanted to use   some newer functionality, I had some planning to do.  The overall process went a little something like this; Find a bash script that compiles all of the mono packages that I needed to get the job done. Execute the script and watch some T.V while I waited for the massive compile to complete. Move the Apache mono module configuration into the "available modules" folder to enable mod-mono under Apache. I needed to create an Apache virtual host configuration file with the mod-mono specific settings that are required. I had to prepare my file system to serve my ASP.NET applications (c:\inetpub\wwwroot\ for all you Windows natives). I needed to provide a simple solution to publish ASP.NET applications from Visual Studio on my Windows 7 machine to my Ubuntu web server. Finally I needed to restart apache2, publish a web application and test the fruits of my labor. BASHing mono into shape As I stated before, I wasn't going to apt-get install my way into the wonderful world of mono with all of the specific details that my target installation required.  Luckily, I found this post http://www.integratedwebsystems.com/2011/02/mono-2-10-install-script-for-ubuntu-fedora/  in which someone created a BASH script that would download all of the specific packages and compile the sources to produce the exact environment that I was after.  I'm sure  if I had used a modern PC it wouldn't have taken so long, never the less, the compilation was quite a time consuming task indeed!  The script was authored very well in that if there was an error detected, the script would break execution to make it easier for you to find what went wrong.  Fortunately, my compilation completed without a hitch!   Enabling mod_mono in Apache The BASH script had installed created the mod_mono.conf configuration file but I had to find it and copy it to the enabled modules directory so that Apache would recognize it. Here is the command that I executed from a terminal to copy the file to the proper location sudo cp mod_mono.conf /etc/apache2/mods-enabled Of course I had to find the configuration file before I could copy it sudo find -name mod_mono.conf With the configuration file in place, I restarted Apache to make sure all was well sudo service apache2 restart The service restarted successfully so I felt OK with what had been done so far. Creating the mono virtual host configuration file There is a webiste that will require you to fill in some input fields and click a button to generate this file the virtual host configuration with mono specific settings.  I merely had to modify one line of the file. The website is http://go-mono.com/config-mod-mono/ I simply used localhost as my server name and it generated the physical path of /srv/www/localhost. I used nano to edit the file and I modified the MonoDirectory line to point to the correct path of my mono_server4 binary's path which I was able to search and find to be /opt/mono-2.10/bin . Creating wwwroot, or /svr/www ... It was now time to prepare my file system to setup a home for my site hosting.  This basically involved creating some folders, setting permissions and creating an alias link or two. Create the directories sudo mkdir /srv/www sudo mkdir /srv/www/localhost Assign a root group to the folder sudo chown root:www-data /srv/www/localhost -R Change the directory attributes sudo chmod 775 /srv/www/localhost -R I then moved the virtual host site generated file to the appropriate path mv ~/Desktop/localhost.conf /etc/apache2/sites-available I then created a symbol link so I could refer to the vhost configuration file with leading zeros (Apache loads the configurations alphabetically). sudo ln -s ../sites-available/localhost.conf "000-localhost.conf" I restarted Apache, fired up firefox, browsed http://localhost and that's all it took...  I hope you enjoyed reading this article and I hope this helps someone configure ASP.NET MVC under Apache on Ubuntu using mono.  Until next time.. ~/Buddy James   kick it on DotNetKicks.com  


The mono project. The state of .NET on non Microsoft platforms.

Ubuntu too I've recently decided that I wanted to install linux on an older PC in my home.  Many moons ago, before most linux distributions could auto detect and configure your hardware, I had cut my teeth on Debian.  I've had a soft spot ever since for the aptitude package manager.  Naturally I wanted to use a distro that was based on Debian so I went with Ubuntu.  The Ubuntu CD that I have is dated (version 8.04) so I did some research and decided to upgrade to version 10.04.  I fired up a terminal and executed 'sudo do-release-upgrade -d' to apply an upgrade to my system. Watching LED dry The upgrade was a pretty long process, and I found myself watching the terminal window as all of the packages were added, upgraded, and removed.  As I watched, I noticed that quite to my surprise, there were many packages that relied on mono assemblies.  As a .NET consultant, of course this had sparked my curiosity.  I've followed the mono project, from a distance, for a while now but I knew that there was a following, however, I had no idea that mono had made it's way into the heart of the packages that make up an Ubuntu installation.   The current state of things I've decided to take a 1,000 feet view of the current state of the mono project.  As stated by the official website; The easiest way to describe what Mono currently supports is:Everything in .NET 4.0 except WPF, EntityFramework and WF, limited WCF.   That's quite a lot of functionality!  I had no idea that there had been so much work done on the project.  I can write a .NET 4.0 application, an ASP.NET MVC 2 web application and host it on a linux based Apache server.  Well at least that's what the website has told me. Perhaps I'll try to accomplish just that and write about how smooth the whole process actually is. Here are some links for those who are interested. The official mono homepage http://www.mono-project.com/Main_Page The mono project compatability http://www.mono-project.com/Compatibility The mono migration analyzer MoMA http://www.mono-project.com/MoMA Design apps for your iPhone or iPad using monoTouch http://xamarin.com/monotouch Design apps for your android device using mono for android http://xamarin.com/monoforandroid I hope you found something of interest.  Until next time.. ~/Buddy James   kick it on DotNetKicks.com  


About the author

My name is Buddy James.  I'm a Microsoft Certified Solutions Developer from the Nashville, TN area.  I'm a Software Engineer, an author, a blogger (http://www.refactorthis.net), a mentor, a thought leader, a technologist, a data scientist, and a husband.  I enjoy working with design patterns, data mining, c#, WPF, Silverlight, WinRT, XAML, ASP.NET, python, CouchDB, RavenDB, Hadoop, Android(MonoDroid), iOS (MonoTouch), and Machine Learning. I love technology and I love to develop software, collect data, analyze the data, and learn from the data.  When I'm not coding,  I'm determined to make a difference in the world by using data and machine learning techniques. (follow me at @budbjames).  

Related links

Month List