Getting the Correct Syntax for JavaScript in XPages

I was recently working on a project where my code was injecting XPage elements onto the page at runtime.  To do that, you need to know a lot of syntax.  Syntax that isn’t in the help file, or blogged about, or easily findable.  Sure, there’s this, but that isn’t exactly reader-friendly, nor are there examples of how to use the elements.  Just because you know you’re using “XspInputText”, doesn’t mean you know how to use it.  What’s the syntax for adding an attribute, for example?  Or maybe you know the syntax structure, but need to know what the parameter looks like in the code.

Designer Data Panel for Date Field For example, you want to add a Date field with certain parameters set.  You know how to set them in Designer in the data panel, but how do you set those parameters programmatically in JavaScript?

Thankfully, Toby Samples showed me a cheat to find out.  Create a dummy XPage, add your element and do whatever it is you want to do, i.e. set the parameters for your date field.  Save the page.  In Designer, go to Package Explorer and your nsf.  Expand the Local folder and then the xsp folder.  There you’ll see all of your custom controls and XPages with a .java extension.  Double-click on the file.  It will open and there you’ll see the Java code used to generate that XPage, including your element and how the parameters were set programmatically.  This can be really useful when you’re adding something like an attribute via JavaScript and you can’t find any examples of HOW to add an attribute (or class or value binding or any other property).

Example, if you set the above “display format” to “Date and Time” in the picker, how is that set programmatically?


With the parameter “both”.  Good luck figuring that out on your own.

File under: “Things you may have already known, but I didn’t, and I share it just in case you didn’t either” AND “Blog post titles I struggled with actually explaining what the post was about without actually typing the post in the title”

Back to Running

Tomorrow will be the fourth run of my current return to running.  Coincidentally, tomorrow is the 9th anniversary of my first run. (Excluding the time when I lived in New York and signed up for the Chase corporate challenge and did almost no training and attempted to run 3 miles..  I had no idea what I was doing, I ran too fast, hated it, and immediately quit.  So I count September 24, 2007 as my first run.)  It was the “run” before I started the couch to 5k program.  After that I ran a 5k.  Then a 10k.  Then decided to run every day (for 3 1/2 years).  Ran some half marathons and eventually a marathon.

A Few Stats (because I love stats):

My first “run” was September 24, 2007.  Distance:  1.6 miles Pace:  18:45

During the couch to 5k program, my pace seemed to bounce around 14:00 min miles

My first 5k was a Turkey Trot on November 27, 2007.  Pace 11:10 (and I was ELATED with that pace)

My best 5k was June 7, 2009 with an 8:51 pace! (I was even more elated with that pace)

My current pace seems to be around 14:00 min miles.  That totally means 8:51 is in my future, right?  hahahahaha

Recent Adjustments to 6 Years Cable Free

Like many people these days, I cut the cord.  In the summer of 2010, I moved into my current house and decided from the start that I wouldn’t have cable.  A few of my friends were already cable-free and could provide advice (thank you, Carl Tyler!).  Here’s the thing though, I’m lazy.  I want things to “just work”.  I don’t want to have to fiddle and futz.  So I knew I wasn’t going to jump through a bunch of hoops to go cable-free, it was going to have to be easy.

So for the last six years, we’ve mostly had Rokus with Hulu, Netflix, and Amazon Prime.  In the last year or so, I added an Apple TV to the mix. For a short period, we had Aereo, which was a channel on the Roku that acted as a digital antenna so we could have local channels. Then they were sued and shut down.  We also had playon for a bit, but the machine that I had it on died and I just couldn’t be bothered to spin up another one (see above where I said I was lazy).  I’ve attempted unblock-us and have several friends who love it, swear by it, and even helped set me up (Carl) and troubleshoot it later (Gab), but every once in a while, Netflix gets all pissy about unblock-us and stops working.  Again, that means futzing and fixing and I just can’t be bothered.  So I don’t really use that either, unless I have to  (like to watch the Olympics this year).

It’s football season, so I finally broke down and got a digital antenna so my son could watch the Patriots.  We should have bought the outdoor antenna (although again, I didn’t want to futz and an outdoor antenna would CERTAINLY require some fiddling with regards to wiring).  I bought the “50″, I think intended to mean 50-mile reach of the antenna, from the rather surly dude at Best Buy.  Me: “Do you have digital antennas”.  Surly guy: “Yeah, get this one, it’s the only one people don’t return saying it didn’t work”.  Well, okay then.

Sadly, the antenna only comes with a 5-foot cable or something equally ridiculous, especially when the antenna probably will only work in one particular spot in your house, if at all.  Mine ended up only working in the window at the end of the hall of my upstairs master bedroom.  So, you know, TOTALLY inconvenient for anyone watching TV.  In theory, you can put it on a wall or bookcase, but mine ONLY worked in the window.  It had to be in the highest point and facing south (because I live north of Boston, where all the signals are coming from).  I bought a 50-foot coax cable, which apparently works better when it’s uncoiled.  Who knew?  But at least that way, it reaches to my TV (where it belongs rather than the hallway).  Unfortunately, this required a lot of fiddling, but it’s done now and set up and working and hey, my kid is happy.

In summary, six years cable-free, Roku and Apple TV with Netflix, Hulu, Amazon Prime, and now a digital antenna.

The kids sitting on bean bag chairs in my hallway, with the TV sitting on a bin of yarn in front of the only window we could get the antenna to work in.

The kids sitting on bean bag chairs in my hallway, with the TV sitting on a bin of yarn in front of the only window we could get the antenna to work in.



Some Experiments in Running and Technology

Okay, technically it was one experiment testing several hypotheses, but anyway.

Background for the experiment:

I used to run.  I had a Garmin Forerunner for a very long time that I loved very much and then I had a Garmin 220, which I also loved very much.  These both served me well before there were phones with GPS and apps and watches, oh my.  I also used to upload the data from these watches to the very awesome RunningAhead website.  I love the site, and especially the training log.   All my running data is on that site.

I now have an iPhone and an Apple Watch.  I haven’t been running, but I have become addicted to the “Activity/Move/Stand” stats on my watch and also some of the health stats like steps per day.

I also like to take walks and play Pokemon Go.

What I wanted to have happen:

I wanted to go for a run and NOT wear two watches (aka my Apple Watch AND my Garmin).  I wanted a way of tracking my steps taken during the run and have my run and steps count toward the Apple Watch activity/move stats.  I wanted a way to record all the great running stats that my Garmin normally tracks AND be able to upload it to RunningAhead.  AND, I wanted to play Pokemon Go during my run (gotta hatch those eggs!).  Oh!  And I also wanted training programs on the watch, like Couch to 5k or similar so I have cues to start/stop running.  No big deal, right?

Pre-experiment trial and research:

I tried a few apps with the watch to see what I could get out of the above requirements and had a really difficult time getting in all of my objectives.  If you open too many apps on the watch, they cancel each other out.  If I started Runkeeper and then the Workout app, Runkeeper stopped.  I tried different apps, same problem.  Then I found this awesome reddit thread, where someone experimented with several variations on recording a run and realized I needed to do.  Further research showed I could upload Runkeeper’s export to RunningAhead.  AND Runkeeper has several free training programs on the app.  Runtastic was in the running (pun intended) for a while, but their training programs all cost quite a bit of money.

Final experiment:

I loaded Runkeeper on my phone, which automatically loads it on my watch.  I made sure both were fully charged.  I started Runkeeper on my watch (but didn’t start a run).  I started Runkeeper on my phone in order to cue up today’s run per the training plan.  I tapped start.  I checked my watch to see that my watch was running Runkeeper, it was.  I went back to the phone and started up Pokemon Go.  I walked/ran for 34 minutes.  I ended the run on my watch.  Saved the run on my watch.  Sat down at my laptop, opened up, exported my run.  Went to and uploaded the file.

Experiment results:

Phone battery went from 94% to 55$ on a 34 minute run with Runkeeper running and Pokemon Go.  Obviously, this isn’t something I’ll want to do on long runs, but it worked and I’m happy.  My training run worked perfectly from the training plan on Runkeeper.  It “counted” on the Apple Health/Activity apps (and I’ll incidentally get two new badges this week since my run was included!).  Everything exported and imported beautifully to RunningAhead.  ALL OBJECTIVES ACHIEVED.

All in all, I’m very pleased with the results.  On longer runs, I’ll have to ditch Pokemon Go just for battery reasons, but I’m okay with that.  Extra super bonus that I’d love would be if Runkeeper could figure out how to get the running cues to use the haptic on the watch.  In a separate experiment I tried several apps to see if any of them would do that and none did.

Anyway, I’m back to running and hoping that all this technology keeps me motivated to stick with it.  Happy running!

MWLUG 2016 Wrap Up

Last week I was in Austin, TX for MWLUG 2016.  This was my second time speaking at this event, and once again, it was a great experience.

I have been to Texas several times, but had never been to Austin.  I’m still not sure I can say I’ve been to Austin, I feel like I only got to see a small slice of it.  Between humidity that felt like I was drowning (it IS August in Austin) and pouring rain, I didn’t get to get out and about as much as I would have liked (and I even stayed a couple of extra days).  Side note, I’m a giant taco snob and I finally found a good taco.  I don’t just mean in Austin, I mean ever since I moved out of California when I was 17 years old.  So that was exciting.

I attended several sessions (though never as many as I’d like).  How we all still come up with new and interesting content is amazing to me, yet we all still seem to do it.  Lots of Champions were speakers.  You couldn’t go in the hotel lounge area without tripping over a Champion.  If you wanted to talk to a Champ, this was the place to do it.

I talked to a lot of people.  That still feels new to me, and isn’t always something I feel I do well, but this week I had a lot of great conversations with clients, and sponsors, and Champions, and attendees, and speakers, and even taught one of the waitstaff how to play Pokemon Go.

Shean McManus and I gave our session, which was well attended, and I think went very well.  Here’s a link to the slide deck.

They’ve announced that next year will be in Washington DC “or environs”.  I hope to see you there!

Older posts «