E-com DevBlog Spider-ball-vacuum

16Apr/081

VirtualBox – and a linux experiment

So a few weeks (or months) ago I read a post on a site that said how to run windows in a linux environment similar to how parallels works on OS X.  I went to the website and found that there was a windows binary available for download and that you can make a Virtual Machine out of just about anything.  So I made one of ubuntu 7.10 (making sure to disable the "network" portion before the install so as not to get stuck in an infinite loop when installing the distro).  Everything went smoothly and soon enough I was booted fully into a very fast running virtual linux installation.  That's when I opened firefox and found out that we have a firewall that hates us.  So now that you've done the same thing and want to figure out how to make things work, lets start by setting up the system proxy settings.

  1.  In Gnome (ubuntu 7.10 default interface) click on 'System' -> 'Preferences' -> 'Network Proxy'.
  2. Click on the "Manual proxy configuration" radio button.
  3. For 'HTTP proxy:'  enter "proxy3.wherewework.com"
  4. For Port use 3128.
  5. Click on the "Details" button
  6. Check "Use authentication"
  7. Enter DOMAIN/username
  8. Enter your password
  9. Click the "Close" button
  10. Click the "Close" button again
  11. Crack open fireyfox and make sure that the proxy pop up window has "domain\username" then your password
  12. Enjoy the surf

It is fairly important to note which way the slashes are going in each step of the process.  If it still doesn't work, your NAT settings may need to be tweaked... I did end up cloning my hosts MAC address, but I'm not certain that will make it work.

Print This Post Print This Post
7Apr/080

The joys of Try Catch (in a jsp)

This post is brought about after having Ninja come over and look at my code and making me realize that while what I was doing was good, I had not used a try catch and as such would never find exactly why my code was generating over 1500 lines of errors in my server log (ouch). Here is the way of Scriptlet (aka ninjascript) Try Catch-ery.

<% try { %>;
   <%-- code goes here --%>;
<% } catch (Exception e) {
   e.printStackTrace();
   Thread.sleep(20000); 
} %>;

You can further mod this to make it possibly more helpful by adding/replacing the last line so you end up with something like:

<% try { %>
   <%-- Code goes here --%>
<% } catch (Exception e) {
   System.out.println("Exception caught in NameOf.jsp");
   System.out.println(e.toString());
   e.printStackTrace();
} %>

Now for those people who are purists and understand that scriptlets really are not up to par, and that they are ugly and screw things up and are not elegant in the least, there is another way to Try Catch on your JSP. Simply use a JSTL Try Catch. Here I'll set up an example:

?View Code HTML4STRICT
<c:catch var ="catchException">
   <wcbase:useBean id="category" classname="com.ibm.commerce.catalog.beans.CategoryDataBean" >
      <c:set value="${WCParam.parent_category_rn}" target="${category}" property="categoryId" />
   </wcbase:useBean>
</c:catch>
<c:if test = "${catchException!=null}">
   The exception is : ${catchException}<br /><br/>
   There is an exception: ${catchException.message}<br/>
</c:if>

We set up a variable (catchException) and then what we want to do inside that c:catch. So we are trying to instantiate this bean and we want to make sure it doesn't throw an error (which as part of the joys of websphere if that bean throws an error your page will fail and you'll either get a portion of your page with nothing else, or you'll get a series of dreaded CMNxxxx errors). Right after the c:catch block we set up a c:if with to test value of ${catchException, if it's not empty, then an error was thrown and we should kick out what the error is so that we can fix it (without digging through 1500 lines of error-logged code).

Print This Post Print This Post
3Apr/080

Weekly Training – Debugging

It's time to learn how to get the bugs out. This week we covered basic debugging (from starting the server) to using some external tools (such as the fantastic Firebug plug-in). For the full show you can check the audio clip at the end (I'll post it when I'm done 'cleaning' it).

Highlights:

  • Rational debugging mode
  • Firebug (for both CSS editing and javascript debugging)
  • Drew's fantastic commentary as nothing works the way he intends (for the first 20-ish minutes)
  • My extremely long pause... that I think I may still be on.

On a side note, there are two other tools that are very helpful when trying to debug or develop on IE, Safari, Linux browsers, etc. They are XRAY and Aardvark, and both are bookmarklets (meaning you bookmark the javascript itself and run it when you need it, similar to a bookmark).

XRAY can be found here http://www.westciv.com/xray/.

Aardvark can be found here http://karmatics.com/aardvark/bookmarklet.html.

Audio clip will be here when I'm done editing it...  UPDATE: Or it won't, looks like my sansa destroyed the file, I mean it's still there, just not in a format that any program can read...  I may still play with this, but I'm thinking it's a lost cause... sorry :(

Print This Post Print This Post