How to setup Fedora Live 15 on Oracle VirtualBox

Standard

For the fall semester 2011 I was lucky enough to pickup a contract at Seneca to teach the ULI101 (UNIX/LINUX, Internet) course in the Diploma programs at the college. One of the weeks included a lecture on using Fedora Live. I decided to show my students how to use virtual box in the labs to use Fedora within a Virtual Machine environment. The infrastructure of Seneca’s computer labs is setup favorably for this way of using Fedora easily. VM’s have also become a standard in large corporate environments to help reduce the total cost of ownership on server hardware and to better utilize CPU cycles, power, and floor space in server rooms.

Below is a step by step guide to setup VirtualBox with the Fedora Live ISO on Windows 7.

Step 1: Download Fedora live cd ISO at:
http://fedoraproject.org/en/download-splash?file=http://download.fedoraproject.org/pub/fedora/linux/releases/16/Live/x86_64/Fedora-16-x86_64-Live-Desktop.iso

Step 2: Install virtual box. (Seneca lab computers already have it included in the image).

Step 3: Run Oracle VM VirtualBox Manager.

VirtualBox Manager

Step 4: Click New to create a new Virtual Machine using the Fedora ISO you downloaded.

Step 5: Click Next on the Create New Virtual Machine wizard window

Step 6: Setup OS

Step 6: Give the VM a Name you can recognize easily like “Fedora Live”, Choose “Linux” from the Operating System list and “Fedora (64 bit)” from the Version list.

Step 7: Allocate RAM for VM

Step 7: Set the memory to the amount of RAM you want to allocate to the VM. The default of 768mb is fine for most needs. Make sure this amount is less than the host machines total ram  minus 2GB to leave 2GB for windows 7 minimum.

Step 8: Create new hard disk

Step 8: Use defaults for Virtual Hard Disk at 8GB space and “create a new hard disk” options, click next.

Step 9: Select VDI option

Step 9: Use defaults for File type of the “virtual disk with VDI”, click next.

Step 10: Dynamically allocated HDD size

Step 10: Use defaults for “Dynamically allocated disk size”, click next.

Step 11: VM file size and location

Step 11: For Virtual disk file location and size you might want to have students put their VDI file on a USB so they can save it and reuse it in other sessions by remounting it. If they are just using it for one session and throwing away the VM each class session and recreating it then the default settings are fine.

Step 12: Press create to create the VM.

Step 13: Start up the VM for the first time

Step 13: Click on the new VM and press start to start it up the first time.

Step 14: Press next to begin, then select the ISO file for Fedora that you downloaded earlier. Press next.

Step 15: Click start to start up the VM.

Running the VM

Notes about using the VM:

When you click inside the VM sometimes the VM hijacks the mouse cursor to the window and wont let it move outside the window. To release it the default key is RIGHT CTRL.

you can map a CD or USB drive from the host machine to the fedora VM so you can access files from the local hosts CD, USB, DVD, or HDD even.

The VM will use whatever amount of RAM you allocated it in the setup from the host. If you set it to use 3GB and the host only has 4GB only 1gb would remain for windows which may cause slow downs or virtual box may not let you start the VM at all if the memory amount is to high that it would starve the host machine.

To close the VM you exit it the same way you would if the OS was running normally with Shutdown from the top right menu. the VM will shutdown and close its window automatically.

You can run the VM in fullscreen mode and it will operate similar to how a remote desktop session would work in windows with a small popup tab at the bottom center of the screen to switch back to windowed mode or close the VM window.

Advertisements

Creating custom JScript for Microsoft Dynamics CRM2011

Standard

I’m in the process of creating some custom JScript code to have some fields on an expense report form auto calculate and to enable one textbox if a certain expense type is selected.

I’ve been at this all day and I have been getting errors along the lines of “Error: Object expected” thrown at me from Dynamics when testing on the form.

It turns out the website I was using an example from used the quote characters “ ” instead of ” “.

It took me close to 4 hours to figure out why my ENTIRE SCRIPT LIBRARY was broken because of this when I was following some online examples exactly.

Yes that’s right my entire script library broke because one function had improper quotes and therefor a field object wasn’t being returned even though the function wasn’t being called it broke every other function in the library.

So word to the wise if you get an Error: Object expected in Dynamics CRM2011 check the following things:

  1. Is your field name spelled EXACTLY right including case? my_fieldname is not the same as my_FieldName
  2. Are there any spaces added by mistake in the name?
  3. Are you using the entity field name or the display name? entity name is correct EX: new_mycustomfield not “My Custom Field Label”
  4. Reduce down your JScript library and check for missing semi colons or other functions that may be broken to isolate the proper broken function it may not be where you think it is.
  5. Finally did you copy paste an example from another website? if so check the quotes to make sure they are the proper double quote character it should be ” “ not “ ”
EX: Xrm.Page.getAttribute("new_mycustomfield"); not Xrm.Page.getAttribute(new_mycustomfield);

As a side note always remember to add code to the onSave event handler for the form as well as the onChange handler for a field if you are using read only fields you need to forceSubmit those values to save them.

EX: Xrm.Page.getAttribute("new_mycustomfield").setSubmitMode("always");

Building a commercial game using Processing.js

Standard

Today I gave a presentation at FSOSS 2011 here at Seneca College on how we went about building a commercial game using Processing.js.

The presentation covered our development story. It covered what our industry partner does and why they wanted to change from Flash to Processing.js, our development story, and a demo of the game in its beta state.

I created the presentation using the deck.js library which allows you to create slide show presentations in a web browser using HTML and JavaScript. What’s cool about this is that it allows you to do things like put a HTML 5 canvas, audio, or video element in your slide.

With this library I was able to have a live demo of the game in a slide or embed other HTML 5 content.

Here is the video of our talk.

[tube]http://www.youtube.com/watch?v=-i5xSVJEbS8[/tube]

Building a 680 Megapixel image with Processing

Standard

For the last 4 months I have been working on a Game project with Processing and Processing.js at the Centre for Development of open Technology here at Seneca College.

This game is designed to help teach the basics of Mendelian Genetics to high school aged students and above.  The concept is to collect and breed different dragons and learn how the genetics of it all works because the offspring are created based on the genetics of the parents.

One of the challenges I ran into when building this game was figuring out a way to handle all the different combinations of dragons.  The dragons have 9 genetic traits that differentiate them from one another and each trait has two or three different phenotypes associated with it.  The end result is there are 2592 different dragons that can be created and collected in the game.

These dragons were being dynamically built from a combination of 27 smaller images and then blended together, colorized, and then had patterns applied to them.  In the native Processing JAVA environment this process took only about 100 milliseconds to build each dragon.  But in the Processing.js environment this process took 700ms on Chrome, 1000ms on Firefox, 2500ms on IE9, and a whopping 4500ms on Safari.

This created a lot of problems, such as slow script warnings, when there were more than 4-5 dragons to build on game load.

To solve this problem I created a sketch in Processing to dynamically build every combination of dragon and call save() on it from a PGraphic to save out an image for every dragon in the game.  Now with an automated build process I can quickly (roughly 5 minutes) generate all 2600 dragons into images and load them up with loadImage() or requestImage() in Processing.js significantly improving the load times when starting the game.

As a side challenge to this sketch to generate all the images I added some code to build a massive collage to stick in a copy of every dragon in the game in a giant PGraphics image.

PGraphics massiveImage = createGraphics(27648,24576,JAVA2D);

Immediately I had problems with this with not enough memory being able to be allocated to the JRE. Because java runs in a 32 bit environment for the PDE I could only allocate about 1600mb of ram to the environment. This meant I would have to create eight separate images and then composite them later in Photoshop unfortunately.  I was still able to do it though and through some crafty code I was able to make eight images that were 6144×13824 in size and then patch them together into a giant 680 megapixel composite image showing all 2592 dragons at 512×512 resolution.

reduced size collage of all 2592 dragons Generated with Processing

Compositing the image in Photoshop took 11 GB of ram, 679477248 pixels, and created a 60MB PNG image file in the end.

If I had been able to allocate 4-5GB of RAM to the PDE I think I could have generated the entire image in one shot and I would have liked to have been able to add a sitting and flying image of each dragon bumping up the resolution to 1.35Gigapixels in total.

 

Using IIS7.5 with Dropbox to host websites

Standard

Up until recently I have been developing a web project using Processing.js and hosting it locally using IIS for development and testing.

For those who aren’t familiar with Dropbox it is a service that allows you to store 2GB of files in the cloud on Amazon’s S3 service for free. It also has Windows and Mac clients that sync files from a special folder on your hard drive to the cloud. The service is super simple to use and the integration with a local folder on your PC makes it extremely easy to work from multiple locations or computers with the same set of files because you can sync your files to multiple computers or with multiple Dropbox users by sharing folders.

When you combine this with the power of GitHub and a web server you can create a system that allows you to develop a web project, have it hosted from that folder on the web, and sync all the files between multiple machines as well as check in files to a managed repository cloud for others to work as well.

I can work from home and all my files are automatically synced from work, when I change a file at home it automatically syncs the file to the web server for me and because IIS points to the synced folder to serve to the web it means as I develop remotely my web server is always up to date within a few seconds of saving a file and the website is updated as well.

Recently though we had a power failure at Seneca and something caused IIS to throw permission errors when linking a virtual directory to the Dropbox folder containing my website.

It turned out I had to add the ‘Authenticated Users’ to the list of authorized accounts that can access the folder. I am also using Basic Authentication for password protection on the website for a quick and easy way to block anonymous access to the website.

The basic steps for creating a password protected development website that you can sync all your files between machines goes like this:

  1. Install Dropbox on all computers you will be working from including your host web server.
  2. Setup your website folder but do not share this folder with other people to modify. This is bad practice you don’t want others changing files on your website from a folder on their computer. Use a source control repository like Github to manage code.
  3. Install IIS on your host machine.
  4. Verify the port your using to host websites is open (usually port 80) on your network.
  5. Create a user for people who will be accessing the website remotely on the host web server.
  6. Create a virtual directory in the default website and set the alias to whatever name you want your users to access like mydevsite which will be accessed by myserveripordomainurl/mydevsite.
  7. Set the physical path to point to your Dropbox folder.
  8. Click on ‘Connect As…’ and check ‘specific User’, then enter a user that has permissions to access this folder and their password.
  9. Click ‘Test Settings…’ and verify both checks pass ok.
  10. If you have a domain name point it to your server ip or create a CNAME record that points to your IIS server ip to make a friendly url for those accessing your website.
  11. In IIS manager, select your virtual directory and pick ‘Authentication’. Disable Anonymous Authentication and enable Basic Authentication.
  12. Ideally you should Enable SSL and use HTTPS and also use a better authentication method than Basic Authentication but that is beyond the scope of this checklist.

Continuation with Seneca

Standard

It’s been a busy first four months of 2011 for me finishing up my last semester for my Bachelors degree in Software Development at Seneca but it appears to be worth it.

Now that I’ve graduated I’ve taken a position with the Office of Research and Innovation at Seneca in the Center for Development of Open Source Technology for the next year working on some projects with industry partners.

Some of them will use Processing.js in part and others will be other technologies. At this point that’s about all I can say though.

One of the things thats been holding me back from blogging besides limited time availability has been the fact that I’m waiting on one last grade to officially _officially_ be able to state that I am graduating.

Part of the reason for this was a final project I have been working on for a professor that includes two processing sketches for use with his course website to help teach game programming students the basics of vectors and matricies. Specifically how vector notation works and what the notation means visually.  The sketch shows how a vectors coordinates change. As you move the head of the vector around it updates the vector notation in realtime and shows the angle of theta. The second sketch is a matrix multiplication calculator that lets the user type in values for two 4×4 matricies and then press the calculate button to see the result of multiplying them together.

I used standard HTML input boxes and then with JavaScript and Processing.js I take the numbers and multiply them out and show the result in a matrix on a canvas.  Sure I could have done it in pure JS and made it simple but I wanted to make use of Processing.js and the canvas element so that I can add more functionality in the future that shows an animation of how the math works to get the result for each piece of the matrix.

This week I continue work on a few projects here at CDOT. One being a game using Processing.js and another being a dashboard app that will show status of the projects going on at CDOT.