Tuesday, January 27, 2015

An App Idea, an App Endorsement, and an Unrelated Music Endorsement

I'm sitting in Starbucks, whiling away some time, as is my Tuesday ritual, and want to listen to some music, probably via Spotify or Google music, and I had an idea.

The Awesome App of AirDroid

I've linked up my phone to my laptop via AirDroid, an app I cannot recommend strongly enough for those who like to links their various devices, transfer files between them, etc. It's not a new app by any means, so a ton of people probably already have it, but I've only recently come to appreciate several of its uses.

I'd originally found it while searching for an Android equivalent to AirDrop (like I expect many people did, and was its original purpose, given the name). I have a lot of drive time so like to transfer audiobooks and other large files. AirDroid does this splendidly, allowing one to connect computer & phone on the same WiFi network, but pointing a browser to a specific IP & port, or (even easier) just be snapping a photo of a QR code with the phone.

What I've come to appreciate all the more its functionality allowing control of the phone from the laptop: texting with a full keyboard, file management on the phone, and about most everything else. It's come in extremely handy.

While I'm broke and unemployed now, I've added AirDroid to the list of apps I'm happy to purchase or donate to once I have an income.

An Awesome-r App (Idea)

I've got plenty of data on my cell plan, and hate to suck bandwidth away from the other WiFi users (I'm not one to play along with the tragedy of the commons!), but I need the phone on WiFi to use AirDroid. So I thought it would be pretty damn useful to have an app that could specify which network connection to use for certain apps. I want to be able to tell Spotify to use the 4G connection, while letting AirDroid use WiFi. I'm not sure to what extent that's possible though, should the OS itself not distinguish the separate network connections well, but I seriously doubt that would be a problem, since Android is Linux-based. 

Perhaps something like that already exists, in which case I've got to get searching. If not, someone should make it! This blog gets a pageview or two most days, so perhaps if I laden it with keywords like "app idea" and "android app developer", I'll get the right person to find it. ;-) 

An Incredible Cello Artist

Finally, I decided to play Zoƫ Keating (Wikip), a cellist with a twist. I first heard of her on an old Radiolab episode, which discusses her unique method of making music, recording herself, looped digitally, and creating incredible songs as a result, consisting solely of her & her cello. Having enjoyed her music from time to time for years, I now recognize the snippets of her songs that NPR tends to play between stories. A good choice!


Thursday, January 22, 2015

Sharing Resources

I added a list of links to the right-hand side of the blog site (labeled "Misc Resources") as a spot to put some of the better various sites, guides, etc. that I find particularly clear or useful.

To start, I put up two pages I've been using heavily of late:

  • Krondo Twisted Introduction: This is a fantastic (albeit lengthy) introduction to asynchronous programming, specifically in Python and using Twisted. Dave Peticolas does a hell of a job taking what can be a very tricky abstract concept and breaking it down into digestible chunks, rather clearly explained and with a twist of humor throughout. And to top if off, he provide all of his example code conveniently organized in a GitHub repo! 
  • Lessons in Electric Circuits: Tony Kuphaldt churned out six "volumes" of textbooks providing a very detailed introduction to electronics and circuits, all available for free (including PDF copies). While the text is a bit excessively thorough and tedious for my purposes & interests, it's so well organized that skimming through to get high-level ideas and work towards the topics of interest to the reader is made really easy. There's an abundance of diagrams and examples, with every phenomenon and lesson very accessibly elucidated. 
I'll try to remember to add in great resources as I come across or recall them. And maybe every once in a while, I'll do something like this post, and provide a summary on recent additions to the list. 

Wednesday, January 21, 2015

Random Business Idea: Scattered Mini-Work-Depots

Framing the Problem

While currently residing a bit south of Columbus, Ohio, I'm spending a day most weeks up in Cleveland. Fortunately the three-hour one-way commute is greatly eased by hours upon hours of Game of Thrones audiobooks. But with multi-hour stretches between appointments and the like, I like to dip into whatever project I'm working on at the time: watching some Coursera lectures, doing some coding, the endless job hunt...

I typically make due by chilling for a while at a coffee shop (Phoenix is a favorite, Algebra's (Facebook, G+) another). But frankly, I'm completely broke, and continually buying coffees to assuage my guilt for camping out and mooching WiFi is not a sustainable option! Plus -- though maybe it's just me -- outlets for charging one's surplus of electronic devices are hot commodities in any such location.

Oh, and I drink a LOT of water. So having to find a public restroom once an hour gets really annoying.

Work Anywhere with Workstations Everywhere!

So maybe it's overkill or otherwise solving a minor problem that doesn't bother too many people. But what if there were rather simple workstations placed sporadically in popular locations, particularly cities or areas where traveling for work might be common. Perhaps a simply monthly fee for X uses per month, or a pay-per-use option.

A small work depot could provide the simple necessities to be productive for varying stretches of time. Charging stations, of course, and WiFi access are obvious needs. But simple chair & desk, maybe an extra monitor with various common adaptors to plug in (but then not everyone cares so much about a second monitor). A place to get out of the heat or cold or rain or snow, and a bit more room to stretch than just staying in one's own car.


I have to admit, though, that this might just be an excessive solution to a small or uncommon problem which has a variety of other easy solutions. Maybe taking up a table for hours in a given coffee shop, having purchased just a $3 coffee doesn't bother most people, or perhaps libraries or other public locations are sufficient. Plus the costs of renting or creating a physical brick-and-mortar service like this, with value closely tied to an extensive existing network of locations, then adding in the costs of power, internet, ways to minimize theft, et cetera... hell, as I'm typing this the idea seems increasingly foolish.

But the idea popped into my mind and I like to work through them, because you never know when you'll end up with a really great idea once fully though-out! I have so many damn ideas like this on a regular basis, maybe I should I post them more often, should one of them spark a better idea in someone else's mind!

Friday, December 12, 2014

Getting Physical: Learning to Interface Python & Hardware

I've always been more of a software guy then a hardware guy. But a litany of factors have resulted in me finally putting a lot of real effort into making an old idea of mine become a reality, so now's the perfect time to start getting hands-on experience working on the hardware side of things!

In short, I need to create a device that can take some real-time distance and motion measurements. Ideally, this device will be small, inexpensive, simple to setup/install, and wireless (which means wireless communication and wireless power). To start, though, I'm just getting a functional prototype going for proof-of-concept, so I'm not worried about the size, wired vs wireless aspect, etc.

It's Alive!

Maybe I'll get a chance to go into some more detail at a later date, but for now I'll skip to the cool part: version 0.2 is operational! (I arbitrarily used v0.1 to getting the accelerometer working, and v0.2 has the distance sensor as well).
Device v0.2: RaspberryPi + GY-521 MPU-6050 accel/gyro + HC-SR04 range sensor

Since I went into this pretty blind (no idea what I'm doing at the outset) and a with low expectations (circuits was one of my worse courses in physics undergrad), I made some choices that erred on flexibility. For one, I started with a Raspberry Pi B+ model. Choosing a RasPi instead of an Arduino came down to two key differences:  1) RasPi is an all-in-one computer while Arduino is a much simpler microcontroller, so the former has a lot more functionality while the latter is intended for a single or fewer uses; and  2) Arduino's programming environment is in C, while Raspberry Pi runs a parred-down Linux, so I can code in just about anything I like: Python, Perl, Java, C, etc. 

There are a wealth of helpful tutorials for getting started in RasPi and interfacing it with various sensors & equipment. For the accelerometer/gyroscope unit, I used a Kootek GY-521 MPU-6050 (also bought a couple ADXL-345 units which were popular on blogs & tutorials). And for distance, I'm used an HC-SR04 ultrasonic range sensor. I'll make a note to come back at a later time and link out to the best tutorials I found, but a simple Google search gives you plenty. 

Oh, and for the Raspberry Pi board itself, I went with a starter kit from CanaKit, which provided a lot of the important peripherals in addition to the basic RasPi board (e.g. power supply, wifi dongle, enclosure). As a complete idiot when it comes to DIY circuits/electronics, I can say the CanaKit package was a really great place to start. 

In the end I'm actually a bit surprised that once I learned the basics of build-it-yourself electronics, the hardware aspect of my project was a surprisingly small portion of the hours I've put into it so far. So I'm already going back to the coding stuff I love! My next task is to start learning multi-threading & queuing in Python, so I can have the two sensors running in parallel and controlled by a single program. 



Wednesday, November 26, 2014

New Moves

A new skill or tool is always best learned through its application. Practice, practice, practice! In the the past I tended to read about something of interest, but not actively apply it to demonstrate and solidify my knowledge. The recognition of that flaw was a hard-learned lesson that slowly, steadily reared its ugly head throughout college. And frankly, I'm sure I'm still guilty of it from time to time, but I'm certainly better at it now!

The Perfect Challenge

While watching a show on Netflix, I thought of trying to model a chess game programmatically. Then I realized that actually makes a perfect project for a whole host of reasons, hitting several challenges I've been wanting explore right on the nose! I want to expand my very limited hands-on experience with machine learning, and chess has a rich history and so tons of data to train on. I've also been looking to get more practice designing MapReduce functions, and chess presents a set of an inherently parallelizable calculation (i.e. simulating outcomes give particular moves). If I get stuck, confused, or otherwise need help, I'm sure there's a plethora of examples out there to work from. I'm in essence intentionally re-inventing a wheel (more like an engine!), so that I have the opportunity to seek guidance when the need arises. I'm sure there's a ton of different statistical tests and tools I can tinker with to take different approaches to assessing the state of a board and determining moves.

Furthermore, there's an incredible range of difficulty to attack: I can keep the task simple by specifying a very specific sequence of moves and/or circumstances (which pieces are where) and trying to determine the "best" move (of course "best" is itself up to me to determine in this case), or go as deep and advanced as I could wrap my head around by attempting to simulate entire games, or varying how many moves out to project, how complicated an algorithm to determine the "best" move(s) to make, and so on. I'd bet one could continue coming up with a plenty more reasons this is such a great challenge to work on.

Starting Positions, Please!

To begin, I laid out the elements I'll need to develop: a board, populated with squares which have given properties like whether or not its location is occupied by a piece; each piece itself having a set of possible moves, and so on. Naturally, I started to get ahead of myself and needed to move backward and start simpler. In the end I wound up setting tonight's goal as establishing a single piece in the center of a small (3 x 3) board and determining it possible moves. I chose the piece to be a King, to have multiple possible moves, but have all such moves be very straightforward to assess. 

I can already see a ton of attributes and functions and the like that I'll need to define in the end: 
  • given a possible move to a new square, is that square occupied? If so, is it a piece of mine (so I can't move there) or is it an opponent's (in which case I can attack). Is there piece "in the way" so I can't move in that direction (with the exception of the Knight, of course)?
  • Am I on/near a boundary? A King can move left, yes, but if he's all the way to the left of the board, then no he can't! 
  • How do I weight possible moves? What's more important, what's less important? And how do I even quantify factors like whether to attack, how to recognize when a piece is "at risk" and whether that risk is acceptable, how to determine a move's importance as a part of a large strategy, so each move is interdependent on other moves...
  • Oh so many more... 

The First Big "Aha" Moment

When trying to define a piece's allowed moves, I wondered how to distinguish between one (say white) pawn's allowed move "up" or "forward" versus the opposing pawn's allowed move "down/backward" -- especially if basing locations on a Cartesian coordinate system board. Then it clicked that a better approach might be to define the entire board, pieces, and match from the perspective of a single player; then a two-person game is really just two separate (but related) instantiations of that single-person game! Each player can see his/her moves as forward, facing opposition pieces which, for the time being, can be considered just stationary obstacles. Then once the basic "moving" functionality is operational, having worked in not only permissible moves but also having those moves dependent on whether squares have another piece on them, I can figure out how to make each player's board setup (and thus moves) interdependent on the opposing player's board. The complexity builds pretty damn quickly, but it was a good realization to have early, I figure. 


The current struggle is how to relate objects to one another. For example, rather than determining moves on/at the level of a particular piece, I'd rather define relative movements for the piece (x+1, y+2, etc) and then use those to determine the set of possible "next locations" at the level of the Square (location) or even Board itself. So piece know's where it is and how it can move, but not where it can move, instead allowing the Square/Location (referenced by the "where it is") to determine and inform the piece where it can move. 

This is how I'm voluntarily spending my evening. I'm such a nerd. :-) 




Monday, November 24, 2014

# Instantiate Blog

A common occurrence over the last several years (and even more so the last several months) has been discovering the solution to a problem I'm faced with, or otherwise getting useful guidance toward solving it myself, from miscellaneous blogs and personal sites found by Googling. Often these blogs or websites are just the public record of someone's hobbies, whether a personal interest or a professional pursuit.

Embracing the perspective that almost any problem, obstacle, or hiccup that I'll face has already been tackled and overcome (and written about!) by someone else, I'll google the keywords of an error message or desired outcome and land on a blog post by someone who's been there and figured it out. And I can't overstate how frequently I search for tutorials and documentation to guide me into something new which have proven invaluable. These uses, combined with the realization that it could help me professionally to get some of my work, tinkering, stumbles, and accomplishments out there, inspired me to throw together a new blog.

At the outset, I have to cohesive "vision" for its intended purpose or target audience or anything else. But all too often the ramblings of others -- combined with the power of Google -- have been a major help to me, even if the original author(s) was never aware! So why not share my own various explorations?

Some "Things-To-Post" that initially come to mind:

  • Hadoop - Errors & Solutions: basic-level pitfalls and mistakes I made, plus lessons learned.
  • Data Analysis - Matching Countries & Counties: I recently started re-creating my old "senior capstone" project from 2010/2011, and one meticulous task is properly matching & merging data from various sources. 
  • Crazy Ideas & Miniature Projects: things I've thought of, thing I'm working on. If I'm lucky, someone else out there will stumble across it and can share some wisdom. 
  • Simple Scripts: misc. small coding tasks or projects
  • Nifty discoveries, useful tools, etc.: mobile apps, handy utilities, neat sites, awesome products

Plus, I finally have something to link to in online profiles & job apps:
       < Link Personal Webpage / URL >
        And don't forget to feel slightly inadequate if you have nothing to put here! 

It's the small things in life. ;-)