Profile cover photo
Profile photo
Jared Kells
150 followers
150 followers
About
Jared's posts

Post has attachment

Post has shared content
Have you ever found yourself in a situation where you want to let your significant other know your feelings for them during the day, but don’t want to send another cliche message? Well, ILoveU is here to give you a subtle but meaningful way of connecting…

Hi Dave

Updating 20 to 30 nuget packages is a bit scary. Hope my tests work....

Post has attachment
Didn't realize this: Updating a property in a JS object that's inherited from it's prototype causes the property to be copied to the object.

Seems obvious in retrospect. 

http://stackoverflow.com/questions/16911132/how-are-properties-shared-across-instances-using-javascript-prototypes

Post has attachment
I was confused by .prototype and .__proto__ in Javascript. This post help clear it up for me: http://sporto.github.io/blog/2013/02/22/a-plain-english-guide-to-javascript-prototypes/

Post has attachment
Global state in Android apps

I keep reading advice online about storing state in static singleton objects or in the Application object. It's just bad advice and is going to lead to unpredictable behaviour.

The Application object and any static variables in your application exist for the lifetime of your hosting process. The lifetime of your hosting process is different to the lifetime of your Activity

When one of your activities is launched, the system checks if a process is already running for your application. If it is then that process is used to launch the new activity. If not then a new process is started and a new Application object is created.

When you navigate through activities inside your application the current process is always reused so your static variables continue to exist and you always have the same instance of the Application object. Sometime after all your activities have ended the hosting process calls onDestroy on the Application object and the process is terminated.

Most of the time the lifecycle looks like this
 * Process Created
 * Application Created
 * Activity 1
 * Activity 2
 * Activity 3
 * Application Destroyed
 * Process terminated
 
 It seems like the application object would be a good place to store state but the only guarantee is that an Application object will be created before any of your activities run and will be destroyed after all your activities are destroyed. It's never guaranteed that it will be the same object.
 
 What happens rarely in development but regularly in the real world is the following
 
 * Process Created
 * Application Created
 * Activity 1
 * Activity 2
 * Phone call received or different app launched. ( Application backgrounded )
 * Some arbitrary time later... 
 * Application object destroyed
 * Process terminated
 .....
 * User re-enters the application
 * Process Created
 * Application Created
 * Activity 2 resumed
 
All your static variables are now null and you have a brand new Application object
 
 I think this is the cause of those Android apps that always fail to resume after an extended delay. They either crash or flash a screen for half a second and then finish.

Some links to accepted bad advice:

http://stackoverflow.com/questions/13633092/efficiently-passing-custom-object-data-between-android-activities-mono-android

http://stackoverflow.com/questions/708012/android-how-to-declare-global-variables

Heading

this should be in italics?

```All your base are belong to us.

* Can you do any formatting in a G+ post? *
<strong>test</strong>
</hr>
-----
* item 1
* item 2

Heading
------------

Heading
=======

<h1>Heading</h1>

Post has attachment
Captured my first portal #ingress
Photo
Wait while more posts are being loaded