Monday, December 23, 2013

Angular And Firebase Routing and Small Data Sets

I was learning how to use Firebase with Angular recently, and I ran into a problem, when I asked a question on stack overflow I received an answer basically saying to call firebaseurl/ of the data, well I can get the index, but I wasn't sure how my second controller could get that data ( so when my router swapped to the new page, I didn't know how to get it). Thanks to a generous soul at Open Hack last night, we discovered $routeParams, apparently when you use :id in your router config, when you use $routeParams in your "new" controller, you can access whatever that : was, so in this case $routeParams.id gave me the id, which is precisely what I needed. 

I just wanted to point this out in case anyone else had issues. So long story short,

First Page had this:
<a href="http://www.blogger.com/blogger.g?blogID=4424951240484003947#/blah/{{index}}">Blah </a>(Where index is my id)

the router config looked like this

path="/blah/:id"

the "new controller" added a reference to $routeParams (like where we reference firebase, just add a comma and go).
Then I did

"firebaseurl" + $routeParams.id to capture a smaller set of data.

Friday, December 20, 2013

On Government Involvement with Hardware Standards

I asked Phil (@civissmith, +Phil Smith ) if I could repost his email on my blog, I thought it was a very coherent argument to the Government getting involved and forcing manufacturers to follow certain standards (Read: USB Plug on Phones). Enjoy! If you have anything to say about it, I(we) would love to hear!

In regards to our conversation yesterday about the EU and whether micro-USB is required in new devices:
The latest news I could find about the subject is that, at this point, it is still only a working consortium. The EU parliament has made a proposition to start working towards formalizing a law, but as of 26-Sep-13, there does not seem to be anything official [1].

As it stands, manufacturers in the EU have voluntarily agreed to work towards a common goal but there is no legal requirement. Even without formal legislation, Apple is apparently accommodating the EU market by releasing a micro-USB to Lightning port adapter [2]. This sets up a very interesting situation. On the one hand, an engineering team has designed and implemented a product and on the other, a non-technical governing body is pushing towards making a different, licensed technology a standard. I believe this is a very dangerous situation - the government is about to start driving design.

Let's take this out of the context of Apple vs. "the world", mostly because Apple is not the only manufacturer to create their own charging system. This is the cable used to charge my Toshiba Excite tablet [3]. Instead let's look at the underlying question, should a government body even be considering this legislation? If governments become involved at this level, I fear that technology will ultimately be hampered because the people constraining the design would be unfamiliar with how to create new technology - in some cases, they may not even be familiar with current technologies.

The prima facie appeal of the law is that it will reduce consumer waste and enhance ease-of-use. While, I agree that these ends are admirable, let's examine the means. A company is designing new "radio equipment device" to compete with the latest generation. During the design phase, this legislation would require the company to use USB as their power connector. This means the company must pay somewhere between US $1,750 US $4,000 per year just to carry the USB logo [4]. If the device is designed to have any media playback capability through a cabled interface, then the company must design a second interface. The device that could have had it's own hardware interface designed to do all in one must now ship with two cables - one USB and one proprietary. This scenario would be asking for consumer waste. Let's assume that the company doesn't want to run the risk of designing a second, proprietary interface. The media playback would then most likely have to be the de facto media standard, HDMI. To implement the HDMI solution will cost the company US $10,000 annually plus a per-unit royalty fee [5]. The saddest part of this scenario is that a device that could have done all of this in one cable must now use two. It's inter-operable, but is that easier to use?

This legislation will also only push the waste from the consumer level up to the manufacturer level. Nothing in consumer electronics is made-to-order which means that HDMI cables and USB cables will still be produced at a certain capacity until trend data suggests that manufacturing should slow down. The end result is still thousands or millions of surplus cables. The only real difference is that the cables never made it to consumers to be thrown away, instead they were thrown out by the manufacturers when a newer interface came along and the antiquated equipment was no longer needed. But speaking of newer interfaces, what does the legislation do to technology growth?

The current USB 2.0 specification only allows for a maximum data transfer rate of 480 Mbs [6]. As technologies get faster and data storage gets cheaper, it's a logical conclusion that 480 Mbs will eventually be too slow to be usable by the average consumer - look at what happened to the 14.4 kbps modem when 56 kbps modems came out. And, in turn, look what happened to the 56 kbps modem when DSL and cable technology became consumer-grade. Granted, these technologies took years to trickle from R&D to commercial to consumer, but artificial standards would have only slowed things down. Lets imagine what would have happened if "to put an end to cable chaos" for consumer desktop computer users, the EU had standardized the network interface card. The de facto standard in 1995, as I'm sure you remember, would have been the RJ-45 connector. The question that I would have to ask is how long would the additional legislation have taken to bring down the RJ-45 standard and replace it with RJ-11 so that consumers could start making the transition from dial-up modems to high-speed Internet? We see it in our legal system now where laws promote lobbyists and large lobbies have a lot of swing. When you have a consortium of companies that all make RJ-45 connectors and chips that talk dial-up - would RJ-11 have ever made the transition? In that 1995, the companies touting the benefits of higher speed through RJ-11 and Cat5 would have to not only overcome consumer skeptic, but also legal dead weight - neither of which is an easy obstacle to overcome. Worse yet, the RJ-45 consortium would only need to convince the legislators that the transition is bad - then the consumers would have never even seen the new technology. Additionally, when the hardware connector for USB 2.0 becomes too obsolete to allow faster data transfers, what happens with the legislation? How long will it be before new technology can start to compete? Will it even be worth while for any companies to undertake the R&D? If your design is not chosen by the legal team, you've wasted all of that time and money - you never even get the chance to vet your design against the public to see what they think. I would liken that to being administratively disqualified, even if your design was superior. The real judges never even got to evaluate your product.

I think Sony and Toshiba both have a couple of catastrophic design failures that prove that consumer support should be the guide, not legislative oversight. Let's look back on the failures of Betamax and HD-DVD. Betamax was technically superior to VHS, but Sony didn't want to play ball with the consumers. Now Betamax is nothing more than a blemish on A/V technology history. Similarly, the format wars between HD-DVD and Blu-ray had a short era of intense competition, but then the standard was chosen by people that were impacted by the technology - not by the government.

At a certain level, I believe this is how technology should be. As an engineer, I want to design things that people want to use. If the people want to use my product, I think they should ultimately be allowed to decide. I don't think the government should be levying requirements on the manufacturer to steer them towards other technology - especially under the guises of environmental good or consumer protection. The government is not only steering manufacturers towards a licensed technology, but they're also requiring the use of OLD technology. The micro-USB "B" form factor has been around for a long time in technology terms and, although it can be used to charge a USB 3.0 device - that's the limit of it's usefulness. As more consumer electronics start to adopt USB 3.0, we'll be left with another split market that will ultimately leave an electronic mess. At some point, people will stop wanting USB 2.0 cables altogether.

It's incredibly seductive to say that the government should step in and force all of the designs into one box, but the other danger to consider is the obtuseness of the government. Officials that aren't in touch with their constituency could potentially side with the lobbyists and not the people. Back in the original context, imagine if the officials are all loyal iPhone users - would everyone pushing for this commonality be happy if Lightning bolt was selected as the new standard? Every new Android, Tizen or Windows phone must now use Lightning bolt. Or better yet, why not make a common OS? That would be the pinnacle of interoperability and ease! The EU... no the world must now use Tizen!

I've seen what happens when the government makes technical decisions and it rarely works out efficiently. In this case, I honestly don't think "designed by committee" is something the people will enjoy if it is ever made official.

Ref:
[1] http://www.europarl.europa.eu/sides/getDoc.do?pubRef=-%2f%2fEP%2f%2fTEXT%2bIM-PRESS%2b20130923IPR20617%2b0%2bDOC%2bXML%2bV0%2f%2fEN&language=EN
[2] http://www.technobuffalo.com/2013/09/29/microusb-mandatory-european-union/
[3] http://www.toshiba.com/us/accessories/Tablet-Power/USB-Charging-Cables/PA3996U-1CAB?src=ANEM&cm_mmc=SF_GooglePLS&CAWELAID=1466835490&catargetid=400007100000003265&cadevice=c&cagpspn=pla
[4] http://www.usb.org/developers/vendor/
[5] http://www.hdmi.org/manufacturer/terms.aspx
[6] http://www.usb.org/developers/usb20/faq20/

Learning something New for the first time

I work with an individual on my team who does administrative tasks. She's been here 27 years, I've been here about 6, in the last few years, she's asked about my job and what we do (our team). I don't think many people have bothered go into any kind of details to tell her about what we do, since her main job is most definitely not programming. She has commented that she would like to learn more about what we do, and I've tossed the standard "go check out Udacity" or "go checkout Coursera" out there (from a programming perspective). But, that is poor form on my part.

This morning I decided to change that. It only took 5 minutes, and she did her first "hello world" in perl. Her eyes lit up, and she about jumped up and down she thought it was so cool to have written her own program. After the new year we'll have a few more sessions. I hope she has more fun, and the excitement sticks around!

There was an XKCD comic that really hits the nail on the head.


I think I'd rather be excited showing someone something for the first time than to "write them off" (if you're reading this, I didn't write you off).  I guess it hadn't occurred to me to just sit down and write hello world with you, it was easier just to say go read this book, or listen to this lecture, then to say "Lets do this right now", I'd like to change that in the future.

If I know something you want to learn, ask me to sit down and show you, right now. I will, if I can't we'll schedule a time. This is important to me and you.

Thursday, December 19, 2013

How I use Virtual Machines

So sometimes it's nice to have custom environments to play with "new" toys. For example I decided the other day I wanted to install Ruby and play with it. Of course I can download the installer (if i'm using windows) or sudo apt-get install, however what happens when I forget about it and don't want to play with it anymore, do i want to deal with the hassle of uninstalling? Do I want to leave it and let it bog down my PC? of course not. So this is where virtual machines come in. Virtual machines can be costly in terms of space though, so today I'm going to teach you about linked clones.

Here is what I did.

I bought a Sandisk Cruzer Extreme (these things rock).

1. Download the ubuntu Server instance (this will keep memory low)
2. Install VirtualBox.
3. Create that virtual machine and install (pointing to your usb drive, or if you already have an SSD then that I suppose).
4. Basically we want a very minimal install, so don't put any of the LAMP stuff in, basically if it says "Hey should I install this extra wiz bang thing?". Say no
5. Install samba (sudo apt-get install samba)
6. Setup a configuration similar to the following:
    6a. Create a folder (whatever you want to name it) in your home folder.
    6b. chmod the shared folder to this:  sudo chmod 777 folder
    6c. Update samba configuration (from /etc/samba/smb.conf) replacing path with the folder you created in 6a.
 
7. Once that was all setup, I start making linked clones for various tasks, I.E. Ruby Machine, NodeJS Machine, etc (be sure that network is set to NAT, in this case I have a HTTP Proxy that is a hassle, so this is my workaround, you may have a better way and I'd love to hear it.)
  7a. So select your Ubuntu Server, right click clone,
  7b. Give it a good descriptive name when it asks,
  7c. When prompted select LINKED clone, this gives you a standard setup, but clean environment!
8. Logging in I see that occasionally my network takes FOREVER to come up, so that's because of some oddball thing so remove this file and it should resolve it, you're welcome to google around but you'll probably find that deleting this file is the solution:
sudo rm /etc/udev/rules.d/70-persistent-net.rules
9. after installing everything you need. halt the machine, shut down, and change the network adapter to Bridged, boot your VM up again, your local machine should be able to see the samba drives at \\\shared_folder (or whatever you called it in the smb.conf file).

Now whenever you want to work, you can startup the Linked Clone and start playing (and reference the folder you setup so you can work from your local machine with all your custom setups, just to play).


Monday, December 16, 2013

DRM of the Future

Digital Rights Management isn't new. It's been around for a while (wow, the late 90's, http://en.wikipedia.org/wiki/Digital_rights_management), and while back in the early 2000's the concept of controlling media was the idea, in practice it's not something that was managable, however with each and every iteration of technology creeping into our lives, the stranglehold gets easier and easier to maintain. This piece is spawned from this article http://boingboing.net/2013/12/15/amazon-takes-away-access-to-pu.html). Lets begin.


Slowly my eyes begin to adjust, my alarm didn't go off. I look at my phone, oh I guess I was wrong, turns out for some reason the Beastie Boys didn't appreciate that I woke up to them, so they revoked my rights to listen to their music as an alarm. Whatever, I stand up walk to the bathroom and begin getting ready. I finish up head to the kitchen and get ready to check the news. Today feels like it's going to be rough. I check my news reader app, weird, something wrong with my account, I don't feel like messing with it. The news is depressing anyways. I look up some recipes and download them to my 3D printer. Pancakes and syrup sound nice. I finish up breakfast and head into work.

I sit down at my desk and turn on my monitors and computer. I wait for it to boot, the camera takes a snapshot and see's it's me, it proceeds to load some advertisements while I wait for the computer to boot (how nice). I work for a while go to lunch and come back. Once the computer attempts to login I'm told that the license for my OS is out of date and I need to pay to renew it. Bleh, call up Ted, "Ted, license is expired again, can you renew it for me?". "No can do, I guess our word processor got too popular, they refuse to re-license our PC's" said Ted. "Wait, are they legally allowed to do that? I mean isn't that a monopoly or something?" I asked. "Nope, we're free to compete, but we just can't use their products to compete, so no monopoly, although it looks like we'll have to start over if we want to continue, since we can't get into the PC's for the source code and the hard drives are encrypted." Ted explained,  "I think I'm going to pack up and go home, you might want to do the same, nothing for us to do here".  "Better update my resume" mutters Ted as he walks out the door.

Slowly I pack my things and walk out the door, as I climb into my car and tell it to drive me home, I ponder why we decided to develop on that OS. In fact I begin to ponder a lot of things. Why can't I listen to Beastie Boys whenever I want to? Why can't I just read the news? Why can't I just use the PC and the Operating System that I paid for? My head is hurting, I reach for an aspirin and look out the window. "Wait, this isn't the right way home". "Where are we going?". "Back to the dealership, I'm afraid they caught wind that the store shutdown, and they're revoking your lease" rattles off the car. We arrive, I guess I have to walk home, it's only 10 blocks better get going before it gets dark. I head home.

Exhausted I walk in the door and decide that tonight I need a break, I've been working a lot of overtime to get our app out the door. Tonight I am going to relax. I look up the spaghetti and meatballs recipe I bought a few months back, and program my printer to make it. I walk to the living room and turn on the television. I scroll through looking for the Sherlock Holmes Series I bought last month digitally but never got around to watching. I can't find it. I call up tech support, and I'm told that the new Sherlock Holmes is on The Onion, and since they own the original they decided that their customers should really be watching the new Sherlock Holmes when it's on, not the older Sherlock Holmes. "Great, so I can't watch it even though I bought it?".  "Nope" replied the tech. No apologies, like I'm expected to know this. I hang up in frustration, walk out to kitchen to grab my food and find that there is no food printed. I check the display, "Two options available Sherlock Holmes Bangers and Mash, Sherlock Holmes Fish and Chips", I call up tech support for my printer. "Hello, I am trying to print out some spaghetti and meatballs, there appears to be some kind of error on my printer", "Let me take a look real quick, it says here that you're planning on watching Sherlock Holmes tonight, is that correct?" "I was planning on watching the old Sherlock Holmes, but I'm not allowed to", "So you'll be watching the new one?", "No, I just wanted to eat and go to bed", "I'm sorry but The Onion has paid for advertising at this time, we'll only be able to make those two items, until 9pm after that you can cook whatever you want again". "Are you kidding me? I can't even cook what I want to eat, with food that I already paid for with a recipe I already paid for?", "Nope", I hang up irate.



All the things start small, DRM to protect the copyright owner from losing revenue by pirating. A little leeway for a corporation here, a little leeway there. Initially DRM was a nuisance, but not a big deal. When DRM was on DVD's corporations would have to chase down every person that bought a DVD and take it back (if they really wanted to recall their product). When these laws were first enacted, not many of us could have even envisioned corporation X stopping by our house and saying "I want my DVD back". We all just laughed it off, and didn't worry about it. As we move to digital content, it's easy to realize that with the click of a mouse everything you "lease" can be taken away from you. I will never buy a Movie, Song, or other digital relic, as long as someone somewhere can type a few words and take it all away. This needs to stop. Refuse to buy anything digital that contains DRM. Start making companies that compete with these companies, and offer DRM free. Show the world and these corporations that we refuse to sit down and take what we're given. They have the right to put DRM on any and all of their products, but we have the right to not buy it. We have the right to produce works of art that aren't taken away from the world at the whim of a president of a company.


Thursday, December 5, 2013

Tool Smith

I'm known at work as a "tool guy" I write tools for everything. I was just reading "The Bastards book of Ruby" and the author put it extraordinarily well.
But even if you never look at that program again, here's the key advantage: For 57 of those minutes (the other two minutes being used to actually type the code), you were actively thinking, researching, and learning how to solve a problem. You may never reuse that exact code. But you've become a better programmer and thinker. The next program might take just 5 minutes to think about and write.
I think it needs repeating, when you spend the same amount of time learning something versus mindless repetition, YOU WIN, you always win, because the next time it might take you 56 minutes and you've saved yourself 1 minute of drudgery, and 2 minutes the following, you've made more connections in that noggin of yours, and you've made yourself just a little bit more valuable to your company and others around you.

Chime in I'd love to hear your thoughts.

Wednesday, December 4, 2013

To Lead or Not To Lead That is the Question

This post was inspired by a tweet one of my old professors re-tweeted. The tweet basically said this:
"wahh my teammates dont work". I don't want to hear that. I tell them suck-it-up. If you're a leader u make it work. @ProfessorF and @olga_lavrova
This will mostly be from the perspective of a student, however I will go over a real world example. 

Working in a team is hard. Even when you can pick your teammates it can be tricky. Unless you've worked with them before and you have a good idea what their work ethic is like, its really like shooting fish in a barrel. You're essentially trying to pull off something that companies have a hard time doing with dedicated staffs, with weeks, resumes, phone and  in person interviews, all in about 5 minutes at the end of class, or worse yet you're TOLD who you should work with. Like companies, you don't discover that the person was the wrong choice until you're far enough along you can't just get rid of them and get someone new. The cost is too high, the deadline is too tight. Training a new person just isn't feasible.

This leaves you with very few choices. You can just ignore the person and absorb their work. You confront the person and sometimes that works, but more often then not you absorb their work (and if you weren't irritated before now you're way more irritated that you've told them they're not pulling their weight AND you're still having to do their work). Or you drop them from the team, they get a bad grade and you have to absorb their work. Do you see a pattern here? It's a lose lose situation for the "leader/teammate" in almost all cases. (This is assuming the leaders job entails more than simply telling the others what to do, if that's the case, the leader never loses, because he is doing his job).

I had a similar problem back in college, confronted the individual, and nothing changed, I've had that problem in the real world at work, the (high level) recommendation I got? Keep micromanaging them. I have my own work to do, I'm not a manager, but we brought someone in to help with a tight deadline and I would be expected to micromanage them while still maintaining my tight schedule? What options would I have (I'm not a manager remember), I have no authority. My ONLY authority is the ability to annoy the person, and if I want to get my job done, I don't have time to do that, so what happens? That person slides along, and nothing changes, eventually the work reverts back to myself or another person who gets work done. The next assignment they get, they can do the same thing, the only time they have to actually show a specific output is if their job is on the line (this is not the case for all people, I'm just giving an example).

What makes this problem worse is that *most* people who chose to go into engineering/software development, have an aversion to conflict, and/or dealing with people. While it's great that we are expected to learn how to deal with it, (nothing wrong with learning to go outside your comfort zone on occasion), no one teaches how to deal with this problem. That behavior simply compounds the problem, because we would rather see work get done than deal with other people, those people are allowed to continue that behavior. If you drop them from the project they *usually* find another team that will let them just skate along and still can continue their behavior anyways, if not, they repeat the course and guess what, find another team to not do anything on. The scary part is that sometimes those people somehow become managers and now the person who does the work is being told by the person who really hasn't done any work in their life what to do, how to do it, AND when to have it done by. (I'm fortunate in that I have a manager who is very technically competent and can understand most questions related to my field and offer useful suggestions). 

We are taught how to think (in theory) but we're not really taught how to handle working with other people when everything is great, everything is terrible, and everything in between. Why is that? If we enjoyed dealing with this interpersonal relationships, communicating, etc, we'd get a MBA (I'm being facetious), but we didn't, we have a curiosity for how things work. As long as they're not people. I suspect that teachers hear these complaints all the time, if the answer is figure it out, then what's the point, we should be fixing this problem from the beginning? This behavior is unacceptable, from Why Can't Programmers Program, it's pretty obvious we're letting more and more people who would rather do nothing slide through the system. I'd love to rant why, but I'll leave that for another time. As Professionals, Teachers, we have a moral obligation to fix this, otherwise our society will continue to our trend of being high volume consumers, but low value producers, and from a economic standpoint that's devastating. The reason for the claimed "engineer shortage" is because we are not training engineers we're training 1:2 engineers:managers when we think we're training 1:1 engineers (and that 2 is a conservative estimate, I'm willing to bet it's more like 1:5 or something crazy).

My challenge to you the reader is to think about how we can solve this problem. What "algorithm" can we tell our engineering students to follow to achieve success in this (seemingly) always losing game?

I would rather not lead, I'd rather have a team that has momentum and can carry themselves where they need to go. Where "leading" isn't so much leading, as it is guiding a solid set of people where they never thought they could go.

People who write blogs are supposed to have all the answers. I don't in fact I think my questions outweigh my answers by orders of magnitude, I'd love to hear your input, maybe WE can solve the problem. (sometimes asking the right questions leads to the right answer, even if you don't realize it).