The perfect get-down-to-work mix.

No title available

Origami Around

titsay

tannertan36
Peter Solarz
Game of Thrones Daily
i don't do bad sauce passes
AnasAbdin

Love Begins
cherry valley forever

❣ Chile in a Photography ❣
NASA
No title available
todays bird
Not today Justin
we're not kids anymore.
noise dept.
DEAR READER

Andulka
Mike Driver
seen from United States
seen from Germany

seen from South Korea
seen from United States

seen from Malaysia
seen from United States
seen from Italy

seen from Czechia

seen from United States

seen from Germany
seen from United States
seen from Türkiye
seen from United States

seen from Mexico

seen from Singapore
seen from Malaysia
seen from United States
seen from France

seen from United States

seen from United States
@callmemd-blog
The perfect get-down-to-work mix.
This makes me feel like I'm in the future of the 1980s.
Code Snippet
Just solved the following Javascript problem:
I have an object called Router. This object is empty. I need to be able to assign a function to a property on the object, like so:
Router = { "routeName": routeFxn };
Complicating issues, I need to be able to store nested routes, like so:
Router = { "routeName1": { "routeName2": { "routeName3": routeFxn } } };
Finally, I need the Router object to persist in my global namespace.
I created this function, digIntoObject, that takes an object and an array of route names. The function takes the object, recursively digs into each route name, and assigns the last route name to what you tell it. For example:
digIntoObject({},["a","b","c"],true)
Produces:
{ "a":{ "b":{ "c": true } } }
Here's the snippet:
var digIntoObject = function(objToDig,levels,assignment){ if (levels.length == 1){ objToDig[levels[0]] = assignment return objToDig; } if (typeof objToDig[levels[0]] == 'undefined'){ objToDig[levels[0]] = {}; } digIntoObject(objToDig[levels[0]],levels.slice(1),assignment); return objToDig; }
Happy coding!
So Many Startups, So Little Self-Awareness
I've been interviewing at many early-stage start-ups recently. The biggest problem I find is not that they have little money (oftentimes, the founders I'm talking to pour a staggering amount of cash into their enterprises), but a lack of self-awareness. People who form businesses have a "can-do" mentality. They believe they can do almost anything, and with good cause. In order to succeed in launching a new company, you need supreme confidence in your product and yourself. However, I cannot tell you how many times this same confidence spills over to other areas that effectively poison the company well.
In so many cases, I've seen cases of founders overstating their abilities in many areas of the business. I've experienced people who think they are brilliant designers, but create jumbled user experiences on the site. I've talked to others who have vastly overstated their influence on a project when they've taken a back seat to making difficult decisions and building things. I've talked to people who say they can deliver on the business side, but have no basic model or exit strategy to make money.
The paradoxical moral here is that you need to both be confident of your abilities and absolutely aware of your limitations. Of course, work on fixing these limitations, but do so in the company of others who already possess this expertise.
This is incredible. One smart cookie created a lighting engine for rendering realistic 3D models in CSS. While the current implementation does suck up a lot of processing power, I believe this project is indicative of the greater desire of developers to do make CSS, JavaScript, and HTML able to handle more complex interactions and visually-intensive processes.
Adding Temporary Fields to Mongoose Object Literals
I am working on a project in Node.js that uses Mongoose. Instead of writing my backend in JavaScript, I am using CoffeeScript because it makes my code cleaner and easier to read.
I had an embedded document of Mongoose objects. I was looping through the document as such:
for doc in allDocs doc.customField = "My custom value" JSON.stringify(allDocs)
However, the result would not include customField. The value of the temporary field would not be copied into the object.
After searching the interwebs, I found this helpful post that solved my problem: https://groups.google.com/forum/?fromgroups#!topic/mongoose-orm/lPJ6otWBDr4
In order to append fields to a document, you must first convert it into an object, so my code changed to:
newAllDocs = [] for doc in allDocs doc = doc.toObject() doc.customField = "My custom Value" newAllDocs.push doc JSON.stringify(newAllDocs)
Problem solved!
This is on repeat right now. Amazing song you won't find on their EPs!
Why Apple Maps is a Boneheaded Move
Recently, Apple announced that with iOS6, they will be removing Google Maps in favor of an Apple Maps. I can't help but feel like this is a completely boneheaded move driven by hatred of Google instead of the development of a superior product.
1. No Transit Directions (http://articles.boston.com/2012-06-13/yourtown/32218069_1_ios-public-transit-new-app)
If you live in a city, this is a huge deal. Google Maps provides you with some of the most accurate and useful public transportation directions I've seen on a phone. Even though I've been living in NYC for years, I still rely on Google Maps to find places and determine optimal subway routes late at night (and with construction advisories). Removing this functionality is going to really hurt and demonstrates that their product is not quite ready for prime-time.
2. No Street View
Google for years has been driving around cars fitted with cameras to capture pictures of streets around the world. Their hard work has paid off in perhaps one of my favorite features of the Google Maps product - Street View. Street View helps me orient myself in an area that is unfamiliar to me. When looking for apartments, it was crucial in determining which neighborhoods were good or bad. On the go, I use Street View less frequently, but I do like having the option on my phone.
3. No features that make it better than Google Maps
Sure, Apple is giving users turn-by-turn directions, but I've been on plenty of road trips where I got by just fine without this feature. Also, if I desperately needed it, all I had to do was turn to an Android phone. And Apple says that their maps are vector-based, not image-based, meaning that the load time will be much faster. Super. That's one feature Google already does and another feature that Google is probably working on right now. If those are all the improvements, why would I ever switch? Apple has a history of making products that do not necessarily represent bold innovation, but take existing technology and make it more user-friendly, beautiful, and coveted. Their new Maps product just seems to be a poorly-placed jab at Google, to the detriment of their users.
To me, this seems like a hastily-rushed, business-oriented move that will cost Apple in the long-run. Maps is a core part of the iOS experience, and they're severely gimping it. We'll see what happens this fall.
Q: What's the Miami Heat's star unix shell? A: Chris Bash.
Atomic (Programming Term)
I've always had a difficult time explaining this term to people. In essence, an atomic function is one in which its operations run in an unbroken linear chain. This means that even in the presence of a multithreaded system, this function is guaranteed to execute in the order in which it was written without an interruption from a different thread. Let's look at an example in pseudocode.
Let's say you have a data structure called bankAccount. This bankAccount has a value of 500. And now let's say you have two functions called withdrawal(float amount) and deposit(float amount):
withdrawal(float amount){ withdrawalTotal = bankAccount - amount; bankAccount = withdrawalTotal; }
deposit(float amount){ depositTotal = bankAccount + amount; bankAccount = depositTotal; }
Let's say you have a multithreaded program. One thread is executing a withdrawal request for 100 and the other one is executing a deposit request for 100. If our bankAccount has 500, we should net even. However, in a multithreading environment, you typically have no control over the order in which the commands are executed. Let's say the following happens:
The first line of withdrawal withdrawalTotal = 500-100 (400) The first line of deposit depositTotal = 500 + 100 (600) The last line of deposit bankAccount = depositTotal (600) The last line of withdrawal bankAccount = withdrawalTotal (400)
We wind up with a total of 400. This is a case where the functions are nonatomic. Let's re-write them to be atomic:
withdrawal(float amount){ bankAccount -= amount; }
deposit(float amount){ bankAccount += amount; }
Because each function executes in just one line, it is impossible for a multithreaded environment to interrupt their execution.
Remember, this is just an example in pseudocode to get you to understand the concept behind atomicity. Different languages handle atomicity in different ways.
One last thing. The name atomic. Why did programmers choose this word to describe this behavior? Well, atoms are the smallest units of matter and atomic functions are the smallest chunks of unbroken code in a program.
What an incredible storyteller.
Node.js
I am in love. While my girlfriend goes to work and I'm at home in my development environment, I carry on a love affair with node.js.
Coupled with CoffeeScript, node is surprisingly elegant, blending the best features of LISP with clean JavaScript. The Express framework is very powerful. It allows you to use ideas from Rails and Django to get really close to your server, providing such a high level of customization that for the first time in a long time I'm truly excited about a new language.
That's not to say it doesn't have its imperfections. Express ships with Jade as a template engine, and I'm finding the syntax to be incredibly weak and cumbersome. And it can take more effort to get the basics going - notably cookies and sessions. But like the flawed features in a lover, these inconveniences only accentuate out the true beauty of node.
If you'd like to get started with node, here's a great set of resources that will give you everything you need:
Getting Started Tutorial http://shapeshed.com/creating-a-basic-site-with-node-and-express/
CoffeeScript/Express/Jade Template (for your first app): https://github.com/alfrednerstu/node-express-coffeescript
Easy-to-use wrapper class I wrote for making GET and POST requests: https://github.com/loudin/node-requestwrapper
Unit Testing with Nodeunit: https://github.com/caolan/nodeunit https://github.com/powmedia/nodeunit-httpclient (For testing HTTP requests)
Mongoose, a MongoDB database interface: http://mongoosejs.com/
Knox, a great Amazon S3 Client: https://github.com/LearnBoost/knox
Nodejitsu for hosting your project: http://www.nodejitsu.com/
Wow. This is a stellar track on a lovely album.