Google+ Peter Bromberg's .NET Blog | All Things Programming

Peter Bromberg's .NET Blog All Things Programming

My Grammar lived to be 100, but she never learnt to write worth a Dime

18. July 2013 15:45 by admin in General

Well, it's Dr. Dotnetsky, back with another of my little rants about one thing or another, all carefully gauged to get you to think. . . Professional programmers often need to write, either to produce articles, for documentation, presentations, or for more mundane tasks such as creating or answering email or newsgroup messages. So my rant this episode isn't directly about programming; it's more related to what happens between the neurons before you start writing any code. In a round-about way, it's actually more directly related to writing professional code than many people think.

What we put on paper or in the media  is a reflection of our own intellectual and creative maturity and abilities in the professional world. Make no mistake -- you may produce an authoritative article about XML, but if it contains any of the more common grammatical bloopers I'll enumerate below, intelligent readers will immediately--if only subconsciously-- call your integrity into question. 

For some reason it seems that intelligent people who understand programming appear to have left grammar school without ever  having been taught  to turn on Option Explicit and Option Strict in the language hemisphere of their brains… I've actually seen ASP.NET server controls with properties that the author titled "LooseFocus" (see below)!  Of course, if you do this consistently, your compiler won't throw any exceptions. But people with an above room-temperature IQ will be taken aback by your apparent lack of basic literacy in your own native language--ENGLISH!

While the Doctor often can be found engaging on this site in various types of slang, witticisms and other tricks that involve playing with words, he also knows how to write formally, too--and so should you. The list below is by no means complete, but if you can absorb it and get to the point where your internal "Debugger" watches for these, you at least will have a fighting chance, because these are the "short list" -- Dr. Dotnetsky's ALL TIME pet peeves, and you KNOW that Dr. Dotnetsky wouldn't play you wrong! Now here are the baddies:

accept vs. except: 
Accept is a verb meaning "receive," "admit," "take something willingly," as in "Bart Simpsonaccepted his Oscar nomination by thumbing his nose at the cameras."  Except is most often a preposition meaning "other than," "with the exclusion of," as in "All of the Oscar nomineesexcept Bart Simpson accepted the honor of being nominated with grace."

If the word you want describes the action of "receiving," "admitting," etc., use accept, not except.  Except is occasionally a verb also, meaning "leave out," "exclude," but far more often than not except is the preposition meaning "other than." Accept is always a verb, it is alwaysan action.

affect vs. effect: 
Affect is always a verb, most often meaning "to influence, or have an impact upon" as in"Drinking alcohol affects a person's judgment."  Effect can be a verb meaning "to bring about or to make happen," as in "The republican congress effected many new important tax reforms."  However, effect is used most often as a noun, meaning "result," "influence," or "impact," as in "Our massive security campaign has had some effect on the incidence of PC viruses, but not the dramatic effect that we had hoped."

If the word you want is a noun, something that might be counted numerically (side effects, e.g.), use effect, not affect.

its vs. it's: 
It's is always a contraction for "it is," and its always indicates possession, as in "It's (it is) a pitiful shame when a computer is abused by its owner."  You should have no trouble with these words. Since contractions are inappropriate in formal writing, there is never any instance when you should say it's in your formal work.

like vs. asas if, or as though: 
As a rule, 
like should not be used to introduce a clause.  "He don't love you like I love you" is incorrect; "He [doesn't] love you as I do" is correct.  Instead of saying, "She looks like she is going to be sick," say, "She looks as if she is going to be sick" or "She looks as though she is going to be sick." Unless you mean "has an affection for," "like" is a great word to avoid altogether. The very worst offender of all time is of course, "Like I said".  No, no, NO! It's "As I said", As I was saying, this one is a real doozy.

loose vs. lose: 
Loose is almost always an adjective meaning "not tight," as in "Since Alexandra has lost weight, her clothes are all loose on her."  Lose is a verb usually meaning "not to have in possession anymore," as in "Since Alexandra is behind on her payments, she may lose her car."  So, if your server keeps "loosing" Session State, you have more than one problem, Dude!

than vs. then: 
Than is always used in comparison, as in "Bill is taller than Bobby."  Then has many uses, but the most common are a) to indicate sequence, as in "First x occurred, and then y happened"; b) meaning "at that time," as in "I wasn't ready to settle down and get married then"; and c) meaning "in that case," as in "If I'm not home, then leave me a message." 

there vs. their: 
There generally indicates a specific location or direction; their indicates possession.

Since there usually indicates location--you can point there, you can distinguish between here and there--it usually answers the question "where?" Note that where and there, which both involve location, are spelled --ere: where & there.

to vs. too: 
To is a preposition; too is an adverb.

To generally indicates direction, as in "Bill was very intoxicated, so we took him to his room and put him to bed."  To often indicates the infinitive form of a verb, as in, "Bill was too inebriated to walk, so we had to carry him."

Too has two most common meanings: 1) also, in addition; and 2) excessively, more than enough.  For example, "Marcia, too [also], was too [more than enough] intoxicated to walk.  Her roommate had to put her to bed, too [also]."

Prepositions such as to are usually "smaller" words than adverbs, literally and in terms of grammar--prepositions are kinds of "connecting words": think of other common prepositions that are also "small" words of only two letters: "of," "at," "in," "on" and "by," for instance.  Adverbs such as too are more important to specific meaning within a sentence--they indicate how an action is done, or when, or how often, for instance. It makes a certain kind of sense that the more important "too," the adverb, is the longer word.  If you're unsure whether to use toor too, ask yourself whether the word is a preposition indicating direction ("to the house") or an adverb meaning also (I, too, was intoxicated) or excessively, more than enough (I was tooblitzed to walk).

Sight vs. Site:

Site is a noun:

  • The place where a structure or group of structures was, is, or is to be located: a good site for the school.
  • The place or setting of something: a historic site; a job site.
  • A website.

    Sight is also a noun, and has at least ten different accepted usages. However, the primary one is "The ability to see".   We use our sense of sight to view a web site. Got the "picture"?

Well! I hope this little exercise in grammar (she actually did live to be 100, the old bag!) was useful to y'all. Now where... Oh, Darn! My nice Stoli Martini, up with two olives, has gone and started to get warm!

Firebase and Angular Fire

12. July 2013 06:44 by admin in database, JSON

Firebase is a cloud database designed to power real-time, collaborative applications.

Add the Firebase library to your app and get access to a shared data structure; any changes made to that data are automatically synchronized with the Firebase cloud and with other clients within milliseconds.

Firebase apps can be written entirely with client-side code, update in real-time out-of-the-box, interoperate well with existing services, scale automatically, and provide strong data security.


GitHub Repo here:

Display RSS Feed with JSONP and AJAX UI-blocking Loader

2. July 2013 08:38 by admin in ASP.NET, JSON

Here is a technique to display an RSS feed with the jQuery $ajax method, using Yahoo's YQL query API to retrieve the feed and return it as JSON:

<title> Feed Demo with Ajax Loader </title>
<script src="//"></script>
<script src="Scripts/jquery.blockUI.js"></script>
function stopUI() {
    $.blockUI({ message: '<img id="AjaxLoader" src="Images/ajax-loader.gif" />',
        css: {
            padding: '25px',
            margin: 0,
            width: '5%',
            top: '40%',
            left: '40%',
            color: '#000',
            textAlign: 'center',
            border: '3px solid #aaa',
            backgroundColor: '#efefef',
            cursor: 'wait'
        overlayCSS: {
            backgroundColor: '#000',
            opacity: 0.2
    $('body').css('cursor', 'wait');
function startUI() {
    $('body').css('cursor', 'default');
$(function() {
function getFeed()
// ajax request to yql public json url 
      url : '',
      jsonp : 'callback',
// tell jQuery that we need JSON format
      dataType : 'jsonp',
// tell YQL that what we want and to output in JSON format
      data : {
          q : 'select * from rss where url =""',
          format : 'json'
// parse response data
      success : function(data) {
        $.each(data.query.results.item, function(i,data)
var news_data =
"<div><a href='""'>" + data.title + "</a>" + 
          data.description +"</div>";
      }    ,
      complete: function(){
<div id="news"></div>

The download includes the Ajax-loader image as well as the required jquery.blockUI.js javascript. (9.58 kb)

How to Format JSON -Style Dates With Javascript

26. June 2013 10:52 by admin in ASP.NET, JSON


Formatting JSON - style Javascript dates can be tricky. Here's some sample code that shows how to do it:

function formatDate( jsonDate)
var date = new Date(parseInt(jsonDate.substr(6)));
return date.getMonth()+'/'+date.getDay()+'/'+date.getFullYear()+' '+date.getHours()+':'+date.getMinutes();  // 12/1/2013 13:46 
<div id=dte><script>document.write(formatDate('/Date(1225243290011)/'));</script></div>  </body>