Thursday, August 29, 2013
My New Hammers
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 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
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
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:
- Mapping trajectories of ALL universes
- Planet/stars etc.
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
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
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.
Tuesday, June 11, 2013
Delete Site on Admob
Steps:
- Login
- Click Sites & Apps heading (mine shows up there by default so no click necessary)
- Hover over the site you wish to get rid of.
- Click Manage Settings.
- Next to the title of your app, click edit.
- Navigate to the section near the bottom titled Delete Site.
- 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
Wednesday, May 15, 2013
Project Idea: Self Learning Samba System
Anyone want to do build something like this for the betterment of mankind? (yea, 1st world problem right?)
Thursday, April 18, 2013
Language Wishlist
Write a foreach loop and use the syntax below (basically perl but a little weird looking)
foreach
{
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
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
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
Let me know if you have any additional tips and/or tricks to install that will setup everything!
Roku SSDP nodejs
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
(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:
.use(connect.static('pathyouwishtoserve')) tells the server where to look for files.
var connect = require('connect'),
http = require('http');
connect()
.use(connect.static('pathyouwishtoserve'))
.use(connect.directory('pathyouwishtoserve'))
.listen(8080);
.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!