Archive for November, 2009
Accessing Your Local MAMP Dev Environment From VirtualBox
You already have a local development environment set up using MAMP (MAMP uses port 8888 so your localhost is accessed at http://localhost:8888 and custom sites, assuming you have set any up, are available at http://whatever:8888).
Naturally you need to test your sites in Internet *barf* Explorer so you have set up a virtual environment to do this. I am using Sun’s fantastic, open source application VirtualBox. The question is, how do you access your local sites from within VirtualBox? Launching IE and going to http://localhost:8888 does not work… hmmm.
Turns out, the address you need to point at is http://10.0.0.2:8888. That will get you to MAMP’s htdocs directory, i.e. your http://localhost:8888!
Now that is useful but it doesn’t get give you access to your custom sites. Here is how you access those!
- Open your Windows host file. It is found here:
C:\windows\system32\drivers\etc\hosts - Under the bit that says:
127.0.0.1 localhostadd the following (using whatever your actual project is called):10.0.2.2 whatever
That’s it! Now you can visit http://whatever:8888 using IE from within your virtual Windows environment.
Improve Netbeans IDE Memory Usage
Posted by Stuart in Troubleshooting on November 12, 2009
Netbeans is my IDE of choice but the resources it commands sometimes cause my machine to choke like the Cleveland Browns on any given Sunday.
Here is what I’ve done to improve the situation a bit:
Nutshell: edit the netbeans conf file to increase the amount of memory allocated and permitted
You’ll be editing the netbeans conf file which, on my Mac and under version 6.7, is located in /Applications/NetBeans/NetBeans\ 6.7.app/Contents/Resources/NetBeans/etc/netbeans.conf The way I handled this was to open the file, copy the chunk that handles configuration (so I have a backup of the original settings), comment the old settings out and then make my changes.
The original settings (notice the pound sign at the start indicating this is commented out):#netbeans_default_options="-J-Dcom.sun.mysql.startcommand=/usr/local/mysql/support-files/mysql-admin.server -J-Dcom.sun.mysql.stopcommand=/usr/local/mysql/support-files/mysql-admin.server -J-Dcom.sun.mysql.startargs=start -J-Dcom.sun.mysql.stopargs=stop -J-Dcom.sun.mysql.port=3306 -J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true"
My new settings:netbeans_default_options="-J-Dcom.sun.mysql.startcommand=/usr/local/mysql/support-files/mysql-admin.server -J-Dcom.sun.mysql.stopcommand=/usr/local/mysql/support-files/mysql-admin.server -J-Dcom.sun.mysql.startargs=start -J-Dcom.sun.mysql.stopargs=stop -J-Dcom.sun.mysql.port=3306 -J-client -J-Xss2m -J-Xms256m -J-Xmx512m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true"
Changes include:
| Old | New |
|---|---|
| not set | -J-Xmx512m |
| -J-Xms32m | -J-Xms256m |
Some definitions… the -J-Xms setting defines the initial memory size, -J-Xmx defines the maximum.
You could set these numbers higher if you have more RAM but going too high can cause instability. One way to determine how much memory Netbeans is using is to turn on View->Toolbars->Memory. This will give you some feeback on how much you are actually using.
Magento and jQuery, Sitting in a Tree…
… k-i-s-s-i-n-g. First comes love, then comes… oh who am I kidding! They don’t really like each other that much. That said, here is how to make them at least tolerate each other:
Integrating jQuery with Magento is not complicated but there are a number of gotchas.
In a nutshell you…
- Create a directory named “jquery” (really you could name it “gorgonzola” but why not be consistent, eh?) in Magento’s js folder and stick the current version of jQuery inside it
wherever-you-installed-it/js/jquery/jquery.js - Implement jQuery’s noconflict mode by putting the following at the very end (very, very end… not inside a function or something) of the jQuery code
jQuery.noConflict();
- Add a call to jquery in the page.xml file (located somewhere like
wherever-you-installed-it/app/design/frontend/default/blank/layout/page.xmlNote that this assumes you are using the “blank” theme in the “default” frontend)This bit goes with all of the other addJs bits but, and this is what took up an hour of my incredibly valuable time (an hour I could have spent playing Wii Sports, anyway), make sure you put it after all of the other javascript files. Not just after some of them… after all of them.
- To now make use of all of this go into
wherever-you-installed-it/app/design/frontend/default/blank/template/page/html/head.phtmland put your jquery code right there at the end of the code





