davecap.com

Mar 28

Using Sentry/Raven.js with AngularJS to catch exceptions

AngularJS makes it easy to override their default exception handler. This means we can plug in Raven-js to send all client exceptions to Sentry :)

Just create your own module and service with the same name as the default AngularJS provider ($exceptionHandler):

angular.module('myExceptions', []).factory('$exceptionHandler',
          ['$window', '$log',
  function ($window,   $log) {
    if ($window.Raven) {
      console.log('Using the RavenJS exception handler.');
      Raven.config('YOUR_PUBLIC_DSN').install();
      return function (exception, cause) {
        $log.error.apply($log, arguments);
        Raven.captureException(exception);
      };
    } else {
      console.log('Using the default logging exception handler.');
      return function (exception, cause) {
        $log.error.apply($log, arguments);
      };
    }
  }
]);

Just get your proper Sentry public DSN and add your allowed domains in the Sentry security settings for your app.

Nov 22

Mac OS X dock hiding speed!

If you want to increase the speed that the dock hides and shows, and remove the delay so that you don’t waste those precious milliseconds, copy/paste these commands into your terminal:

defaults write com.apple.dock autohide-time-modifier -float 0.05
defaults write com.apple.dock autohide-delay -float 0
killall Dock

You now have a fast hiding dock!

Jul 24

The scientific communication revolution: Why disrupt the scientific publishing industry?

In December of 2010, NASA published a paper in Science (Wolfe-Simon et al. 2010, A Bacterium That Can Grow by Using Arsenic Instead of Phosphorus.) in which they claimed to have isolated bacteria that substitutes arsenic for phosphorus on their macromolecules and metabolites. Of course, the implications of this finding would have been immense… had it been true. Soon after publishing, Dr. Rosie Redfield presented meticulous criticism of the original paper on her Wordpress blog (http://rrresearch.fieldofscience.com/2010/12/arsenic-associated-bacteria-nasas.html), and was essentially shunned by the NASA group, citing the non-official nature of her blog. It took one whole year for Dr. Redfield to submit her rebuttal paper to Science (http://rrresearch.fieldofscience.com/2012/01/arseniclife-manuscript-has-been.html), and five months more for her manuscript to be accepted for publication. Overall, it took one year and a half for traditional publishing to catch up to a Wordpress blog.

If there’s one thing in this world that needs to die and be reborn it’s the scientific publishing industry. One hundred years ago, the centralization of scientific publishing was necessary because content distribution was a hard problem. Now, as we all know, the problem of freely distributing content has largely been solved by the internet. Scientific publishing, as it stands today, is actually a hindrance to scientific progress. I’m not talking about the scientific method here, but purely the mechanisms by which we organize, compile, and distribute the vast amounts of scientific information.

Science is an old world institution where credit and reputation come mostly from journal article authorships. You can tell how well a scientist is performing by looking at their list of publications and by calculating something called an “impact factor”. An impact factor gauges the importance of a paper by calculating the number of times it is cited in the two year period after it is published. This is kind of like looking at the financial statements of a business. Both scientists and businesses require money to fuel their operations, and both must generate value from the fuel. In business, this value is typically represented by money. In science, value is knowledge in the form of publications. As a result, science has developed a strong dependence on the academic publishing industry. Over the past half-century, publishers have leveraged this dependence to build up the $20 billion scientific publishing industry that exists today.

Unfortunately for science, the traditional publishing model has become costly, painfully slow, and inefficient. It can cost anywhere between $1000-$5000 to have a paper published and even more (upwards of $8000) to publish an Open Access paper (free to read without a subscription). It can take up to a year for a paper to become accessible to subscribers (and/or the public) as it goes through the drawn-out publishing process. I’d venture to say that, because of this process, the vast majority of papers that come out today report on data that’s over a year old. Scientists are busy people, but they do most of the heavy lifting throughout the process. In academic publishing, unlike many other industries, the two most important inputs are provided virtually free of charge by researchers. Publishers argue that they add value by supporting peer review, typesetting, printing, and web publishing. The reality is that their main role is in representing their brand (the journal’s brand). All other processes can be fully automated over the internet (and they basically are already!).

As a way of mitigating the costs of publishing, some fields such as physics and math have collectively decided to bypass traditional journals altogether and use Open Access “e-print archives” such as arXiv.org. But, biologically-oriented fields are way more stubborn, most likely because of how afraid many researchers are of being scooped and the potential for valuable intellectual property. They’ll be sticking with traditional publishers until a reliable and trustworthy alternative comes along.

Between the rise of Open Access publishing houses and preprint servers such as PLoS and arXiv, and the more recent global boycotts of specific publishers (http://thecostofknowledge.com/), a lot of change is starting to happen. Many people have written about this issue (http://michaelnielsen.org/blog/is-scientific-publishing-about-to-be-disrupted/, http://www.nytimes.com/2012/02/14/science/researchers-boycott-elsevier-journal-publisher.html, http://scholarlykitchen.sspnet.org/2010/01/04/why-hasnt-scientific-publishing-been-disrupted-already/) and awareness is growing, but the future of scientific communication has yet to be discovered.

Jun 13

Slocans @ Brutopia! (Taken with Instagram)

Slocans @ Brutopia! (Taken with Instagram)

How to get fashion advice from Google

You know what’s fun? Google Insights for Search. That’s what’s fun. You know what else is fun? Asking google for fashion trend advice. It’s fun because it’s kind of like asking Ronald McDonald for cooking tips.

Here’s what’s happening with “hawaiian print”:

In the #menswear world, you might think that everyone’s wearing Hawaiian prints. Maybe that’s true in that world, but if we venture out into the mass market it looks like Hawaiian print was hot in 2004… and kind of died off since then. As we might expect, it seems to peak mid-summer, every summer.

How about “camo pants”:

Camo pants are strange because there are all kinds of people that wear them, so it’s not as easy to know if they are actually “in style” or not… BUT here’s the kicker. Camo pants usually peak in the fall/winter season. This year the peak has turned into a plateau! Camo pants (or camo everything!) might actually be in style this summer!

Here’s a cool one, “selvedge denim”:

Now there’s a positive trend. Pretty clear that lots of men are finding out about selvedge denim these days. That’s cool.

Ok, so here are the last two interesting ones. Bow ties. Are they back in style or not?

Yes. Searches for bow ties are the highest ever in history (well, since 2004 to be specific). Bow ties are clearly coming back, at least for the time being.

One extra little thing I thought was interesting was the data on “how to tie a bow tie”:

Once again, a slight increase in the past couple of years… but what the hell are those peaks in December? WHAT IS HAPPENING IN DECEMBER? Someone please tell me… Christmas? what is it?

That’s all for today folks!

Jun 06

Today is World IPv6 Launch day, and I predict…

In the next 10-20 years, every baby born in the developed world will be allocated their own personal IPv6 address.

Why? Well, wouldn’t it be cool if everyone just had the same phone number for life? Fine, so there are services like Google Voice and the Yellowpages but come on, how many people actually use these things in real life? Instead, what if everyone just had a single address that they could link to their phone, computer, computer-phone, brain-implant-phone, tooth-implant-phone, eyeball-phone, or whatever you might have in your pocket in 10 years, to your personal IPv6 number!? Think about the possibilities!

Also.. IPv6 also has cool integrated security features that should make the world a better place.

Today is dedicated to IPv6 Launch Day and Giant Steps by Coltrane.

Giant Steps by John Coltrane on Grooveshark

Jun 05

Ringing a bell in your browser through WebSockets

Today at Dolbeau I wanted to make a bell ring when a new order comes in… just like Jeff Bezos did in the early days of Amazon. I wanted to make sure that our bell rings in any browser that has the bell page open. It turns out it’s super easy to do using NodeJS/Express and Socket.IO.

This is how it all works:

  1. Load the URL in any number of browsers
  2. Send a POST to the same url
  3. Listen to the bell ring in all open browsers!

Also you can specify which sound you want to play by using the ‘type’ POST parameter. Just check out the JS and HTML files and you’ll be good to go!

Fork it on GitHub!

Jun 02

"Feudal Japan’s sartorial laws"… this is what happens when you study the history of fashion in Japan. Dolbeau kills it with SEO!

"Feudal Japan’s sartorial laws"… this is what happens when you study the history of fashion in Japan. Dolbeau kills it with SEO!

May 31

[video]

May 30

Julien Smith modeling his collabo edition (Taken with instagram)

Julien Smith modeling his collabo edition (Taken with instagram)