Bookmarking for e-reading devices(Kindle and IPad)

Our family has Kindle and IPad, and periodically I had to use one or another.

Normally I prefer IPad, but Kindle has 2 advantages –   on a light sun it’s much easy to read Kindle screen, and it also have free free wireless internet(but browser is quite limitted),when for my IPad wi-fi is required.

 A few months ago I’ve wrote a  post about Kindle and ability to transfer articles using Instapaper  add-on I beleive that it’s the most convinient way to pass html files to Kindle.
   For iPhone and iPad I love ReadItLater. It saves any articles from web site on iPad Safary.
  When you reading inside RIL, you can click on any link and ask to “Read it later” and continue with the main article. Previously In Safary new link was opened in a new tab and it became current, which interrupted reader from the main article.It has been gixed in the latest version of Safary.     

Put reusable code into libraries to share between projects

I’ve recently read the post The Mooney Project » Reusable Code Is Bad.

Also I disagree with the title of the post, most of the issues in the text are valid and important.
Mike Mooney is mostly talking of creating customizable applications, that have hundreds of configuration settings.
Most close to my opinion is a comment from Geoff H

Design libraries for reuse, glue code to bind together, and logic code to call libraries through the glue.

When I am writing  an individual method, I am asking myself, how generic is the logic, is it only be useful for this feature, or to different parts of my application, or can be used as an extension of .Net framework.  Depending on this , I will move the common logic to one or another of my libraries. Sometimes, when I will looking to which class/dll should I add this new method, I will recognize, that our library already has the same or very similar method, and I don’t need to write it again.

Copy HTML documents to Kindle DX

I’ve tried to work out, is it good to use to convert and send documents to Kindle DX.
Amazon description is not very clear, and it’s not obvious, that DX doesn’t support WiFi.
Finally I understood, that sending to just sends the email to your email address attempting to convert attachments to azw fromat.
You can then transfer the document to your Kindle through the USB cable.
Keep in mind that IE support  to send html page in email body, but not directly  as attachment, Also images from html pages were not converted properly.
So I decided do not bother with this free kindle service.

Much simpler is to Download Calibre ,save any html file from browser(using ctrl-S in FireFox), and use Calibre to send the file(s) to Kindle through USB connection.

UPDATE: Recently I’ve started to use Instapaper and found the article
I am using Kindle DX 3G browser, but wasn’t able to save links< as it was suggested in the article.
Fortunately, comments have a link to, which allow to copy every saved to instapaper document to the Kindle as soon as Kindle connected to my machine.
It is much simpler than Calibre.


Search systems on desktop/enterprise level

I’ve put together a few links regarding search systems on desktop/enterprise level

Search engine optimization Links

Below there are a few links, that I used for my Search engine optimization research for PrintPagesOnline site. :


Google Search Engine Optimization


 And more technical links:

URL Rewriting Using ISAPI_Rewrite” 

Do not check-in DEBUG specific code.

We are using .Net Remoting to interact beteeen client and back end server. I needed to call a method from services class.
For debugging purposes I decided to create the class directly. It was easier to debug without starting extra back-end process.
The code was like the following:

IMyServices services = (IMyServices)RemotingHelper.GetObject(typeof(IMyServices));
    services = new MyServices();
// Process the task

During the development I checked that the method done the required processing and changed the parameter object as expected.

And I’ve checked in the code, assuming that in Release mode the application will work the same way just by instantiating proxy instead of full object.
However in Release mode changes in parameter inside calling method were not returned back.
Of course, If parameter is serializable, it is passed by value. and correct implementation will use return value

 ItemsCollection = services.ProcessItems(ItemsCollection);

But more general recommendation before check-in remove/comment-out any DEBUG specific shortcuts and test the code  as it will be in production.

Use HashSet instead of “seen” Hashtable.

In our code (originally created in .Net 1.1)  there are a few examples of “seen” Hashtable pattern
Hashtable seen = new Hashtable();
for (int i = 0; i < nCount; i++)
    if (seen[key] == null)
        //Do the changes
        seen.Add(key, key);
It's better to use type-safe HashSet:
HashSet<string> seen = new HashSet<string>();
for (int i = 0; i < nCount; i++)
    if (!seen.Contains(key))
        //Do the changes

Don’t Repeat Yourself(DRY principle) when modifying existing function

If there is an existing  non-trivial function and you need to change it , do NOT copy and paste it , but modify to satisfy new requirements.
You may be need to split a big function into small ones and call them in different order or with different parameters.
Often you need just to add extra parameter to the function and have if-else branches depending on a new parameter.
In some cases new change is actually a fix of the problem, that applicable to all usages of the function.
Remember that “Copy and Paste” is NOT a good way of code re-use.
I also strongly recommend to read Exploring Smelly Code article to avoid other anti-patterns.

Code reviews and coding recommendations

We don’t have code reviews, but sometimes I have to tell the team quite obvious coding recommendations.

There are a few examples:

1. We should do the check if array element is available before access it:

 E.g. BAD:
            string departureCity = Flight[0].StartPoint;

GOOD:      if (Flight.Rows.Count <= 0)
                WarningMessageEvent.Raise(“Flight.Rows.Count <= 0″);
            string departureCity = Flight[0].StartPoint;

2. Keep separate functionality in small functions, rather than add morre code to existing functions, that makes them too big.

It is easier to read, test, maintain and investigate errors.

You can use VS Refactor –Extract Method to make functions smaller.

Also highly recommend to install RefactorAsp from

See “Common Refactors” section here about

  • Extract method
  • Replace Method with Method Object
  • Decompose Conditional
  • List of Refactors can be viewed here(or original here).

    3. Do not “eat” exceptions 

    Even if you don’t want to report errors in production, Debug.Assert them in development environment to understand, why they happen and avoid them.
    E.g. BAD:
                    //we ignore any errors
                catch(Exception exc)
                    //we ignore any errors in production 
                    Debug.Assert(false, “Investigate why “ + exc.ToString());
    4. Use enums, do not hardcode magic values
    Use Enum (C#) instead of magic numbers 
    and (more general) C# Coding Style Guide .
    Aside note: By some reason this particular post is not searchable by Google. I have no idea why it is different from other posts.

    Developers should avoid smart-quotes in Word

    We had a Word document, describing steps, based on MSDN instructions Use the Windows Workflow Tracking Service
    I desided to create batch file createWorkflowTrackingDB.bat to create Database:

    @echo Change name of Database server if required
    @echo press control-Z to stop batch
    sqlcmd -S localhost -E -Q “create database WorkflowTracking”
    cd “C:WINDOWSMicrosoft.NETFrameworkv3.0Windows Workflow FoundationSQLEN”
    sqlcmd -S localhost -E -d WorkflowTracking -i Tracking_Schema.sql
    sqlcmd -S localhost -E -d WorkflowTracking -i Tracking_Logic.sql
    @echo Ensure that application account has tracking_reader and tracking_writer roles

    But it was failing on the line
         sqlcmd -S localhost -E -Q “create database WorkflowTracking”.
    It took me a while to recognize, that MS Word replaced double-quotes with smart-quotes , and sqlcmd didn’t like it.