Showing posts with label Parallels Desktop. Show all posts
Showing posts with label Parallels Desktop. Show all posts

Productivity and happiness going from 4 to 8 GB RAM

This post tries to illustrate the productivity improvements you get when you go from 4 GB to 8 GB RAM.

I bought a Mac mini last year and when I started using it to do software development, data started to be processed very very slow… I ordered mini with “just” 4 GB RAM. My assumption that I’d develop only Mac software wasn’t true because now I know that I can’t live without Windows development. This way I have to use a virtual machine/VM (Windows 7) to install Visual Studio, database servers and everything else. That requires a lot of memory as you may know already.

Situation before and after memory upgrade

Mac OS Win VM Comment Feeling
Before 3 GB 1 GB This is crazy. I know. Necessity rules. Steaming mad
After 4 GB 4GB This is what a software developer needs today. Open-mouthed smile

There’s nothing better than images to illustrate my situation before and after the memory upgrade. Pictures can tell thousands words… Seeing is believing!

Before memory upgrade

Mac OS Activity Monitor  ( before memory upgrade ) Screenshot 1 - Mac OS Activity Monitor  ( before memory upgrade )

Parallels Desktop with Windows 7 virtual machine - Process Explorer ( before memory upgrade ) Screenshot 2 - Parallels Desktop with Windows 7 virtual machine
Process Explorer ( before memory upgrade )

Parallels Desktop with Windows 7 virtual machine - System Information ( before memory upgrade ) Screenshot 3 - Parallels Desktop with Windows 7 virtual machine
System Information ( before memory upgrade )

After memory upgrade

Mac OS Activity Monitor ( after memory upgrade ) Screenshot 4 - Mac OS Activity Monitor ( after memory upgrade )

Parallels Desktop with Windows 7 virtual machine - Process Explorer ( after memory upgrade ) Screenshot 5 - Parallels Desktop with Windows 7 virtual machine
Process Explorer ( after memory upgrade )

Parallels Desktop with Windows 7 virtual machine - System Information ( after memory upgrade ) Screenshot 6 - Parallels Desktop with Windows 7 virtual machine
System Information ( after memory upgrade )

Analysis and Points to take into account
1 - In both Activity Monitors (Screenshot 1 and Screenshot 4) you can see in the pie chart that the sum of memory (3.75 GB and 7.75 GB) is always 250 MB bellow the total installed memory. This is because Mac mini shares its RAM with the video card.

2 - I do not turn off the computer, that is, I put the computer to Sleep (Mac OS term for what we call Hibernate in Windows). When the computer comes back from sleep its memory isn’t completely empty. These screenshots were taken while the computer was in the process of sleeping/waking for a few days and hence the values of Wired, Active, Inactive memory tend to stay high even after waking the computer.

3 - The number of open apps is for sure different but I can guarantee that I have much more apps open after the upgrade, for example: two Visual Studios (desenv.exe) in Screenshot 5 while I had only 1 VS opened in Screenshot 2. To make it even more clear we just have to compare the Totals section of Win 7 System Information. Before I had 53 processes and after 75 (Screenshot 3 and Screenshot 6). An increase of 41.50%.

4 - Despite the values for Page outs and Swap used, after the upgrade I change screens very very fast. So these values do not scary me anymore.

5 - After upgrading Parallels Desktop 6 to its latest release (Build 6.0.12090 / Revision 660720; May 26, 2011) I noted a better memory management regarding the virtual machine. Now Page outs and Swap used are in MBs as shown in Screenshot 7:

Mac OS Activity Monitor after Parallels Desktop upgradeScreenshot 7 - Mac OS Activity Monitor after Parallels Desktop upgrade

Conclusion
Comparing the data shown above, it’s clear that RAM upgrade plays a big role when it comes to developer productivity and happiness.

Now I can say that I have a responsive computer and that means a lot in my day to day work.

Developer: get 8 GB RAM if you can afford it. It’s the bare minimum in 2011. You’ll be happy. No stress… If you can afford and your hardware supports 16 GB RAM, go for it and you’ll have no RAM headaches for a long long period.

Manager or whoever pays the bill: give a descent computer to your developers with at least 8 GB RAM! No excuses… RAM is so cheap nowadays that I don’t understand how can a lot of developers out there work with less than the necessary amount of RAM.

Note 1: Windows processes and memory information come from Process Explorer by Sysinternals. It’s way better and more powerful than Windows default Task Manager.

Note 2: To better understand memory information in Mac OS, refer to this article by Apple: Mac OS X: Reading system memory usage in Activity Monitor

Access web app from Parallels Win 7 VM in Mac OS

About a month ago I started the creation of an ASP.NET MVC 3 app to a buddy. I’ll write some blog posts in the near future sharing my experiences with this awesome web framework. This app I’m still developing is a web application that I develop using my "new” computer. Today I use Mac OS as my main operating system and since I’m using ASP.NET I also need to use Windows.

Parallels Desktop is the way to go to have a Windows virtual machine [ VM ] running side by side with Mac OS. This way you have the best of both worlds. I discuss more about Parallels Desktop here.

One of the things I wanted to do during the development was seeing how the app would look like when viewed in a different OS, in this case, I’d like to see it running in Mac OS as if I were an end user accessing the app. This is good to test how the app behaves when it’s viewed in a different environment, that is, the perspective/environment of the end user, and not the developer’s perspective/development environment.

It’s cool to see the app running in a different OS and different web browsers. In Mac OS I have the chance of testing it against Safari too. I also have the chance of seeing how exceptions are being handled. There are certain types of errors that only happen when the end user is using the app in his environment. I think you know that already. This kind of testing allows me to deliver a better user experience.

When the app is accessed from the Mac side, the first difference is mainly visual because my Win 7 VM has all visual effects (clear type) disabled and so things look really simple if compared to Mac OS. I’m running the VM with no visual effects so that I have a somewhat fast VM to do the development. I only have 4 GB RAM available and I have to share it with both operating systems. I thought 4 GB RAM would suffice but that’s not the case. I have already ordered 8 GB RAM but am eagerly waiting it arrive from US. That’s another story that I plan to write in other blog post.

The reason I’m writing this post is that things don’t work at first when you try to access in Mac your app that is running in Windows VM. To get things working from both sides ( host = Mac OS and VM = Windows 7 ) they must see/communicate with each other. That’s where I had to do some work to get things going. So here are some instructions of what you need do:

1 - Set a fixed IP address for Windows VM
Set up a fixed IP address (read this page for a complete guide) in your Windows 7 virtual machine. This will make it easy when you need to access your app from Mac OS side. You won’t need to take note of different IP addresses handled by the DHCP server each time you restart your VM.

Windows 7 VM with fixed IP addressFigure 1 - Windows7 VM with fixed IP address

Above I have given the IP 192.168.1.106 to the VM. As I do not have a lot of devices connected to my wireless router, this IP is just fine.

2 - Set Virtual Machine’s Network Type
In your Parallels VM devices bar set your network type (orange arrow) as bridged:

Parallels Desktop VM devices toolbarFigure 2 - Parallels Desktop VM devices toolbar

3 - Test Communication between Host and VM
Make sure both operating systems can see each other.

Open Mac OS Terminal and execute a ping command:

ping 192.168.1.106

Change the IP with the IP you have in your Windows VM.

You should see something like this:

Mac OS Terminal pinging Windows 7 VMFigure 3 - Mac OS Terminal pinging Windows 7 VM

Now, open Windows 7 Command Prompt and ping Mac IP address. To see your Mac IP address go to System Preferences. Under Internet & Wireless, select Network.

Mac OS IP addressFigure 4 - Mac OS IP address

Let’s ping 192.168.1.100:

Windows 7 VM Command Prompt pinging MacFigure 5 - Windows 7 VM Command Prompt pinging Mac

As you see, both computers can see/communicate with each other. This means that the Network is working as expected.

4 - Configure Windows VM webserver for external traffic
What address should you type in a Mac OS browser to access the app? Well, this needs a little bit of caring. You’ll probably fail when trying to access the app with the same address you use in Windows side.

I’m using IIS Express as the web server in Windows. You can install it using Microsoft WebMatrix. IIS Express is by default configured to only server internal traffic (Windows VM). As I’m trying to access it from an external environment (Mac OS), I needed to configure it. The first link bellow was the main doc that helped me:

Serving external traffic with WebMatrix Beta
Handling URL Binding Failures in IIS Express (Serving External Traffic)

Basically I had to configure HTTP.SYS, create a URL binding that allow me to access the app in Mac side and disable Windows Firewall for my private home network.

4.1 - Configure HTTP.SYS
Type this command in Windows command prompt:

netsh http add urlacl url=http://leniel-pc:7777/ user=everyone

Change the url in the above command according to your desired configuration.

Note: the above command requires elevation. Right click the command prompt shortcut and select Run as administrator.

4.2 - Configure URL binding
As mentioned in the 2nd doc referenced above you must open your applicationhost.config file and add URL bindings that fit your needs. Mine is located here:

C:\Users\Leniel\Documents\IISExpress\config\applicationhost.config

Take a look at the last binding I have added:

<site name="FitnessCenter" id="3">

<application path="/" applicationPool="Clr4IntegratedAppPool">

<virtualDirectory path="/" physicalPath="C:\Users\Leniel\Documents\Visual Studio 2010\Projects\FitnessCenter\FitnessCenter.Web" />

</application>

<bindings>

<binding protocol="http" bindingInformation="*:7777:leniel-pc" />
<binding protocol="http" bindingInformation="*:7777:localhost" />

<binding protocol="http" bindingInformation=":7777:leniel-pc" />

<binding protocol="http" bindingInformation="192.168.1.106:7777:"/>

</bindings>

</site>

4.3 - Configure Windows VM firewall
The last step is disabling Windows VM firewall for your Home or work private networks.

Windows 7 VM FirewallFigure 6 - Windows 7 VM Firewall

As I just use this virtual machine to do software development, it’s ok to me to disable the firewall. Be careful though. Surprised smile

5 - Access Win 7 VM web app in Mac OS
After all this configuration you should be able to browse your app externally.

To see if everything is working, open a browser in Mac OS and try to access the app typing something as this in my case:

http://192.168.1.106:7777/

That’s it.

Hope it helps.

Learning to develop for iPhone with a Mac mini

I think you should read this one too:
Productivity and happiness going from 4 to 8 GB RAM

My 2010 Unibody Mac mini arrived on Sep 9. Now it's time to get to coding for the iPhone. That's why I bought it after all. Go code guy instead of being here writing this somewhat long post. :) Go figure. Oh wait, I need to share my experience with the rest of the world so that I can contribute to people that like to do what I do, that is, software development. So, let's share and learn together.

In this post I’ll write about hardware, software, virtual machines and iPhone development. All this takes into consideration my Windows background and my need of having Windows around while I’m using the Mac.

New hardware
I needed new hardware to learn how to develop for the iPhone platform. My Windows PC is an "old" Intel DualCore Pentium E2180 2 GHz and so I couldn't get MAC operating system also known as Mac OS X running on this hardware because the processor lacks Intel VT-x (hardware virtualization) feature. VT-x is necessary if you plan to run Mac OS in your Windows PC hardware through a virtual machine. I needed Mac OS X because currently iPhone development can only be done the proper way (read with Apple official development tools) within the Mac operating system.

I didn't want to spend a lot of money buying a new computer. So I opted for the bare minimum necessary to develop for iPhone.

While buying the mini that comes with a “somewhat” powerful Core 2 Duo P8600 2.4 GHz processor I also bought the Magic mouse and the Wireless keyboard. Mini doesn't come with a mouse or keyboard. I customized Mini with 4 GB RAM¹. Memory customization made the shipping take 2 weeks more. I bought Mini at the Brazilian Apple online store. Because I customized Mini it shipped from China and that's a long way to Brazil. If I had opted for the standard 2 GB RAM version I'd get the Mini the week I placed the order since there's stock right here in Brazil.

All this wait was to get a new development box that could make me capable of developing for iPhone and that's cheap for my pocket.

¹ - It's OK to work with 4 GB of RAM, but if you can afford 8 GB of RAM, go for that. Don't think twice. NVidia graphics card that comes with Mini also gets 256 MB of RAM. Virtual machines also like RAM. Continue reading to know why I'm mentioning this.

Mac OS Activity Monitor showing the System Memory
Figure 1 - Mac OS Activity Monitor showing the System Memory

To better understand what those Wired, Inactive memory are, read this doc:
Mac OS X: Reading system memory usage in Activity Monitor

The quality of Apple products is undeniable! I also own an iPhone and it makes me second that.

Things I really appreciate about the Mac mini set (unordered):
- Being wireless with Apples’s magic mouse and wireless keyboard. I think they're a must have with Mini.
- No noise approach when it comes to working with computers. Mini makes no noise. The only sound you'll ever listen is the hard disk and you'll only listen to it when there's no other environment sound, for example, during the night. If you opt for a SSD drive you won't get any noise at all. SSD is still expensive so that was not an option for me.
- HDMI port that allows me to connect it to my 32'' Sony Bravia HD TV for crystal bright images.
- Sound output quality (it's better than my dedicated Creative Audigy sound card on the PC)
- Small size. See the photo bellow where Mini’s size is compared with my Playstation 3 joystick (photo taken with iPhone 3GS):

Mac mini's size compared with a Playstation 3 joystick  
Figure 2 - Mac mini’s size compared with a Playstation 3 joystick

Mac + Windows
As a user of the PC movement for the past 15 years (I started with Windows 3.1 in 1995) I got it going really fast with Mac. The transition is being straightforward.

I could for sure only use Mac OS but that wouldn't give me the power I need. As I still work with Windows only applications as is the case of Microsoft Visual Studio and Windows Live Writer (that I use to write these posts) I need a way of having Windows around. For that I got Parallels Desktop. This software enabled me to have a Windows 7 virtual machine running alongside Mac OS with a beautiful integration between the two operating systems.

Virtual machine
Remember the amount of RAM memory I mentioned and showed above? It plays a big part when you’re using virtual machines because the system RAM is shared with virtual machines. So if you plan to run virtual machines in your Mac computer, you’d better get more RAM. This will give you better performance (read responsive applications) while you work avoiding the infamous Page outs.

Using a virtual machine there’s no need to reboot the machine to go to other operating system – this is cumbersome (if using Boot Camp and installing Windows in other partition I would have to do that). Actually I first installed Windows 7 using Boot Camp but then I realized that Parallels could move that Windows 7 Boot Camp partition over to a virtual machine. So I decided to go this way and used my Boot Camp partition as a virtual machine.

After going to Boot Camp solution and then using a Boot Camp partition as virtual machine I saw that Parallels Desktop also allows us to move an existing Windows PC entirely to a Mac based computer. This means that all the software, configurations and files you have on your Windows PC disk partition can be migrated to a virtual machine. I tried this but it just didn't work for me. The migration that is done using Parallels Transporter Agent failed twice in a process that takes at least 5 hours to complete. In my case it tried to migrate 197 GB of data over my wired home network. The error message I got was that the Transporter migration failed/The migration could not be completed (no me info). I tried to run this resolution but that didn’t do the trick (no problems were found on my Windows PC). If it had worked for me I wouldn’t need to install anything as everything that I had on the Windows PC would be just copied over to the virtual machine. That’d freed me of having to install everything again on the virtual machine.

No problem at all as I created a brand new virtual machine with a clean install of Windows 7.

You see, all this work allowed me to learn a lot of things along the way… Things that I wouldn’t have tried.

Tip: I found that using a new virtual machine with a clean install of Windows instead of a Boot Camp partition as a virtual machine is really better. Windows runs faster this way.

Now, the only thing I have to do is to start the virtual machine and there I'm using Windows 7 just inside Mac OS as if I were using the PC. So far so good. This satisfies my needs as a multiplatform developer.

You can put your Mac mini to sleep and you'll never have to start the virtual machine again because while sleeping Mini keeps the memory in "On" state, which means that all applications that you have open will be kept in the same state they were before you put Mini to sleep. Isn't it good? It's a kind of Hibernate we have in Windows but it's not Hibernate at all. While Mini is sleeping you get a beautiful white glowing blinking light that shows you that it's sleeping of course.

Mac software
Applications look more polished in Mac OS. Better native windows design, beautiful icons, etc. Some things are simpler in Mac OS. Take for example the application installation process. In most cases you just copy the application file to your Application folder in the dock and you’re ready to use it.

Some Windows software I use and that I can't live without are available for Mac too:
- µTorrent
- Firefox
- Microsoft Office
- Babylon
- Eclipse
- SnagIt

Mac only software that I'm using:
- TextMate
- BBEdit
- QuickSilver
- UnRarX
- Pixelmator

I'm using keyboard shortcuts a lot more with Mac.

iPhone development
Before I could feel comfortable to start learning how to develop for iPhone I had to configure my work environment first and that’s why I had to go over things such as virtual machines, etc. Now that it’s done it’s time to engage!

For those that are starting in this new world just like me, here goes what you need to get going and coding:

1st - get the official iPhone SDK that stands for software development kit. You’ll have to create an account with Apple to be able to download it and use all the features that Apple iOS Dev Center has to offer. The SDK is a big download - for the current version (Xcode 3.2.4 and iOS SDK 4.1) its size is: 2.9 GB.

Xcode is the name of the the IDE used to develop applications for iPhone. iOS is the name of the operating system that iPhone uses.

2nd - learn how to develop in this platform and that’s totally a personal path you have to follow. After learning the basics you can follow the more diverse paths depending on what types of application you want to develop.

As for learning iPhone development I'm understanding how things work with some easiness. It's always good to learn new programming languages as Objective-C, a new development environment as Xcode, etc. The easiness I'm finding here is a result of some years of coding and my familiarity with the Model View Controller pattern that is extensively used in iPhone applications.

The main learning source has been the iOS Reference Library.

Tutorials I have followed ²:

Your first iOS Application
Core Data Tutorial for iOS: Introduction
Introduction to The Objective-C Programming Language

² - I'll try to update this list while I make progress.

Updated on 8-26-2011

As I explain in a recent post titled Xcode iPhone beginner projects with GitHub integration, I decided to follow a new path to learn iPhone development. I’m learning with sample projects taken from a book and I’m committing those projects to a GitHub repository. Feel free to clone the repo: https://github.com/leniel/iPhone-Beginner-Guide

Final note
This is a new world that opens up just in front of me. In the coming weeks and months I'll be immersed in this new world.

I won't let my Windows developer part behind because I'm always answering some questions at StackOverflow and every now and then I need to write some apps to test some code.

I really love programming. Any programming language that you learn opens a new door of possibilities. This is what motivates me and moves me forward. I'm thirsty for knowledge.

Let's see what the future reserves for me in this new endeavor.

If you're also planning to develop for iPhone in the near future (because things change really fast in the technology world) this post shows you a possible start point.

Hope you've found this an interesting read and that you can learn something from my own experience.