Private over-sharing will improve your life


I have shared my life and my digital content online for many years now. Usually with family and friends, but increasingly more and more my information is shared publicly (Last.fm, Instagram & Strava are just a few examples). Naturally this increased open content sharing asks questions such as: is this information being stored safely? can people see where I am and stalk me? what could happen to my information in the future?


Privacy groups will often warn you against uploading your information and revealing your location. There are many risks to this and they are all obvious! Services online such as Facebook & Google+ encourage you to share more, because the volume of data is valuable and can help them know more about you. These arguments sit at the two extremes of the debate about content online.


I believe that there is a really important middle-ground to this argument which is not really being championed. You can and should record and store all of your information online but... only behind private closed settings. I have coined this technique as 'private over-sharing' as you are sharing more information than you currently think you should (e.g. photo of what you're eating, who needs to share that?), but you are sharing it only with yourself. Maybe this could have a better name!


By private over-sharing, you are effectively writing your own timeline and history. You are leaving a story which you can revisit later in your life, but the more detail the better. You could call it your digital story.


As services and applications get more powerful and interesting, I can see your digital story will be your most valuable asset as it will be a record of who you are and what you have achieved. Digital services will store infinitely more items than you could ever remember and your quality of life in the future may actually depend on it.


Let me give you a few examples of how my digital archive is already enriching and improving my life.
- I know my favourite artists and where I can see them next
- I see how far I cycle and how much energy I am using
- I share my photos directly with my family so they can see what i'm doing whenever they want


In the future I imagine services will to continue to make my life easier. As long as I keep my data safe, I now feel that I should be storing and recording as much as information as possible (without affecting my day-to-day life). This means i'm future-proofing myself for the array of services that are just around the corner...

JavaScript inheritance overwriting and calling class functions


If you want to inherit a class and then overwrite parts of it with new code, but still keep the original then you will need to use the call and apply functions in the correct order.

1) call the parent class first
2) save a reference to the original function first
3) apply the arguments of the new function back to the parent class function

Here's a working example.

function Animal(name) {
this.name = name;
this.run = function() {
console.log(this.name + " is running!")
}
}

function Rabbit(name) {
Animal.call(this, name); // call the parent constructor first to bring in the class 
var parentRun = this.run; // save a reference to the old run function
this.run = function() { // overwrite with a new run function
parentRun.apply(this); // call the previous run function
console.log(this.name + " is running 2!");
}
this.bounce = function() { // add a new class function
console.log(this.name+" is bouncing");
}
}
Rabbit.prototype = new Animal(); // this allows you to see the chain of prototypes in console log

var rabbit = new Rabbit('Andy');
rabbit.bounce();
rabbit.run();

var rabbit2 = new Rabbit('Bill');
rabbit2.bounce();
rabbit2.run();

console.log(rabbit, rabbit2);

Setting up Apache on a mac


If you're wanting to do web development on your computer then you will need to set up apache web server so you can run websites locally.

For Mac
- From the Apple menu, select System Preferences
- Click “Sharing”, and then click the services tab.
- Select Personal Web Sharing, and then click the Start Button
- in your browser go to http://localhost
- You can save your files for a site at: Users Directory > Your Username (homedirectory) Sites

enable PHP
- open /etc/apache2/httpd.conf
- remove the hash from the line that reads
LoadModule php5_module -  libexec/apache2/libphp5.so
- save the file, if you don't have permissions it won't allow you to save, some editors give you permissions automatically

remove your username from the url
- open /etc/apache2/httpd.conf
- change the line
DocumentRoot "/Library/WebServer/Documents" to
DocumentRoot "/Users/yourusernamehere/Sites"
- save the file, if you don't have permissions it won't allow you to save, some editors give you permissions automatically

Improving JavaScript animation

jQuery might be a great tool for quickly putting together animations on your pages. However when start to do more professional complex animations the limitations become apparent.

Previously Adobe Flash was the best solution for a complex animation, and the Flash library Greensock TweenLite was our favourite. Thankfully they have now ported the library over to JavaScript and it brings some great performance benefits.


It is 5x faster than jquery using their speed tests
http://www.greensock.com/js/speed.html

You can read the docs and download it at:
http://www.greensock.com/get-started-js/

Browser Feature Detection - Plugins

Feature detection is the best way to ensure a good user experience when browsing the web. Rather than presuming an iPhone can read pdf's (which it can). We should be detecting whether the browser is capable of displaying pdf's natively first, then embedding the pdf (in a new window seems the best option). Non-supported browsers could be shown a download button and message telling the user where to find the relevant plugin.

Here is a great post showing how browser plugin detection can be implemented easily using JavaScript:
http://www.matthewratzloff.com/blog/2007/06/26/detecting-plugins-in-internet-explorer-and-a-few-hints-for-all-the-others/

Google Developer Make The Web Faster

While searching for articles about improving performance in websites I noticed Google have updated the 'Make The Web Faster' page with some interesting new statistics.


  • The average web page takes up 320 KB on the wire.
  • Only two-thirds of the compressible material on a page is actually compressed.
  • In 80% of pages, 10 or more resources are loaded from a single host.
  • The most popular sites could eliminate more than 8 HTTP requests per page if they combined all scripts on the same host into one and all stylesheets on the same host into one.
It's also a great resource for tips and tutorials to speed up your pages.
https://developers.google.com/speed/articles/ 

Chrome JavaScript Beautifier

When viewing the source of sites you come across lots of minified files. These can easily be made readable by going to a site such as JsBeautifier. However I've just stumbled across a plugin that will do it in-line for you.

JSBeautify for Google Chrome
https://chrome.google.com/extensions/detail/kkioiolcacgoihiiekambdciinadbpfk