By coincidence I recently found out how to open an Eclipse workspace via drag and drop on Windows.

It is actually a simple trick, but I want to share it anyway:

  1.  Create a link to the eclipse.exe that you want to use (e.g., named EclipseWorkspaceDragAndDrop on your Desktop).
  2. Open the properties of the link (e.g., via Alt+Enter).
  3. Locate the Target input field, whose content should end in eclipse.exe right now.
  4. At the very end of the input field, append -data.
  5. Open the Explorer (or suchlike), navigate to the parent directory of your workspace directory, and drag the workspace directory onto the link (e.g., EclipseWorkspaceDragAndDrop)
  6. Eclipse should startup into the selected workspace without asking you to choose one.

 

Oftentimes, files that have no ending can be treated as text files. Still, Windows 8.1 kept asking me, which program to use for such files.

The solution is to provide a default program for files without extension – and this can be easily done, even without modifying the registry directly:

  1. Open a priviledges Shell:
    (Windows+Q -> cmd -> Context menu -> Run as administrator
  2. Enter:
    assoc .="No Extension"
  3. Enter:
    ftype "No Extension"="[Path to your favorite text editor]" "%1"
  4. (Optional) Enter the following to get a nicer default icon for files without extension:
    assoc "No extension"\DefaultIcon=%SystemRoot%\system32\imageres.dll,-102

Thanks to this post at Stackoverflow for the solution.

When we encounter strange, unexplainable problems with text files, hidden characters may be reason. This article describes several possibilities to tackle line-ending and whitespace problems.

Correcting mixed line endings

If a file has mixed line endings, the standard tool flip may help you:

echo -e "unix\nmicro\r\n" > test.txt
file test.txt
#result: test.txt: ASCII text, with CRLF, LF line terminators

A check with file reveals that the file test.txt has mixed line endings. Flip unifies the line endings to Unix (-u) or Windows (-m) standard:

flip -u test.txt
file test.txt # result: test.txt: ASCII text

flip -m test.txt
file test.txt # result: test.txt: ASCII text, with CRLF line terminators

Examining files

vim can show whitespace characters, if you enable the option list. In command mode, execute the following to show whitespaces like tabs or line endings. Unfortunately, the editor does not differentiate between different types of line endings.

:set list

Use :set nolist to return to normal view. With :set ff the program identifies the line ending standard.

If you need to get a detailed picture of the whitespace characters in your document, the octal file viewer od may be helpful, it displays the file as octal values and (interpreted) ASCII characters:

echo -e "item1\titem2\titem3\r\nline2 (unix)\n" > test.txt
od -c test.txt

The results looks as follows:

000000  69  74  65  6d  31  09  69  74  65  6d  32  09  69  74  65  6d
         i   t   e   m   1  \t   i   t   e   m   2  \t   i   t   e   m
000010  33  0d  0a  6c  69  6e  65  32  20  28  75  6e  69  78  29  0a
         3  \r  \n   l   i   n   e   2       (   u   n   i   x   )  \n
000020  0a
        \n
000021

Using cat -v text.txt, you can see bogus (non-Unix) line endings  being marked with a special symbol: ^M

item1   item2   item3^M
line2 (unix)