Wednesday, October 30, 2019

Dino Dai Zovi : Aha

https://youtu.be/8armE3Wz0jk?t=1417

"I learned a valuable lesson that day - automation and software can be a force multiplier"
  1. Work backwards from the "job"
  2. Seek and apply leverage
  3. Culture >>> Strategy >>> Tactics  --- ">>>" = "way more powerful than.
Most successful software product in history? Unix

Apple No Match for Israeli Genius

Don't take my word for it. Here's the Ralph Langner of the smartphone world telling you about it :

https://speakerdeck.com/mbazaliy/pegasus-internals?slide=6

https://youtu.be/riRcYwOvamY


Sunday, October 27, 2019

There's Sliced Bread and There's.. (Vim - Coding Productivity)

Did you know you could just do "gg=G" (without the quotes of course) (hit 'g' twice, then '=', and then 'G') and get your entire file properly indented?

Man! K is P!

Saturday, October 26, 2019

Perl : Highlight Matches in String

That is, you have a string, and now, you have a bunch of patterns to match and, you now want to print the string with the matches highlighted. How/why?

Start with why so Simon don't cuss : You can use this to build your own personal search engine. Who needs to contend with the crappiness of Evernote?

How :

use Term::ANSIColor qw(:constants);
have your patterns in @regexes = ( 'string1', '\bword1\b', 'etc')

Then, (this one assumes all the items in @regexses will match. If that's not your data, put in an if :)

foreach $word ( @regexes ){
  $string =~ /^(.*?)($word)(.*?)$/;
  $string = $1 . UNDERLINE . $2 . RESET . $3;
}


Seem amateurish? :)

Sunday, October 20, 2019

What Do Career Criminals Look Like?

You thought Antwerp was big. How come I've never heard of these. When jewels are stolen, they're almost impossible to recover unless they're highly personalized.

These guys planned this for three years - the mark - a firm whose security systems were good for WW2, but not the 21st c..


The Ozzie take : https://www.youtube.com/watch?v=vgP4z1zBL0g

Going by this one (who knows?) - they couldn't have done it without YouTube tutorials on how to use drills for drilling through concrete. And, they used Forensics for Dummies. Nice. Did someone say something abou told dogs and new..?

Wednesday, October 16, 2019

Bow Bowman (Swim Coach, of M. Phelps) Spin on IBD's Success Tips


Num Maxim Notes
1 HOW YOU THINK IS EVERTHING Be positive. Have a picture in your head of where you want to go - that should be your focus - even Brian Crutcher says this
2 DECIDE UPON YOUR TRUE DREAMS AND GOALS Write them down and be specific. Goals should mean something to you
Remember Lombardi : Obstacles are what you see when you take your eyes off the goal
3 TAKE ACTION Remember Google's hiring checklist : Bias to Action!
4 NEVER STOP LEARNING Go to someone better than you and ask them questions
5 BE PERSISTENT AND WORK HARD Success is a marathon. Never give up.
6 LEARN TO ANALYZE DETAILS The higher up you go, the more the little things matter. Neils Bohr : an expert is someone who has made every mistake that can be made in a very narrow field
7 FOCUS YOUR TIME AND MONEY Don't let other people or things distract you
8 DON'T BE AFRAID TO INNOVATE Following the herd is a sure way to mediocrity
9 DEAL AND COMMUNICATE WITH PEOPLE EFFECTIVELY Keep adding to your tool box. Don't go through life with only a hammer
10 BE HONEST AND DEPENDABLE - TAKE RESPONSIBILITY All the others don't matter if you don't have this. 

Tuesday, October 15, 2019

Shame on CU Boulder

See what happens when you flip Charlie Nuttelman off. Kid? I don't need to listen to him or anyone else who knows more than me about Excel.

Duh! It takes 10 seconds or less to get this right. Select all and hit them align buttons and you're done.

Spot the ugliness here? That's right - you want to align the text in the cells vertically and horizontally (align Center is what is called for here)


Jeez, it gets worse. Look at this one in Week 2. How much are those undergrad student workers raking in to deliver this?

And of course, there's this :
And then, the giveaway, they have an Asian student doing the grunt work..

Wednesday, October 09, 2019

Kelly, Goldmeier and Bach - An Eternal Golden Braid

Whatever - needs an unconventional title don't it? Here's the challenge :

Your data looks like this :

Name N S E W
Alpha 700 800 900 500
Beta 2 3 5 6
Gamma 111 445 333 212
Delta 78 11 99 2

And, you want to be able to (easily) plot the bars for any ONE of the players AND, also make the largest bar STAND OUT. (Excel without VBA, overlay plots show bars from data with max bar highlighted)

What? If you're plotting the bars for Alpha, you don't want to see just this :


But, you want to see this! :


And, you want to be able to (easily) change between the players. There's a few things I didn't know you could do. The easy one is - if you have a chart and click on the title, you get to put in a formula! You just have to point it to the Data field that the user is going to use to "Choose the Player"!

First, the on-demand chart - that, is the plain vanilla (no max highlighting) that gets you a player's performance on demand (yes, I know it's salesman, but player sounds cooler, right?)

Easy - 

In  cell, put your cursor, then, go to the Data menu and then click on Data Validation (if you don't even see the Data menu, which I highly doubt. I can understand if you don't see the Developer menu)

In the resulting "Data Validation" dialog, set "Allow:" to List and for "Source:", click in the field and then go to the worksheet and click and drag through the cells containing the names. You can do this much with a pic right? :)

Now comes the fun - how do you get the numbers corresponding to the player you've chosen? (Using the drop-down)

Pure gold :

Enter (in one cell, and then you can drag ) :

=VLOOKUP(                             (and now notice the tooltip)

Now, when you're being prompted for "lookup_value"
you just click on the drop-down cell (where the user chooses the Player's name) you recently created with Data Validation, et al.

In my case, I get B19 when I do that. Is that what I want? Sort of. I want $B$19. The recipe? After clicking the reference, you hit F4. Did you know that? Ain't that cool?

Type the comma, and now the fun - it's asking you for the "table_array". Here, you select the entire table, but not the headers. So, you click and drag starting on Alpha and finishing on the "2" at the bottom right.  Yes, if you're wondering, that's not the only start and finish you can take :) But don't be perverse now :)

And then? Magic! Type the comma and then (without the quotes, duh) : "{2,3,4,5}"

The reasoning? If you noticed the tool-tip this time, it's asking you for column numbers. Well, the names are in Column 1, obviously :). But, why the curly braces and the array?

That comes in handy when you do the drag to fill. For now, just finish up with the final parenthesis, the ")" and see if Excel is happy (i.e., it has dutifully displayed the appropriate value from the "N" column for this Player. Yes? Good.

Your cell that you just finished will look something like this if you care for the formula :

=VLOOKUP($B$19,Table1,{2,3,4,5})

If you didn't format the data to be a table, then it's probably like this :

=VLOOKUP( $B$19, B26:F29, {2,3,4,5})

Now, you put your mouse pointer on the bottom right corner of this cell and drag over the next three cells to the right. You'll see four cells highlighted, and looking something like this

That's cause you need to give Excel more info - i.e., define this array. So, if these four aren't already selected, select them, then go to the formula field, and put your cursor in it and hit

CTRL+SHIFT+ENTER

This defines the array. You should now see them magically show the four values corresponding to this player. If you choose a different player with the drop-down, you should see the values update.

From here, on, the first chart is easy. You select the four cells, and the Insert a chart :

Just use this one for now :)


And you get your chart. You'll notice the X-axis don't exactly have the N,S,E,W :) What do you do?
You'll see the Chart Tools menu being active (look at your title bar :) Click on Design, and now you'll see button for "Select Data". In the resulting "Select Data Source" dialog, you click on the "Edit" button (how do you know it's a button? Don't ask me) and then, you get a new dialog called Axis Labels. You can now select the N, S, E, W cells and you're through. Phew :)


Okay, now to make this chart magical - that is, get the max bar to stand out!

Easy, all you do is make another four cells, (you get the idea, you're making another chart that you're going to paste over this one!) where only one has a number other than zero :) You dig?

Easy - you just enter

=C19*(C19=MAX($C$19:$F$19))

And drag this. See the logic? Unfortunately, hackers would prefer the "=" were actually "==", but M$ disagrees :(

"Cell-Value times 1 only-if-cell-value-is-max-of-these-four-cells else 0 "

Simple? The Boolean takes care of the 1 else 0 part.

Now, Just select these four cells and do a CTRL-C and then, click on your existing chart, and do a CTRL-V. Look at im! You have to give someone credit for at least making this one somewhat intuitive :)

Yup, we're not quite there. (If your eyes are open, you know you already have enough info to fix the "Chart Title" :) Go to it! ) That's where this guy helps out :


How do you get the red to dominate? Easy (if you know how :) - like with all things M$) :
Click on one of the bars, then right click and choose "Change Series Chart Type" :



Then, all you have to do is check the "Secondary Axis" checkbox for Series 2. And you're done!





How to Find the Path to One of Your Source Code Files in Visual Studio

 This is a full-featured professional editor that is accompanied by all the unfriendliness that suggests you have to pay our dues - sad. VS Code is so much nicer..

Anyhow, let's say you added a bunch of existing files to Source by right-clicking on "Source Files" in the Solution Explorer (what?) and now, hours later, you're curious where they actually reside.  You're entitled to know right? :)

Click on one of them, and then, down below, you'll see the Properties pane updating with the "Full Path" showing you where it is.

Unfriendly as hell..

Monday, October 07, 2019

Visual Studio Code Python Hello World

Okay, was following this one : https://www.youtube.com/watch?v=WdGyfCceCvM but it's a couple years old already, so some things are off..

For a start, to build-and-run, you have to set things up once.

But, unlike this geek says, it's no longer CTRL-SHIFT-P and then "Tasks : Configure Task Runner"

You have to go for "Tasks : Configure Default Build Task" -- choose the only "Creates tasks.json file from template" and then choose Others..

Honestly, this is not the way - that video is crap.

Try this : https://code.visualstudio.com/docs/python/python-tutorial

Crap. Even that on is sh*t. How does M$ get away with being so crappy?

I install Python from *their* store and then, I have to manually edit the path using sysdm.cpl and then, all I can get is python to give me something. And their effing doc says to try "py -0" and "py -3 --version". And, in the integrated terminal, even python doesn't give me respect. Damn M$!! Nadella my foot. Bordello is more like it. Or maybe Nutella - since that actually exists.

Now, on the VSC's Terminal not seeing python, yes, when it starts up, it captures the PATH and that's that - so, you either have to find a way to update VSC's path, or restart. Restarting is not too painful - so, with that done, it actually does find it.. - the new one that is :)

One decent leg that this tutorial doc has over the golf cap dude is the CTRL-SHIFT-P (Command Pallette) "Python: select interpreter" thing - it was finding my Anaconda installs..

And then, again, it's again hair pulling time - Terminal sees the new install of Python, but Command Pallette doesn't. *ds of M$!!

I'm watching the beginner series (why? after years of dabbling in py? I want to nail down modules and packages and string formatting and decorators once and for all :) from M$ : https://www.youtube.com/watch?v=jFCNu1-Xdsw&list=PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6&index=1

And I'm thinking... the freaking idiots - why can't they follow through - don't they, the software experts, and these are smart people we're talking about, see that people will notice they're typing

python filename.py

every time to run their snippets? Shouldn't an IDE (which is really what the course is marketing) have a run button? I set that up in the first five minutes. What gives????

And another kicker - when talking about dates, they're abandoning the US style and going with DMY - why? To appeal to an international audience?

Then, the whole virtual environments stuff - so poorly integrated into the IDE. And then you have to deal with powershell which is about one tenth of bash. *ds! Is it time for PyCharm?

For virtual environments, first
# install
pip install virtualenv

then they tell you how to create a new venv.. Duh - should you tell someone how to look for what venvs already exist?

python -m venv <new-folder-name>

Of course, no one tells you why "lsvirtualenv" doesn't work :)

To activate an environment,

> <new-folder-name>\Scripts\Activate.bat # if you're in the cmd prompt

In powershell, it's
> <new-folder-name>\Scripts\Activate.ps1




Excel VBA Hack : Go to the First Column of Your Table (Not Sheet)

You can't use (which you can get from the Macro Recorder) :

Selection.End(xlToLeft).Select  -- because, if you're already at the first column, you exit the Table and, if you're too far to the right (and still in the Table), you don't go to the first column. Why don't they ask you what you're really trying to do :) ?

What does work :

(only within a Sub, mind you :)

Cells(ActiveCell.Row, ActiveCell.ListObject.Range.Column).Select

Excel VBA recipes - better than making a separate post for each one..

How to get the name of the first worksheet in your workbook :

ActiveWorkbook.Worksheets(1).Name

Sunday, October 06, 2019

One Definition of Crappy : Get Skye Drone - What Would Elon Do?

Read Elon Musk by Ashlee Vance - you get fired for not having done anything great in six months. And PR people get fired for typos in emails. Nice. Tesla might be controversial, but they're great because they make great products. Sure, they need to figure out how to make money, but..

Anyhow, see if you can figure out why these dudes trying to make it on their own can't even spell better than third graders..



And here's another stafe/strafe. Really, how difficult can this be? Is it the Yahoo boys or the Nigerian email scam guys doing this? Only market to those dumb enough to not see through the typos?