Friday, December 15, 2017

As long as there’s another code snippet to try, there’s hope!

Some days it feels like I am the last XPager standing but in my mind I know the reality is far from that.  I mean, come on, Paul Calhoun is still doing XPages as well!  Ha ha ha.

Anyway our application has morphed into quite a best of functionality over the years so it is not often I need to go to the bit bucket to find new code but recently I had to do just that.

The task was actually very simple:  A user clicks a link, we copy some text to their clipboard for them.

That's it.

Alas...I found that was not as easy as it sounds.  The good news for us is we only support current browser releases and only IE11+ but still all of the existing code libraries I tried just did not want to work with XPages.

I looked around and found clipboardjs.com then I found clipboard-polyfill but in a rush those libraries just would not work inside an XPage.

In my typical Soviet-style coding paradigm (does not need to be pretty, it just has to work) I found and used the following code:
function copyToClipboard(str) {
function listener(e) {
e.clipboardData.setData("text/plain", str);
e.preventDefault();
}

document.addEventListener("copy", listener);
document.execCommand("copy");
document.removeEventListener("copy", listener);

};

Alas, it does not work in IE or Safari.  Dang.

Then I went back to trying to get the previously mentioned libraries to work.  I had more time so I figured I could code more in a Japanese-style paradigm (works + elegant).  Nope.  I could make those libraries work on a Domino server just fine, just not in an XPage or even a Notes DB (all on the web of course).

So then I found this on Stack Overflow...and Poof!

We have a solution!
function copyText(text){
function selectElementText(element) {
if (document.selection) {
var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
} else if (window.getSelection) {
var range = document.createRange();
range.selectNode(element);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
}
}
var element = document.createElement('DIV');
element.textContent = text;
document.body.appendChild(element);
selectElementText(element);
document.execCommand('copy');
element.style.display="none";
alert("Copied!")
//element.remove();
}

All I had to do was remove the last line for IE ( it does not like it), add the line to set the display to none and for good measure I added an alert so the user knows "It worked!"


Saturday, October 28, 2017

I say it here, it happens there...


Love to know what the actual price was.  I'm guessing it was less than $100M.

I said...


IBM Says...

IBM Announces Investment in Notes Domino Version 10 and Beyond by announcing a "partnership" with HCL Technologies which is essentially HCL Technologies getting all of the hard work (and IBM Notes and Domino) and IBM just selling the product.



Monday, April 10, 2017

The Announcement United's CEO Should Make


Um yeah this...http://cbs4indy.com/2017/04/10/man-forcibly-dragged-off-plane-after-refusing-to-give-up-seat-to-united-employee/


Here is the press release/announcement that Oscar Munoz, CEO of United Airlines, should make immediately:


Response to United Express Flight 3411



April 10, 2017


“This is an upsetting event for all of our United customers.  I apologize for this incident.

We, all of us at United, were wrong in this situation.  We will be taking the following positive steps in order to win back the trust of our customers.

First, we will work with the appropriate authorities to ensure that no criminal or civil charges are brought against any passenger involved with this situation for any reason.

Second, we will work with the passenger who was forcibly removed when required to give up his seat to a United employee to ensure that he receives significant and just financial compensation for our wrongdoing.

Third, effective immediately, all United staff involved with this situation are being reassigned to new duties elsewhere in the company that does not involve interacting with customers.

Finally, effective immediately United will never again require any customer to give up their seat on any of our flights to a United employee or any other airlines' employees for any reason.


– Oscar Munoz, CEO, United Airlines

Friday, January 6, 2017

Manage Your Doctors

Friday morning, December 16, 2016,  I arrived at my mother-in-law's home for a routine "take her dog to groomer" pickup and was greeted with the sight of several emergency vehicles right in front of her place.  She had fallen outside and hit her head.

Based on what we were told by the emergency doctors which was essentially "...let us cut two large holes in her head to drain the bleeding, she will not be the same person in any case, we would not do that to our mothers...OR let nature take its course here...", I sent this text to family later that morning...


Yesterday my 87 year old mother-in-law left the hospital to go to a rehab facility and, frankly, I think it is actually possible she might end up having a 90% - 100% recovery and may even be able to return to her own home.

I would never tell anyone to ignore doctors BUT you do need to MANAGE them.  The number of times doctors wrote Ginny off in the last weeks was astounding and our protestations that we were seeing "her" in her movements even when she was unconscious for days were unwaveringly met with polite and sometimes disdainful smiles and comments was quite surprising.  Since we had already made The Hard Decision on Day 1, we were prepared for The Worst but she continued to improve most days.

ADVICE: Ask way too many questions of your doctors when it comes to any procedure, condition or treatment.  Nurses know things.  Ask them for their advice.  You're The Boss of You and your family when it comes to health care decisions.

Saturday, December 31, 2016

2016 Rating: Mixed

2016 over in about 11 hours for me so I took a look at the calendar for this year to see what happened.


January

Daughter #1 turned 27.


February 

Grandmother turned 100.  Big Party in Oklahoma City.  Very cool.

Two weeks for the Mrs. and me on Big Island, Hawaii.  Loved it.


March

Turned 53.  Wife took me to see Brad Paisley play in down state Illinois.


May

Spent week before Memorial Day in Orlando/Disney World.  Nice time with the Mrs.


June

QDiligence exhibited at national conference for Corporate Secretaries (the ones for The Boards, not the other ones) in Colorado Springs and stayed at The Broadmoor.  No idea how I'd never heard of that place before but it is A Special Place.


July

10th Wedding Anniversary!  Had dinner at Alinea (finally) to celebrate.


September

Labor Day weekend in southern Ohio in a cabin with The Kids.  Very fun.


October/November

Cubs won World Series.  Hillary Clinton lost the election.  Both good.

Grandmother diagnosed with cancer.

Cousin's husband diagnosed with cancer after they punctured his colon, twice, during a routine colonoscopy.


December

Daughter #2 turned 26.

Mother-in-law fell and cracked her skull a week before Christmas and is living on to tell the tale.

Grandmother still hanging in there.  Likely to see 101.

Cousin's husband making his way through chemo.  Likely to see 51.

Kids did Christmas for us here in Chicago.


Business continues to be very good.  Our impact on the industry has never been more evident.

We're gonna' give 2016 a Rating of...Mixed.