Is Processing.js fast yet?

Standard

YES

One of my current projects I am working on is an educational game aimed at teaching the concepts of Mendelian Genetics to students.

What I’ve been working on for the last few days is optimizing the game for the web and iPad deployment.

My first shot at optimizations is making the game load up faster.

Comparing Processing.js to Native JAVA Processing on my PC I found the following results and they were surprising!

While the speed results for different pieces of code were different between browsers one thing was clear that the overall total time to complete running the setup() function was fastest in the browser in all cases except for IE9 and Safari on Windows 7. For individual test results only once was one piece of code faster in the JAVA environment compared to the browser.

Test System: Intel core i7, 12gb ram, Windows 7.

The green boxes show the fastest time for that section, when a time was within 1ms I have called it close enough to be a tie. I ran each test 5 times per browser and averaged the results to make sure there were no one offs.

Running the setup() loop to initialize the game

I’m sure I will be able to further optimize it in the next few days to be even faster this is just an initial observation. Now that I know whats slow I can work on some async loading or deferred loading. Or just better code.

Advertisement

How to install Windows Server 2008 R2 on Macbook Pro 2011

Standard

I recently took on the challenge of teaching a Windows Server 2008 administration course at Seneca College and I spent the weekend working on installing server on a laptop so I can demo it in class.

Windows Server 2008 R2 on Macbook Pro 2011

Sounds simple enough right? The thing is my only laptop is from 2007 and has no video driver for 64bit server so I cant attach it to a projector. Otherwise I could use my old dell laptop. So what I am working on is installing Windows Server 2008 on a core i7 Macbook Pro with 8gb of ram 🙂

I started off thinking I could just use boot camp assistant to install Windows 7 and then put Server 2008 inside a VM on Windows 7 with Virtual Box but the problem with that is I have to cover a lecture in one of the weeks on Hyper-V. Hyper-V is Windows Server’s virtualization hypervisor technology. You cannot install Hyper-V inside a VM environment and have a scenario where you have a VM inside a VM inside a host.

So my only option is to install Windows Server 2008 R2 as the main host and dual boot OSX Lion with it.

So to begin you’ll need to have a few things up front.

  • Windows Server 2008 R2 DVD
  • A USB with about 2GB of free space formatted as FAT32 not NTFS for storing boot camp support files
  • At least 60GB or more of free space on the HDD, I set aside 200GB (of 500GB total) because I may install Win 7 VM’s that can take 30GB+ each.

Steps involved:

  1. I started out by running the boot camp assistant in OSX. The boot camp assistant lets you download the Windows drivers for the Mac and stick them on a USB for later. It also helps you partition the HDD for Win7.
  2. Once you have a partition ready you’ll reboot and do a normal install of server by booting from the DVD. you’ll have to format the BOOTCAMP partition as NTFS for server. Make sure you dont format the wrong partition or you’ll could wipe out your OSX partition.
  3. Once the install finishes you’ll notice that there is a lot of devices that wont work. You can start by installing all the boot camp drivers on that USB from earlier that boot camp assistant created for you. WARNING: if you do not install boot camp drivers before rebooting you will not be able to press ctrl+alt+del to login to server because the option key is not remapped to alt until you install the bootcamp drivers. You can get around this problem by plugging in a USB keyboard to be able to press ctrl+alt+del.
  4. This will leave you with about 3-4 things still not working. Wireless, Video, Bluetooth, and sound will all not be working.
  5. Windows 7 and Windows Server 2008 R2 were developed in parallel and most windows 7 drivers will work ok in server 2008 R2 just fine. This is mostly the case for everything but video and bluetooth.
  6. The Macbook Pro I have has an Intel HD Graphics 3000 video adapter, and an AMD Radeon HD 6490M graphics card, bootcamp tried to install Nvidia drivers for my video from the USB.
  7. Windows Server 2008 R2 installs as a bare-bones OS with almost everything turned off. This includes wireless and sound. You will need to add the ‘Wireless LAN Service’ feature in Server Manager to enable wireless networking.

    Enable 'Wireless LAN Service'

  8. Sound can be enabled by trying to go into sound properties in control panel. You will get a popup saying the windows audio service is not enabled, do you want to enable it? click yes and your sound should start working and be adjustable by the mac volume keys.

    Enable Windows Audio Service

  9. I started searching the web for discussions about getting the audio working and came across a good post about catalyst not detecting the hardware but the drivers still being able to be installed manually.
  10. I was able to find two different versions of drivers one from ati.com and one from guru3d.com. I installed the one from Guru3D as it was 11.10 instead of 11.9 and it worked but once i enabled Hyper-V I started getting tons of blue screen errors revolving around atikmpag.sys.  When I did some searching I found out that when installing Hyper-V before SP1 on 2008 with Sandy Bridge chipset it can cause BSOD on video errors. And more specifically the AVX feature on Sandy Bridge chips was the cause. A hotfix is available here but I just installed SP1 instead. I ended up uninstalling the video drivers temporarily. If you find yourself getting blue screens boot into safe mode menu with f5 then press f8 for more options and choose last known good configuration and you should be able to boot up and uninstall the video drivers.
  11. If the video drivers are not installed you can probably safely installed the Hyper-V role now.
  12. Do all the Windows Updates now there will be probably about 120 of them in waves because some require others to be installed first. SP1 will show up in Windows Update after about 4 sets of updates. If Hyper-V throws an error saying can’t initialize a VM when trying to start it and the event log shows error 3040 its related to the SP1 fix and Sandy Bridge chipset most likely.

Enjoy.

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.