K&R . . . check!

Study of King DavidSource Code:  Kernighan and Ritchie The C Programming Language Code Examples

I’m happy to say that I finally completed my effort to work all the exercises in the classic “The C Programming Language” book by Brian Kernigham and Dennis Ritchie (co-creator of UNIX). What started as a side effort to reinforce pointers and memory management as part of my efforts to write a Scheme interpreter supporting my efforts to work through another classic “The Structure and Interpretation of Computer Programs” turned into an eight month effort (mainly due to my lack of time for side projects).

The effort did reinforce that the C programming language is certainly the king of procedural computer languages. There is nothing a von Neumann architecture computer can do that cannot be programmed by ‘C’ and converted into machine code by a good compiler. However, this king is an old king. Yes, garbage collection, object-orientation, concurrency, and JSON encoding can all be done using ‘C’ from either scratch or via open source libraries. Yet, I’m concluding that the effort outweighs the gain when languages such as ‘Go’ and ‘Rust’ coming into their own.

I have mixed emotions. I’m overjoyed to have re-mastered this language using one of the most classic programing language books to do it. But, overall I would put this effort down as a “failed experiment” from which I have learned that I probably need to look to a more modern language (I’m going down the ‘Go’ route) to fill my needs for a “get the job done with no BS” general-purpose language.

All that said, I can confirm “The C Programming Language” is a truly great book. This single book takes the reader through all aspects of classic ‘C’ (it has not been updated to the latest language standards). In the process it also works through basic implementations of classic algorithms and data structures: arrays, queues, linked lists, hash tables, binary trees, binary search, shuffle sort, quick sort, and a simple recursive decent parser. The book also covers implementations of basic standard library functions using low-level operating system calls. By the end of the book, you will have completed a tour de force of the basics of this classic language. I still highly recommend this book to any developer serious about their craft.

Here is a link to my exercise solutions: Kernighan and Ritchie The C Programming Language Code Examples

Article Summary 2015-05-29

44 years of UNIX, Time-lapse Photo Mining, Self Healing Buildings, Free NASA Code, Realtime User Monitoring, Email for Apple Watch, Two-thirds of Europeans Have Same Fathers, New Language for FPGAs, Smartphone with Projector, and Light Bulb with Speaker.

“A Repository with 44 Years of Unix Evolution”

This is one of the coolest things I’ve seen for a nerds and geeks alike in a long time–a GitHub repository that traces 44 years of evolution in the UNIX operating system code base from 1972 to 2015–659,000 commits from 850 identified individual contributors.

“Time-lapse Mining from Internet Photos”

These guys mined 86 million public photos then collapsed ones of places into a common viewpoint. From that, they were able to develop time-lapse videos. Their detailed paper is an amazing read.

“The First Building That Can Heal Its Own Cracks With Biological Cement”

Self-healing buildings.

“It Is Rocket Science! NASA Releases Abundance of Free Code”

Open source code from NASA

“How to provide real user monitoring for single-page applications”

Discusses three challenges single-page apps (SPA) face with respect to real user monitoring (RUM) along with a solution path for Angular-based SPAs using Boomerang.

“How To Send a Hidden Version of Your Email That Only Apple Watch Will See”

Discusses how to craft email messages to specifically utilize the capabilities of the Apple Watch.

“A handful of Bronze-Age men could have fathered two thirds of Europeans”

“Genetic study reveals that two-thirds of European men can be traced back to just three individuals who lived between 3,500 and 7,300 years ago.”

Presents even more detail on the research into the Y-chromosomal most recent common ancestor (“Y-MRCA” or “Y-chromosomal Adam”) and the matrilineal most recent common ancestor (“MRCA” or “Mitochondrial Eve”). If you want to have your genetic ancestry documented, there are some services that can give you a genealogical DNA test.

“Enginursday: A New Approach to FPGAs!”

To increase the usability and approachability of Embedded Micro’s Field Programmable Gate Array (FPGA) “Mojo” development board, they have released a new language named Lucid. Lucid should make customizable hardware as approachable as the Arduino made embedded microcontrollers. Hopefully once things calm down with my bookshelf project, I can start playing with one of these fellows.

“Lenovo’s Projector Phone Beams a Touchscreen Onto Any Surface”

For at least a couple years now, after seeing the projected keyboards and miniature video projectors, I have been saying that what someone needs to do is create a phone that integrates the two. I was specifically thinking of something that could project your view onto a wall at the same time it could project a keyboard. Since this only has one projector it cannot do both yet, but it is certainly getting closer. Not available in the States.

“Sony’s LED Bulb Doubles as a Bluetooth Speaker”

Now if they could only get a variation of this out that supports changing the color like the Philips Hue, one would have the ultimate in mood lighting. But, none the less, this is pretty cool. Also not yet available in the States. (Do you sometimes feel like we’re lagging a bit these days?)

Does Your Lenovo Laptop Own You?

Anyone who has purchased an inexpensive Microsoft-based laptop recently knows how the laptop vendors “supplement” Microsoft Windows with various “pre-installed” software and utilities such as the ever-nagging “have you paid for your subscription yet” anti-virus software. Not only is this “Crapware” practice annoying, and performance degrading (original ad-laden article), but it is also can endanger your security and privacy.

Over the last week or so it came to light that Lenovo (a Chinese-owned company) installs software from a Superfish called “WindowShopper” on laptops from September 2014 to January 2015. The good news is that they have stopped doing it. The bad news is that what they did is very, very, bad. Just how bad is hard to explain to someone who has a limited to little technical understanding.

They installed this software so that they could inject ads into your browsing experience. What this means is that they sell your information to ad providers who then buy ad space. This ad space is “injected” into your browser search results. It is as if you are reading a newspaper like the New York Times and another company comes along and inserts ads into it without either the New York Times or your consent. This is called a “man-in-the-middle” attack.

Let me be really clear on this. The Superfish software is HACKING your Google search feed with a man-in-the-middle attack and Lenova knowingly facilitated this attack vector to make money by selling access their customers to help boost the profits of their cheap laptops

What makes this so bad (the “Paul Harvey Page Two” for you old timers) is that they do it on SECURED web sites because Google encrypts the results they send you (hence the “https” in the URL and the little lock icon in your browser). And, it turns out (surprise, surprise) that the software they installed to do this is flawed. The flaw lets those that know how break secured access to other sites such as . . . your bank, your healthcare provider, etc. Hopefully, you get the idea.

Here is more information:

And, some of my personal advice:

  • If you own a Lenova laptop, follow the instructions above to check and see if WindowShopper is installed. If it is, remove it. If you are uncomfortable removing it yourself, pay to have someone at your local computer support company do it.
  • If you need to buy a laptop and also need to minimize your spending in doing so by buying a cheap pre-loaded laptop, factor into the cost buying your own clean copy of Windows, wiping what comes installed on the computer, and installing your own copy of Windows from scratch. This is the ONLY sure way of having a clean Windows laptop that is not already loaded down with the “bonus” software the vendor sees fit to include. If you are uncomfortable doing this yourself, factor into the cost the expense to pay your computer store to do it.
  • Or, if you can afford it, consider buying it directly from the Windows Store. I have heard, but not confirmed, that these PCs are sold “clean” of all the adware and “bonus” software.
  • Unless you’re highly technical, my best recommendation is that you buy an Apple Macintosh. I am an Apple Fan Boy and admit it. There is a reason.
  • If you are technical, and you really want to take control of your computing environment, they buy cheap hardware and then install one of the various Linux or BSD distributions. This skips the whole Windows versus Apple debate (but does put you in a Linux vs BSD debate) and gives you the most control of the situation. Although, it isn’t as easy. “My Other OS Is Linux”

UPDATE 2015-02-25

Here are some updates:

  • Lenovo is being sued over their Superfish implementation. There was an excellent interview with Bloomberg News this morning on NPR.
  • Basically, you can no longer trust that a “secured” https connection really is secure. Turns out, that Superfish is not the only software vendor doing this for the sake of ads:
  • From this article (original) and this article (original), the following additional software providers may be doing the same thing. These providers all have an Israeli technology called “SSL Digestor” and “Watchdog”, by a company called Komodia. Basically, these are commercial tools to hack and break your box.
  • If you are a Mac user, while generally you are safer from “Crapware” you are still susceptible to ad ware. To help protect yourself, here is a good article walking you through some steps you can take (original). Also, I highly recommend disabling automatically running Flash in your browser. I don’t know if I would go so far as to shut down JavaScript; otherwise, you’ll be finding yourself managing a large exceptions list for all the sites you like that extensively use JavaScript.
  • Crisis in the House of Node.js?

    An interesting thing happened this Independence Day —TJ Holowaychuk (the brilliant fellow that wrote Empress, Mocha, Jade, Stylus, etc., in other words, a NodeJS guru) announced he is greatly reducing his work in Node.  See his ‘Farewell Node.js‘ post (best quote, “callbacks suck”).

    As can be guessed, this is causing a stir in the vibrant Node and JavaScript communities. Interestingly enough he mentions the venerable C language that I love in passing, but his next language-of-the-day love appears to be the very young Go language. Personally, I would place bets that he will eventually step away from Go too.

    Some of the reaction:

    An excellent functional-language developer I know recently described the language-of-the-day trend, especially regarding the explosion of wrappers and libraries for JavaScript, simply as efforts to make up for deficiencies in the base language that other mature languages simply don’t have or that were solved years ago (c.f. this article, by Douglas Crockford, the author of JSON).

    The ubiquity of JavaScript interest, in my opinion, is because it is a “lowest common denominator” language (as put by my functional developer acquaintance) that is initially easy for new developers to learn. It is the new, more functional, BASIC. Eventually, the most serious of these new programmers run into its problems and thus start seeking (or use their talent to re-invent) various libraries, extensions, and wrappers to try and fill these gaps.

    Perhaps some of this trend comes from our lack of the pursuit of a pre-college software development curriculum leaving smart people who may be interested in software development on their own to pursue their interest. Logically, they first turn to front-end development where they are exposed to HTML and CSS then, in turn, JavaScript and JQuery. The march then to libraries and Node.js logically follows.

    I cannot help but wonder that if we had a decent curriculum for young developers (like the one by Project Lead The Way that focuses on Python as a starter language) then these smart developers would gravitate towards C/C++, Java, or C# for imperative and Lisp/Clojure, Erlang, or Haskell for declarative development needs.

    On the personal side,  I continue to re-birth my own skills and have been refreshing my straight C skills these days, doing some bash scripting, and Java. I’ve also been wondering if Haskell can be brought to bear on some of the more complex algorithm challenges I have at LigoSphere.

    Bookmarks with a Twist

    By P. Todd Decker

    Do you use multiple browsers, multiple computers, and multiple ‘smart’ devices and want to have a directory of web sites common to them all without depending upon a particular vendor?

    Do you ever use a friend’s computer, work computer , or ‘cyber cafe’ kiosk and want access to the same list?

    Do friends ever ask, “Do you know of any good websites about topic X?” to which you would like to easily be able to respond without headaches, retyping, mailing, etc.?

    If any of these occur, then a ‘social bookmarking‘ tool might something to add to your online toolkit.

    I have been using Pinboard for several months now. You can fairly easily import all your existing bookmarks from your browsers to seed your directory. After doing so, I cleared them out and replaced them with a simple link to Pinboard. I then installed the tagging tools to my bookmark bars and have slowly been cleaning them up (proper tagging and fixing dead URLs). I like Pinboard because it is still relatively non-commercial, gets the work done, and has a fairly clean interface. It also allows you to mark entries and tags as private. I use a private tag of “.reverify” to track the links I need to check.

    You can access my Pinboard using the link in the Resources section of this site.

    P. Todd

    Raspberry Pi Alive and Kicking

    Raspberry Pi

    By P. Todd Decker

    With only about 20 minutes of work, once I had the right supporting peripherals, I was able to get my Raspberry Pi up and running. Amazing little computer that I will be using as a master controller for Ashley’s continued quadrotor robotics experiments (resources) and a controller for my aquaponics garden (resources)

    I’m using the Occidentalis v0.2 Linux distribution from Adafruit with a Ourlink 802.11n USB wireless adapter, Belkin powered 4-port USB hub, MC SAite mini keyboard, an old wireless mouse from Embarq marketing days, and a cheap 19″ HDMI Sansui monitor from Walmart.

    Adafruit provides step-by-step tutorials that couldn’t make it any easier to get started.

    P. Todd

    Update: 4:03pm

    With just a little more work, you can also set up the Raspberry Pi so that you can (once configured) drop the direct attached monitor, keyboard, and mouse. Then just use your primary desktop to access it remotely with both a graphical interface (via VNC), terminal (standard SSH), and file sharing (Mac Finder).

    Screen Shot 2013-01-26 at 3.55.24 PM