From Pocket to Instapaper

Some time ago I’ve described the issues that I’ve had since a new version of Read It Later, named Pocket, was introduced.
I’ve waited with hope for a new upgrade, but I had a huge disappointment with the latest version 16 June 2012. It didn’t fixed any of the two major problems, that I  experienced since new Pocket was introduced-

 

1. iPad app still didn’t show many of the saved links.


2. ability to rename articles on iPad still wasn’t restored.
I’ve posted the message into their forum. They did not show my comment on their forum( I would name it censorship, not moderation), but a few days ago I’ve received an email, recommending
“try logging out of the app on your iPad, and back in again.” Their suggestion helped,  but I don’t understand, why it is not posted as a recommendation on their support site.

So I decided to try InstAPaper on my iPad, Previously I’ve used it for Kindle. I never considered it before on iPad, because there were no free demo and I was very satisfied with RIL free and then RIL Pro. Currently InstAPaper cost $3, so the price is not an issue.

I’ve checked that it has most of features that I am using(e.g. renaming, folders) and I am quite happy with it now. Actually I am using Pocket (or RIL free) for old bookmarks( I have 1000+ stored on my iPad) and for new bookmarks I am using InstAPaper.

Having a solid experience with RIL/Pocket I’ve created a list of suggestions to Marco Arment to implement.
1. Some pages stored in InstAPaper have removed essential sections of the text. E.g in many blogs comments are not stored in  InstAPaper.
Some pages lost almost all of important links (e.g. http://www.lib.rus.ec/a/32416 -sorry, in Russian). RIL/Pocket has 2 modes to store offline- Web view and Article view. Web View includes all links/images of the original page, but it’s very reliable. Article view suppose to strip unrelated information, but often corrupts the content. I prefer to use offline Web view.
InstAPaper should also support offline Web view, in case if stripped view removes important part of content.

2.  Black full screen Saving on iPad Safari is very annoying. After user pressed a bookmark, the saving has some delay and then for a few seconds prevents from reading the text.Would be better to show as message on the top part(as in Pocket ). I am surprised, that  a full screen popup was  implemented recently as a desired feature.

3.There are no comments allowed on http://blog.instapaper.com/. I would prefer to post some of these notes as comments on http://blog.instapaper.com/ rather than write them in my blog and then send link to Marco.(I found recommendation how to add support of comments on tumblr at http://www.tumblr.com/help, but then realized that Marko was the lead developer ofTumblr.)

4. Also there is no support forum. I understand that maintenance of the forum ican be a hassle, but stackexchange fSome time ago I’ve described the issues that I’ve had since a new version of Read It Later, named Pocket, was introduced.
I’ve waited with hope for a new upgrade, but I had a huge disappointment with the latest version 16 June 2012. It didn’t fixed any of the two major problems, that I  experienced since new Pocket was introduced-
orums can be referred on  http://www.instapaper.com/main/support page, i.e.
http://webapps.stackexchange.com/search?q=Instapaper  or http://apple.stackexchange.com/search?q=Instapaper

5. Tags are more convenient than folders. i.e. an ability for the same article to have more than one tag. Also creating of new folders is not supported offline, which is an annoying limitation.

6. I would like to have a narrow list – additionally to existing list modes have a subject only list or subject+site list to show more list items on a screen.
7. Limit of 500 offline articles sounds quite big, but my RIL list exceeded 1000, so it could be a issue in the future.
8. Search button on iPad version is visible, but doesn’t work- it forces to buy Premium subscription. I think, that it’s not correct. If the button in a paid version is visible and enabled, it should  provide  a working functionality, e.g. search in article names only. And leave full-text search for the premium support.
9..Copy URL is an important operation and deserves to be in a first level of Action menu, rather than in Share sub-menu.


I’ve also have comment re post http://www.marco.org/2011/04/28/removed-instapaper-free. Marco Arment  explained, why he doesn’t provide free version of Instapaper.  I believe that he is loosing essential part of his customers. When I decided which of iPad application to choose, I’ve selected RIL, because I was able to play with free version, and I liked it. I didn’t have a chance to compare RIL and InstAPaper on iPad, so I’ve bought  RIL pro. For a user there is no point to pay even $3 , if there are similar free product, that user can try and see, is it suitable for him/her.


I’ve also played with Readability. It doesn’t have folders or tags(which is very important for me), but nicely supports full text search

Configuration setting of HttpWebRequest.Timeout value

I wanted to set in configuration on client HttpWebRequest.Timeout.
I was surprised, that MS doesn’t provide it as a part of .Net configuration.
(Answer in http://forums.silverlight.net/post/77818.aspx thread: “Unfortunately specifying the timeout is not supported in current version. We may support it in the future release.”)
 
I added it to appSettings section of app.config and read it in the method of My HttpWebRequestHelper class

  //The Method property can be set to any of the HTTP 1.1 protocol verbs: GET, HEAD, POST, PUT, DELETE, TRACE, or OPTIONS.
       public static
HttpWebRequest PrepareWebRequest(string sUrl, string Method, CookieContainer cntnrCookies)
       {
           
HttpWebRequest webRequest = WebRequest.Create(sUrl) as HttpWebRequest;
           webRequest.Method = Method;
           webRequest.ContentType =
“application/x-www-form-urlencoded”;
           webRequest.CookieContainer = cntnrCookies;
webRequest.Timeout = ConfigurationExtensions.GetAppSetting(“HttpWebRequest.Timeout”, 100000);
//default 100sec-http://blogs.msdn.com/b/buckh/archive/2005/02/01/365127.aspx)
           /*                //try to change – from http://www.codeproject.com/csharp/ClientTicket_MSNP9.asp          
                       webRequest.AllowAutoRedirect = false;
                      webRequest.Pipelined = false;
                       webRequest.KeepAlive = false;
                       webRequest.ProtocolVersion = new Version(1,0);//protocol 1.0 works better that 1.1 ??
           */
           //MNF 26/5/2005 Some web servers expect UserAgent to be specified
           //so let’s say it’s IE6
           webRequest.UserAgent =
“Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)”;

           
DebugOutputHelper.PrintHttpWebRequest(webRequest, TraceOutputHelper.LineWithTrace(“”));
           return webRequest;
       }


Related link:
http://stackoverflow.com/questions/387247/i-need-help-setting-net-httpwebrequest-timeout

v

C# tip: do not use “is” type, if you will need cast “as” later

 

We have a debate with one of my collegues, is it agood style to check, if the object of particular style, and then cast  as this  type. The perfect answer of Jon Skeet   and answers in Cast then check or check then cast? confirmed my point.

//good
    var coke = cola as CocaCola;
    if (coke != null)
    {
        // some unique coca-cola only code
    }
    //worse
    if (cola is CocaCola)
    {
        var coke =  cola as CocaCola;
        // some unique coca-cola only code here.
    }

Code review recommendations and Code Smells

Some time ago Twitter told that I am similar to Boris Lipschitz . Indeed he is also .Net programmer from Russia living in Australia.
I‘ve read his list of Code Review points and found them quite comprehensive. A few points  were not clear for me, and it forced me for a further reading.

In particular the statement “Exception should not be used to return a status or an error code.” wasn’t fully clear for me, because sometimes we store an exception as an object with all error details and I believe it’s a valid approach. However I agree that throwing exceptions should be avoided, if you expect to return error as a part of a normal flow.
Related link: http://codeutopia.net/blog/2010/03/11/should-a-failed-function-return-a-value-or-throw-an-exception/

Another point slightly puzzled me
If Thread.Sleep() is used, can it be replaced with something else, ei Timer, AutoResetEvent, etc” . I believe, that there are very rare cases, when anyone using Thread.Sleep in any production code. Usually it is used in mocks and prototypes.

I had to look further to clarify “Dependency injection is used instead of Service Location pattern”.
Even most of articles has some preferences to Dependency injection, there are also advantages to use Service Location. E.g see http://geekswithblogs.net/KyleBurns/archive/2012/04/27/dependency-injection-vs.-service-locator.aspx.
http://www.cookcomputing.com/blog/archives/000587.html  refers to Concluding Thoughts of Martin Fowler
The choice between Service Locator and Dependency Injection is less important than the principle of separating service configuration from the use of services within an application

The post had a link to excellent article Code Smells of Jeff Atwood, but the statement, that “code should not pass a review if it violates any of the  code smells” sound too strict for my environment.

In particular, I disagree with “Dead Code” recommendation “Ruthlessly delete code that isn’t being used. That’s why we have source control systems!”. If there is a chance that not used code will be required in a future, it is convenient to keep it as commented or #if/#endif blocks with appropriate explanation, why it could be required in the future. TFS is a good source control system, but context search in source code of current solution is much easier than finding something in the previous versions of the code.

 
Related links: