Friday, December 20, 2013

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).

Friday, November 8, 2013

Learning From Requirements

Learning to use a system from requirements is much like learning how to drive by reading how the engine works, it's limitations and what it does, (as well as all the other components). I have done some learning by reading code, and that helps some, but it's still a similar scenario (but possibly much lower level). Of course sometimes just playing with the system helps, but there are lots of things that you don't have a clue how to do.

In my opinion, along with any set of requirements, there should be a general "Theory of operation", or a Driving manual if you will. Then people new to your organization will have a little better idea what's going on. If you don't you're just making more work for them trying to extrapolate how to use a system by what it can and cannot do.

Another thing that would be nice, is to take an approach similar to the web, if you try to enter data in and it doesn't match, try giving an example of the "type" of data you're looking for.

If you're putting in a number but it has to be range limited, then say what that range is!

Anywho, thanks for listening, I have a few interesting posts that I am preparing for my readers (you), so hang tight. They'll be here eventually.

Monday, October 14, 2013

Unusual R&D Companies

When you think of Disney what do you think about?

Movies, books, maybe a theme park right?

Did you think about them as an R & D company? I know I didn't.

But lately they've been coming out with some really interesting things. The latest being Paper Generators.

http://www.disneyresearch.com/project/paper-generators/

The theory behind it is that you rub paper and it generates electricity to light up things, (or deal with e-ink displays/etc)

I'm really impressed, I wonder what other companies are doing some interesting R&D that you wouldn't expect. Do you know of any? please tell me!

Wednesday, October 9, 2013

Hacker Scouts

I love the idea, and I would be interested in supporting (teaching?) if someone wanted to get something like this kicked off and running.

http://www.garratt.info/blog/hacker-scouts-is-awesome-technically/

Tuesday, October 8, 2013

Data Books

Here is a list of good books for Machine Learning, Data Analysis, etc.

http://blog.yhathq.com/posts/ten-data-books.html


Open source Natural Language Processing book too (linked above anyways, but I don't mind duplicating)

http://nltk.org/book/

Thursday, October 3, 2013

HN post on getting the word out on an idea links

Seems like some good ideas, biggest takaway is to figure out your target audience, and make sure to market to them as your primary source, but sometimes other areas find them interesting too.

https://news.ycombinator.com/item?id=6488822


This is kinda my way of bookmarking something I'm interested at the same time, hope you find it an interesting read like I do.

Tuesday, September 24, 2013

Is it a job?

When you go to work, is it easy to fall into and discover half (or all) of your day gone? If not, are there times that happens? 

When I get to work and start solving a problem, and follow up with building it, I find myself hours later not realizing its time to go home.  Other times I come in and dread doing some of the work, for me as long as the times I am doing what I love happen more than the not, I consider that a win, and sometimes wonder if it is even a job I'm at. Is it just some one who wants to pay me to keep doing my hobby?  Many people say that of you make your hobby your job then it won't be fun anymore. I guess my question is this, does your hobby excite you? Do you find passion in it? I personally would be surprised to find out you are.

Then again I have an addictive personality (why I stay away from bad stuff :)), when I like something I'll keep doing it until I'm forced to stop, I love building things and engineering things, and unless someone makes me stop I'll probably just keep on trucking.

What do you love doing, could you make that a living? I think there are all kinds of possibilities out there. Don't think you can find a way to make it work? Ask me, maybe I'll have an idea!

Monday, September 23, 2013

Cc2541 ti bluetooth mcu

This may work for a replacement to my arduino/Bluetooth combo for music glove, need to install eagle to view for size http://t.co/nzGrj1LBKa

And may need to adjust circuit, ideally I would like coin battery usage

Pressure Sensor

Don't have time to watch this right now but may be a solution for my fingertip buttons http://m.instructables.com/id/eTextiles-How-to-Make-a-Pressure-Sensor/

Wednesday, September 18, 2013

My thoughts on Projects and Learning

While I was mentoring one of my good buddies, we talked about projects and the like a lot. It was interesting, and I came to the conclusion that there are 2 primary types of learning when you're out there on your own. There is learning for the sake of learning, and learning to accomplish a goal (which is not learning in this case). I'll talk about each a little and what I think about them.

School Learning
Learning for the sake of learning is going through an entire API just to read up on it. Learning all the details of a language just to know it. One of the benefits of doing this is that you end up having a deeper toolbox to give you more understanding of the underlying structure.  In some cases this learning may actually give you ideas because you didn't even know that particular aspect of an API or language worked that way or existed. Often times it simply allows you to recognize patterns of problems as well, if memorization is involved. The downside is that it's slow, if you spend the time to read every little bit of an API, or language, by the time you are ready to use the language (or API) they may be out dated.

Real Life Learnin
When you start a job in the real world, you don't just take the tools you learned in school and use them and nothing else. You start picking up new things constantly, and usually (unless you work at a really cush job) you won't be given the time to spend reading every bit. What you find is that you define your problem, break it into pieces, determine what pieces you know and which you don't. From there you research enough about each piece to complete it. The benefits of this approach is the quick feedback loop. You discover quickly what works what doesn't, what's easy what isn't. You also can start hitting a wider variety of items in your toolbox. You don't get the depth of school learning, but unless you are writing a very complex piece of software, or debugging, a cursory understanding is sufficient to complete the task usually.

When you set out to learn what approach do you find most useful? Do you use one or the other? Maybe a hybrid approach?

Why I decided to become an Engineer, or Why do I do what I do

When I was going to school, I would ask other students occasionally why they chose Engineering. Often times the answer was "My father or mother is an engineer, so that's why I decided to be an engineer". Occasionally, I would get a "I liked to take things apart so I figured ...>Engineer". Rarely I would get a "I don't know, someone said I should be".

While there is no right or wrong answer, doing it just because someone told you to just doesn't seem quite right. Doing it because you look up to someone is a pretty cool way to get into it, although without that curious nature I think you're pretty limited. I'm sure there are tons of awesome engineers who are engineers just because someone they looked up to is an engineer. And I'm sure people look up to them even now (which is pretty cool). If I were to pick a reason someone should become an Engineer I would have to go with the second choice personally. If you have a curious nature and like to look at how things work, thats headed in the right direction for what I think makes a Rockstar Engineer.

But this post is about why I decided to become an engineer, so I'll tell you (by the way, if you are an engineer, or well anything, tell me about what made you decide that career choice!). Way back when, I moved to Albuquerque to work on Flight Simulators for Lockheed Martin, it was a pretty cool job, but I was hired as a Tech, and thus was supposed to do "tech" stuff. This meant only hardware, even if I looked at the software and found a problem I wasn't allowed to fix it. A "degreed" engineer was supposed to fix it. I really loved how you could control something physical with software (re: I/O and robots, and lots of embedded stuff). I decided going back to school was the only way I would get to play with that stuff professionally. Back I went.

A number of years later (working full time and occasional semesters of full time) I managed to get my Computer Engineering degree from UNM. Just having that piece of paper opens a lot more doors I think. However, if you don't have a curious nature and want to learn more and more. You'll start running into more and more doors closing as time goes on. Just having a piece of paper might get you to an open door and talking to someone (especially in the early days of your degree), but if you're not constantly bettering yourself, and pushing yourself to learn more, you'll find you're falling behind.

Why do you do what you do?

Monday, September 16, 2013

Class Inheritance Problems In Python

I was trying to play around with classes a little the other day I ran into some problems.

I tried to call a function on a child, that calls the parent and uses the self attribute. It wasn't having it.
I got the error
AttributeError: Class Instance has no Attribute ''

After some searching I came across this post, it was a little confusing but I think I finally got it.

http://stackoverflow.com/questions/16528171/attributeerror-child-object-has-no-attribute-name

Here is an example of the result in action:


*Notice I had to do Animal.__init__(self) for the function to work. It took me quite a while to figure this one out.

Tuesday, September 10, 2013

School, Learning, And What to do with it.

People complain about having to take classes they don't think they'll ever use. And I fell into that camp for a long time, in fact until about 2 days ago I fell into that camp. What changed?

I became a little more enlightened. You see, I don't need to use almost anything I learned in school, except for some of the solid basics, you know, reading, writing, arithmetic. Its when you start trying to solve harder problems that people don't ask you to solve, that you discover that using those tools makes things easier.

I'll give you an example.

I was working on testing some code, it's pretty complicated, and it requires lots of inputs, it outputs 3 values. Now to figure out how to get a particular output can get kinda tricky. So analyzing the function, if you can reduce the number of inputs that change the particular output that will make your job easier.

One way of solving this problem is attempting to plot the inputs, and the outputs and look for commonalities. This was my first attempt at solving this problem. After speaking with a fellow colleague (You know who you are, if you want to be credited I'd be happy to link to you), he suggested that I could write a search algorithm. You see, I had completely forgotten about finding "maximum" and "minimum" values, I even think I heard about it in my Machine Learning class, but unless you are actively searching out these problems it's easy to forget that there are solutions you've already learned about.

Even better my colleague suggested that that particular line of code might be to prevent the variable from causing out of bounds (WITHOUT EVEN LOOKING AT THE CODE, THAT'S HOW GOOD HE IS). How did he know this? He listened to the signals. I mentioned things like Cosine and Sine were being used in the function. He knew at a high level what KIND of calculations were going on. So he made the guess that it could be protecting. He was right!

So all I can tell you is to keep actively seeking out those problems and using those tools we were taught. I was wrong. I can admit it.

On Converting Ada to Python Pt 1

So rather than using Overloaded operations on each kind of "type" you would want to make the class (which I'm using as types now) have the operation.
I.E.
Ada:
   function Convert_to_Something(This : in Dog) return Animal is
   begin
      return This.Animal
   end Convert_to_Something

Python

(in class definition)
class   Dog:
   def Convert_To_Something(self):
      return self.Animal


How they're called:
Ada:
   Convert_to_Something(This)
Python
   .Convert_To_Something()

Thursday, August 29, 2013

My New Hammers

Sometimes you come across something that you just find really interesting. Like making lists out of lambdas. While playing around with sets in python at work I came across map, filter, and reduce functions, I thought these were neat but at the time had no use for them. Lo and behold, I decided I needed map a few days ago.

Map
Suppose I've got a fun list like this: (In Perl)

@a = ("blarg.raw","blewy.raw","breqs.raw","blraw.raw");

suppose I want to strip .raw off each element of the array?

@a = map { s/\.raw//; $_ } @a

Guess what @a looks like now? Yea you guessed it:
@a = ("blarg", "blewy", "breqs","blraw")

I happened to need this in perl, so thus the perl syntax.

Filter
While talking to a buddy he mentioned that he was taking two lists, finding the smallest element of one list, and then kicking any elements that were smaller from the second list. Sounds like a job for Filter to me!

I haven't tested it but based on my understanding something like this should work:

lowestElement = 10
yourList = [1,2,3,10,45,6,7,8,876,543,3245]

yourList = filter((lambda x: x > lowestElement), yourList)

guess what yourList looks like now?

yourList = [10,45,876,543,3245]

Pretty awesome right?

Now I hadn't suggested it to my buddy but I'm thinking that we can somehow use reduce.

Update: (12/5/13)
If you want to "mimic" a similar functionality as filtering you can kind of use map, in this case here is an example:
@a = map { m/.*\.raw/ () : $_} @a;
so in this case if we match "raw" in the name, then we can toss it out, otherwise we can store off the value.This allows us to reduce to only a set of files that don't already contain .raw, we can also do other operations.in place of the regex match, but I wanted to keep this around for reference (I actually needed to use it today)

Reduce
I'm not even remotely sure if this could work, but reduce keeps using elements in your array.

Something like this *might* work for him

firstList = [2,3,4,5,6,7,8,10]

firstList = reduce((lambda x, y: y if x>=y else x), firstList)

So the idea here is that we compare each element, to eachother, find the smaller of the two, and then get rid of the other.

I think that's pretty neat, and I expect the result to be 2 in the above example.

Thursday, August 15, 2013

Communication through space

I have to assume that communication through space will have to be limited by the speed of light (unless black holes will somehow provide "warp points" to send data faster through space, or shortcut it I suppose).

I was thinking about if we took a space craft and gave it a bunch of little beacons whose job is to simply transmit any message that it receives to any other beacon it can reach. We could put a time stamp on it (using our Absolute Time we have calculated), and each beacon when it see's it can determine if it's forwarded it on or not. This is all cool and stuff, but if we assume that we're restricted to even radio waves for speed (not light), we could conceivably send something out that is constantly transmitting, eventually due to distances and these restrictions, when we receive things from it will begin to distance themselves. Imagine listening to transmissions from years in the past that are being heard for the first time? Imagine if someone took off from earth, and once they were say a distance of 50 earth years transmission time (so we get their transmission 50 years after transmission), we start hearing a new form of music, or hearing about discoveries. We would literally be listening to echoes from the past. New discoveries from the craft could be getting transmitted to us and we would be discovering them years in the future. I for one find this facinating.


Some of the upcoming posts are a bit inspired by Elon Musk's big ideas, If you don't know who he is take a look at his wikipedia page, I think some of the goals he has are amazing, and I agree that we as a society need to start focusing our efforts on big ideas, and not on the next fart app. A collegue and I have been chatting about space travel and how amazing it would be to make it to Mars, so we started looking into it, I don't know much of anything about it, but who knows, maybe I'll learn something, and maybe you will too.Either way, knowing more about a wider range of technologies makes us better as a human race, fart apps, don't. 


Wednesday, August 14, 2013

Navigation in Space

I don't know much about this subject and most of these thoughts are things that just came to me as I was thinking about it.

Aircraft have flight management systems to determine how/where to go and in the most economical ways, etc. I can only assume that the same goes for space. The biggest differences being that on earth we travel and we have gravitational constants that are known, and we can estimate different things like drag, etc, we have to determine where we are with respect to other aircraft in order to stay safe (I believe this is ADS-B stuff, correct me if I'm wrong). In space you have to worry about other aircraft (assuming space gets busy out there), still, but now you have to calculate where you're going to be at different times, where other planets are going to be (this is for long distance space travel). Gravity of each of those planets, using our current systems we can determine what speeds we need to increase/decrease to in each phase of our travel (I won't call it flight, because to me that implies aerodynamics and dealing with things like drag/etc),so we can miss a planet, all together, or avoid the most of it's gravity, also we could use them to our advantage to make turns while maintaining forward thrust only (don't waste fuel on pushing side to side). Obviously my last post Absolute time plays a part in this whole mess, if we don't have a constant time wherever we are, calculating these things will get very tricky.

Some of the upcoming posts are a bit inspired by Elon Musk's big ideas, If you don't know who he is take a look at his wikipedia page, I think some of the goals he has are amazing, and I agree that we as a society need to start focusing our efforts on big ideas, and not on the next fart app. A collegue and I have been chatting about space travel and how amazing it would be to make it to Mars, so we started looking into it, I don't know much of anything about it, but who knows, maybe I'll learn something, and maybe you will too.Either way, knowing more about a wider range of technologies makes us better as a human race, fart apps, don't. 

Tuesday, August 13, 2013

Absolute Time

According to wikipedia...

Absolute, true and mathematical time, of itself, and from its own nature flows equably without regard to anything external, and by another name is called duration: relative, apparent and common time, is some sensible and external (whether accurate or unequable) measure of duration by the means of motion, which is commonly used instead of true time ...
https://en.wikipedia.org/wiki/Absolute_time_and_space

So this got me to thinking, suppose we were really into space travel, suppose our super fancy atomic clock that was set back on Earth to the relative time there, and our super fancy clock broke. Uh Oh, how can we know where earth will be at any moment in time?

Some things that I think need to be overcome to determine an "absolute" time:

  1. Mapping trajectories of ALL universes
  2. Planet/stars etc.
I think if you have those two things we could then say that if a particular planet we were nearby is in a particular location with respect to another say 2-3 planets/universes, we could then triangulate where we were with respect to the rest of space. Unfortunately I just don't see a way of getting around using "relative" positions in space to determine absolute time.

One thought I had was suppose we took a radioactive item, encased it so it was safe for human use, and then we setup a monitor, and on day 1 it read the decay and we initialized the value, then as we move through space we have a pretty accurate clock, that isn't dependent on factors such as magnetism, or other things, the problem goes back to "what if it breaks", how can we get back?

Taking off from somewhere in deep space and "hoping" that a planet isn't in your way when you take your straight line path is going to be problematic.This is why we need an absolute time calculator. With that you can create a "FMS" of sorts for space that will calculate positions of planets in your trajectory, as well as different gravitational pulls as you move through space. (in Theory)


Some of the upcoming posts are a bit inspired by Elon Musk's big ideas, If you don't know who he is take a look at his wikipedia page, I think some of the goals he has are amazing, and I agree that we as a society need to start focusing our efforts on big ideas, and not on the next fart app. A collegue and I have been chatting about space travel and how amazing it would be to make it to Mars, so we started looking into it, I don't know much of anything about it, but who knows, maybe I'll learn something, and maybe you will too.Either way, knowing more about a wider range of technologies makes us better as a human race, fart apps, don't. 

Sunday, August 11, 2013

Some thoughts on attempting success in a large organization

Large organizations typically are all about the benjamins. (Some are not ONLY about the benjamins, but ultimately in the end, at least enough benjamins to stay afloat).

If you want to do well in a company like this you need to think of ways to do one of two things.

1. Make them more money.
This is where having ideas for new products and ways to bring in more revenue come into play. Look for areas of opportunity, what things do potential customers struggle with daily, that you/your company can fill the hole with a "new" product. Sometimes this happens because you've found something that you do daily that could be made easier and boom new idea. I think this is sort of how Trello came along, it was frustrating keeping track of where everyone was on projects/etc, and Fog Creek came up with something to make it easy. Now it's a product their customers can use.

2. Save them more money.
I HATE sitting around on my butt doing things that computers should already be doing. Working in a software company, there are too many times I have to watch test scripts run and do things when they pause. Finding ways to "fix" these pauses, so you don't have to have your butt in a seat is a money saver, and companies like that. One of my latest "money savers" was writing a wrapper that used auto hot key, so now whenever a script needs the user (note: me/collegues) to do something, we just have the auto hot key utility do it for us. It saves engineer hours, and sanity (if you're anything like me you hate the idea of wasting your precious time sitting and waiting for some "dull" event to occur just so you can do some dull thing to make the next event occur!).

How do you do these things?
Always be cognizant of your surroundings, look for opportunities. If you see something you think would be neat to try, go for it. If you have to do it a little on your own time to get a proof of concept by all means. Now if you're spending months of it, I would at least bring the idea up to see if it sparks interest, and possibly get paid specifically to do it (otherwise you're giving away your time to a company that has no vested interest in you other than "Wishes to avoid training someone new" which I may talk about someday).

Every day when I sit down and look at what I'm doing, I think to myself, how can I avoid having to do things that I don't find fulfilling, I can't always automate things, but I'll be darned if I don't try whenever I think it makes sense. We are engineers, not monkeys, and to be honest making us sit in front of a PC and act like monkeys just doesn't make sense. So lets do something about it, make a change and see what happens. I think you'll find that if you make it simple (easy for everyone to use), and it works, you'll at least attract some attention, and maybe even some more interesting projects. I have always said, you make the work you do what you want it to be. So make it!

Saturday, July 27, 2013

Latest Projects

I received a Raspberry Pi for fathers day, so I've played around a little with it. So far I've built two projects, and they're located at github.

This is a wrapper to download a mRSS feed and then play it in a random order on your Raspberry Pi
https://github.com/onaclov2000/omxrssplayer

This is a Text to Speech wrapper, that uses google to do the translating, it could really do some improvement, by counting the letters, then splitting on or before the 100th letter (space).
https://github.com/onaclov2000/pytts

I'm working on using the code from this link:
https://github.com/raspberrypi/firmware/tree/master/opt/vc/src/hello_pi/hello_font
to try to overlay a news feed of sorts over the OMXrssplayer (wrapper) app I wrote.

I would like to keep working on the pytts, and get a pystt (speech to text), and then have it listen to my voice and do things (kinda like Jarvis from Iron Man :) )

I thought it would be fun to setup a chatbot and then connect all three, so I say something, it relays it to the chatbot, which responds, then it converts that to speech, so it can talk to you!

Anywho if you like it, and want to start building up components that would be cool, let me know, I would love to build it to work with Wolfram Alpha too, but even more I'd like for it to have a learning algorithm so it can be taught, and/or learn. (I like AI, but don't know much about it yet).

Friday, June 28, 2013

Back in the Day.

Found this gem on my old Angelfire website, pretty awesome. Many that brings back memories, there is even another site called neocities starting up that is hoping to emulate geocities. I loved building some simple webpages on angelfire, although their banner stuff, is a mess. Pretty cool though.

Tuesday, June 11, 2013

Delete Site on Admob

If you develop apps and use Admob, sometimes you might make a test "site", I was having trouble finding how to get rid of a test site. I thought I read there was a max admob site count, so I wanted to remove any misc, so I'll be able to use my max amount (whether I'll ever hit that or not, is another question).

Steps:

  1. Login
  2. Click Sites & Apps heading (mine shows up there by default so no click necessary)
  3. Hover over the site you wish to get rid of.
  4. Click Manage Settings.
  5. Next to the title of your app, click edit.
  6. Navigate to  the section near the bottom titled Delete Site.
  7. Click Delete Site.




Friday, May 24, 2013

Tip Calculator

In keeping with the madness I've written a tip calculator this week.

https://play.google.com/store/apps/details?id=com.onaclovtech.tipcalculator

Temperature converter

So I started out doing a simple converter for Celsius, Kelvin, and Fahrenheit, found a Wikipedia entry, kinda went overboard, now there are a ton of conversions, and the best part is they're simple to do, just drag the slider.

https://play.google.com/store/apps/details?id=com.onaclovtech.temperatureconverter

Wednesday, May 22, 2013

Percent Off

Percent off is my latest app, figure I'll go for breadth in the app store, not depth...lol

https://play.google.com/store/apps/details?id=com.onaclovtech.percentoff

Friday, May 17, 2013

Simple Perl Actions Template

I wrote a simple template (runnable) that goes over some actions I commonly use in my perl scripts I write at home and work. Check it out below: Let me know if there are any other simple templates you'd like to see!

Wednesday, May 15, 2013

Project Idea: Self Learning Samba System

Self learning Samba configuration. Tools which you include on client and server. Server steps through each set of settings, then spans the client to download files (or upload). Checks times that it takes to do such tasks. Finds the most efficient (fastest) speeds and bam. Best scenario.

Anyone want to do build something like this for the betterment of mankind? (yea, 1st world problem right?)

Thursday, April 18, 2013

Language Wishlist

I have a wishlist, I came across today of a few things I would really like the language that I would love to write to be able to do.

Write a foreach loop and use the syntax below (basically perl but a little weird looking)

foreach , ,... (@variablearray1, @variablearray2,... @variablearrayn)
{
 So I can loop through multiple arrays in the same iteration and not have to have arrays of arrays or other crazy stuff.
}

Also I would like to be able to pick a "random order" of ALL of the arrays, but the indexes are linked, I.E.
@array1 = lah,bl,a,we
@array2 = 1,2,3,4

I would love to see a "random function" or keyword, I can use that will rearrange it to something like this:

@array1 = bl, we, a, lah
@array2 = 2,4,3,1

(basically the original indices stay matched).

Now of course I could write a tool which will do the second one. and I could write a "templating language" which would essentially replace ,... with $variablearray1[$i] and the foreach to a for loop but well that's annoying I....maybe one day I will...we'll see.

Saturday, February 23, 2013

Twitter the next text messaging app?

I was reading a tweet by @haacked and came to a realization, not sure if he has realized it but using twitter as your text messaging is brilliant.....

Phil Haack (haacked):
If you are with @shiftkey tell him we're waiting for him outside the lobby of the Hyatt by the valet!

Here's why:
Suppose @shiftkey doesn't check his messages often, but his buddies with him do, if they follow haacked they may see that message and relay it to him, its like being able to get someone's attention without having to explicitly text him and friends, one message and you're done. I really like the idea, my only issue with twitter still is privacy, of course I've heard rumors of people tracking others inline presence to determine if they're home or not (for nefarious purposes) aside from that hiccup its a really useful tool for that. Of course if you don't know shiftkey and you most definitely aren't at the hotel this is just noise, which makes me wonder, would location aware tweets make sense? You only see a tweet like that if you're within x miles of said location/person?

Just some thoughts!

Tuesday, February 19, 2013

Speed up Eclipse in Ubuntu

In an effort to keep old hardware running trying to build Android Apps, I was really looking for a way to speed up eclipse. The best improvement I've found is to run using the Sun (Oracle) JDK, it's impressively faster, but for some reason or another you can't just apt-get it anymore.

I found a github site https://github.com/flexiondotorg/oab-java6.git that handles that, however it required a few extra steps, so I just made a quick script for it.

I'm sure there are some parameters that can be added so you don't have to keep adding yes to things, but this was a quick and easy with minimal monitoring, if you make an update (just fork the gist),  then let me know and I'll include it here.

Here is the gist:

Sunday, February 10, 2013

Ripping DVD's in Ubuntu 12.04 -- Handbrake

It took me a little while to figure it out, but these are the steps I use to setup a fresh install of Ubuntu with the necessary software to rip dvd's.

Let me know if you have any additional tips and/or tricks to install that will setup everything!

Roku SSDP nodejs

I tried using the SSDP to find the roku ip address using ncat as recommended by Roku, but using wireshark to moitor it just didn't seem to be working. In Ubuntu using sudo wireshark brings up the app, selecting your network interface under filter type in udp.dstport == 1900 and click apply, I was seeing my router and the roku box notifying the 239.255.255.250 ip of their ip addresses, but I wasn't seeing the "M-SEARCH * HTTP/1.1 showing up. I wanted a nodejs solution so I tried searching for that, hoping that might change things up, I found this:

However placing the roku parameters ST: just wasn't working"roku:ecp", I did notice in the notify from the box that it was using MX as 2, so I tried updating that, however still no luck. After consulting nodejs.org I discovered the optional call back and in their example they close the connection when the call is completed. So I made the update to the following.

It appears that the program was closing the client connection before the message was sent out (and a response occurs), so once I put in the callback to close it, I got a response. Hope that helps anyone else who wants to use SSDP.

 Check out the Roku Remote nodejs module I am working on.

Friday, February 1, 2013

Music Glove Explained

I realize (thanks to a twitter follower) that I never really explained how my music glove actually works.
(Introducing Proof of Concept Music Glove)

Here goes.

The glove connects to the arduino over I/O. (basically just use some I/O pins to read a pressed state).

I wrote some code (referenced by this post: ) to transmit over the arduino's RS232 (Serial) port. The RN-42 uses RS232 to communicate to the device, so as long as the baud rate, etc are the same, then sending data from the Arduino to the RN-42 is a breeze.

Next we need a way to read the data. Download the bluetooth chat application from google (located here: ), modify it where the line says

Next I added some code to read received data.

The receive message section should look something like this:


Changing Volume, songs, etc, are all located in the following function I stuffed in there.

Of course you need a preferences to deal with things but you don't have to, you can simply just say if you see A, then do the action listed for the one you want in the above code.
Put it all together and you have a device which will change the volume or songs (if you set it up via preferences). Remember that some of the options are not publicly declared intents so they work right now, but may change in the future. If you have further questions go ahead and leave a comment, or find me on twitter @onaclov2000.

Thursday, January 31, 2013

Using Nodejs as a fileserver


Creating a Simple Fileserver.
Tip #2
I wanted a simple fileserver, I tried looking for a variety of search terms, but finally came upon simple file server. I came across the post linked by Tip #2 above, but it wasn't exactly clear what it was doing exactly.

The documentation isn't 100% clear so I played with it a little, (and added some comments to one of the posters).

I used connect.

Install it with npm connect.

Next use the following code:

var connect = require('connect'),
    http = require('http');
connect()
    .use(connect.static('pathyouwishtoserve'))
    .use(connect.directory('pathyouwishtoserve'))
    .listen(8080);
.use(connect.static('pathyouwishtoserve')) tells the server where to look for files.
.use(connect.directory('pathyouwishtoserve')) tells the server to return the following directories contents.

If you now navigate to http://your-ip-address:3000 you'll get a list of the directory contents,
if you add a /filename to that path you'll get the file.


I'll be posting tips as I come across them of using NodeJS as an intranet fileserver.
Long story short, I want to build a Roku app that will refer to the NodeJS server for where to find the files. I figure it'll be simpler than PLEX, and also faster (I'm hoping). Once I get the stuff running I'll plan on running it on my Pogo Plug as a media server for my Roku, totally awesome!

Tuesday, January 29, 2013

Creating a Kindle EBook Part 1


I was looking up how to create an ebook, now according to this website: How to Format Childrens Ebook it's a matter of creating a html file and including some image files, then zipping them all up and sending them to your kindle.

It's not quite that simple these days. When you send that zipped file out to your kindle, amazon splits it up and you get each item pushed to your device, so if you have 3 pictures, you have 3 pictures plus your html ebook.

The fix for that is to create a .mobi file, now there are some sites that do that, also the program Calibre works, but for now I decided to try using Amazon's solution. Kindlegen

I use ubuntu so I'll be giving the ubuntu version, if you want an example in the Windows version, then let me know, and I'll try to update for that!

Here goes.

I found this little trick out, create a file called kindlegen located at /usr/local/bin
enter in the following (I had to use sudo):

#!/bin/bash
exec /kindlegen "$@"
afterwords use the following command
:/>sudo chmod -x /usr/local/bin/kindlegen

Now whenever you want to convert an html file, simply call kindlegen . Ok we're done with that part.


Lets make a book.

First lets try the following

Based on the website I mentioned at the top they suggest naming things page_nn.jpg, etc, however as long as you keep track, it doesn't really matter the naming (it's for simplicities sake).

This particular book has 3 pages. Duplicate the following lines for each page, and you're set.

Save your file as test.html (or whatever you want, just substitute your filename below)

Next we'll actually create our Mobi File.

Navigate to the folder via commandline:
:/>kindlegen test.html

The resulting file will be called test.mobi

Next login to your amazon account check your account settings and scroll down to manage your kindle.

Click Manage Devices

Here you can find your email address to send your mobi file.

Next email your .mobi file to that email address.

When you see the file visible on the Personal Documents Section. Check your kindle and see if the file has arrived. If not, you can "resend" it using the Personal Documents Section.

Good luck!

Sunday, January 27, 2013

Using NodeJS as an Intranet Webserver

I'll be posting tips as I come across them of using NodeJS as an intranet webserver.

Long story short, I want to build a Roku app that will refer to the NodeJS server for where to find the files. I figure it'll be simpler than PLEX, and also faster (I'm hoping). Once I get the stuff running I'll plan on running it on my Pogo Plug as a media server for my Roku, totally awesome!

Tip #1
When running a http://nodejs.org/ port, the IP address should be of the machine you are currently on. I chose the port 8080 as it's the standard http port.

From linux you can find this by doing a simple ifconfig command on the command line. From windows ipconfig should do it.

Then using the example below: (from the NodeJS website)

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(8080, '100.11.1.6');
console.log('Server running at http://100.11.1.6:8080/');

So when you go to another machine such as your phone and access the page 100.11.1.6 you should get "Hello World". When you're able to do this, your Roku can now see the server (when you have the app setup).

The above tip was discovered after a google search to figure out an error. The link is from stackoverflow, and can be clicked above on the Tip #1 link.

Friday, December 28, 2012

How to quickly build amazon affiliate links on an android device.

Mobile
I was attempting to build an amazon affiliate link on my phone for a pogoplug I bought the other day. I found it to be quite cumbersome. I knew there had to be an easier way!


Social
Additionally the links coming from amazon are long, and don't post well to social networks (read Twitter). I thought there had to be a better way, i searched the android market but just couldn't find anything that easy.

The App
So I wrote an android app to do it.
This app makes creating links trivial. I wanted the interface to be as simple as possible. There are only 4 buttons (possibly a 5th someday) from left to right, copy, share, help, settings).

Download Amazon Affiliates Link Generator.

How
Simply visit the amazon page from your Android, click share, select the Amazon Affiliates Link Generator. It will open up the app and allow you to reshare or copy the link.
Easy as pie!

Ads
This app has no ads.


Check out my other apps as well as Amazon Affiliate Link Generator

Tuesday, November 27, 2012

Syncing Picasa

Anyone here have a Google Picasa account? How about 2? (I'm thinking families here) More?

Sure someone can share an album with you, but if you want to view it, you have to find the link, until google allows shared albums to be visible in your account (and indirectly visible via your Android phone). You'll have to just deal with it.

I got tired of dealing with it, I started working on a project, right now it does a one way "copy" from one account to another, I have plans to finalize the checks that compare the folders (albums) and determine what differences exist, and move photos back and forth to sync them.

My current implementation runs from a python script, and you have to have the Google API's loaded. This is great for those cases where you only need to sync once. However I want to sync say, once a day. Using this locally would require my computer to be running, what if my other family members wanted to sync albums with eachother? Now we have multiple instances.

Eventually I would like to set this up to run on Google's App Engine on a daily or more frequent rate, however oddly enough, their API's are not as clearly available via App engine.

On a positive note, I hadn't really done much programming in Python prior to this project, now I've begun, I don't mind it as bad as I originally had (don't get me started on the whole whitespace thing).

If you're interested in what I'm working on and would like to poke around, follow along, (or maybe help) you're welcome to check out the repository located on GitHub.

I'll keep you updated as I move along with this project.

https://github.com/onaclov2000/PicasaSync


Wednesday, November 14, 2012

Introducing Geek Book Club

If you know me personally you probably have heard of "Geek Book Club", basically we are a group of people interested in learning more technical things. Some work in technical jobs where we don't feel like we're learning enough new techniques to really make us valuable, and some don't work in technical jobs but find it interesting. Either way we're all here to learn.

I recently created a repo on GITHUB, so check it out.

https://github.com/onaclov2000/GeekBookClub

Thank you,
Tyson

Tuesday, October 16, 2012

Unit Testing with Structural Coverage


I don't love spending time testing, so I try to make the best use of my time. I write Unit Tests when I can, and automate any other testing if possible. Sometimes I try to even make writing tests easier on myself by using some techniques I picked up from The Pragmatic Programmer: From Journeyman to Master
Side Note: If you haven't read this book, stop what you're doing, go buy it, rent it from a library, borrow it from a friend I don't care, READ IT, LEARN IT. It's one of the best books I've read about software development hands down, lots of good ideas to improve your craft.

Unit Testing

Unit Testing code is helpful for looking at code you've written in a very controlled environment, you know the inputs and outputs, and being able to duplicate your results should be pretty consistent and easy. Often times this testing puts a single function or procedure through the paces, but depending on what level you are will determine what number of units will be involved.

Primer

After writing some code a few months back, I created what I thought were some good Unit Tests for it. They all passed in the end (and before they did, we found some issues when they weren't passing) which is great. The change got closed and merged into the baseline. I thought I had made a good attempt at ensuring that the software was solid. For the data I used I agree it is solid. Then a bug was found. I hadn't tested every case (even though I thought I had). What would have been a huge help is to have simply combined Structural Coverage with it.

Structural Coverage

Structural coverage is attaching special code to test for running through each path of your code. This is helpful for simply ensuring you've tested each route. This isn't a substitute for proper testing. I'll say it again. A structurally covered program is NOT a bug free program. It's simply a program that has been proven to work as expected for a (pseudo) normal scenario on each path encountered.

Combined Testing

By combining Unit Testing and Structural Coverage, you can prove that the Unit Tests at least are checking each case once. I have since re-ran the unit tests with Structural Coverage, and guess what? I missed a few paths, this didn't explain my particular problem, however it made it easier to see other possible problems I may have in the future. I have since added some unit tests and have made sure that my Unit Testing at the minimum covers each case.No program is bug free, but all we can do is analyze and pick the Unit Tests that we as Engineers believe will cover what's necessary.


If you don't do Unit Testing where you work, I highly recommending starting to do it on your own. From the start make it as easy to setup and run as possible, this will make sure that you will use it, and that your colleagues will use it. Additionally, look for opportunities to make the unit testing automated. If your unit tests run on the system everytime a build is ran, any bugs introduced in those pieces of code can be found quickly. This keeps you from violating the DRY principle, forcing yourself to repeat yourself testing it over and over. OR trying to fix the same thing multiple times because it's not caught at the right time.


Good luck!

Monday, October 8, 2012

Christmas Lights

Description
I finally got fed up. We bought a Christmas light "timer". This thing would do essentially 3 functions, the first was simply turning the outlet on, the second to use a photo sensor and turn off when it's light outside, and the final was a set number of hours (there being anywhere from 1 to 8 hours).  
The Problem
The problem with the hours one is that you have to manually turn it to off, then back to the number of hours you would like. This is frustrating. The photo sensor would seem like a neat idea, however when you don't get good lighting where the photo sensor is, you end up with Christmas lights on all the time. I (and in part due to my wifes request) decided this had to be rectified. 
Attack Number 1
My first run at it was to simply solder onto the point where the timer is on, and try to set and clear the 4 hour timer (but since the system needed to go back to off, then back to on, this failed miserably). 
Attack Number 2
Then I realized that the photo sensor should handle the turning off and on automatically, and I wouldn't need to turn it all the way off. I decided to remove the photo sensor, and put a pair of wires in there and a relay instead. Now the fun part. I have a PIC16F684 that I decided to control this with. With a multimeter I tested putting the photo sensor under the light in my room, when it was under direct light, the resistance went up really high, when I covered it, it seemed to reduce to a low amount of resistance. My guess is that I can put a resistor in line with the relay and whenever there is a high amount of resistance it turns the system off. When the resistance is low it turns the system on. Essentially what I needed was my microcontroller to activate my relay for 4 (or so) hours then turn it off. Then 24 - 4 hours later, it would attempt to turn on the relay again. If I can get this working on a short run, I.E. 10 minutes on, then 2 hours off, then 10 minutes on. I may consider putting in a pseudo random number into there, so the lights are on somewhere between 3 and 7 hours.
Unfortunately I plugged it in, tried shorting the pins for the photosensor (hoping it would activate the lights), well it didn't seem to matter whether the wires were shorted or not, the lights just stayed on.
Final Solution
I finally actually did what any smart engineer* should do. I took a look at what was already there. I saw 2 chips the first was a LM393 a dual voltage comparator. And the second was a programmable timer. JACKPOT. (Here it is for those of you interested: cd4541be). Looking at the datasheet I see there is a master reset line. I tested it out by turning the system on for 1 hour, then when the lights turned off, I simply tapped 3.5 volts to the MR line and bam lights were on again. I now have my "in".

On to the Microcontroller
I decided to use my Pic 16F684, I have a smaller one (can't recall the number at the moment), but I didn't have time to make sure my code ported smoothly as well as verify the timing. I did a couple tests using a couple nested for loops for a wait (I know, I know, I could have used a timer interrupt, and in fact i would like to go fix this, but I didn't have a lot of time to mess around with this and well, hey it was a hack)
So after some timing, I simply put an initial wait in there to get it to hold off to about 7pm from when I plugged it in, and then set the timer to 4 hours. The lights turned on for 4 hours, then a few hours later 7pm hit, and bam we have light.

However over the long term the timing was off for sure, when I got back from vacation it was definately wrong, I'll have to play with it this christmas again!

*Smart engineers keep things simple, and just using a reset line is MUCH simpler then the previous methods I tried.

Monday, September 3, 2012

Syncing ZSNES game saves across ubuntu systems

I was hoping to sync my ZSNES game saves across all my pc's. It turns out it take very little work.

First I made a folder in dropbox for my game saves and made a copy of my current saves out there.

Next I removed the contents of the zsnes folder located at
/home//.zsnes.

Steps:
(Make sure you've saved the files from .zsnes folder below first
cd ~/.zsnes
rm * (this gets rid of the files)
cd ..
rmdir .zsnes

Finally I setup a simlink from my dropbox to the folder so I always had my game saves synced.

Steps:
cd /home/
ln -s ~/Dropbox/zsnes .zsnes

Substitute the path with your path and bam you're done!

Good luck



Saturday, September 1, 2012

Environment Tips

This tip comes from Phil otherwise known as @civissmith on the interwebs.

Often times you have to swap between screens, I usually use alt/tab or some combination of swapping between document/editor in order to read and update. A neat tip Phil alluded to was that if you set your command line to semi transparent, you can still read any commands or notes while typing your code or commands over. This is a great tip as it can save time on having to constantly swap between (possibly losing your train of thought).

Thanks Phil and any other tips you pass along I'll be happy to post!

Wednesday, July 18, 2012

Energia Setup

There is a link in the "issues" section of the github site for energia.

Setup
Extract to a folder on your computer, inside that folder go to hardware/tools/mspgcc-4.6


Swap to super user. (may not be necessary but for sure need to use SUDO).

Then finally run bash ./build-mspgcc
A while later when it's done, you can navigate up a level to the same folder as mspdebug.

Make sure to set the execute bit on this file. This will require use of CHMOD. I just used 777 to be quick, but be careful as this isn't always the best choice of permissions.

Plug your launchpad board to the computer.

Now navigate to the main folder and run (at a minimum sudo) ./energia as super user.

This is the screen you get when you first start.

Ensure your board is communicating:
Select tools->serial port make sure something is there and selected.

Select tools->Board make sure your launchpad is listed and selected.

Select tools -> Programmer mine says AVRISP mkII not 100% if yours should be but these should already be selected automatically.

Test Program A.K.A Hello World
Select file-> examples -> 1. Basics -> Blink


Finally you get the above. Now if you hover over the second button from the left, you see it says Upload.

Click this button your board's led2 should be blinking (this is the led near the bottom of the board, opposite the USB cable, near a button and pair of jumpers).

You should be good to go, have fun and good luck, oh and,

HELLO BACK

Monday, July 9, 2012

IAMHERE 2.0

Well I finally released an update, and IAMHERE has been improved. I added categories of texts, as well as a share button.

There are a few categories and if you have any suggestions let me know and I may add them to my list of updates to include.

If you have any suggestions let me know and I'll definitely look into them.

Thanks and have fun.

https://play.google.com/store/apps/details?id=com.onaclovtech.iamhere

Wednesday, April 25, 2012

Introducing Proof of Concept Music Glove

Well the day I never thought would come has arrived. I have finished a proof of concept of my android music control using an external (in this case glove) device.

It was a long and slow journey, I've often times got so many projects in the pipeline that it's really exciting when I get to see one finish up.

This evening I finished up wiring my device, and asked @civissmith over to help with the video, so Thanks I really appreciate it, trying to do what I was showing with one hand would have been, painful to say the least.

Basic concept, Buttons attached to arduino send characters to android app, when music is running, pressing a button allows control of the music app.

Shot of Glove
Shot of Glove


Button inside glove


Without further words, I think the video will be proof enough.




If you'd like to follow me on twitter I can be found here: @onaclov2000

Monday, April 16, 2012

Causing the next song to play

With the android music player you can change songs using the following broadcast. It's not guaranteed to work with any other music players, or even with any updates they make, however it works for what I need right now (I have no interest in making a music player), If you have a music app and have an intent to change songs,etc, please let me know and I'd be happy to support if possible. I found this across the interwebs somewhere probably nearly a year ago now, I can't remember where I found it, or who wrote it, so if you are the one responsible I would love to give you credit (i'm sure it came from stackoverflow at one point, but after a lot of searching recently I can't seem to find anything about it).
Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "next"); sendBroadcast(i);
Good luck.

Modifying Bluetooth Chat

I started out trying to pull the android bluetooth chat application from the developer website....BAD IDEA. I spent quite a bit of time commenting this out, adding a toast here and a if then there. That one is built for a different sdk version than I'm using, so my recommendation would be to pull it from the examples folder in the sdk download.

Well I finally grabbed the bluetooth chat application from the sdk examples folder (when you download from google). After about 5 minutes I tried loading the default app on my phone and touchpad, it worked just fine. I then changed ONE LINE of code and my arduino can talk to my android devices with bluetooth. What line say you? This one:

In the BluetoothChatService.java
From
private static final UUID MY_UUID = UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");

To
private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");


That's it that's all it took. Apparently that UUID from what I've been able to gather is for the bluetooth serial interface, so that's all I needed.

Here is video proof of the application in action.





http://youtu.be/Zof0IYUU71Q

Good luck and let me know if you have any questions.

Monday, April 9, 2012

Ada Withs

Eclipse has a really nice feature which allows through a keyboard shortcut the ability to update the imports required for your code.

I liked that, but didn't know of anything that did the same thing for Ada source code.

I have began creating a script which does this, and you can use programs to run it, (perhaps port it to a plugin for a program).

I called it Ada-Withs (I know it sounds pretty boring)

It's not complete, but right now the script will pull out all packages used in the program.

If you want to give it a try go for it. If you want to mess with it, pull and let me know if you have any improvements.

The link above does go to it but here is the full url as well:
https://github.com/onaclov2000/Ada-Withs

Wednesday, April 4, 2012

One Language to Rule Them All

Do I think that there is one language that is best? No. I can say that with a high degree of confidence. Each language has it's own idiosyncrasies. If the first language that was created was the best, we wouldn't be using anything else. But we all know that there are issues with each language, and each language was often created to make an aspect of another language easier/better.

Last week I recommended not attempting to solve a particular problem with python. The solution was already partially coded up in perl and it just didn't make sense to re-solve the problem (simple data parsing) all over again. It got me to thinking, was this the right suggestion? I think the final result of the script should have been in perl, however learning to do it in python was a good idea. It would improve their toolbox.

I realized I should encourage writing things in a variety of languages. Why? So you know which tool to use. I came to realize that parsing data was easy to do in perl 90% of the time. If I knew python better I would probably feel the same way about python. The issue isn't about python vs perl vs java vs c++ vs c#, the issue is knowing what to use when.

I know that if I want to make a simple fast to build gui application I can use Visual Basic. Joe Blow will use Java, and Jim Bo will use Perl. Are any of them wrong? No, what you use, depends on your tools available. If you know how to do the same thing in 5 different languages, you'll start using a default for one set of problems, another for another, and mixing them if necessary.

I can solve the same problem in every single language, but the issue is, which is easier to do it with? Do some research, if you find that dragging and dropping a button onto a form is easier then writing the back end required to create you idea. DO IT! There is nothing more encouraging then building something and actually seeing it working, then spending tons of time building something and never seeing it come to fruition.

Good Luck.

Monday, March 12, 2012

New Apps

New Apps Released!
Well it was a busy couple of weeks, I have released 2 apps on the market in the last few weeks.  Pizza Area, and I Am Here.

Pizza Area
This calculates the square inches of a pizza for you (really works for any size circle with a diameter), Also if you have a price it'll calculate the price per square inch, as well as the estimated cost at that rate for the pizza size smaller and larger that the app contains. Give it a try and let me know if you have any suggestions, and as always a positive rating on the appstore would be appreciated.


I Am Here
This app will allow you to select a friend from your contacts (or type the number in) and when you hit the icon it'll send a message. This app is very similar to another one on the Apple Market, I was a little disappointed I hadn't released this sooner, my buddy civissmith had come up with the idea originally,  and I was just way to slow to implement. Well give it a try either way, I think mine has a little more spunk then the Apple Market version.

That's all for now, I have so many projects in the works at all time, I just have to finish a few so I can write about them.

Thursday, February 16, 2012

GraphViz

I decided to start playing around with GraphViz, here are a few of my notes:
To call a file use the following command (works for me).

dot .gv | dot -Tpng >.png
This generates a png file.

Next up what the .gv file contains:

digraph G {Hello->World; World->Earth; World->Mars; World->Jupiter}

It looks like if you call it a digraph, and give it each of the start/finish points, it'll graph them for you.

I'll be back with more as I discover more.

Friday, February 10, 2012

TrueCrypt

I was having problems getting truecrypt to work on my ubuntu machine. Once I downloaded it and unzipped it there was no extension and for some reason my machine didn't know what to do with it. I simply renamed it with a .sh at the end and re-ran the file, everything worked as advertised at that point.
I.E. FROM: truecrypt-7.1a-setup-x86
      TO: truecrypt-7.1a-setup-x86.sh


Good Luck