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 29, 2013
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.
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.
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...
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:
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.
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!
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!
Subscribe to:
Posts (Atom)