Friday, February 19, 2016

Updating Git Remote URL's

This is a follow-on to the last post, so you've moved your git repos around a bunch now you need to fix your push/pull locations. This is a really easy fix.

Go to the folder where your repository lives and edit .git/config (for me command line gedit .git/config) and change the url to the one you want.

With BitBucket, for me the URL that contains onaclov2000@bitbucket.org isn't right (not sure who that would be right for).

So for me the URL's look something like this (much more githubish).

https://bitbucket.org/onaclovtech/rpm.git

Good luck!

Friday, January 8, 2016

Python For Loop Fun

I had a problem recently where I needed to loop through a for loop to find some lines then only combine some lines so I thought for i in range(len(list)): ought to do it. It did not, I'm here to tell you the sad story of what happened. (Well actually this is a conversation I replied to with my buddy Phil, who should start a blog, cause he's awesome and probably could teach you many more things than I could).

Actually there is duplication but I think you forgot to include 'shut your dirty mouth' in the l array anyway... ;)
I added a "blah" to the 3rd element (0 based) so you can see when it's being printed vs the 2nd element.
Phils Function:


l = ['blah', 'blah blah', 'blah blah blah', 'blah blah blah blah']
for i in range(len(l)-1)):
   print l[i], l[i+1]

Phils Output
0blah blah blah
1
1blah blah blah blah blah
2
2blah blah blah blah blah blah blah
3
Tysons Function:


q = range(len(l)).__iter__()
for i in q:
   print l[i], l[i+1]
   q.next()

Tysons Output
0blah blah blah
2blah blah blah blah blah blah blah

Note the difference in the number of blahs and the number of lines
Phils approach prints current line plus next line through the entire list (and skips the last element due to the -1) Also note that even though we did a +=1 the next time through the loop the number is back is back....
Mine skip lines and print the current line and the next
Now this is obviously a contrived example as you can do range(0,len(l),2) and I think get the same result, but in my particular case I only wanted to combine certain lines, so only if line + 1 (or l[i+1] contained X would I want to print l[i] and l[i+1] afterwhich I wouldn't want to print the "new" l[i] (which was the same as the old i+1).
I hope that makes some more sense.
Here is a (only slightly) less contrived example.

My new function

l = ['one', 'my', 'buckle', 'my', 'shoe']

q = range(len(l)).__iter__()
for i in q:
    if 'my' in l[i]:
        if 'buckle' in l[i+1]:
            print str(i) + l[i], l[i+1]
            q.next()
        else:
            print l[i]
    else:
        print l[i]

My New Output
one
1my buckle
my
shoe

See now I only want to combine my buckle on the same line but not my shoe
So long story short, I can't just i+= 1 in my loop, I have to do a 'next()' but I can't just do that on an int (i.next() won't work in the above context) but I can do a next() on the range business (if it's got the iter, which I'm not sure about), however you need a variable to fiddle with to do that.


Anywho, next time you need to do the same thing as a simple c style for loop with numbers and want to increment remember.... it won't work like you expect it to.


Wednesday, January 6, 2016

It's not You, it's Me


Clearly that has to be the problem. I mean millions of people use computers every day and have little to no problems...right?  I must be doing something wrong.

I'll tell you my pathetic story.

So I wanted to combine some content from an excel spreadsheet into a word document as comments, so first approach was to just extract the text, add comments in a fancy "html" page. Did this, but tables and the like didn't export to plain text well. So I thought I could come up with something better.
Racoon accidentally dissolves cotton candy in water

Next shot, let's try VBA and just extract some comments from a CSV to insert in a Word Doc. (Seems like it should be straightforward, open CSV, grab data in columns 1 and 2, search in word doc for data in column 1, add comment from column 2). Nope Couldn't figure out how on earth to extract column data from a Excel application within a Word macro (using VBA).

Next, well, Word is a Zip file, lemme try unzipping the file and seeing how that works. Tried adding a single comment, Saved. Clearly they're not going to make this easy for me. Comments are in a comments.xml file with some unique identifiers and then in the document.xml file is the.... you guessed it, document, with the comment reference. This is do-able, but painful, so I thought I'd avoid this for the time being. (Oh by the way, if you haven't looked at the Office Open XML yea it's roughly 7k pages... AINT NO BODY GOT TIME FOR THAT)

Oh wait I nearly forgot, I tried adding a comment, very blindly, that failed, so I tried just unzipping the contents with python, tossed the output into a folder and rezipped, then renamed to .docx, yea word thinks the file is corrupted, no clue what the appropriate "re-zipping" is but good luck figuring that out too.

Next I tried out Mammoth something that attempts to convert a docx to a passable html file using python.... yea tried printing the resulting "HTML" and get unicode errors. Tried a few google searches, and approaches, no luck. Finally decided on a loop through all characters, then doing a Try Catch when printing to command line (Stderr), and storing "successful" prints to an array, for later printing. otherwise passing the "exception" catch. Only problem with a large doc, it takes FOREVER to print all to the command line (due to delays from printing to the command line, in this case not file IO). Oh Wait..... mammoth died, about 2 hours later..... yay for me.

It seems like anytime I need to fight with a Word doc to extract data, I can't seem to find the right incantation in google to solve my problem. Case in point again, find document line number of a comment, Not the section offset but the ABSOLUTE LINENUMBER OF THE DOCUMENT. Good luck. I dare you. I flipping dare you to try. If it takes you less than 8 hours before you give up you haven't tried hard enough, if you've been going on more than 8 hours.....Good luck, but you'll likely miss out on the rest of your life if you keep going.

You see, you can't just go through a word document line by line, you have to go section by section, but then lines aren't really lines in there, they're paragraphs, so how can you ever figure out what line in a paragraph something is? You can't you have to somehow figure out how many characters are on a line and possibly have to do some kind of mod operation ON EVERY PARAGRAPH to get EACH PARAGRAPH linecount and then FINALLY you can sum them up.... but oh wait, you have to do that for all preceeding sections. I won't get into the pain too much more, suffice to say, I finally finished with something that just gives you a section number and the line of the paragraph on that PAGE. No flipping clue how you can even figure that out, but it was the first solution I found and I finally had to give up and use that.

I probably could come up with a dozen horror stories of word if I was really pressed to it, but I'm fairly certain my PTSD would attack and I'd just blog.

Did I mention that 2015 just wasn't my year for computers? I gotta be honest 2016 isn't looking any better.

Tuesday, January 5, 2016

Knowledge Based AI:Cognitive Systems Udacity Custom Curriculum

I love Udacity for the ability to have a free set of lectures/learning etc online, with forums etc. However one thing that annoys me is that sometimes having an assignment really solidifies learning, so I would like to remedy that.

When going through the Knowledge Based AI:Cognitive Systems lectures, it has a reference link to a pdf to read for supplemental reading, I went through the links and found this site:

http://courses.csail.mit.edu/6.034s/resources.html

I haven't gone too far down the road of finding what is up with it, but perhaps some options are in there, or we can find other "open" assignments online that are available. Or create our own, for folks NOT in the GA-Tech program or even the ones in it, looking for additional projects to learn from.

Just something to consider and I'll probably post some additional ones here.

(Book reference, minus the blah.pdf reference, can be found here:
http://courses.csail.mit.edu/6.034f/ai3/)

Friday, January 1, 2016

Why computers aren't a viable business future 2015

This is a bit of a joke post but I wanted to highlight the pains I have felt (and one of my friends Phil) with computers in the last year. Most of these are/will be linux/Ubuntu specific systems that we saw these problems with, but occasionally were other systems.

10. Opening Image Writer in Ubuntu 15.10 causes a system crash (right click menu), opening with command line doesn't. However when trying to restore the rasbian image to an sd card, it wouldn't work right, and the card refused to be recognized after until I shutdown for a solid 5 minutes.
Solution:
df -h (to find the SD identifier of the drive) then
sudo dd if=/home/hotdog/Downloads/2015-05-05-raspbian-wheezy.img of=/dev/sdf
 9. Python list.sort() and sorted(list) behave different. Simply put, list.sort() sorts in place and, sorted(list) returns the sorted list.

8. My daughter has nearly bought hundreds of dollars in gems on a game by disney, fortunately we don't have a credit card associated with our account.

7. 3 monitors in Ubuntu and Mint is pipe dream. Don't waste your time.

6. Switch from Ubuntu Unity to Plasma 5/KDE, Nothing works.

5. Never mind about the rest, i tried installing my new bluray drive and now my computer which i just upgraded, no longer works. I give up on computers

Friday, November 20, 2015

Cameras, Tablets, and Remotes Oh My

If you've got a reasonably nice camera, and you've ever gotten professional pictures, you've realized that things can get expensive pretty quick. So you decide to do it yourself, but setting the timer, then running to get in the picture only works so well, plus if you have little ones it makes it about 10x harder. I did some searching and found some really awesome bits and pieces to help things out.

Goal #1 Quit having to run back and forth to start the timer.

Things start to get tricky, you can set everything up and take pictures remotely now, but you don't know if they're turning out, and well, you run into the same problem again, you gotta keep running back and forth.

Goal #2 Quit having to run back and forth to check the picture turned out right.
You'll need a few pieces to get this part working.
1. EyeFi Mobi (If you'd like there is a different version but I haven't used that).
2. SD/SDHC/MMC/Eye-Fi card to Compact Flash CF (Assuming you have a CF card).
3. EyeFi Mobi App (Android) or EyeFi Mobi App (Apple)

So once you install the app, and put the card in, there is an option (at least in the android app) where you can tell it to start a slideshow of incoming photos, so now when you take a picture, it'll transfer the photos within a few moments and you're done.

One final note, when I started saving the pictures to my phone, google plus photos asked me if i wanted to back up the folder, so this means that when I take pictures with my nice camera, all my photos get automatically uploaded to the cloud, no more download to computer, then upload to picasa (well google plus photos now). This is crazy handy.

Finally if you wanted to you could install the tools on your laptop/wifi enable desktop and the pictures will show up there as well, using their tools.

Good luck!


Here is an example video of someone using this with an iPhone


Friday, November 6, 2015

Programming Anywhere: Rudy BBQ

I decided to try out Rudys for breakfast and working. I love their tacos (Red Chile + Sissy Sause = BEST EVAR). Rudys has tons of space, if you're not around during main lunch and dinner crowds you can hang out in the outer area, there is great music playing (little older music so it's kinda fun). And its not distracting. The temp is comfy (well right now in mid October) too! (Inside may be more distracting and a little less awesome).

Pro's: Free Wifi, Great Breakfast Tacos (cheap too), Good music, and most of all not distracting.
Con's: Again you really should buy food, and don't go around busy times.

Friday, October 30, 2015

Programming Anywhere: Chows Asian Bistro


In continuing to find good places to work, I have found Chows Asian Bistro to be great. If you are in on the weekend nights, you get treated to live piano music, which is just AMAZING. They seemed receptive to my working from there, I suppose if more people showed up to work (but also bought food) they wouldn't complain. It's the folks who show up order a tea and hold seats for hours, don't be one of those. Some of the seating is in the right spots that it's easy to not get distracted when working. Aim for one of those seats.

Pro's: Great Music, friendly folks AMAZING food (well it's my favorite Asian food in Albuquerque, probably the world).
Con's: You really should support the business and not just take up space. No Wifi (That I found)

Stay Tuned I'll be talking about Rudys BBQ next week

Wednesday, October 28, 2015

Numpy Array Size, and ValueError

I just wanted to capture this for others as I'm not sure the *correct* solution but it appears that trying to use a very large array within SKLearn's kmeans seems to cause a problem.

Traceback (most recent call last):
  File "..\School\GeorgiaTech\Assignment_3\live_pca.py", line 167, in odule>
    k_means_results('Live No Feature Selection', [X,y], [X_test, y_test], colorm
ap = False)
  File "..\School\GeorgiaTech\Assignment_3\live_pca.py", line 60, in k_m
eans_results
    fit_results = k_means.fit(X)
  File "C:\Python27\lib\site-packages\sklearn\cluster\k_means_.py", line 785, in
 fit
    X = self._check_fit_data(X)
  File "C:\Python27\lib\site-packages\sklearn\cluster\k_means_.py", line 755, in
 _check_fit_data
    X = check_array(X, accept_sparse='csr', dtype=np.float64)
  File "C:\Python27\lib\site-packages\sklearn\utils\validation.py", line 344, in
 check_array
    array = np.array(array, dtype=dtype, order=order, copy=copy)
ValueError: setting an array element with a sequence

When I reduce the size of my input by a bunch (I had roughly 246 features, and 3500 lines), the code begins to run correctly (I have a smaller input size for another dataset, that has the same setup except 6 features not 246, and is shorter, no problems there).

Good luck

UPDATE
Open your csv input in excel move to rightmost column, now one more over. Hit crtl and down arrow, if you have incorrect data, youll find more elements, if you load a csv like i did

Friday, October 23, 2015

Programming Anywhere: Food Court At The Mall

Being crazy jam packed with school I've had to sneak away to work on projects/homework. Typically in Albuquerque Flying Star is the defacto standard for studying/etc. I love the place but haven't been loving the menu choices, so I decided to start trying other places out.

The first place I tried food court at the mall. I got in around 9 or 10 even though stores aren't open often times the mall is open to allow for walkers, this means you get a quiet place to work for a few hours. In the case of my mall there were a few free wifi locations so I was able to do any looking up of things I needed to. If you're in a pinch this is a place to try out.

Pro's: Early and late enough it's quiet and easy to get work done, well lit. Don't feel bad about not buying things to support a business (you're not taking up valuable customer space really). You can usually find Wifi
Con's: As the day goes on, more and more people show up. If you're distracted easily this is probably not the place for you.


Stay tuned. I'll be talking about Chows Asian Bistro in the next post!

Friday, September 25, 2015

You're speaking our language. Up for a challenge?

Fun to see one in the wild, I finally got a "You're speaking our language" message via google :)

I won't give away the query that got it, but was pretty fun to see!




Monday, August 17, 2015

Back to the Future

Ok so this feels vaguely familiar all over again. I am starting classes as of today. It feels strange and exciting at the same time.

I am currently enrolled in the Artificial Intelligence for Robotics. This class is also known as Programming a robotic car. The more I'm taking the lessons the more excited I am getting about the course.

I went through the first lesson and problem set, we learned how a localization function works. I got a refresher on Bayes rule. I am sure I have a lot of learning to go, but so far I'm really optimistic.

One thing that was tripping me up a lot was figuring out which points were which in my inexact motion calculation. Additionally I was needed to make sure i accounted for Total Probability. In this case I am not going to normalize, I just multiply by all the probabilities at each of the squares as necessary.

Inexact motion is basically a way to assign probabilities to where on a grid you have moved to based on your starting point, and direction. If you overshoot (meaning you should have stopped at grid spot X but you went to gridspot X+1 assuming rightward movement), it's one thing, undershoot is less, and exact is right on.

In the problem set we have a similar inexact motion condition, except in this case it's undershoot or right on. Additionally what i was doing before was moving everything THEN doing the calculation, this was throwing things off.


All in all it's a fun first lesson. Also I have heard there will be an optional hardware component....I am SOOOO excited for that, I love that part of software, when you get to interact with things.

Tyson

Thursday, June 11, 2015

#50over20

What is this hash tag? Well I got tired of seeing all these #30under30, or #40under40 clubs that people are a part of. There are plenty of awesome people who are not necessarily part of these communities where they can be nominated and win (assuming it's not just a popularity contest). So here's my idea. I'm going to find 50 people I have met in person that I think are awesome. My ONLY requirement is that I have met them. That is all. I think you guys need to have some recognition. If you're tagged in my #50over20 twitter feeds, (or if you're not on twitter, well that's ok too, we'll mention you somehow). Please send me a short bio and I'll try to talk you up too. (If you don't have my email, it's my twitter @gmail.com unless it's my onaclovtech twitter account, in which case it's tyson @ well you know my domain name.

For those of you reading this thinking. Man I wish I were part of a #50over20 club... YOU CAN BE, just start your own. Tweet things with the hash tag, and just rock it. Recognize people around you that you think are deserving, or well have simply met you that you would like to call out!

Maybe I'll make it on someone's list, but if not, at least I know that there are 50 people I know who deserve to be on someone's list!

I'll be following up with a post of the "winners" :)

Thanks and have fun!




Friday, June 5, 2015

Working Around Nodejs Module Common Singleton Design Pattern

I ran into a problem a few days ago. I built this really nifty queue module. It removes elements once they're old as defined by the key "endTime" (which come to think about it, maybe that could be a future enhancement to specify how to "expire", but I digress). Here is the problem, I needed a second queue. Well I can't just require my queue module in because it's cached and well it's not a "new" instance.

So for example.

var queue = require('queue.js');
var queue2 = require('queue.js');

queue.add({endTime : 1234});
queue2.add({enddTime : 2345});

// Assume queue.element returns the head of the queue
console.log(queue.element());

Output
>> {endTime : 2345}

// Assume queue.entire returns the entire queue
console.log(queue2.entire());

Output
>> {endTime : 1234}, {endTime : 2345}

As you can see you don't get a unique queue.

I found some examples around the interwebs and gave it a try. I have a problem with the common approach shown below.

var queue = function(){
   var self = this;
   self.local_queue = [];
   var funcs = {
                      add : function (obj){
                      ...... stuff ......
                      },
                     entire : function(){
                     ..... stuff..........
                     }
                     ...
       }
}
module.exports = function(){
    return new queue();
}

I don't like implementing my functions IN the surrounding function (the add: function example).

I prefer the following:

var add = function(obj){
... stuff ...
}

...

...


var queue = function(){
   var self = this;
   self.local_queue = [];
   var funcs = {
                      add : add,
                     entire : entire,
                     ...
       }
}
module.exports = function(){
    return new queue();
}

The problem is that my functions were not able to reference self. 

So I finally worked around this like this.

var add = function(self, obj){
... stuff ...
}

...

...


var queue = function(){
   var self = this;
   self.local_queue = [];
   var funcs = {
                      add : function(obj){return add(self, obj)},
                       ...
       }
}
module.exports = function(){
    return new queue();
}


If you notice now we have a self reference being passed to the function, all is now well in queue land.

Now when I require in it looks something like this.

var queue = require('./queue')
var queue1 = new queue();
var queue2 = new queue();

Now any adds and removes all affect only their own queues.

If you have a better cleaner way to implement this I'd be happy to see it.

Wednesday, June 3, 2015

My First Hour with a Chromebook

I'm excited. I do believe that a computer with all the tools you need at your fingertips exist. Why should compiling git require figuring out build resources, and installing a handful of different things, why not just be able to go to git.com/org/whatever and say I have a file, please compile, and it does it, on your machine (or optionally on their). Why do we have to fight to install software we may use intermittently?

Well in keeping with that thought, I decided my first laptop purchase in nearly 10 years (I know let the ridicule begin for a Software Developer to go so long between computer purchase), would be a Chromebook. I thought about this alot, I did *some* research, but frankly I'm a hands on kind of person. I like to get in and get dirty. So this post about my First Hour with a Chromebook, is being written on my Chromebook. I purchased the Chromebook linked to on this page. (Fair Warning: Click "Chromebook" anywhere here and you'll be taken to my Affiliates link on Amazon). It's a $250 dollar computer. I opted for the 16GB SSD, with 2 GB Ram, and HD display. From what I found online thanks to the NVIDIA Kepler GPU with 192 CUDA Cores and a few other things it's got a great power profile and the transitions are like butter I read somewhere.

Developing

First things up I installed an SSH terminal as I am working on my webdvr. It works as expected, however I do plan a future post on setting up keys so I don't have to type in my password every time. Hopefully we can get a series of posts to setup a basic dev environment with these tools configured to make things easier and faster.

Second install was Caret. I read this is a GREAT editor with a Sublime like interface (I have heard enough people praise Sublime I was interested). I haven't gotten deep into configuring, but once I do, this will be another post as well.

I finally tried opening a file from my raspberry pi. You can "add service" in the Caret Open File dialog. Once I selected SFTP, entered my credentials (Also future post about setting up keys for this). I was connected and running. Now for some reason while I was trying to copy a file and paste a copy (so I could rename and use again), the connection got flaky, and I decided to close the connection to my pi. This is where things were "weird" for me. When I clicked Open in Caret I was expecting the ability to essentially remount my drive and keep going, since that's what I did the first time. This was wrong (I have a question with the developer if this is expected behavior, I'll report back if it is/not), you need to find the SFTP service again from your system mount again, and THEN the folder will be visible again. I find this unexpected, and I get if Caret has no control, but seems like it would be nice to have. Aside from this, thus far, I really like the Chromebook for developing. I haven't searched but I expect I can find a Diff tool (similar to Beyond Compare) in the Web Store.

Looking at Carets github wiki they mention following the Unix Philosophy, wherein a bunch of small utilities able to be chained. I love that and think it works. In fact as I begin to use this system more and more, I am sure there will be some "small utilities" I'd like to build.

Movies

Ok so For some of my friends the question of whether Amazon Instant Video works or not.  The answer is a resounding YES. Does the site need some love, yes. I guess browsing amazons regular site works but it would be nice if they had a "instant video" specialized site, that worked similar to their roku app. (Which I guess maybe it is close enough, but just feels like some UI improvement could be possible).

Things that will take getting used to

I normally am used to the "delete" key in the upper right. Now it's the power button. Gotta be careful with that one, but frankly everything is synced, it's a 10 second or less boot, really not a big deal.

I'm not sure the "proper" right click, but I've found that ALT and a click accomplishes the same thing.

I'm told Apple folks are pretty used to the two finger scrolling. I am not, (I haven't owned an Apple laptop ever), so I'm sure there are some scrolling features I'll have to learn, but this one appears to have two finger scrolling.

More eventually.

Future Plans

I plan to install nodejs locally. (for when I need to do offline development).
I plan to get a Sandisk UltraFit low profile USB memory to both boost my RAM (using virtual Ram) and to boost my HDD space in the event I need it, which if I'm developing locally I suspect I may run into a space issue. I really like the SanDisk Extreme CZ80 but it's a bit "big" for a laptop like this. If you're aware of an SD card that has speed like the above mentioned drives thats an even more ideal scenario.
I have tried a few of the android IDE's and they kinda work, but they're just not quite there for me the last time I tried. I'll probably try them first before trying to setup locally.

I plan to setup Android App Development (at least try it) eventually. I am nervous about speed, but this is much faster than my netbook so that should be less of an issue.

I'd really like to see if I can connect an Arduino to this and actually program it (Fair Warning, I haven't researched if it's been done before). I think ideally to me, if you could make a webapp that interacted with it, that would be key. I mean we can install linux tools on here all day, but that defeats the purpose of this device. Same goes for the Android IDE. Building something that uses the native ecosystem just seems right to me. Plus it'd be handy to be able to have an always updated, and always working "install" of a program. I hate trying to wade through configuration. Just give me a site. If I need to pipe into another program, let me decide when I get there (and/or give suggestions along the way).

Final Thoughts
I really like this device, it's sleek and works well. It's a really reasonable price, the screen is crisp and clear (unlike my 10 year old Dell...hahah). I truly believe this is the future of a computer and what Puppet, Vagrant, etc are all trying to accomplish with VM's. I guess we'll see where we are in a year or two. I hope that I am able to contribute to this future. If Firefox came out with a REASONABLY priced device (similar to this) I fully expect I would give it a try. I tried the Firefox Phone and unfortunately the jump from an android to it was tough. I think it's got a ton of potential though, and I'm very interested in it's future.


So that's basically my first hour with a Chromebook.  I hope you had fun. Leave me a comment if you have any questions.


*Hey anyone reading this, a battery profile would be pretty slick to see, I.E. Time since charged, and all that jazz for someone interested in a 11-13 Hour battery life. Harder to keep track when you use it an hour here and an hour there. I think Android has something like this, but I don't see anything obvious here. But I digress.

Wednesday, May 13, 2015

Making a simple webapp using flaskr

Most flask examples use a blog as an example. This is probably very similar (and I'm pretty sure 90% was from another tutorial) but I just wanted to show some differences.

First we create a schema, and make a database

schema.sql looks like this.
Before running that you'll need to create the initial db which can be done via the command line in the same folder as your flaskr.py file
sqllite3 flaskr.db < schema.sql

 at the command line type python
>>
from flaskr import init_db
init_db()
This *should* create the first intance of the database.

finally when you're ready, start the following file with
sudo python flaskr.py

So here is the code to run for the simple server(flaskr.py)



So if you want different data stored off, you can change your schema, and the insert/select statement.

If you don't care about storing data, (you just want to perform actions) you can ignore most of the sql related items, and just read the data and perform whatever operation

For example

Now that we have a working app.

If you want to see the app get "data"
go to your browser and type in your ip address (if you did your IP and port as your values) and the data to send for example:
http://192.168.0.1/add?text=yourock&title=thistutorialhopefullyhelps

So now on your python script
request.args.get('title')  should pull out "you rock" and
request.args.get('text') should pull out "this tutorialhopefullyhelps"


Good luck!


This is the site that I had most of my tutorial from:
http://flask.pocoo.org/docs/0.10/tutorial/schema/#tutorial-schema
And the last example some came from here:
http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask

Monday, February 16, 2015

10 Tips for an Awesome Technical Resume

I've been asked a few times about providing tips regarding resumes. I'd like to provide them here.

  1. GPA is a must for some companies, keep it on if it's above 3, off if it's below (but know who you're applying to, if they care about GPA then you'll need to give it eventually).
  2. Don't use your school's email address on your resume. If companies don't have any openings but like you, they may not be able to get in contact with you in 2 years when they do if you use myname@unm.edu on your resume.
  3. Personal Email addresses should be professional looking. If you have an email account that has inappropriate words in the name, email is cheap, get a new address, you can link to your main account if you need to, but don't put dogpoo@gmail.com for your contact info.
  4. Quantitative, Quantitative, Quantitative. I think it bears repeating.
    I supported Einstein creating the Theory of Relativity, did you get him coffee, or tell him the secrets to the universe. I might hire the person but I would need to know if they make good coffee, or change the world first.
  5. Anything that is older than 8-10 years not related to what you're applying to, remove it. Generally if it's not useful to show a potential employer you had a paper route, leave it off.
  6. I would generally exclude Office, and Windows and probably iOS as "skills" employers expect you to know those two, and you don't need to explicitly state it. Linux is good to mention somewhere.
  7. Your intro shouldn't be "I want job x, with company y for reason z". That's boring and most hiring people are probably going to jump over it, instead opt for an intro. Tell people about yourself and what things you're interested in (this should typically be someone related to the job).
  8. Be concise, keep the resume to 1 page. It's amazing how many new grads straight out of college have bolstered their resume to 4 pages. I would dare say, with almost any amount of experience aim for 1 page.
  9. You don't need to break up your current job by project, and/or year.
  10. Remove redundant data. If you've written requirements on 3 projects, specify only that. You don't need to specify all 3 projects and what you did for each specific one.


If you want to take a look at my "sort of living" resume check out http://onaclovtech.com/
Above all, a resume is a piece of paper that attempts to give you an opportunity to talk to someone in person. Your goal is to give people something easy to read, that makes them want to talk to you at the end (or even mid ways through ;)).

Tuesday, December 23, 2014

Building your own DVR Part II

This is a continuation from Raspberry Pi + HD Homerun Dual = OTA Dvr

The original post here was outdated and I decided to remove it.

There will be future posts but it's slow going.

This is going to be a very step by step tutorial as I go through things :)

Monday, December 22, 2014

Raspberry Pi + HDHomeRun Dual = OTA DVR

My latest project has involved working towards a cord cutting world.

Lets get started.

The Parts

(prices as of current posting)
35.09 Raspberry Pi Model B+ (I initially used, Raspberry Pi Model B but don't expect any difference)
About $10 Research your own microsd card (for Model B I used this, I will post what I use when I get my B+)
18.99 Powered USB Hub (Any version should work, I just picked something cheap)
110.77 HDHomeRun Dual (There is an upgrade the HDHomeRun Connect-2, I haven't tried it but if you're feeling luck here's the link HD Homerun Extend-2, looks like it'll encode to other formats which is nice).
45.74 HD Antenna (This one picks quite a few channels up and has worked really well thus far, Antennaweb.com recommended a different one, but after adding a mount it was more than this one).
47.99 Router (I'm using the WRT54G because it was a spare one I had on hand).No Longer Needed.
64.99 1 TB Harddrive (I had an existing one, so some of these costs I'm not accounting for myself so my break even is sooner)
This comes out to a grand total of about $300. In my case I pay around $28 per month for my Dish Network Subscription. This means it'll take to about 12 months and I'll be ahead for costs (assuming I buy everything at once, and don't have spare parts I can just use).

Note: I didn't include powering the Raspberry pi in this calculation of cost, I plan to see if I can plug directly into the powered usb hub, and plug in the HDD from there, but I don't know for sure on that, however it uses the same plug as MOST new phones out there these days, so you probably already have a cable. (one can be found here though)

Setup

The HD Home Run Dual is a REALLY Easy piece of equipment to use. All I did was plug it into the wall, plug into the router, and plug into the antenna.

You ABSOLUTELY need to be connected over ethernet with the raspberry pi (So NO raspberry pi Model A since it doesn't have an ethernet port).

I installed Rasbian (at some point in the past).

For the setup I booted into LXDE, (login and type startx).

I found this useful to remove a few unnecessary programs, but since we have a powered usb hub we are going to be storing the data on an external drive as the size of the saved file is a bit large.

http://www.sbprojects.com/projects/raspberrypi/tweaks.php

The Raspberry Pi will also need the following:

Download libhdhomerun, HDHomeRun Config GTK from here:
http://www.silicondust.com/support/downloads/linux/

Here is a GIST of the commands I used after I downloaded and extracted the above zip files, and I entered into the hdhomerun_config_gui folder.



Finally I ran the following to test that the tuner was running.

hdhomerun_config_gui

I then updated the firmware on the tuner (Disclaimer, do so at your own risk, not sure if it's required, but I did it).

Clicking on the Update tab, you can select the firmware also downloaded from Silicondust website above,

If you're using the DUAL it should be this driver: HDHR3-US (hdhomerun3_atsc).

If  you're using the Extend you'll have to research which version of the firmware is right.

Recording

At this point I believe I exited the gui and re-opened it once I got the firmware updated (I got worried for a split second cause it couldn't find my tuner anymore, but it was something as simple as that to get going again). I was able to scan and see some channels and click on View to see them playing.

If you note on the left side the name of the tuner is listed (I believe it's id - 0,1), you'll need this number, also if you type hdhomerun_config discover via command line you should be able to get it right.

My general process for recording TV is this: (may be improved in the future)

1. Set Channel
2. Save Stream for some period of time.
3. Open Handbrake and transcode to another format.

I decided to just save the default format of the stream (TS?).

Looking at the developer gui You will see there is the ability to pipe into another program.

As of right now I believe that the "save" command will basically just write bytes to a file. So there is very little processing overhead happening, adding transcoding into the mix might be too much for the pi (but may not be, I really haven't verified).

I haven't tried it but you MAY be able to record BOTH tuners from one raspberry pi at a time.

Here is the single line command I used to record something last night, I'll explain what each means in a minute.

date; sleep 3600; date; hdhomerun_config set /tuner0/channel auto:27; timeout 3700 hdhomerun_config save /tuner0 test_show.ts;

Ok so I'll break down each section.

date prints the date/time
sleep will sleep the number of seconds allocated, I put in the dates around to verify it is waiting the right amount of time, and it appears to be.
hdhomerun_config ID set /tuner0/channel auto:27; This will set the first tuner to channel 27 auto selecting the modulation
timeout 3700 run a command for just over an hour (When I ran the .ts file, it was usually a little shorter than the timeout time, so I just expand it over a bit, you can edit it back if you need to using video editing software).
hdhomerun_config save /tuner0 test_show.ts; This is what actually saves your OTA channel.

Note: Remember to navigate to your external hard drive when you run this (you may be able to point the .ts file to the path, but I haven't tried it), otherwise you'll run out of memory pretty fast. When I recorded about 4.5 hours it came out to 26.1 GB of data. Transcoding down should come out to 5-7 GB so it'll go quite a bit down (using Normal on Handbrake and MKV, other settings may come out smaller).
Good luck and let me know what you come up with!

Keep an eye out for a future post, I'm planning on building a NODEJS server that will allow me to schedule recordings from the internet this will be similar to my post about controlling my roku/chromecast from the internet, I'll be using Firebase as an intermediary. (I'd love to go full on DVR solution but just worry MythTV or some other equivalent would be too heavy).

Tuesday, November 25, 2014

Automated Email Form Part 2

Continuing our post from Automated Email Form Part 1.

Now you have a trigger setup in Zapier, lets setup the webpage to send an email to yourself.

This will be an AngularJS app, so add the appropriate pieces to make it work. (you can look at angularjs.org or many online tutorials for specifics).

First lets add an input field to your webpage like so:



If you notice I left name in there, but i'm not collecting names, I decided the less a user has to type the lower the barrier to contacting me in this case. Maybe one day I'll add a name if I feel its necessary, but just adding one more field with the NG model set to name would capture the users name for yourself.

Basically I setup an NG-Click to call a function in my angularjs code.

So while in some cases you could put your angularjs code in html, most of the time you put it in a .js file, (I'm putting in the .html so there are script tags surrounding, but generally don't do that, unless it's a REALLY simple app, which in this case it is).



If you notice I do a simple regex email validate check.

When it passes it pushes the email address to my firebase link, next Zapier picks up the change and sends you an email.

Pro Tip: In fact I almost forgot I had it setup and when I received an email with the submitted email, I got really confused. so DON'T forget to make the subject easily recognizable, otherwise you might run into the same case :)

Good luck and let me know how it works for you!