Monday, February 19, 2018

The Uselessness of Microsoft Excel

How can such a simple feature be missing from such a key product?

I want to search for "form" and not find "information". That is, I want to "match entire word".

Why? Why? Why?

Please, developer, developer, developer, developer, developer,.... *ds!

Saturday, February 03, 2018

Beating a Bad Web Page

As in a page whose user experience could be better :

https://www.thefreedictionary.com/words-that-start-with-wit

What, specifically? Scroll down, and you now have to scroll back up to get back to the text field. Wouldn't it be nice if that entry field was always within view no matter where in the page you went?

Enter frames - the poor man's solution :)

I want to have one frame with a text box where I can enter the prefix, and hit Go and load the result in the frame on the right. Doesn't work! Why? What's special about this website? The page sort of loads up - partially... They tell you, something's wrong..

Fortunately, I have a solution that works okay if I say open in new tab. Other, less useful pages work fine, but thefreedictionary does not.. Go figure..

I feel like I've arrived as a webeloper with that hack that selects the text in the field when you click on it :)

For your index.html :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset cols="20%,80%">
<frame name="left" src="input.html" />
<frame id="right" name="right" src="http://www.wordfind.com/starts-with/tru/" />
</frameset>
</html>

And for the input.html :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script type="text/javascript">
function process()
{
  var seturl="https://www.thefreedictionary.com/words-that-start-with-" + document.getElementById("url").value;
  window.open( seturl, '_blank');
  return false;
}
</script>
  <form  onSubmit="return process();" >
Prefix: <input onClick="this.select();" type="text" name="url" id="url"> <input type="submit" value="go">
  </form>
</body>
</html>


And, you guessed it. With my OCD, I want more - the text input field is way too small - you want to be able to click anywhere - a bigger target boosts productivity :) So, :

<input onClick="this.select();" type="text" style="height:200px; font-size:30px;" name="url" id="url">

Helps big time!!

At the end - the frames part didn't really help - in fact, it only hurts  - coz we're not using it at all..
Meaning? Use just the input.html and you'll be fine - use that for your bookmark. Now, if you have OCD like me, you want to get the focus in the input field, with the text selected when you activate the tab that this page is in.. For starters, when the page loads, you want the cursor in the text field :) And then, anytime you "return" to this tab, you want to focus in the text field, and you want all the text selected so you can replace it..

<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script type="text/javascript">
function process()
{
  var seturl="https://www.thefreedictionary.com/words-that-start-with-" + document.getElementById("url").value;
  window.open( seturl, '_blank');
  return false;
}

function onFocus(){
 document.getElementById("url").select();
};
// http://www.thefutureoftheweb.com/demo/2007-05-16-detect-browser-window-focus/
window.onfocus = onFocus;

</script>
  <form  id="wform" onSubmit="return process();" >
Prefix: <input onClick="this.select();" type="text" autofocus="autofocus" style="height:200px; font-size:30px;" name="url" id="url">
  </form>
</body>
</html>

Still Pulling it Off Though Age Piles Up

once in a while :)


Monday, January 22, 2018

Unix Cut Command Omit Specified Fields

Nice work by the desi gang here - and they're actually pulling in ad revenue from AMZN!

https://www.geeksforgeeks.org/cut-command-linux-examples/

https://www.thegeekstuff.com/2013/06/cut-command-examples

$ cut --complement -d':' -f2,2

will omit column 2 in the output..

Saturday, January 20, 2018

Pretty Print a urllib urlopen Response

So, you did

data = urllib2.urlopen( full_url )

Now you want to look at the web page you got back. You try

print( data ) and that doesn't help.

Do :

print( data.read() )

https://pythonprogramming.net/urllib-tutorial-python-3/

Sunday, January 14, 2018

Blinded by the Prize : Dan Goleman

Struck a chord with me - I've had to work with such a$$h's unfortunately...

She was a partner at a huge law firm who drove her team crazy. She micromanaged, constantly second guessing them, re-writing reports that didn't meet her standards even though they were perfectly fine. She could always find something to criticize but nothing to praise. Her steadfast focus on the negative demoralized her team. A star member quit and others were looking to move laterally in the firm.

Those who, like that high-achieving lawyer have this high-achieving super-focused style are called pace-setters - meaning they like to lead by example, setting a fast pace they assume others will imitate. Pace-setters tend to rely on a command and coerce leadership strategy where they simply give orders and expect obedience. Leaders who display just the pace-setting or commanding style or both, but not any others, create a toxic climate that dispirits those they lead. They may get short term results through personal heroics like going out and getting a deal themselves, but do so at the expense of building their organizations. "Leadership run amok" was Harvard Biz Review's title for an article about the dark side of pace-setting written by Scott Spire and his colleagues at Hay Group. Spire told me, "They are so focused on the prize, they are blinded to their impact on the people around them in the room." Spire's article offered up that hard-driving law partner as a prime example of pace-setting at its worst. Such leaders don't listen, let alone make decisions by consensus. They don't spend time getting to know the people they work with day in and out, but relate to them in their one-dimensional roles. They don't help people develop new strengths and refine their abilities but simply dismiss their need to learn as a failing. They come off as arrogant and impatient. And, they're spreading. One tracking study finds that the number of people in organizations of all kinds who are over achievers has been climbing steadily among those who are in leadership positions since the 1990's. That was a period when economic growth created an atmosphere when raise the bar at any cost heroics were lionized. The downside to this style, for example, lapses in ethics, etc were too often winked at - sound familiar Uber?

How come Google doesn't have such issues?

Wednesday, January 10, 2018

The Kiczales HtDF Way

To design Functions :

1. Signature, purpose, stub.
2. Define examples, wrap each in check-expect.
3. Template and inventory.
4. Code function and body.
5. Test and debug till done.

signature : type of each arg, separated by spaces, followed by -> type of result.
purpose - a meaningful one line statement.
stub : syntactically complete function definition that produces a value of the right ype. This makes it possible to run examples even before the function design is complete..

You ain't got UBC under your thumbnail for nothin bro.

Unix : Print a Specific Line from a File (sed)

you want to print line number N, where N may be 31 (say)

> sed -n '31p'

When you have time :

https://zwischenzugs.com/2018/01/21/ten-more-things-i-wish-id-known-about-bash/
Sure to be some nuggest you can ues somedya.

Ian also has a book on bash : ($8 max - you could pay less if you want) https://leanpub.com/learnbashthehardway

Wednesday, January 03, 2018

Amazon Insights : Remote Teams Should NOT Communicate

From the big man himself, after junior execs suggested ways to improve communication :

"I understand what you are saying, but you are totally wrong. Communication is a sign of dysfunction. It means people aren't working together in a close, organic way. We should be trying to figure out a way for teams to communicate less with each other, not more."

"A hierarchy isn't responsive enough to change. I'm still trying to get people to do occasionally what I ask. And if I was successful, maybe we wouldn't have right kind of company."

Sunday, December 31, 2017

Congratulations Vietnam

As General William DePuy told the French general who said the South Vietnamese were incapable of fighting : "They kicked your ass at Dien Bien Phu!"

Congratulations and congratulations Korea! Again!

China as reliable as ever. And congratulations India on picking up the pace going the other way - out of the top-50 now. Behind Saudi, Bangladesh, Peru..

CountryTeam sizeP1P2P3P4P5P6TotalRankAwardsLeaderDeputy leader
AllMFGSBHM
Republic of Korea6514239142222417016000Yongjin SongSuyoung Choi
People's Republic of China664225042193115925100Yijun YaoSihui Zhang
Vietnam664236042211415534110Anh Vinh LêBá Khánh Trình Lê
United States of America664229042231214843300Po-Shen LohBrian Lawrence
Islamic Republic of Iran66423204217914252310Omid Hatami VarzanehSeyed Hesam Firouzi
Japan66412104223713462220Yasuo MoritaKeiko Tasaki
Singapore66422603722413172121Yan Loi WongXinghuan Ai
Contestant [♀♂][←]CountryP1P2P3P4P5P6TotalRankAward
Amirmojtaba SabourIslamic Republic of Iran770777351Gold medal
Yuta TakayaJapan770777351Gold medal
Hữu Quốc Huy HoàngVietnam770777351Gold medal
Qiuyu RenPeople's Republic of China770774324Gold medal
Aleksandre SaatashviliGeorgia770773315Gold medal
James LinUnited States of America770772306Gold medal

Are you, like me, wondering what was so tricky about Problem 3? (I'm clueless, ICYW). Nice variation on the curve of pursuit problem I first saw in Brilliant Tutorials (lifted from Irodov).

Problem 3. A hunter and an invisible rabbit play a game in the Euclidean plane. The rabbit’s starting point, A0, and the hunter’s starting point, B0, are the same. After n−1 rounds of the game, the rabbit is at point An−1 and the hunter is at point Bn−1.

In the n th round of the game, three things occur in order.
(i) The rabbit moves invisibly to a point An such that the distance between An−1 and An is exactly 1.
(ii) A tracking device reports a point Pn to the hunter. The only guarantee provided by the tracking device to the hunter is that the distance between Pn and An is at most 1.

(iii) The hunter moves visibly to a point Bn such that the distance between Bn−1 and Bn is exactly 1.

Is it always possible, no matter how the rabbit moves, and no matter what points are reported by the tracking device, for the hunter to choose her moves so that after 109 rounds she can ensure that the distance between her and the rabbit is at most 100?