Month: March 2013

Self-Hosted Alternative to Google Reader

With Google pulling the plug of my all-time favorite Google App “Google Reader” and people fighting over the right/wrong Google did by stopping the service, it was high time to find a good alternative to Google Reader. After a long search and using multiple different services like Feedly, oldrssreader etc… there was no service that satisfied me.

Closest thing I could find to what I liked was OldRSSReader but it was very slow and had lots of down time. Further it was missing various features that I would love to see in a good Google Reader alternative.

Further search led me to “Tiny Tiny RSS” reader, good thing about it was that I loved it at first usage J so I hosted it on my own server.

Here is, “BemusedMe Reader” the latest alternative available to you all “Google Reader” fans, As of now I’ve limited maximum users as its still is in its alpha stage and I’ll be working on it in my free time and will try to improve it.

Thanks to Andrew Dolgov for this wonderful application.

 

PS: I don’t have any experience in PHP programming so future updates may be screwed up. Use at your own risk.

In Case you can’t register reach out at connect@bemusedme.com, I’ll try to provide you access.

Disabling Inline Editing/ Quick Editing in SharePoint 2013 List

In SharePoint 2010 when we create a Custom list by default inline Editing or as it’s called in SharePoint 2010 “Datasheet Editing” is disabled.

In SharePoint 2013 similar feature is there and it is enabled by default.

To disable Inline or as it’s called “Quick Editing”

  1. Go to “List Settings”

  1. Advanced Settings

  2. Scroll down and Set “Quick Edit” to No

Failure is the condiment that gives success its flavor

There are very few people in this world that can talk about the failures in their lives with confidence. They are the people who have tasted success. They are the people who have learnt from their mistakes.

Reading “Arrrrr! Cap’n Eric be learnin’ about threadin’ the harrrrd way” can explain you how even The Great Programmers were once Mere Mortals, they were not born with their brain preprogrammed to code, they learnt here and are still learning from the mistakes they are doing.

 

Now, when I was a young swabbie seven years ago I was given the task of implementing the Scripting.Dictionary object, and I didn’t yet understand all the stuff I just told you maties about threading.  In one build that was released to the public I accidentally marked the dictionary as Both, even though it is a Single Threaded Apartment object.

Keep Learning, Keep Coding J.

Confusing Closures made Simple

JavaScript

Closure is one of the trickiest concept of functional programming and all languages that have “first-class functions” support closures.

Closure by literal definition is “The act of closing” or “The state of being closed”

Have a look at function below:

[sourcecode language=”javascript”]

function OuterFunction(outerVariable)
{
var InnerFunction= function(innerVariable)
{
alert(‘I still remember Outer Variable : ‘+outerVariable +’ when you passed Inner Variable : ‘+innerVariable);
}
return InnerFunction;
}

var returnFunction = OuterFunction(‘Yahoo!’);

[/sourcecode]

Now when we make a call to returnFunctions(‘bing’); output will be

ClosureAlert

Even though ‘OuterFunction’ has executed and returned ‘InnerFunction’ the value of ‘outerVariable’ is still there in the memory.

‘returnFunction’ will always contain the value of ‘outerVariable’ as ‘Yahoo!’ and it is a closure over the ‘outerVariable’.

Reblogging: My First BillG Review

Nice read from Joel Spolsky if you are a Microsoft Enthusiast.

http://www.joelonsoftware.com/items/2006/06/16.html

In those days we used to have these things called BillG reviews. Basically every major important feature got reviewed by Bill Gates. I was told to send a copy of my spec to his office in preparation for the review. It was basically one ream of laser-printed paper.

He didn’t meddle in software if he trusted the people who were working on it, but you couldn’t bullshit him for a minute because he was a programmer. A real, actual, programmer.

I left the company in 1994, assuming Bill had completely forgotten me, until I noticed a short interview with Bill Gates in the Wall Street Journal, in which he mentioned, almost in passing, something along the lines of how hard it was to recruit, say, a good program manager for Excel. They don’t just grow on trees, or something.

Reblogging: My First BillG Review

Nice read from Joel Spolsky if you are a Microsoft Enthusiast.

http://www.joelonsoftware.com/items/2006/06/16.html

In those days we used to have these things called BillG reviews. Basically every major important feature got reviewed by Bill Gates. I was told to send a copy of my spec to his office in preparation for the review. It was basically one ream of laser-printed paper.

He didn’t meddle in software if he trusted the people who were working on it, but you couldn’t bullshit him for a minute because he was a programmer. A real, actual, programmer.

I left the company in 1994, assuming Bill had completely forgotten me, until I noticed a short interview with Bill Gates in the Wall Street Journal, in which he mentioned, almost in passing, something along the lines of how hard it was to recruit, say, a good program manager for Excel. They don’t just grow on trees, or something.

Floating Point Calculation Error

In a blog post I read somewhere that if you give alert(9.2*100); in JavaScript then the alert box will show 919.999999999999 instead of 920.

Many people wonder, “Why is it so?”, “Is it a bug?”

Answer to question “Is it a Bug?” is Yes and No.

Yes, because you are getting wrong output and a general definition of bug is “software bug is an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways.”

No, because this is the way floating point calculations have been designed and this is what has been standardized by IEEE in IEEE 754 standard. Similar behavior you will see in 8.2*100, .1+.2 etc…

To Understand “Why is it so?”

The behavior we are seeing is because underneath calculations are done in Binary not in Decimal and the languages which don’t handle rounding off of numbers show this behavior.

Let’s have a look at this calculation

9.2 * 100 = 1001.? * 1100100

Converting .2 into Binary

.2 * 2 = 0.4 – 0

.4 *2 = 0.8 – 0

.8*2 = 1.6 – 1

.6*2 = 1.2 – 1

 

So number is – 00110011……(an infinite chain)

Calculating back to Decimal: to show that we are not taking huge precision and it will impact final result

2^(-1) *0+ 2^(-2)*0+2^(-3) *1+ 2^(-4)*1 +2^(-5) *0+ 2^(-6)*0+2^(-7) *1+ 2^(-8)*1

= (.5)*0+(.25)*0+(.125)*1+(.0625)*1+(.03125)*0+(.015625)*0+(.0078125)*1+(.00390625)*1

= 0+0+.125+.0625+0+0+.0078125+.00390625

= 0.19921875

 

Now 9.2 is 1001.00110011….

Or Take it as 100100110011 after incorporating shift (2^8)

Now 100100110011 * 1100100 = 111001011111101100 (Done in Programmer Calculator J)

Incorporating Shift

1110010111.11101100

1110010111
= 919

11101100
= .5+.25+.125+0+.03125+.015625+0+0…………………

= 0.921875

So 1110010111.11101100 is 919.921875

If we would have taken a longer chain of.2 i.e. we would have taken 00110011001100110011001100110011001100110011001100110 it would have given a more precise result of 919.99999999999999

To read more about floating point errors you can check these links.

http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

http://docs.python.org/2/tutorial/floatingpoint.html

Still Using Hungarian Notation?

While going through a blog post written by Eric LippertWhat’s Up With Hungarian Notation?” I got really confused as he had religiously lawyered the use of Hungarian notation and kind of ridiculed those who were not in favor of using it.

It took me long time and some getting used to off to move from Hungarian notation so arguments given by him didn’t make sense to me, if I wouldn’t have known that the article was written by Eric I would have ignored it as written by someone who is ill informed and wrote it just for the sake of it. Respect for Eric made me think about what he was saying and then everything started making sense. Article was 10 years old, written on “12th Sept 2003″ and it was written under COM Programming. 10 years is a long time for IT and way we have been coding has changed drastically, Platform he was talking about wasn’t having IDE support that we have now.

Some comments he had:

“The Hungarian prefix tells you the semantic usage, not the storage type. A cBar is a count of Bars whether the storage is a ushort or a long.”

Agreed, Hungarian notation which was invented by a “Hungarian” Microsoft programmer Charles Simonyi was intended to specify the end use of the variable you were declaring. It was supposed to help programmers identify its use by looking at the name. It saved lots of time of finding that particular variable in your code and understanding what it was really meant for.

 

“Annotate the semantics, not the storage. If you change the semantics of a variable then you need to also change every place it is used!”

This argument was given by Eric against “If I need to change the type from, say, unsigned to signed integer, I need to go and change every place I use the variable in my code”. Eric is correct here as people do misuse Hungarian notation in there code and then blame the notation for being a wrong coding practice.

 

    “But the benefit of knowing that you will never accidentally assign indexes to counts, or add apples to oranges, is worth it in many situations.”

Again agreed, it does solve the issues and help in preventing bugs while coding. I’ve seen many benefits of this when I used to follow Hungarian notation.

 

All three arguments are very valid and all three argument make sense if you read his article but

  1. “The Hungarian prefix tells…. ” So does intellisense if you hover over a data member in any modern IDE (including SharpDeveloper which is just 15 MB download)
  2. “Annotate the semantics, not the storage……” you don’t need it now “See point 1”
  3. But the benefit of knowing….” Same benefit is with intellisense if you add proper Summary tags while coding. It will tell you details of what you are working “messing” with.

 

So, Hungarian notation is good in scenarios where you don’t have proper IDE support, where semantics are to be maintained by developers rather than IDE but if you see with time we have moved far ahead of the benefits provided by Hungarian notation. Choose your coding standards smartly as tomorrow someone else might be working on the code you are writing today and you don’t want to be “The Bad Guy” coder for that person.

 

PS: Now Microsoft is also preaching Pascal /Camel Casing. Go through this link for more info.