Posts

System Testing Bookmarklets: Selenium

My switch search engine bookmarklet had two bugs. First when I deployed the page, the URL was screwed up (thanks for telling me Chris) and second my bookmarklet was incompatible with FireFox[1].   Conveniently the software engineering community has a solution to this class of problems and it's called  system testing. In this context, System testing means interact with the web pages via a browser just like users do.  I did some digging and I couldn't find a perfect (or awesome) tool for system testing web apps. I was able to get a tool that could drive FireFox and Chrome (IE isn't working).  This tool had some warts, and took some experimentation to get working, but it mostly meets the needs. Please comment if you find a better tool! The tool I used is called Selenium , and it's scriptable via python (also Java and C#). Selenium is able to impersonate a user performing actions via the common web browsers. The code below should make reasonable sense to someone f...

Assembly to JavaScript;TSRs to Bookmarklets

Image
Back when I started computing (the nineties), the coolest thing to to know was assembly. If you knew assembly you could make the computer do anything because the computer was essentially executing assembly[1]. Back in those days the way to inject code into the system was something called a Terminate And Stay Resident ( TSR ). This mini application could be invoked via a hotkey and run arbitrary code in your memory space - this was a great way to hack applications, or provide additional capabilities to programs. Luckily history repeats itself.  Today, assembly has been replace by JavaScript, and  the mechanism for  TSRs is called bookmarklets. Bookmarklets are book marks which execute arbitrary javascript code. To show you the power of bookmarklets I wrote a JavaScript bookmarklet that will take a search from  bing and run it on google or vice versa. You can install it by dragging  SwapSearchEngine  to your bo...

Soft Skills: Listen to people, and understand what they are telling you

( This post is not designed to be belittling, instead it's designed to be root cause analysis.) When Zach, my two year old, figures something out he screams out barely intelligible words and repeats them until I can figure out what he is saying and repeat it back to him.  The more non-obvious Zach's discovery the more insistent Zach will be that I understand his unintelligible statement. For example, the other day Zach and I were outside and Zach started screaming buddaf -  I was baffled! Zach was very insistent so I started looking around and sure enough I found a picture of a butterfly painted on a bus stop. I screamed butterfly, and Zach became ecstatic and we were able to move on to another topic. By contrast if I can't figure out what Zach is saying he gets sad, and acts rejected. This morning at breakfast Zach wanted something and I couldn't figure out what it was.  For 3 minutes Zach kept repeating masfd (which I still can't figure out) with vigour and ...

Cool Tools:Excel Online - The web services I use

I wanted to show off embedding online spreadsheets from excel and sky drive, and remind myself how much I spend renting content, hosting, and renting software.  So, here's what an embedded excel sheet looks like To produce, save an excel file to your sky drive then click Share then Embedded: The excel web app control is great, you can sort, filter, or make local modifications (they are not saved to the original). Anyway - have fun with this.

The 5 assignment operators of "R"

In every programming language I've used, '=' is the assignment operator, but in R you can assign 1 to x in the 5 different ways  listed below.  I'm sharing this with you because it reminded me how many ways there are to skin a cat, and how each of those choices has tradeoffs. [A] x = 1 [B] x <-1 [C] 1 -> x [D] x <<- 1 [E] 1 ->> x [A] x = 1 '=' is supported in R, but rarely used.   Google Style Guide  says don't use it. And I've never seen R code that does. [B] x <-1 '<-' Is the most commonly used, so you'll almost always see x<-1.  Some R people claim x<-1 is a superior assignment operator since the '=' assignment  operator (x=1) can be confused with the equality operator (x==1).     It strikes me the '<-' assignment operator can be confusing as well.  When using negative integers a single space can really change the meaning aka: x<-1 vs x < -1. Trade offs are everywhere! ...

Pain Alignment - Align the pain with who you want to fix the problem.

Image
As a  manager, I have to build systems to make people do the right thing. For example, if I want software engineers to make the software testable, I make the same software engineers in charge of testing (This is not a majority Microsoft opinion)! I call this strategy Pain Alignment. I heard a great example of pain alignment  on my run this morning and I'm going to share it Verbatim:    Rocky (not his real name) lived in a house with single paned glass in the city. Being in the city his house was very close to the neighbors.  Unfortunately for Rocky his neighbor's house had nice double paned windows and if the dogs barked outside it didn't bother them.  One day his neighbors decided they needed some yippy dogs.  At first this was fine since the dogs lived in the house, and the neighbors walked the dogs regularly. Soon the neighbors realized walking the dogs was a lot of work, and they installed a dog door. Now the dogs could run into the yard and bark...

Why is the internet covered in ads (aka How much does a website makes on ads)

More and more, I've been noticing the internet is covered in ads. While this is annoying it's parallel to the real world. Drive down any physical highway and you are assaulted with billboard ads, the information super highway ( does that date me? ) is just as covered. Why is the internet covered in ads? Because it's good money. Lets work through an example, first some terms and values: TLA Term Value Definition CTR Click Through Rate 0.3% % of times an add will be clicked EPC Earning Per Click $0.10 Average $ received when a user clicks RPM Revenue/Thousand Impressions $3.00 Amount of money you make when you show 1000 ads. If you can show 1000 ads your website will make 3$.   This doesn't sound like much, but lets look at how much traffic some websites get. Lets use livestrong.com , a health and wellness website, as an example.   Sites which tell you how much traffic a site gets are compete ,  alexa  and google ad planner .  Compete es...

Real World Artificial Intelligence

Today's  AI interaction was a spam chat bot.  Spam is an excellent example of big numbers times times tiny probabilities. Below is the transcript of me talking to an AI (calikelya3) I especially like lines 5/6 and 7/8.  Impressively there was some pattern matching to handle line 9. 1) me: who are you? 2) calikeyla3: hey Im ashley. Dont you remember? 3) me: Did we meet at that conference? 4) calikeyla3: hey whats up? 22/F here. you? 5) me: are you a computer 6) calikeyla3: hmm. have we chatted before? 7) me: I have a fish 8) calikeyla3:  oh ok. i wasnt sure. anyways.. whats up? 9) me: Do you have naked pictures? 10) calikeyla3: No sorry not on this computer 11) me: How do you want to get my money then? 12) calikeyla3:  im like so boreddddddddd.... theres nothing to do ohhh wait! i got a idea. have you ever watched a girl strip on a cam before? 13) me: This is what I was waiting for 14) calikeyla3: it turns me on ...

Dealing with task overload

All of us get to a point where our boss (*) gives us more work than we can handle.   With more work than we can handle one of three types of conversations will occur: Type Time Conversation B : too Busy When task assigned I’ve got too much on my plate, what can we take off to make this fit? F: I Failed/We're F@#$'d When task becomes a failure I couldn’t get this done, now we’re screwed what would you like to do. Q : I Quit When burned out I haven’t seen my family in weeks, my fish died of starvation - I quit! Even if you're not yet in task overload think very hard about which conversation your boss would rather have.   If your boss would rather conversation F or Q, you need to find a new job(+). I'll assume after doing the previous mental exercise you're not out looking for work, so let's ponder how to have conversation B. Clearly your boss didn't give you a task because she was bored, she needed the work done.  Bring your boss your current ...

Do you have a problem?

Recently I became a developer lead.  In case your company uses different titles, a developer lead is a software developer who has software developers reporting to her. Since I became a lead, I've realized the different roles in an organization see the world differently. The table summarizes how different roles see a problem. Role Says Thinks Developer We have a Problem F@!#$ one more thing to fix, how am I going to get this done Lead We have a challenge Something isn’t the way we want, we’ll get it fixed Manager (Lead of Leads) We have an opportunity My competent teams will solve this. Director Of Development (Lead Of Managers) We have a functioning team You think that's a problem? Ha ha, you'll fix it. You should see what i have to fix. I'm not sure if this is brilliant, or just funny. Maybe it'll become the career choice acid test :)

AlgoRhyme

Today, I had lunch with the mother of the internet . Among other things she told me her poem that accompanied the spanning tree protocol . Perhaps if a poem was required for each algorithom and protocol submission,  computer science would be simple and clear. With great pleasure I reproduce Radia's poem: AlgoRhyme I think that I shall never see a graph more lovely than a tree. A tree whose crucial property is loop-free connectivity. A tree that must be sure to span so packet can reach every LAN. First, the root must be selected. By ID, it is elected. Least-cost paths from root are traced. In the tree, these paths are placed. A mesh is made by folks like me, then bridges find a spanning tree. Radia Perlman

F# and the immediate window

(This post is inspired from t his Stack Overflow question ) F# debugger integration is quite good, except for the immediate window. The immediate window requires C# style syntax, so calling F# functions is not intuitive. Below are recipes for the immediate window integrated into a console application. As always code can be found here : // Learn how to use the immediate window for F#. module Program= // To build, add a reference to Microsoft.CSharp. This is required for dynamic support in // the debugger. let allowDynamicToWorkFromImmediateWindowByLoadingCSharpBinders = Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.BinaryOperationLogical let plusOne = (+)1 let xPlusOnes = [1;2;3] |> Seq.map plusOne [ ] let main (args) = printfn "Try the following in the immediate window: // plusOne 4 ((dynamic)plusOne).Invoke(4) // Seq.Head xPlusOnes Microsoft.FSharp.Collections.SeqModule.Head(xPlusOnes) // let xPlusTwos= xP...

Using WinDBG/CDB and SOS to find a thread given a ManagedThreadId

CDB and SOS have more power than most people realize, I’ll use this post to show some some handy cdb/sos tricks while at the same answering the simple question of which thread a ManagedThreadId maps to. At the end of this post you’ll be able to: Map a ManagedThreadId to the correct thread ordinal Use CDB to convert from decimal to hex Pipe CDB commands through pipeline commands like findstr Full source for the simple app below can be found here . In the below app we want to figure which thread we’re running on so we can inspect the stack. internal class Program { private static void SleepForever() { Thread.Sleep(Int32.MaxValue); } static void Main(string[] args) { const int countThreadsToStart = 20; foreach (var unused in Enumerable.Range(0, countThreadsToStart)) { // Instantiate thread that prints and stores its ManagedThreadId. new Thread(() => {...

Use Paint.Net to Highlight key areas in an image to get your point across

Image
(Since posting this I've also become very fond of  Jing , which is the tool I use when taking screen shots) Earlier , I mentioned how important communication is to software engineering. A key tool in communication is being able to highlight portions of images.  For this task I use some basic features of Paint.Net .  In the below image I want to draw your attention to the name of the dress, and the name of the color of the dress. Without these highlighted regions, it's likely your eye wouldn't have picked up the points I wanted you to see. To perform these highlights in Paint.Net do the following: Copy image into Paint.Net Select the ellipse tool Specify Fill Options as Draw shape with outline Set Secondary color(the fill color) to yellow Set transparency to 50 % Draw ellipse

Cool Tools: Paint.Net

Paint.Net is a nice compromise between advanced picture editing software, and picture editing software usable by humans. The biggest problem I had with paint.net is figuring out how to download it. In what I assume is an attempt to make advertising dollars, this website exists that make it impossible to download Paint.net without accidentally downloading crap.  Here's a direct paint.net download link . Update here are my usages of Paint.Net: Highlighting portions of an image  Other you'd like to see

Leading by praise: How to use a carrot when you really want a stick.

Many naive leaders believe they have two ways to enact change in their followers.  The first way is "the carrot" aka praising good behavior. The second way is "the stick"  aka criticizing bad behavior.  In my experience, the stick is extremely ineffective. I'd say the only time the stick has any positive impact is when the follower doesn't realize she's doing something wrong, or how serious that wrong thing is.   The goal of this post is how to use a carrot when you want a stick.  First lets recall how to use a carrot effectively in general: Keep it timely, short, specific and often (the one minute manager is my hero).  Any time you see a new good behavior praise it.  When you praise,  be as specific as possible so the follower knows both the behavior you are praising and the valuable impact of that behavior.  It's easy to praise when things go well, but how do we praise when things are going poorly? When things a...

Google killed the video store

As a younger man I remember arguing with a co-worker about the death of local storage.  Me: Who wants to store data themselves?  I can store all data in the cloud, where it will be preserved forever! Wiser co-worker: What incentive does this cloud have to keep your data? I'll keep my data on my local hard drive thank you very much!   8 years later my co-worker was  correct. I got the following letter from Google today: Later this month, hosted video content on Google Video will no longer be available for playback. <snip> We’ve added a Download button to the video status page, so you can download any video content you want to save. If you don’t want to download your content, you don’t need to do anything. (The Download feature will be disabled after May 13, 2011) Ouch for being wrong,  and double ouch for having to download all my videos to my hard drive. Notes: Astute readers will note, I actually got a decent deal since I got 8 years of free s...

Software Engineering “The Soft Skills”

To date, I've focused my blog on the "computer" parts of software engineering. However, as I've grown as a software engineer, one of my largest aha moments is the realization that software engineering is all about people. As such, I'll start posting articles dealing not just with computers, but also with communication, people leadership and management. These "people skills" are as important to a software engineer as the ability to crank out a design specification. For the hardcore among you that think people skills have nothing to do with software, consider this .

Powershell script to enable windows to capture localhost traffic in wireshark

If you want to understand why the following scripts work read this post . Otherwise just paste the following into an elevated powershell window: Setup windows networking to allow localhost capturing in wireshark: # Find the network configuration that has the default gateway. $defaultAdapter = Get-WMIObject Win32_NetworkAdapterConfiguration | ? {$_.DefaultIPGateway} if (@($defaultAdapter).Length -ne 1) {throw "You don't have 1 default gateway, your network configuration is not supported" } # Route local IP address via the default gateway route add $defaultAdapter.IPAddress[0] $defaultAdapter.DefaultIPGateway Write-Host "Start capturing on localhost by connecting to $($defaultAdapter.IPAddress[0])" Return windows networking to normal configuration: # Find the network configuration that has the default gateway. $defaultAdapter = Get-WMIObject Win32_NetworkAdapterConfiguration | ? {$_.DefaultIPGateway} if (@($defaultAdapter).Length -ne 1) {throw "Y...

How did we get a 53 byte packet size in ATM?

I'll be honest, I don't know squat about ATM, but I was having lunch with this fellow , and he told me the story of the 53 byte ATM packet.  You can find more details on Wikipedia , but here’s the synopsis: (Disclaimer: I’m not an expert in ATM; nor am I trying to teach you technical details about ATM networks; so I’ll hand wave and trade off accuracy for simplicity. For example, ATM does have variable sized packets which it divides into cells, and it is the cells which are 53 bytes long. However, since the closest thing to a cell in common networks is an Ethernet packet, I’ll simply refer to cells as packets.) ATM is designed to be shared between data network applications, and voice network applications(+). In data networks we want large packets because this gives maximum efficiency.  This is because each packet has a fixed size header and thus the more data you can transmit per packet , the higher your ‘real’ throughput. For voice networks we want to reduce latency...