So I’m working on a project for a new customer. There is one aspect of the project that makes it attractive to store the data on one of the big three cloud systems (Amazon Web Services, Microsoft Azure or Google Cloud). I need a https route to catch Ajax submits from a single webpage. This is a small application, but if the money is right perhaps we can make this work.
I do a bit of research, and I was pleasantly surprised to see that Google offers a pretty decent free tier. Hmmm. Well that looks cool. So I do a bit of coding. I create a decent node.js server application with access to a Mongo DataBase. That works for me.
So the problem is the pricing I’m seeing on the console don’t at all match my inexpensive expectations. I end up doing a whole lot of research, trying to figure out exactly where the charges I’m seeing are really coming from.
So here is the deal. The free tier for Google Cloud App Engine Standard Environment only (Java 7, Python 2.7, PHP 5, Go). It does NOT apply to Google Cloud App Engine Flexible Environment (Node, Java 8, Python 2.7/3.5, PHP 5/7, Ruby, Go, Custom Runtimes). If you use a flex environment, the minimum number of instances is set at two. And if you add those costs up, it comes to $1.26 per instance per day… no matter how many web hits the site sees. For a 30 day month, that comes to $75 as month just to sit at idle. Add an other $6/ month for the mongo db. Cool service yes. Low cost, no.
But I will say… I’m not giving up yet. PHP or Java or Python or Go are still possibilities. Stay tuned.
But in the ever changing world of software, there is something better available. Enter VirtualBox from our friends at Oracle. So what is VirtualBox you ask? Good question. A virtualbox is an implementation of a virtual operating system installed as an application. VirtualBox allows additional operating systems to be installed on it, as a Guest OS, and run in a virtual environment. And like anything else, that may not be obvious until you see it in operation.
So here’s the deal.
- Open up VirtualBox, the Virtual Machine manager from Oracle
- Download Ubuntu Server.
- Spin up a Ubuntu Server O/S. This is pretty straight forward, but you do need to enable Bridge Mode for your network connection: Virtual box, settings, network, Bridged Adapter. This will enable you to use IP addressing to get to the server from a browser on any computer within your local network.
- Spin up a LAMP (Linux, Apache, MySQL, PHP) server.
- Look for your IP Address
- Open up the Apache Server @ given IP address
- Figure out the directory structure for Apache HTML web server content. The address is shown right there in the Apache Ubuntu Startup Page
- Go to that directory, clone the github repository of interest.
- Open up the link in the browser. Success!! See top photo on this blog entry.
git clone https://github.com/MaximeCheramy/simso-web.git
git submodule init
git submodule update
–Check out that image on the right… that’s one virtual machine running Ubuntu Desktop, while another machine runs Debian Pixel
–Create a Ubuntu Desktop. Add a shared drive. This is a great way tool to use if you ever need to use a torrent to download a large file. Transmission, the Linux torrent tool, works great, and doesn’t expose your desktop or laptop operating system to potential problems.
–This is great way to test different flavors of an operating system. Not sure if you want Ubuntu desktop or Lubuntu or Edubuntu or Mate? Try ’em all. Quick, easy, done. Toss out what you don’t need without leaving extra installations on your desktop or laptop. Clean, seamless. Move along.
–Android Emulator. Run the Genymotion android emulator within VirtualBox. I was playing around with the native emulator that comes with Android Studio. The laptop I was using wasn’t the newest, or latest or greatest. The native emulator was slow. Brutually slow. And flaky. And fragile. Total pain in the neck to work with. The Genymotion emulator, wow. That thing spun right up. And I was testing Android apps with React-Native in no time. Note, the free version of Genymotion emulator is for personal use only. But its pretty nice.
–Debian with Pixel. Perhaps you want to understand what Pixel is, and how it works. Pixel is an ultralightweight interface to the Debian O/S, generally used on devices like a Raspberry Pi. Now released for PC or Mac. Give it a try.
–Run GnuCash (Open Source Accounting Software) on a MacBook.
–Try alternative Open Source DataBases… Cubrid or Firebird or MariaDB or…
–Test that voice activation program you’ve always wanted to install on a Raspberry Pi, but don’t have the desk space for all that hardware for your design and coding phase.
So recently I’ve been playing around with Raspberry Pi type Internet of Things (IoT) devices… In my case I’m experimenting with OrangePi Zero and the C.H.I.P. Both of these are way small, way powerful processor headless computers. I’m trying to do fun and interesting things using these as control devices for special input/output. One of the things I’m interested in is ultra low latency… that is, an absolute minimal amount of time between user input and computer output.
I found an interesting article comparing the use of different programming languages to control things on a Raspberry Pi. Basically the guy hooks up an oscilloscope to and I/O pin, and then turns the pin on and off via different programs / shell commands. Its clear from that test, if you want to control things quickly, go to C for the win. So C it is.
I started playing around with code. I started playing around with different hardware.
First go was with the Orange Pi Zero, with Armbian Linux Server Image (Debian Jessie Legacy v 3.4.113 ) First test was to be using simple General Purpose Input/Output (GPIO) to blink some LED’s. It turns out the Orange Pi is a little bit off standard. To get the GPIO to work, we need to use a modified WiringPi library, courtesy of Github and user Zhaolei.
Here’s a photo of the Orange Pi Zero, an add-on shield with extra USB connections, an audio jack, a microphone and an infrared receiver. I also made a couple of LED jumpers for easy blinky I/O testing. In my case I wanted to use the on board microphone and audio jack… they work pretty well.
Let’s talk a little bit about software. With this device, I always planned on a headless installation. Generally my only contact would be thru SSH, either from desktop / laptop (Git Bash Command Line Interpreter) or mobile phone (with either the Termius or WebSSH app.) Coding consists of me writing original in Atom.io, then copying the code and pasting it into .c files via the nano editor. Compilation and shell run commands are run via the SSH tool.
I ALWAYS want a backup copy of the software I’m writing on my laptop/desktop. The only downside is there is no great way to delete a large block of code with nano. Frankly its easier to delete the file and copy/paste new again.
- Setup the remote device. Probably best to see that things are updated, via
$ sudo apt-get updatefollowed by
$ sudo apt-get upgrade.
- Verify Git is installed on the remote device. If not there, add it with
$ sudo apt-get install git-core
- Install the WiringOp (Orange Pi) library, via
$ git clone https://github.com/zhaolei/WiringOP.git -b h3
- Compile that library on the Orange Pi via
$ cd WiringOP
$ chmod +x ./build
$ sudo ./build
- Create a test file at the user directory (~/) via
$ nano GPIO.cCopy, paste the code from Atom.io. Exit nano, save the file.
- Compile the test file…
$ gcc GPIO.c -o GPIO -lwiringPiThe gcc -lwiringPi command links content from the wiringOP library.
- Finally run the compiled file via
$ ./GPIO. If you did this right, you should see some blinking LED’s. Yipee.
So far, so good. Now its about this time, I’m realizing that I will need to be writing some pretty involved programs. And one thing I don’t have is the ability to debug my code interactively in a convenient method. Its about this time in my research that I stumble over this posting, Visual C++ for Linux Development Wow. No, really… Wow. You can use Visual Studio to manage code, keep copy on your laptop/desktop computer, push code to remote device, AND run code in debugger mode. Way cool. The system uses GDB (the GNU DeBugger) to manage the process remotely.
Now at this point, I spent a heck of a long time trying to understand how Visual C++ for Linux development actually worked. I had more than a few problems, and I couldn’t tell if my troubles were based on my custom libraries or my Visual Studio setup. The answer here was to go back to basics, run the thing one step at a time and see that everything worked well. Now my first off-standard was my choice of the Orange Pi Zero. For a Visual Studio proveout, I reverted back to basics, and used a Raspberry Pi Model B. I set up a clean install.
- Clear SD card via SDFormatter tool (Format type = Full, Format size adjustment = On). I used a 16Gb Samsung Evo MicroSD card in holder.
- Download Raspbian Jessie Lite Minimal Image from raspberrypi.org
- Unzip it. Push OS to SD card via Etcher.io
- Update/Upgrade the OS. Add Git (same as above).
- Add the WiringPi library to the remote device per these installation instructions.
$ git clone git://git.drogon.net/wiringPi
$ cd ~/wiringPi
- You can verify the install via
$ gpio readallwhich creates a handy pinout identification map.
At this point its time to start up Microsoft Visual Studio. I’m using Visual Studio Community 2015, version 14.0.25431.01 with Update 3.
- You are going to want to download and install the Visual C++ for Linux Development extension.
- Install a few tools on the remote device
$ sudo apt-get install openssh-server g++ gdb gdbserver
- Add a few LED’s to your Raspberry Pi. I added one LED to wiringPi Pin #0 and another to wPi pin #1.
- For me, this added one LED to actual pin 11, GND to pin 9 and one LED to pin 12, GND to pin 6. Verify that you have the LED’s oriented in the correct direction.
- Create a new Project. Select Templates –> Visual C++ –> Cross Platform –> Linux
- For this quick test, select ‘Blink (Raspberry)’. Accept the defaults, with one exception. Give the file name a .c suffix (and not a .cpp suffix)
- You will have to set up the program as a ARM processor program, with a pull down selection in the top menu bar.
- At some point you will have to add login credentials, via (Top Menu) Tools –> Options –> Cross Platform –> Connection Manager.
- You can observe output via (Top Menu) Debug –> Linux Console.
- When you click “Remote GDB Debugger” Visual Studio performs the compilation and execution processes.
Visual Studio creates the following files on the remote device (in this case, my Raspberry Pi). Project = Blink, code = main.c
And that Blink.out file, it is fully executable via ssh and
$ ./Blink.out . Note that the WiringPi library is located elsewhere on the remote linux device. If you inspect the sample code carefully, you will note two things.
- Right click on the Blink project in the Solution Explorer. Choose Properties –> Linker –> Input. In the block entitled “Library Dependencies” you will note ‘wiringPi’ This is the command line that tells the system to look for that library on the remote device. The files needed are actually located at /usr/local/lib (normally xxx.so files). Note: there is one thing here I wasn’t very happy about. What if you’ve neglected to compile the library files correctly? If you do that, you get an error message “fatal error: wiringPi.h: No such file or directory”. Wait, what? For a missing file on a remote device, that error message seems to be lacking, and probably should be improved. It’s not immediately obvious that the error is for code content on the remote device, instead, you are wondering what you did wrong on the desktop/laptop machine. My recommendation is “fatal error: wiringPi.h: No such file or directory at remote Linux device.” or words to that effect. The folks at Microsoft seem to agree, and as a result of my email to them, they’ve added this to their open issues list.
- The other thing of note on the Blink project is all the notes involving
// LED Pin - wiringPi pin 0 is BCM_GPIO 17.So in the history of Arduino and Raspberry Pi’s there have been a whole lot of implementations of GPIO pin numbering. The whole WiringPi GPIO thing gives you the chance to custom define different pin schema’s. I will admit for most of us the whole thing is confusing. In this example, its very easy to get pin #0 to function. Starting from the code as written, its way difficult to get pin #1 to function. In this case BCM_GPIO pin #17 = WiringPi pin #0 = physical Pin #11, but what pin is used for WiringPi Pin #1? Hint, it you use the mating BCM_GPIO pin (#18) that is a total fail. Why? Because you have to declare each BCM_GPIO pin special via the Property Pages –> Build Events –> Remote Post-Build Event command. Yes it is important to understand that process, but not, Not, NOT for a beginner exercise. I wasted a good portion of time trying to understand the entire numbering scheme. For 99% of us, its just best to understand our hardware, ssh
$ gpio readallto obtain a pin map for your hardware, and then simply use the WiringPi (wPi) pin numbering.
And heck, to make things easier, I’ll include my beginner approved code sample, RaspberryPiBlink.c (suggest you right click, and save document).
And by the way, just so we don’t forget why we’re using Visual Studio with the Raspberry Pi for programming… with the Gnu Debugger installed we can STEP DEBUG our program on the REMOTE device from within Visual Studio on the laptop/desktop easily. You can see a variable’s content. You can see the order of processing for complex calls. This is way cool, and well worth the tiny bit of extra effort it takes to get everything set up smoothly.
The more I know about statistics, the more I despise sports.
I’m a big Dr. Deming fan. You remember Dr. W. Edwards Deming, right? He was a foremost statistician evangelist lecturing to manufacturing folks a few years ago. I was fortunate enough to see him in a lecture in Dearborn once. He did this cool thing with the audience. He asked ten volunteers to step up on the stage. He told them they were new employees in the Red Marble Company. The goal of the Red Marble Company was to… produce red marbles. Dr. Deming had this big bucket full of red and white marbles. He held the bucket up high, and each employee was asked to select ten marbles. The employees reached high into the bucket (sight unseen) and selected ten marbles. When all the employees got ten marbles, Dr. Deming did a tally on the number of red and white marbles selected by each employee. One lucky employee, Susan, produced 7 red marbles. Dr. Deming heaped lots of praise on Susan, gave her extra prizes and even a $$ bonus. Susan was so proud, she was beaming on stage. Then Dr. Deming went back to the tally results. One poor soul, Ernie, only produced 3 red marbles. Poor Ernie. No, really poor Ernie. Dr. Deming verbally abused the guy on stage, made him feel about one inch tall. “How could you do so poorly, look at what Susan has done?” This went on for sometime. You could actually see the guy cringe on stage. Everybody in the audience was quite uncomfortable with Ernie’s beat down.
But the message was CLEAR. The results of each employees marble selection were absolutely random. And it made zero sense to reward Susan and punish Ernie for what was clearly a series of random events. Woe is Management. Look at significant differences between employees, but account for randomization for exactly what it is.
And lets fast forward to game seven of the 2016 World Series. I don’t normally watch sports on TV, but this game seemed special. I’ve lived in both Cleveland and Chicago for at least five years each. I know how important a win like the World Series can be to each of those cities. The game was fun to watch, well played by two very awesome teams. It went ten innings, each of them on the edge of your seat exciting. And at the conclusion of that game, the winner would be declared World Series Champions. As I watched the game, complete with DVR with rewind, and presenters with paint on the screen strike box, I noticed there were many “questionable” calls made, that I’m not sure I agree with. There were numerous pitches that looked like strikes, but called as balls, and vice versa. I know one scoring runner from the Cubs took his base on a 3-2 count that I believed to be a strike that was called as a ball. There may have been one base runner event (out? not out?) that didn’t hold well to instant replay, but wasn’t reversed… I will say the questionable calls went in both directions, one time supporting the Cubs, and another supporting the Indians. Shit happens. If any one of those events had gone the other way, we could have had a different final result. They’d be celebrating in Cleveland instead of in Chicago.
Am I complaining about the umpire staff? No way. Tough job, and I certainly wouldn’t want the job. But when I step back and look at the game as a whole, these events seemed random. Random enough that it reminded me of the Dr. Deming Red Marble Company. Two great baseball teams, both with high hopes and aspirations… but with only one declared the winner. In my view, that win, at least on that game, was largely a coin flip. And that’s why I gotta say… The more I know about statistics, the more I despise sports.
Baseball photo courtesy of AP Photo/Charlie Riedel
So I’m working on my desktop computer (with hard wired mouse) and every once in awhile the computer operating system (Windows 10) will start making notification noises and the mouse freezes up. Drives me batty. But I keep working on. Occasionally the cursor will freeze on the screen, so I place the computer into sleep mode (with a quick push on the power button) and then wake it up after a minute or two. That frees up the cursor.
But the problem doesn’t go away, it just gets worse. And I’ve already bought new mice over this in the past.
So today, I try something different. I take the mouse apart. I use a pair of tweezers and a vacuum cleaner to remove all dust dirt and HAIRS (2 each) from inside the mouse. Put it back together and presto! No more issues. I think one of the hairs got trapped in the top scroll wheel just enough to play havoc with the optical rotary encoder the operates from that wheel. Total easy fix. No more woes.
Hmmm.. So I’m checking my local Craigslist, looking for some wall mount speakers with the search terms “wall speakers”. Lo and behold, in my results I’m getting a whole bunch of ads from a Scuz Bucket selling artificial turf. Huh? So check the ad, and at first glance it’s pretty innocent.. a few lines of text advertising artificial turf. So wait a minute, how did that one pop on my search? So I do a Control-F search, and zing, there are displayed a huge amount of spam search terms hidden away in the ad. It seems the guy hid a bunch of stuff in a
way off to the right margin. There seem to be over a thousand words there.
Clearly a violation of Craiglist’s terms of service. The terms of service clearly prohibit “spam; miscategorized, overposted, cross-posted, or nonlocal content”. So yeah, the guy is an unscrupulous businessman. Would you buy anything from someone who thinks its okay to break the rules? Do you think these guys have an ounce of integrity? Someone you’d trust?
I was playing around with an idea for an application. I was interested in engaging customer input. I came up with this as interesting concept. It’s an online calculator to determine the volume of water in a swimming pool. The user types in an address, then creates a polygon that surrounds the pool. Add an average depth and its an easy determination to obtain the volume of the pool in gallons.
And if you are a pool supply company, this one’s for sale to you, cheap. Contact us from here…
A couple of notes:
- It’s been a long while since I’ve looked at Google Mapping applications. I was pleasantly surprised to see the costs for these services VERY reasonable. Google has clearly adjusted pricing downward in the past few years. Kudos to them!
- I set this up for US only. Obviously that can be enhanced.
- The other surprise is the Google GeoLocator API key is available for server use only. You’d have to write a REST API server to perform the lookup correctly. I’m currently running a client API key, authorized for this domain only. This works temporarily but it’s really a hack.
I’m working on repairing a laptop for a friend. She has very minimal needs, but reliability is one of them. I’m asking her to try Ubuntu Linux for a while. She’s totally open to the suggestion.
Here’s my question: How would you (simply) explain the difference between Windows Operating System and a Linux O/S to a total non technical person?
The only thing I could come up with was this:
Windows is like a Barbie Doll. She plays with Ken. They do cool stuff. You can dress her up, move her, do lots of different things. When you lose one of Barbies shoes, you really can’t buy just one more. If a dress rips, oh, well. There are a whole lot of accessories you can buy for Barbie. She’s way cute. She is fun to play with.
Linux is like a Gumby Doll. You can pose him, do different stuff. He plays with Pokey. They do cool stuff. He doesn’t come with many accessories, so there’s nothing to lose. Gumby costs a lot less than Barbie with all her accessories. He’s also VERY reliable. Not much to break, nothing to lose. He is fun to play with.
Anybody have a better way to explain the differences?
Barbie and Gumby image courtesy of Trash-n-Treasures Antiques & Collectables
So I happened to be looking at a SoundCloud website while chasing down a particular image. I opened the site in Chrome and then opened up the dev tools elements in Chrome. At the bottom of the screen, in the console, I was surprised to see
You like to look under the hood? Why not help us build the engine? http://soundcloud.com/jobs
The only folks who would even see this message is somebody looking at the details of the code. Way cool.
I often find myself looking at the details on large volume production sites as a learning experience…
- What tools are they using and why?
- Is it organized well or obfuscated and ugly?
- How many visible errors are there shown in the dev tools panel?
- Are there any tools there that will help me become a better developer and service my customers better?
So I was talking to a former mechanic friend of mine. We were talking about tools. I was saying I don’t really understand why, but I just like owning nice tools and I really like that all the tools come from the same manufacturer. It’s like they’re an organized, integrated set. Yes I know that’s pretty anal… the sign of a perfectionist. (I always thought Snap On should give away a 15 piece tool set.. let folks get started and addicted. They’d make lots of money in the long run.)
But sometimes being really a perfectionist is a good thing, particularly where design and engineering come together. When you design something you really want it to be the best it can be. (insert your own rant here…)
The funny thing was, in talking to this friend, I was explaining that I was so anal that as a young kid, I couldn’t play with trucks and cars in the sandbox unless they were all the same scale. It just didn’t make sense that a Tonka Truck and a Hot Wheels car were on the same road together. Don’t know where that comes from, but I couldn’t have been more than six or seven. My friend, laughed and admitted he had the same scale issue when he was a kid.
Trucks in the sandbox image from Sandra Miller at ShutterBEANPhotography