My most used phone Apps.

These are my most used phone Apps. Currently I’m using a Samsung S5, I just scrapped my 3 year old iPhone. I’m loving the bigger screen on the Samsung. The UI took a bit of getting used to, but it rather smooth sailing so far. I still find cut & paste a ton easier to use on the iPhone, but liking a change of GUI with Android. Also liking far more storage for same price with Samsung for local music storage.

The obvious built in apps: Phone, Messenger, Contacts.

The more serious stuff:

Rdio – I’ve found lots of new music on this app, stream or download for $12 a month.

Google Play Music – Their recommendations are different than Rdio, so I find different things -) where (things == music) {listen;}

Google Maps

Chrome web browser – I tend to surf the web a lot on my phone, instead of installing web site in an App type apps. It’s quicker to open a web browser.

Gmail – I use this for more development related emails.

Mail – I use this for my work email and a general personal email. 

Yo – Getting hooked on this little puppy.

Twitter – I only use it about once every 2 weeks, but I always use it.

Facebook – Again I may log in once every 2 weeks, but hardly ever post. I’m too busy to bother. 

LinkedIn – Another social app I might use once a week, more for work stuff.

Voice Recorder – I use it to record song / guitar ideas.

Games – I’m not playing any right now, but that might change.

That’s about it for now. As you can see my app use is rather simple. I spend most of my spare time coding at a Mac Book laptop, so apps tend to be more for getting work done. When I take coding breaks I’ll dig into my Kindle reader, and games like Three’s.

Blockchain for Distributed Social Media (PuffBall)

What happens when you take the blockchain used for digital currencies such as Bitcoin, and use it for text (or other media i.e. video, pictures, audio)? I came across an new opensource project called, PuffBall, which uses the blockchain for distributed publishing. If you’re semi-tech savvy, you know that with Facebook, Twitter or any social media web site, that all your posts and history is readable by those companies. Regardless of what you choose to share with your friends, the company that owns the web site/app can see everything you write as it’s all stored on their servers.

Blockchain goes Social

Puff BallBy using a blockchain that is encrypted on each client you get to liberate posts and tweets from being stored on any one single companies servers. Further, with encryption controlled by you the end user with a private key, only the people you grant access to can see your data. This is not good news for the Facebook’s of the world that mine users data for trends to sell advertising against and make additional recommendations based on what you write or like (or dislike). Although these types of recommendations may appear useful to new users, after a while you realize they are nowhere near as accurate as what you really want in the moment (at least with most current algorithms). I know recommendation algorithms are getting better with time, but that’s besides the point when it comes to your privacy and preventing strangers from seeing your history.

Anyway, back to the technology: PuffBall  is opensource code, based on the blockchain, that anyone can use to write a web site (aka web app) or mobile app to connect to the PuffBall blockchain; and host it on your own server or an instance of a cloud server such as Amazon’s AWS (or the piles of other cloud providers). You can write your app in what ever language or platform you want, so long as it can consume PuffBall’s JavaScript API.

The EveryBit app is an example forum client, you can download the opensource code and modify it to your liking. EveryBit currently uses ReactJS for it’s HTML templating, although there’s nothing stopping you from writing your own client to access the PuffBall API, with your favorite framework whether that’s Rails, AngularJS, MeteorJS, etc. There’s a good overview of PuffBall and EveryBit on the GitHub page README.

The Bitcoin block chain stores a history of transactions (called the Ledger), it doesn’t actually store the digital coins. Bitcoin’s stores ‘cash’ in a digital wallet, which can be located on your computer (or phone/tablet) or on a web site that stores wallets. With PuffBall the ‘cash’, i.e. the text and images for a post, is stored within the blockchain. There is no concept of a wallet with Puffball (at least not in it’s pre version 1.0 incarnation). In this sense, PuffBall is extending the blockchain to allow for storage of text and images (or any data).

Puff Ball has a modest road map, initially it will only support text or images. Although if the blockchain for distributed media takes off there’s no reason it can’t be extended to support larger media / files such as audio and video and possibly even executable applications.

A Few Challenges

A team of scientists measure a giant sequoia.

There are a few challenges that Puff Ball will need to work out, as with any new technology that is still going through transitions.

How could large files work in the blockchain? This will be a challenge for the hosting servers to be able to store all the data that could be uploaded by a system if it’s user base took off. Matt Asher the project lead said, “It might be worth making clear that each user will have their own blockchain (or “puffchain”, in this case).”

Another challenge is how public and private keys work; to be 100% secure that your data cannot be accessed by anyone except you and the friends or followers you specifically grant access to, the client app developer can never store a users private key. This works well for security, but puts the onus on the end user to remember their private key, as password resets will not work, no key is stored to reset. Although there are some interesting ways to get around this using multi-factor authentication. Or, like some of the more popular Bitcoin online wallets, the client can simply store private keys for users, with the usual email/password protection to access the site. Although this doesn’t stop the client app developers or rouge governments from accessing the private keys (and your data).

A distributed publishing network that can’t be taken down by any one government (or evil corporation)  still offers an advantage, even if they can snoop on your data, it makes it harder to block access from specific web sites the way Turkey and Iran block Twitter, or China blocked Google. Makes me wonder what else their blocking that doesn’t make the news!

Side Note – Encrypting Encrypted Data: If the server encrypts the private key and stores it encrypted on the server, you still need a way to un-encrypt the private key, and that is where it falls apart, as to recover a forgotten private key that is encrypted the server would need the key to access the key.  If you created a new key, like when passwords get reset, then the end user would loose access to all their previous content.

How will PuffBall content be distributed around the internet? Anyone that chooses to set up their own client app will need to host it on a server somewhere, this server can cache (store) the blockchain. When another person wants to set up a client app, their server will also have access to the blockchain stored on the 1st guys server, and so on. And technically if someone wanted to write a thick client, i.e. one that isn’t running in a web browser, then the client could now store part of the block chain as part of a peer-to-peer network – although with enough independent people hosting servers all around the planet, in many different countries, this would be a more likely scenario that is easier to implement for developers.

Why I chose ReactJS ?

Why I chose ReactJS over other web app front ends?

I did a lot of work with www.meteor.com, and found it to be missing some key features such as easier joins of collections. And there was a mobile app in the iTunes store, Ralph Chat, that was slow scrolling and hitting ‘send’, I believe this is because they were using the old template system that Meteor has recently replaced with Blaze. Since MeteorJS is pre version 1.0, I still plan to try Meteor out again once it’s released, as I’ve got an app almost finished in MeteorJS.

However, I wanted to get a different web app & mobile app going and fast, so I took a very quick look at AngularJS. It was confusing, with their API terms such as scope, dependency injection, their own module system, and a few other Angular specific terms. Although that’s not why I decided against Angular as I don’t mind a bit of a learning curve if it’s the right tool for the job. I was reading other blog posts about Angular’s poor performance in mobile apps & browsers, and since we live in a “mobile 1st” world I was hesitant. Even though the Ionic mobile GUI for AngularJS looks amazing, I decided to try ReactJS.

There were also blog posts by guys with far more Angular experience than me (I only ran through the Angular tutorial, and hooked up a simple Firebase.io test app). These guys were saying ReactJS is easier to reason about, they write fewer lines of code, and ReactJS renders way faster than Angular, or Backbone. There’s even people using ReactJS within an Angular or Meteor project, so I figured why not just write the app from scratch in ReactJS.

In terms of Backbone, I use the Rdio music streaming app on iPhone & iPad, it’s super slow, very annoying to use when scrolling through album lists… and it was written in Backbone… Although the Google Music Play app is also super slow (i have no idea what it’s written in?)

Another reason is that the guys working on Puffball.io are using ReactJS for their EveryBit.com frontend, and doing a good job of it.

I also took a look at mobile specific frameworks such as Ionic, Titanium, Sencha and a few others… I decided that ReactJS may take a little extra time to do the GUI without the pre-built mobile GUI that other frameworks offer, but I’ll have the benefit of using the same code base for both mobile apps (with something like PhoneGap) and desktop browsers.

btw – I chose to use Parse.com for the backend storage, push & analysics. I was initially going to use FireBase, but they don’t have full internal searching implemented yet, due to their real time DB.. I may use FireBase for parts of my app that need realtime updates if Parse.com can’t handle that task.

What I personally Like about ReactJS!

So far I’m liking the speed at which I can mock up GUI with ReactJS. It’s actually faster to not keep switching between files, as the controller code and the HTML (JSX) are all in the same function call. I suppose you could separate this out if you needed to for large teams using something like RequireJS, but for what I need it’s pretty slick.

I don’t have to learn a template specific language, everything is in JavaScript or HTML. This makes it easy to just get things done by using as few languages as possible. It may make code a little longer in some parts, but I’m OK with that, as it’s easier to understand and easier to maintain.

The concept of props and state are super simple to understand. props are properties you pass from one ReactJS component down to it’s siblings, and state is for things that change so the GUI updates automatically. You can easily pass state and props down or up between components; although it takes a bit of getting used to the patterns used (passing this.yourHandlerName down the component chain), yet it’s simple and quite obvious when reading the code what’s going on.

Also, ReactJS is a hard baked project that’s in heavy use by both Facebook and Instagram unlike pre v1.0 MeteorJS.

I won’t bother with any code examples as you can check out the simple examples on the ReactJS site.

What I don’t like about ReactJS!

On a development side, ReactJS can get a bit strange when all HTML/JSX (JSX is a simple way of writing HTML inside JavaScript) is inside your controller code, although it’s something you can easily live with or use modules. There are a few other things to figure out (as with any framework), stuff like using className instead of class in your HTML. ReactJS doesn’t change the DOM directly, it uses a diffing algorithm, which means you have to do certain things the React way, although it’s rather easy to grasp after a short time; you can read more about that on the ReactJS site.

The big things are that ReactJS doesn’t have it’s own module system, doesn’t have it’s own backend DB like MeteorJS does, doesn’t have an official router (I’m using React Router and so far so good, although I’ve yet to do anything major with it). In that respect ReactJS is like AngularJS without a router or module system.

For modules I’m using RequireJS (actually Browserify & Watcherify) which follows the RequireJS format. But this took me a while to wrap my head around how it works i.e. I didn’t realize including ReactJS in my HTML file’s <script> tag was breaking things as I needed to use the node model of ReactJS for React Router to work (not the script tag). It’s extra stuff and time that you wouldn’t have to mess with in Angular or Meteor. But I think it’s going to be worth it to have a full ReactJS front end, and other frameworks have their own learning curve.

ReactJS could use a more explanations in the documentation, it’s good but not great. It would be nice to see a bit more description or examples in the docs for using things like Refs or child properties. I find the ReactJS documentation isn’t laid out in an easy way to find things, it’s more like a blog, but it’s just a matter of me getting used to it. And with the help of Stack Overflow I’ve been able to get things moving fairly quickly. Granted, I haven’t done much reading on ReactJS, no books, just checking out a few code examples and it’s pretty straight forward.

I find most of my dev time is still spent screwing around wrapping my head around JavaScript specifics (objects, callbacks) and with CSS trying to make things look pretty. In terms of CSS and HTML apps, this is the price you pay compared to using a mobile specific HTML framework or a native app, but I’m betting on a bigger payoff down the road, so I can easily port the app to iOS, Android, desktop browser, and Windows or BlackBerry phones.

Summary

I didn’t have the luxury of time to do more research and testing of various frameworks, so I did the best I could when choosing and relied on both my previous experience, gut instinct, my research, and reading other developers blogs. At the end of the day, I’m picking a horse to ride, if the horse falls over and I can’t get the horse back on it’s feet then I’ll change horses. But for now I’m knee deep in ReactJS and liking it.

Time Ago for Dates using SugarJS

Here’s how to get nice clean dates in your GUI. This shows relative dates for the current day, i.e. “2 hours ago”, and “month day” for dates in this year, for anything older that this year, i.e. all posts from last year and beyond it simply adds the year as “month day year”.

I’m using Handlebars with MeteorJS, but the Javascript code below is still… Javascript, with SugarJS, so you should be able to figure it out with a cut & paste job if your using something other than Meteor / Handlebars.

Make sure you add: www.sugarjs.com to your project, otherwise you’ll be a fish out of water.

Here’s the Handlebars helper, just pass in a date created with JavaScripts Date().  i.e.

In the Handlebars template:

  {{fn_timeAgo createDate}}   

createDate is a DB field created using:

  createDate: new Date()  

And finally… the main code — you can customize this to your liking, it’s pretty simple to change formatting, check the SugarJS page for more ideas:

Handlebars.registerHelper('fn_timeAgo', function(IN_date) {

  var ret_val;
  var new_date = Date.create(IN_date); // uses SugarJS create().

  // All methods on new_date are from SugarJS.
  if ( new_date.is('today') ) {  
    ret_val = new_date.relative();  
  }
  else if ( new_date.is('this year') ) {   
    ret_val = new_date.format('{Mon} {dd}'); 
  }
  else if ( new_date.isBefore('this year') ) { 
    ret_val = new_date.format('{Mon} {dd} {yyyy}');
  }
  else {
    console.log("ERROR: in Handlebars helper: fn_timeAgo().")
  }

  return ret_val;

});

Messy Web: Angular.js, Ruby on Rails, Dart, GWT! Almost forgot Closure

Man, with all the various web development libraries, tool kits, languages and technologies it’s a tad overwhelming trying to figure out up from down.

Ruby on Rails: Lot’s of room to Improve

Sure, it’s easy to just go the Ruby on Rails way, and try to figure that beast out. But dealing with Ruby on Rails isn’t trivial, it still requires a lot of effort and the learning curve can be a bit painful. I personally found it a major pain trying to figure out the intricacies of tying in the embedded Ruby, Coffee Script and views (HTML/CSS) side of things. The actual Models and Controllers are pretty straight forward. It’s the V for View in MVC (Model View Controller) that seems to be the reason for so many new happenings in web development.

What’s your Angle?

So I did some reading, and that always leads to more questions than answers at this stage of the game. After reading up on Angular.js (a Google open source project), Google’s new Dart Script language (open source), Google Web Tools (GWT) which is not open source, Closure (another Google project), I came to the conclusion that I was confused.

I can either go back to Ruby on Rails, which is what I started using, or keep trying to figure out if there’s a better way. Am I locking myself into some over hyped framework that I will regret down the road? I don’t mind building a throw away prototype, what I do mind is that there is still a learning curve to Ruby on Rails. So if I’m going to throw away my 1st born, the effort involved in the learning curve may be better spent on a language and framework/libraries that I will also use for the second baby.

Is that too much to ask? I don’t know. However I do know that you have to find a healthy balance between scrapping old technology for the new.

At first I thought Angular.js has no place in the Rails framework, same for Dart, but a few qwuick Google searches showed blogs mentioning using Rails with Angular.js and Dart. When it comes to web development, trying to figure out the best libraries, frameworks, and languages to use is nutty. Developing a native Windows or Mac application or a native iOS or Android app is pretty simple when it comes to picking a language and tools compared to the messy world of web development.

Good-Bye Internet Explorer, you greedy little thing

Larry Page, CEO and co-founder of Google alluded to this in his Developer IO keynote talk, here’s the YouTube video, Mr Larry starts at 2 hours 40 mins in. He’s specifically talking about how Microsoft is not interested in open standards. Thanks to the success of Google’s Chrome browser, Microsoft may not have a choice, and then the Dart Scripting language may quickly become the defacto standard and replacement for JavaScript.

But until then we have to wait and see, at the same time, have some vision and belief… in my case I think Microsoft is still a beast to be reckoned with from the point of view they have a large developer base, and every Windows desktop and laptop ships with IE. But, it’s looking like Chrome has more users based on the stat’s from this Wikipedia page.

Either way you slice it, I’m betting on Chrome and Google. I get the point of developing web apps on Microsoft platforms with .NET and ASP (ease of use, hardened tools used by corporate developers) but I don’t have the cash or desire to be locked into an evil empire. Is Google an evil empire too? Maybe. But they don’t have much, if anything, to do with Rails, and Google’s web dev tools mostly open source, so I trust Microsoft less than I trust Google. In fact I actually like Google, and the last time I liked Microsoft was around 1995.

Don’t Believe the Hype

And for Rails, well, it’s certainly over hyped. There’s the PHP crowd that hates Rails because they’re too invested in their existing skill set, no time for another steep learning curve when you’ve got project to complete. And there seems to be a big part of the Rails friendly crowd that are a little too bliss-ed out, I kind of get it, these guys all seem to have a solid background in PHP and were willing to make the change, so they appreciate the ease of Rails and the time savings.

And in both crowds you’ll find the blow hards that figure they spent years learning to code that hard way with poorly designed tool and languages, so you should too if you expect to get anywhere in life (these types are the enemy of progress, productivity, creativity and innovation).

Not to mention the guy that initially wrote Rails holds the trademark on the Rails logo and the phrase “Ruby on Rails” and apparently won’t let book authors use the logo without his permission. Doesn’t sound too open source to me, what a great way to stop people from wanting to write a book to promote the framework and technology of Rails. Kinda turns me off from wanting to use Rails.

Good Killed Great

I’m not looking for good enough, or better than a bad way of doing things. I’m trying to find the optimal route from A to Z. A few quick Google searches will show that Dart can replace Coffee Script in Rails, and people are using Angular.js with Rails (how and why is still a mystery to me, that’s the more questions than answers part of the equation). But just because you can, doesn’t mean you should. So now I’ve got to read more DOCs, tutorials, blogs and books to figure out what’s the best thing for me, myself and the 7 billion “unique” people that will visit my site each hour. Not to mention the scalability I need when the worlds population grows to 8 billion.

The Present Moment: In the Now

See, this isn’t a small undertaking. But seriously, like I said earlier, who wants to waste time learning a technology if there’s a better, easier way to get things done. If that’s sounds lazy, let me put it this way, do you develop in Assembly Language for the web? Likely not, so why are we developing with the mess we have today? Well that seems to me why Angular.js, Closure, GWT, and a zillion other funny named projects exist.

The mess is chaos and out of chaos comes, more chaos, and hopefully, eventually, focus and simplicity.

It took a while to get here, the C language came onto the scene in 1973, C++ in 1985, Java in 1995, JavaScript and PHP also came out in 1995, and Ruby on Rails in 2004. In the meantime I’ve got to figure out what’s the best way forward, as I have a web app I want to develop and I don’t have the time to write a better MVC framework, especially since I still have a full time job.

I like the simplicity of Rails to create models and controllers, like I said earlier, the views drive me nuts. The question is, should I use Dart with Rails? What about Angular.js, Closure or GWT (I know the rumors are that Dart will replace GWT)! Or is there a better way to do MVC while retaining the simplicity of the M and C in Rails?

Then there’s Django, I mean where does this end, trying to navigate the maze of tools to make your masterpiece. I stumbled across a mention of WebObjects from Apple, seems to of lost the spotlight… what’s NeXT (no pun intended)?

The Source of Time

Where does time come from? What is the source of time?

Apples come from trees – trees come from apple seeds. Water comes from rain – rain comes from clouds – and clouds come from evaporating water in lakes and oceans.

Light comes from the sun, the sun comes from gasses expelled by other suns as they emit light.

If one person stands at the equator and another person stands in the Arctic, the person at the equator will rotate around the spin of the earth faster than the person in the Arctic. Their speed changes depending where they are on the surface of the earth. In this scenario time is constant, speed is not. In the same 24 hour period the person at the equator travels a much longer distance around the rotation of the earth than the person in the Arctic. To travel further in the same time span you must be moving faster.

Anyway, could it be that the source of time is gravity and motion? Would time be different on another planet, with a different gravity and speed of planetary rotation than earth? Is there an example where the reverse is possible, where the distance is constant and time changes? Yes, when the speed changes? Two goats running the sames distance at different speeds will arrive at different times. Pretty simple right!

What affects time? Hint: Gravity. When gravity is ‘heavier’ things fall to the ground faster. Consider the gravity (speed) of a falling rock dropped from 500 feet above the earths surface through air, and the same rock dropped into the ocean. The friction of the water would slow the rock down a bit, kind of like how gravity works. The end result being the rock would travel the same distance in different amounts of time.

GOING FORWARD
If time speeds up as a space ship travels faster towards the speed of light, as the Theory of Relativity claims; then the space men will find that time back on earth has passed slower than their experience of time. In essence, the space men will have traveled forward in time. “Einstein showed that if a twin leaves the earth in a rocket travelling at speeds close to the speed of light, when he returns to Earth he will be younger than the sibling left at home.” Ok yeah, prove it, not on paper, but in the real world!

STOPPING TIME
Stopping the flow of water around the planet would entail stopping evaporation, the sun being the #1 culprit of evaporation. So “turning the sun off” so to speak in terms of time may indeed stop time. If the speed of the planets rotation stopped, how would this affect time? Or our perception of time?

When a grand father clock’s pendulum slows down, the clocks “reporting of” time slows down, in other words we still have 24 hours in a day, but the clock is operating in a different “time”, say a 23 hour day. The speed of the pendulum affects time, or more specifically the distance the hands move around the face of the grand father clock. So really, the clock isn’t measuring time, it’s measuring distance as a function of speed multiplied by time. Here time is constant, speed slows down, the distance of the clock’s hands is 1/24th shy of a full hour. (12 slices of the pie on the clock face X 2 spins around the clock face = a 24 hour day). So the clock really is not operating in a different time, it just operating at a different speed.

But… have you heard the one about a wrist watch reporting time differently when worn to the top of a really big mountain like Mt. Everest?

“General Theory of Relativity showed that clocks run more quickly at higher altitudes because they experience a weaker gravitational force than clocks on the surface of the Earth.” OK, but isn’t that the same as a pendulum moving slower? Weaker gravity would imply to my lay brain as atoms moving slower in the clocks themselves, so wouldn’t that make the clocks run slower, not faster as the Theory of Relativity states? Or does this mean the opposite, less gravity frees atoms up from the pull of the earth so they can move faster? I know, too many questions and not enough answers.

GOING BACKWARD
Traveling backwards in time may be equivalent to reversing the cycle of apple & tree, going back to a time before the tree existed by reverse evolution. Imagine a tree de-evolving to a plant that reproduces by spores or whatever trees did before they bore fruit. I suppose this would be possible if the environment changed and enough years passed to support these changes before the tree went extinct due to extreme climate changes. But for time to go backwards it seems more of a sci-fi fantasy.

LIKE THIS AND THAT
Water has properties of waves, so does sound and light. Water flows like a stream, so does light. Does time act like a wave, with different speeds (frequencies) and volume/quantity (amplitudes)? Water can pool up, it’s flow stopping. How does time stop? Light can be eliminated (really dark curtains) without affecting the source (the sun). Can time be eliminated or pooled up without affecting it’s source?

Who knows? Really, do you know?