to type or not to type…

that is the question.  Rather than a Shakespeare reference, I’m here referring to a term in software development which determines how a language deals with variables, for example.

Define: type

When you create a variable in a computer language, it’s usually something like this:

var someVarName = 1;

In a case like this, we might infer that someVarName stores a number (an integer).  We might say that the someVarName‘s type is integer.  Using a pet-ownership metaphor, it’s like purchasing a dog house first (“someVarName”) and then next buying a dog to put into it (“1”).  You wouldn’t buy a fish bowl to store a dog… although this seems to work out great if you own a cat.  JavaScript, e.g., is like this picture:  it doesn’t seemingly care if you want to store a cat in a fish bowl.

cat-in-a-bowl

Two Schools of Thought

There are two camps out there:  those who like languages which force the variable type and those who don’t.

A statically-typed language usually involves a step in which your code is converted into something else (compiling) and any type-related issues must be fixed before a program can be created.

A dynamically-typed language is run “as is” and the code is evaluated at the moment of truth—determinations about the type of a variable are made at this time.  If there is a type-related issue, your end-user could be the first person to see the error.

Statically-Typed Dynamically-Typed
Java JavaScript
C++ Python
C# PHP
C Objective-C

The Pendulum Swings

Over the past three decades, the popularity of either approach has waxed and waned.  It’s safe to suggest for the moment that the less-strict languages are gaining rapidly in popularity over their stricter counterparts.

most-popular

We have the world of open source to thank for the popularity and speed of development we’re currently seeing in these dynamically-typed languages like JavaScript and Python.

Seeing the Future

Honestly, though, there are too many people in that strict-is-better camp and their influence is felt within software development companies.  If I were to guess at the future of JavaScript, I’d probably have to say that TypeScript and Flow will gain in popularity as larger development teams look to lower the number of bugs in their code.

I don’t know, though.  Maybe it’s time that we just relax and let the cat hang out in the fish bowl.

 

the power of seo

Everyone wants to sell you search engine optimization (SEO) as a service.  I’m sure there’s good money in doing that but I’ve never paid anyone for this since it’s easy enough to do yourself.  The higher you are in a Google search result, the more likely that you’ll be seen.  And the more likely you’re seen, the more likely your blog will be read.

“Roll Your Own” SEO

Believe it or not, one of my most popular blog posts of all time is “why PowerShell sucks so badly”, enjoying 743 views so far (mostly from searches in Google).  Viewing this graph, clearly something changed between Jul & Aug of 2016.

powershell-sucks

The views for this blog post were all 100% organic (unaffected by anyone’s attempts to manipulate search engine placement) before August 2016.  If you typed in “powershell sucks” into Google before this time you would have had to search page after page within their results to find any mention of my blog.

August 2016

Somewhere during that month, I noticed the popularity of this particular blog post and wanted to do an experiment.  Up until this point there might have been a total of 50 views, making it one of my most popular posts at the time.

Daily, for about a week, I visited Google and typed in “powershell sucks”, then walked through the pages of results until I found the link to my own post.  I then clicked the link and parked that browser.  (It’s important to just appear as if you’re actually reading the content because Google’s JavaScript is tracking your behavior.)

It’s only necessary to do this once per day, to be honest.  It doesn’t take much to make an otherwise-obscure blog post gain in popularity in the “eyes” of Google’s search engine.

I repeated this behavior until the blog post was listed in the top five entries of the first page of results and then let nature take its course.

The Result

Of course, the Internet loves to complain.  From this point on, the Internet-at-large would then see the blurb in Google’s search results and offer to them the promise of a rant by some distant blogger (Yours Truly).  They clicked the link, landed on the page and were instantly rewarded by a smarmy commentary on my frustrations with PowerShell.

Once this “pump” was primed by my own efforts, it was unnecessary to do anything other than to continue to write content.  Well, at least, I write content which I myself would be interested in reading.

Have I learned anything from all this?  The Internet appears to love a post whose title resonates with something they’re feeling at the moment.  For comparitive purposes, I demonstrate that “too much fun” received three views and “windows 10 sucks balls” has about 120 so far.

Do you change your blogging style to accommodate the prevailing mood of the Internet?  I wouldn’t suggest that.  Just write.  Try to find something interesting and say what you need to say.

windows-10-sucks

too-much-fun

the rise and fall of the microsoft empire

1975-1980

Our historical timeline begins in 1975 when an unlikely duo—Paul Allen as Batman and Bill Gates as his awkward “Boy Wonder”—started Microsoft Corporation.  I’m guessing that ro-sham-bo was involved in this decision but incredibly somehow Bill was made the CEO when the company got its start.  Maybe dropping out of Harvard gives you that kind of confidence.

1981BillPaul

1981-2000

Nothing really significant happened until they managed to modify an existing operating system for the IBM PC in 1981 from another company and rename this to MS-DOS. Significant sales of the IBM series of computers and those of their competitors then launched a thirty-year stretch of dominance in the business world in the area of operating systems, software and development platforms.

For most of us, we reasonably dismissed Apple’s hardware and the MacIntosh operating systems as nothing we could seriously use in business outside of the marketing department.

Consumers bought new versions of software and that license was good for life.  It could often be transferred from one computer to the next as long as the last one was de-registered first.  If you built software for Windows, you likely used a Microsoft compiler to do so and you paid for that.  In fact, the Microsoft Technet collection of CDs was quite expensive.

2001

About six years into the “Internet Tidal Wave” as Bill would call it, Microsoft was starting to lose its way.  They tried to dominate in the browser wars but never quite managed to quash the competition.  Others saw their efforts in this area as annoying.  Their software for creating programs, Visual Studio, first hit the scene about four years prior to this.

Google was founded some five years prior and was just beginning to get attention from an investor before they had anything real yet.  In 1999 they moved from their garage to an actual building in Palo Alto.  Yahoo’s popularity as a search engine from a decade ago was waning.  Google’s ad-based revenue from keywords was paying off; they’d planted a money tree which eventually created an entire forest of money trees for them.  It wouldn’t be long until Microsoft’s executives behind closed doors would consider Google their biggest threat.

About this time Apple created a very clever method of provisioning content for one-and-only-one device within the music-delivery space.  The iTunes store would turn out to be the goose that laid the golden egg, as seen in the following revenues.  And yet, it would take years for either Microsoft or Google to realize the beauty in this fulfillment model and to come up with their own versions.

showmethemoney

The “Internet of Things” concept started gaining in popularity at this time.

2009

Microsoft’s attempts at copying Google’s success (MSN Search, Windows Live Search, Live Search) now culminated in the introduction of Bing as their default search engine destination for all things Microsoft.

Apple introduced the first iPhone and the first iPad about this time, noting that the same provisioning model from iTunes was incorporated into both via iOS.  The subscription model of sofware licensing was born with this, if you think about it.  If you wanted to write a program for either, you needed to use Apple’s software to do so.

Google has just introduced Chrome as a browser and would begin their campaign to slowly break Internet Explorer.  The same was true of the Android phone and its related operating system.  It would take a few years for Microsoft to catch up to either the iPhone or the Android before releasing their own app-savvy smartphone offering.

Amazon some three years prior had introduced the beginning of what would be a full complement of cloud-based services to support web development.  It would take Microsoft two full years to realize that they needed to be in this space and they didn’t have their offering ready for a few years more, too late to effectively compete.

Github.com had just celebrated their first year online, hosting over 46,000 repositories by then.  The world of open source was the very antonym to the way that software had been developed prior to this.

The free Ubuntu operating system was released about four years prior to this, backed by the well-funded company Canonical.

2015

Microsoft releases Windows 10, “the last version of Windows” (they claimed).  Rumors suggested that Windows would eventually go from a version-based license model to an annual-subscription model with respect to pricing.  I think it’s safe to say that the market hasn’t really embraced either Windows 8 or Windows 10.

The subscription-based model for Office 365 was introduced four years prior to this so the writing was definitely on the wall:  Microsoft wanted to depart from their former methods of making money and to chase the monthly subscription model.

2015-popular-coding-languages

The world of open source was offering new programmers a wealth of free code.  All they had to do was to take it and make it their own.  Formerly, Microsoft-friendly coding languages like C, C++, C#, VB and .NET dominated the playing field but this graphic shows how the game had changed.

2017

And here we are, present-day.  That curious number 42 now describes the number of years that Microsoft has been around.

Yesterday evening, I attended a very geeky meetup of perhaps fifty or sixty coders and only saw one Windows-based laptop.  Almost everyone had a MacBook of some kind.

I just spent about two hours today installing the free Visual Studio Community 2017 software so that I could—in theory, anyway—alter a free copy of the source code for TightVNC software.  Out of the box, so-to-speak, Visual Studio doesn’t want me to build this project since it uses an earlier target platform (Windows 7 or 8, one would assume).

Microsoft only wants me to make things for Windows 10.

So rather than making it easy for me to build a program that will happily work with Windows 7, they’re forcing me to jump through hoops in order to add the necessary pieces for this to happen.

Add two more hours to this and I find that my installation does not want to download the earlier pieces to allow this to happen.  I’m forced to then upgrade the code to Windows 10 compatibility mode… only to find that the build fails with 528 errors.

The main crux of all these errors appear to be:  “we can’t find common files”.  It’s a very amateur sort of error from a company that’s been providing compilers for several decades now.

I have to think that Microsoft doesn’t want me to do anything with Visual Studio unless it benefits Microsoft.  And this is the core of the reason why I suggest that they’re doomed.

Every time a coder like myself runs into obstacles like these, the usual seed that’s planted inside their head is “this would be easier with another free compiler or another language from someone else”.

2022

Fast-forward another five years and Microsoft will have lost ground on many fronts.  New software development here, there and everywhere will be via some language which wasn’t popularized by Microsoft on computers which aren’t Windows and with browsers which aren’t Internet Explorer or Edge.  Our toasters and refrigerators and our cars will be powered by the Ubuntu operating system or perhaps Debian, a similar free Linux flavor.  These appliances will be connected to our wi-fi and even to the Internet but there won’t be a scrap of anything Microsoft about them.  They’ll be coded up with something that isn’t C#, doesn’t use .NET and doesn’t need Visual Studio in order to compile it.

The only thing with a Microsoft pedigree with some staying power could be some of the websites and services currently served up at Microsoft’s datacenters via Azure.  But Amazon or Google could kill that by simply lowering their own prices for cloud-based services.

the 21st century digital résumé

It used to be that a programmer’s résumé was a single sheet of onionskin paper (expensive, semi-transparent) with a carefully-selected collection of one’s job history and such. Parts of what you were trying to “sell” to the would-be employer were your wordprocessing and layout design skills.

Now, everyone can type, has access to printers/computers and Microsoft Word. In fact, they can even select an attractive template from the many offered so it’s not like much skill is now involved in those areas. At one time, spellchecking was an activity that involved a Webster’s dictionary. The world has changed.

Github

To be an open-source programmer, you must now have a public set of repositories on github.com or so it seems.  My collection of repositories on github.

jsfiddle

As of today, I now have my very own jsfiddle.net collection. My public dashboard on jsfiddle.

WordPress blog

More and more, programmers are encouraged to be social and outgoing enough to want to communicate to others. Obviously, you’re here already so you have my blog’s address.

Slack

And part of that “being social” requirement now seemingly includes spending a fair amount of time during your life chatting with others within the coding space. Since slack.com projects appear to be project-centric rather than coder-centric, there doesn’t appear to be a way of publicizing your identity outside of a particular team URL.

Website portfolio

And then of course, potential employers want you to highlight several existing website concepts in which you either participated or you directly own them.

blinking the raspi’s built-in LED

I’ve just added a repository of some JavaScript code to take over and exercise the built-in activity LED on a Raspberry Pi Zero W (and presumably other models). It’s called gpiozero-toggle-led and it’s a pretty simple interface with installation instructions and some sample code. It works with the underlying js-gpiozero JavaScript port of the popular original Python code. This would be an excellent way of simply demonstrating GPIO without any additional wiring, components, breadboards, extra power supplies or electrical knowledge (like finding a 330-ohm resistor using its color bands).

zero-wireless

Note that the “zero” in the title of the repository and in js-gpiozero does not refer to the Raspberry Pi Zero but to the original gpiozero Python library.

This should remove some of the guess work when attempting to use the relatively-new library since their documentation examples at the moment are taking a back seat to their code port from the more-extensive Python offering.

This approach can easily be modified to instead exercise external LEDs (as soldered or otherwise attached to the header pin locations seen below).  Note that you’ll use “BCM numbering” for APIs such as this one. For external LEDs, you would need to connect it inline with a resistor from a selected pin to one of the grounds for this to work with correct orientation of the LED’s anode/cathode, of course.

raspberry-pi-pinout

If you’re trying to use this with a Raspberry Pi of a different model, you’ll likely want to adjust the JavaScript slightly as seen below.

/routes/index.js:

// Existing code, for a Raspberry Pi Zero
var ledActivity = new LED(47, false);
// For Raspberry Pi 3, for example
var ledActivity = new LED(47);

And that’s it. Since the Raspberry Pi Zero assumes an opposite value for true/false than the bigger models, it’s necessary to configure this in the device constructor to make things work as expected. Since BCM pin 47 is the activity light on the board itself, this will allow you to control it.

o please, gentlemen, a little bluer…

Today’s inventiveness involves a new teaching method for music, a synesthetic approach to colorizing musical notes. The title’s quote comes from Franz Liszt, a 19th-century composer who was a synesthete—he saw music in full color.

Although western doctors probably think of synesthesia as a malady, I would suggest that it is a product of beneficial neuroplasticity. The brain has cross-wired itself across the senses to allow for better recognition and appreciation of something. There’s a long list of famous musicians and composers who wrote of this personal condition and in each case it helped them to succeed.

vexflow-syn

In order to promote this cross-wiring in young musical students, I’ve created a repository to colorize musical notes in client-side JavaScript. I’ve developed an organized method for this and have described the process there.

Compatibility

Given that the client-side JavaScript approach requires the newer HTML5 canvas features, this will work on newer browsers (and seems to be working in IE11 if you “allow blocked content”).

Musical Talent

I have always had a fondness and an early aptitude for music. In fact, I had such a brilliant audible memory and an ability to play anything I’d just heard, that I used this as a crutch when confronted with the task of learning to read musical notation. I didn’t actually have to read the notation in band since the sound of the music was in my head. So although I was a slow reader with respect to notation, nobody actually could tell.

My earliest formal training was for the saxophone, noting of course that you only play a single note at a time. Unfortunately, this led to my later difficulties in learning to play the piano in my thirties. Piano chords on a stave? To me, this just seemed like jumbles of notes piled on top of each other. I had no easy way of interpreting what I was seeing.

After many weeks of painstakingly trying to decypher these heiroglyphics, if you will, I began to have a small breakthrough. My brain started to recognize some patterns. Due to some unfortunate timing, I had to stop all this training and abruptly move and had to sell the piano. It would be another decade until I’d bought another piano to re-learn piano notation.

Attacking the learning of chords-in-notation anew, I realize that colorizing the notes would be a benefit to me.  All C notes are red.  All E notes are yellow.  C-E-G are primary colors (C-maj).  The Eb in the middle of the C-min chord is more orange than the original yellow. A synesthetic approach to musical notation is a wonderful adaptation to a centuries-old teaching methodology I’d suggest, at least in my own case.

tommy can you hear me?

Okay, so this week’s invention involves me being uncharacteristically-cheap. If you usually read about the gadgets I buy, you should know that I’m seriously into making things and using a variety of tools that I need to get these projects done. I’m happy to buy something if it’s worth the cost.

For these monthly talks I’ve been giving, I wanted to have a hands-free option for the Sennheiser FM transmitter. Because when you’re giving a talk and you’re also typing on the computer it just makes sense that both hands need to be free to do that. And yet, the Sennheiser has a propriety 1/8″ jack that makes it difficult to shop anywhere but their website for accessories.  And their cheapest headset is still hella expensive (~$180) and it’s just a standard headset with a standard microphone with a propriatary plug.  <_<  So I decided to try to build an entire rig instead.

The Gear

Of course, I’m starting things with a Raspberry Pi 3 at the moment but will likely port this over to a Raspberry Pi Zero W when I get things working.

raspberry-pi-3

I just picked up a digital USB microphone from Radio Shack (since they’re closing almost all the stores here in San Diego) so that was a mere $10 and has great quality in a tiny package.

mic

At REI, I snagged an FM radio so that I could do the development and listen in on the transmitted signal.

midland

The Sennheiser at the venue looks like this.  At the last monthly talk I took a photo using my phone so that I could record their tuning for their setup.

sennheiser

You can’t see the hand-held microphone on a cable from this stock photo but it’s kind of a pain, as it is right now.

Progress

So far, things are looking pretty good. I’m able to record from the microphone using the alsa-utils arecord program. I’m able to convert the output WAV file into something suitable for re-transmission. And I’m able to broadcast the signal from a GPIO pin on the Raspberry on a selected FM frequency. I believe I can make a longer antenna that should work out.

What’s missing at the moment is a way to (correctly) daisy-chain each of the commands together so that things will continuously transmit, say, upon startup.

arecord -D plughw:1 -f S16_LE -r 48000 - | ./pifm - - | sudo ./rpitx -m RF -i - -f 87900

Something like that, anyway. Any yet, it doesn’t seem to work like this.  The various, raw “-” hyphens as seen throughout are supposed to represent STDIN/STDOUT for streaming commands from one to the next. Many times this works as expected, albeit with the odd hyphen showing up here and there.

Anyway, things like this take a lot of hacking at the problem to get it solved. Perserverance usually wins a game like this.

Update

And of course the solution was a slight tweak to the earlier attempt.

arecord -D plughw:1 -f S16_LE -r 48000 /dev/stdout 2> /dev/null | ./pifm /dev/stdin /dev/stdout | sudo ./rpitx -m RF -i /dev/stdin -f 87900

captcha the moment

Robots

According to Newton’s 3rd law of motion, for every action there is an equal and opposite reaction. Out on the Internet that probably means that when forum content spammers apply force (adding content advertisements in order to enhance someone’s SEO) then forum admins must use an equal force to repel them. In this particular case, we’re talking about that captcha challenge that you keep seeing everywhere: prove that you’re not a robot.

recaptcha

Part of the problem is that the assumption here is that we are a robot and that we must prove otherwise to proceed. And I suppose that to some extent, Google is part of the underlying problem.

Search Engine Optimization

SEO is the acronym for what’s behind all this. Google, for example, can be faked into thinking that a particular website is more important than it should be.  Spammers have figured this out of course. Every day of the year, people are being paid to create fake content across the Internet’s collection of forums, blogs, websites, etc.

Behind-the-scenes, websites and forums are being visited nightly by a virtual army of Google’s webcrawlers, those robots which visit all the pages of a website and re-add them into the big indexed database which is the brain of Google, if you will.

The problem, though, is the collection of odd configuration settings and files for which most people have no knowledge. A typical website would have a /robots.txt to tell webcrawlers what files to add to the collection; the webmaster could simply not index this area of the website. A really awesome forum or blog software would know to automatically decorate the visitor-supplied links added in comments with a no-follow argument. What this means is that these spammers/advertisers would be foiled almost overnight since they wouldn’t get any value from this behavior.

But since nobody spends much time thinking about a real fix, most of us—the forum and blog users—are forced to prove our humanity on a daily basis. We are inconvenienced in many ways.

Fast Typist = Spammer

This detection method really annoys me. Back in the ’70s I typed 115 WPM on an Underwood typewriter. Now imagine how fast I type now on a computer keyboard with almost forty years’ of experience.

Underwood

Add to that, my brain works well. I can process problems and develop solutions in a hurry and will on many occasions attempt to provide assistance to others on the Internet, say, on a forum. Unfortunately, I’m often confronted with these anti-spam countermeasures which seemingly think: if you can type more than two posts in five minutes you therefore must be a robot. Seriously, I hate that one.

Denial-of-Service to Everyone

This is the reason behind today’s post. I was out there attempting to ask a question on the Sainsmart forum and after trying multiple browsers realized that I simply wasn’t going to get to ask that question. Their registration mechanism’s captcha doesn’t work. It fails over and over again since their code is wrong. It’s a denial-of-service (DoS) to everyone, robots and humans alike.

More Than One Lookup = Spammer

I tend to use the WHOIS database information a lot since I work in Information Technology. Each domain registrar (like GoDaddy) maintains a database like this of who has registered a particular domain. And yet, I’m sure there are people who create scripts to promiscuously query this information in order to build and sell marketing lists. I would urge people who maintain websites not to be so heavy-handed at robot-detection methods. (In other words, looking up two domains does not a robot make.)

Typical Customer Reaction

In my particular case with respect to Sainsmart’s forum DoS, it feels like Newton’s 2nd law of motion: the acceleration of the customer away from their forum is directly proportional to the force of rejection by their failing captcha mechanism. Okay, even for me that was stretching things a bit but I did want to add another Newton reference so there you go. Seriously, it will take a lot for me to go back to Sainsmart’s forum again. (See, that was a Newton’s 1st law of motion joke. You knew I was a geek, right?)