Posts

Elementary OO Javascript and prototyping I

Considering the apparent fact that everything in Javascript is an object to be another day's story we will learn what is object oriented javascript. a) Object declaration. var foo={}; function Foo(){}; The first is a literal object and the second is a constructor object. The literal object is used when the same object is used throughout and any changes to the object will be carried forward. The constructor object is used when multiple instances of the object are required with some initial work is already done during object declaration. b) Method and Property declaration. var foo={     bar : "foobar",     getName : function(){         return this.bar;     } }; alert(foo.getName()); // will display -  foobar function Foo(){     this.bar = "foobar";     this.getName = function(){         return this.bar;     } } va...

Elementary OO Javascript and prototyping II

Image
Prev Post We will learn some basic prototyping today Every object has a prototype property function Foo(){}; alert(Foo.prototype); // displays object Every object has a prototype function Foo(){}; alert(Foo.__proto__); // displays Function function Foo(){}; alert(Foo.__proto__ === Foo.prototype); // displays false function Foo(){}; alert(Foo.__proto__ === Function.prototype); //displays true I'll reiterate every function has prototype property and prototype N.B.: We'll be using prototype property and not prototype(i.e. __proto__) a) Let's take a constructor object function Foo() { function Foo() { this.name = "foobar"; this.name = "foobar"; this.getName = function() { }; alert(this.name); Foo.prototype.getName = function() { } ...

Can I borrow a feeling

  Can I borrow a feeling? A feeling of belonging, to my country. Can I borrow a feeling? A felling of rage, towards the perpetrators. Can I borrow a feeling? A feeling of disgust and gross out for the histrionics. Can I borrow a feeling? A feeling of trust and faith on the unfearing peer. Can I borrow a feeling? A feeling of chasing rainbows for the wish to subsist is still present. Can I borrow a feeling? A feeling of endurance towards the dysfunctional system. Can I borrow a feeling? A feeling of hope for judgement of dismissal. Can I borrow a feeling? A feeling of contentedness for justice being served. Can I borrow a feeling? A feeling of assurance for an honest allegiance. Can I borrow a feeling? A feeling of vigor to live in a safe and  virtuous environment. Can I borrow a feeling? Can I borrow a feeling? A feeling of belonging, to my country.

Font style in TextBlock from Isolated Storage in Windows Phone

void FileStreamingCompleted(object sender, FileStreamingCompletedEventArgs e) { IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication(); FontSource objFontSource; using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream ("Font.ttf",System.IO.FileMode.Create, file)) { fs.Write(e.Result.byteArray, 0, e.Result.byteArray.Length); } using (IsolatedStorageFileStream fileStream = file.OpenFile("Font.ttf", FileMode.Open, FileAccess.Read)) { StreamReader reader = new StreamReader(fileStream); objFontSource = new FontSource(reader.BaseStream); MyTextBlock.FontFamily = new FontFamily("Font Name"); MyTextBlock.FontSource = objFontSource; } MyTextBlock.Text = "Changed Font"; }

Guilty as charged

One of the most inexorable state of mind wherein its faculties tend to become the food of the state itself. The two components of it are guilty to oneself and towards others. Repentance and remediation come into play and assertiveness decreases. Mistrust and blames tend to make you a hangdog. The guilty to oneself urges one to incessantly ask the same question “Why”. The guilty towards other urges one to perpetually ask the question “Howcome”. The spectre and its consequences leave you with mental ailments. People lose faith in your words as well as actions. Recuperation from the result of your misdeed reminds the affected ones how they believed in you and within a moment you filched it.   You wish you could just turn back Time and rectify everything. You want them to look at you the same way they used to earlier, but that flare of confiding in you is missing and it kills you. How tired God must be of guilt and loneliness, for that is all we ever bring to Him.  ~M...