Dojo 1.1 and 1.3 on the same page

June 16th, 2009 by Brian filed in work has no comments

Today I dug into the deep dark world of running multiple versions of Dojo on the same page. Turns out, it’s not all that dark! Working with some pages as my guide I was able to get 1.1 & 1.3 working in the same page.

This is a step towards running multiple versions withing WebSphere Portal, which I’ll likely be dealing with in the near future.

  1. <html>
  2. <head>
  3. <title>Dojo 1.1 and Dojo 1.3 together on the same page </title>
  4.  
  5. <!– Bring in Dojo 1.1.x –>
  6. <script type="text/javascript">
  7.   djConfig = {
  8.     parseOnLoad: true,
  9.     baseUrl: "dojo11/dojo/"
  10.   }
  11. </script>
  12. <script type="text/javascript" src="dojo11/dojo/dojo.js"></script>
  13.  
  14. <!–
  15. redefine djConfig (allowed in 1.1+)
  16. create namespaced dojo, dijit &amp; dojox
  17. –>
  18. <script type="text/javascript">
  19.   djConfig = {
  20.     isDebug: true,
  21.     baseRelativePath: "dojo13/dojo",
  22.     scopeMap: [
  23.       ["dojo", "dojo13"],
  24.       ["dijit", "dijit13"],
  25.       ["dojox", "dojox13"]
  26.    ]
  27. }
  28. </script>
  29. <script type="text/javascript" src="dojo13/dojo/dojo.js"></script>
  30.  
  31. <!– test it –>
  32. <script type="text/javascript">
  33.   dojo.addOnLoad(function(){
  34.     alert(dojo.version);
  35.   });
  36.   dojo13.addOnLoad(function(){
  37.     alert(dojo13.version);
  38.  });
  39. </script>
  40. </head>
  41.  
  42. <body>
  43. Dojo 1.1 and Dojo 1.3 together on the same page
  44. </body>
  45.  
  46. </html>

Tags:

Websphere Portal theme navigation context menus

May 1st, 2009 by Brian filed in work has no comments

I spend a lot of my day working with WebSphere Portal server, and as of late, spending more time (than I’d like!) with themes & skins. I am currently working with Portal v6.1, but the information below should be useful for previous versions as well.WebSphere software

Our portal is pretty open, we want people to come in & customize it as much as they’d like. One feature that we allow is for the user to come in & create new pages. We are running our own theme policy which is a copy of the DoubleTopNav policy. Our theme displays these 2 levels of navigation at the top, and we have no side navigation.

The hurdle I ran into was – how do I prevent the “New Page” option from appearing in the portlet menu for pages in the second level of navigation? The way the out-of-the-box Portal theme works is that when you create a new page, it is created as a child of the page that you are on. This works fine for top level pages, but there no policy or rule that can be set to prevent the “New Page” option from appearing in the portlet menu for second level pages.

The solution, proposed by a member of the Portal team was to create an alternate pageContextMenu.jsp which simply didn’t have a “New Page” option. Since the call the that JSP is done via AJAX, prior to the call we can determine what navigation level we are on and call the appropriate version of pageContextMenu.jsp.

Piece of cake, right? Eh .. maybe not cake, but not all that difficult. After creating the new pageContextMenu2.jsp & removing the “New Page” option, the next place to go is head_inlineJS.jspf. Below is the code I have added/modified to the head_inlineJS.jspf.

  1. <%– START – see if we are in 2nd level of navigation –%>
  2. <%
  3. String pageContextMenuJSP = "pageContextMenu";
  4. %>
  5. <portal-navigation:navigation startLevel="2" stopLevel="3">
  6.   <portal-navigation:navigationLoop>
  7.     <portal-logic:if nodeInSelectionPath="yes">
  8.     <%
  9.       //it’s in selection path &amp; it’s selected (this is the page we are on!
  10.       if (wpsSelectionModel.isNodeSelected(wpsNavNode)){
  11.         int level = wpsNavLevel.intValue();
  12.         if (level == 2) {
  13.           pageContextMenuJSP = "pageContextMenu2";
  14.         }
  15.       }
  16.     %>
  17.     </portal-logic:if>
  18.   </portal-navigation:navigationLoop>
  19. </portal-navigation:navigation>
  20. <%– END – see if we are in 2nd level of navigation –%>
  21.  
  22. <%– Context Menu Initialization –%>
  23. <c-rt:set var="pageNoActionsText" ><portal-fmt:text bundle=‘nls.engine’ key=‘info.emptymenu’ /></c-rt:set>
  24. (function(){
  25.  
  26. var pageMenuURL = ‘<portal-navigation:url themeTemplate="<%=pageContextMenuJSP%>" />’;
  27. <%– OLD var pageMenuURL = ‘<portal-navigation:url themeTemplate="pageContextMenu" />’; –%>

Now that you’ve got that taken care of, touch head.jspf && touch Default.jsp, reload your page and you should no longer see “New Page” as an option in the page drop down for pages in the 2nd level of your navigation.

That worked and was a thing of beauty .. well, almost. I wasn’t a big fan of looping through the entire navigation model, but I didn’t know any other way. I ran the code past my colleague from the Portal team and he pointed me at the navigationSelectionModel. The code below is smaller & faster. Best of all – it works :)

  1. <%– 2009.05.04 OLORE – see if we are in 2nd level of navigation –%>
  2. <%
  3. String pageContextMenuJSP = "pageContextMenu";
  4.  
  5. int level_count = 0;
  6. for (java.util.Iterator i = nsm.iterator(); i.hasNext(); ) {
  7.   NavigationNode node = (NavigationNode) i.next();
  8.     level_count++;
  9. }
  10. if (level_count >= 4) { // level 4 == our 2nd level of top navigation (shouldn’t ever be >)
  11.   pageContextMenuJSP = "pageContextMenu2";
  12. }
  13.  
  14. %>
  15. <%– 2009.05.04 OLORE – see if we are in 2nd level of navigation –%>
  16.  
  17. <%– Context Menu Initialization –%>
  18. <c-rt:set var="pageNoActionsText" ><portal-fmt:text bundle=‘nls.engine’ key=‘info.emptymenu’ /></c-rt:set>
  19. (function(){
  20.  
  21.   <%– 2009.05.01 OLORE – use pageContextMenu2 if we are in 2nd level nav –%>
  22.   var pageMenuURL = ‘<portal-navigation:url themeTemplate="<%=pageContextMenuJSP%>" />’;
  23.   <%– 2009.05.01 OLORE – use pageContextMenu2 if we are in 2nd level nav –%>

Tags: , , ,

Launched new Twitter accounts

April 30th, 2009 by Brian filed in play has 1 comment

I was inspired by this story in the Anchorage Daily News about a woman that started @AKBadDrivers “who started describing bad drivers on her personal Twitter feed from her spot in the passenger seat as she commuted in from Wasilla.” The simple brilliance of this usage of Twitter really struck me.

With tweets like

  • silver jeep, FLB 272. thanks for cutting me off not once but TWICE when you were going straight in turn only lanes prick.
  • To the girl in the Green Explorer outside Muldoon Fred Meyers this afternoon: Sorry my U-turn scared you. My bad :-(
  • white Nissan pu FEL 365 hang up ur cell phone pay attention 2 ur driving. ur lane ended & you nearly hit me merging 2 mine.

I wanted a piece of that action!

So I started @NJBadDrivers and @CTBadDrivers. Then I realized I better grab @NYBadDrivers to complete the tri-state trifecta. Imitation is the sincerest form, right ? After talking to my buddy who moved up to Alaska, he said that people really are crazy drivers up there, but come on, can they really be worse than New York, Connecticut or New Jersey drivers? (Admittedly, I’ve had licenses in all 3 states.)

I’m running with Christopher Finke’s slick little python application called retweet on my Dreamhost account. If Chrstopher’s name sounds familiar (it should!) it’s cuz he’s the mastermind behind ScribeFire and the TwitterBar Firefox add-on. For those interested in running retweet on Dreamhost, be sure to use python2.5 as it already has the sqlite3 library configured. Once I figured that out, I cron’d it and it’s been working like a charm.

So how’s it work? All you need to do is send a message to one of the accounts via Twitter and it will get retweeted by the bot. Just say “@NJBadDrivers does anyone around here know how to function at a four way stop???” or “@NYBadDrivers srsly people, traffic circles are not that difficult”.

I wonder… is reserving Twitter names the new domain squatting? If so, would it be called twatting?

Tags: , , , ,

Needed: Better HTTP debugging on Linux

March 3rd, 2009 by Brian filed in work has 4 comments

I’ve been running Linux as my only OS for the last year and a half. I’ve recently switched over to Ubuntu 8.10 (from RHEL5) and am enjoying it since January.  The biggest difference between the two thus far has been the more-up-to-date versions of things and the ease of finding & installing codecs and proproetary drivers (NVIDIA).

There is one thing that’s missing from my old Windows days – Fiddler. Fiddler is a (Windows only) HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Invaluable for debugging cookies, headers and other HTTP specifics. The killer feature for me is the UI which lays out, line by line, each of the HTTP requests which you can glance at for quick infomation, or click on to get a detailed view of just about everything you could imagine. A geek’s dream :)

I’m dying for something like this on Linux. I’ve tried Live HTTP Headers, Firebug, Wireshark and a combo of all three. Each of these captures all the data I need (and in some cases much more), but each falls short in one way or another:

Live HTTP Headers
The Good: Firefox plugin, keeps running list of requests, good filtering (especially if you dream in regex like myself!)
The Bad: The user interface – BLAH! It’s just one big long list of requests. Sure you can copy & paste, but rich data like this needs better treatment

Firebug
The Good: Firebug isn’t as good as everyone says it is .. it’s better. If you are doing web development and not using this tool you aren’t a true web developer. You’ve been notified. The Net panel is fantastic, especially the colors and bars they’ve added in recent versions.
The Bad: The Net panel is almost what I need, but here are the problems:  the panel reloads on every page load, blowing away any previous data (argh!), it’s next to impossible to be looking at the details of one request and quickly jump to another request because the UI is so cluttered – a dedicated details pane would help considerably here.

Wireshark
The Good: Fantastic network analyzation of all types, not just HTTP. If you want to sniff traffic and watch your family’s network traffic on your home … wait .. who would ever do that ;)
The Bad: Slightly more difficult to install and use. Not being HTTP specific, it rather generically handles and displays the details of HTTP requests.

I hate to sound like a Fiddler fanboy, but I think that their user interface layout really makes examination of the requests simple and painless. For all it’s greatness, I think Firebug falls short here, but I also think it’s got the best chance to be modified to suit my needs.

… and I just might take a stab at it…

Tags: , , , , , , , ,

Firefox – View Source

February 3rd, 2009 by Brian filed in work has 1 comment

Everyone knows about “View – Page Source” in Firefox & it’s counterparts in other browsers , but have you ever hit a web page that returns JSON or XML or some other text and have Firefox prompt you to choose an application to open it ? So annoying! Why can’t Firefox just display it?!??!

I stumbled across a great workaround while clicking around the Project Zero forums: view-source:

It’s used like this:

view-source:http://www.projectzero.org/

That’s it … just prepend view-source: to any URL and it will display the source… so handy for those pesky JSON URLs!

Credit to dieselchrist for his post on the Project Zero forum
Note: brandon suggesting using the Firefox Poster plugin … definitely worth a look as well.

Tags: , , ,

Aptana on Ubuntu 8.10

February 2nd, 2009 by Brian filed in work has no comments

I was having a problem getting Aptana to run on my fresh install of Ubuntu 8.10

I lost the original error message, but it was something like

[ERROR] Invalid key
java.security.InvalidKeyException: Invalid AES key length: 26 bytes


Even though I’m running 32-bit, the solution to include an older version of xulrunner and reference it in a startup script worked like a charm.

In case this page ever dies, the trick is to install xulrunner-1.8.1.3 and use a script similar to this to start Aptana

#!/bin/sh
MOZILLA_FIVE_HOME=/usr/lib/xulrunner-1.8.1.3
if [ $LD_LIBRARY_PATH ]; then
LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:$LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME
fi
export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
~/aptana/AptanaStudio -vm /usr/lib/jvm/ia32-java-6-sun/jre/bin/java

For reference, I am running IBM Java 1.6

#!/bin/sh
MOZILLA_FIVE_HOME=/usr/lib/xulrunner-1.8.1.3
if [ $LD_LIBRARY_PATH ]; then
LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:$LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME
fi
export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
~/aptana/AptanaStudio -vm /usr/lib/jvm/ia32-java-6-sun/jre/bin/java

Tags: , , , ,

My birthday

November 23rd, 2008 by Brian filed in life has no comments

I recently celebrated my 32nd birthday and realized that there has been a significant shift in the method in which people have said “Happy Birthday” over the past 10 years:

Yes my daughter picked out a Turkey ice cream cake for me

My daughter picked out a Turkey ice cream cake

10 years ago it was mostly birthday cards and birthday shots
5 years ago it was mostly email
3 years ago it was mostly e-cards
1 year ago it was mostly SMS messages
This year was mostly Facebook wall posts

What will the next few years bring? Holograms?

Tags: ,

My Lotusphere session

November 20th, 2008 by Brian filed in work has no comments

Come check me out at Lotusphere 2009.

Session Title: Innovation with Integration: IBM’s “Next Generation” Intranet Portal
Session Track: ID503
Track Three: Planning and Managing Your Collaboration Infrastructure

Continuous innovation of IBM’s enterprise portal, in a rapid, non-disruptive, evolutionary manner is a major goal of the “ODW Next” project. The On Demand Workplace (ODW) is IBM’s single point of entry for employee intranet access (w3.ibm.com). It serves as the “front door” to IBM’s internal transformation activities, providing a personalized work environment for more than 350,000 employees, in over 100 countries. The approach of ODW Next is to couple a live innovation platform – a “perpetual beta” – alongside the production environment, to obtain the maximum benefits of live usage and continuous feedback from a statistically significant number of global employees, while minimizing risk to the steady state production systems.

Tags: , , , ,

First Post!

November 17th, 2008 by Brian filed in Uncategorized has 1 comment

Well I guess I shouldn’t be all that excited, it is my blog after all. I was bound to get the elusive “first post”.

This blog is going to hopefully supplant my intranet blog where I can rant and rave about rumors on the Internets and maybe even provide some useful information for one or two people.

If you are so intrigued, you can read more about me.

Tags: ,