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.

The network emulator Mininet offers VM images for download, which can be imported, e.g., into VirtualBox.

A common problem seems to be that the delivered ovf file (in my case mininet-2.1.0-130919-ubuntu-13.04-server-amd64.ovf) causes an exception when VirtualBox tries to import it: VBOX_E_NOT_SUPPORTED (0x80BB0009).

Even setting the OS manually to Ubuntu (64bit) did not help.

I finally found the solution in this post: You may also create a new virtual machine and select the contained VM disk image mininet-vm-x86_64.vmdk as hard disk.

The utility svnrdump allows you to dump and load Subversion repositories, including the whole revision history.

A typical use case for svnrdump looks like this:

svnrdump dump <OLD-REPOSITORY-URL>  > my-repository.dump
svnrdump load <NEW-REPOSITORY-URL> < my-reposiotory.dump

To find out which revisions a particular dump file contains, grep comes in handy: The contained revision numbers are stored in plain text and in increasing order in the dump file.

grep -a "Revision-number:" my-repository.dump

returns all stored revisions. To find out the first or last contained revision, simply use head and tail:

grep -a "Revision-number:" my-repository.dump | head -n 1
grep -a "Revision-number:" my-repository.dump | tail -n 1

 

Cygwin is a great Unix emulation for Windows. A killer feature, to my mind, is its ability to handle arbitrary long file names (e.g., when moving or deleting files), which is for some ominous reasons still impossible in current versions of Windows.

A very useful command in the Cygwin repository is chere: It adds a context menu entry that allows to start the Cygwin Terminal from the current directory.

Here are the steps to install:

  1. Install Cygwin. See http://cygwin.org/ for details.
  2. In the package selection dialog, select chere, which is located below Shells, for installation.
  3. Open a Cygwin Terminal as Administrator
  4. Type chere -i to install a context menu entry. You may also try chere -h to get more info. Running chere -u uninstalls the context menu entry.
  5. Let’s try it out: Open your file manager and right-click into a folder and select Bash Prompt Here.
  6. A terminal pops up with the current working directory set to the selected folder.

References

This solution and some alternatives are listed in a stackoverflow thread.

 

To assign default permissions to pages in Typo3, the following TSConfig snippet is helpful:

TCEMAIN{
  permissions.userid = 1 # Backend user with ID 1
  permissions.groupid = 1 # Backend user group with ID 1
  
  permissions.user = show, editcontent, edit, new, delete
  permissions.group = show, editcontent, edit, new, delete
  # no permissions for 'other'
}

This code should be placed at Edit Page > Resources > TypoScript Configuration.

After saving the configuration, any new page below the edited page receives the configured default permissions.

In Git, every line of the file .gitignore is a regular expression that describes files that should be ignored. However, one can also add lines that state which files not to ignore.

Example:

The following example shows a configuration that ignores everything in a particular directory (./tmp) but explicitly states that PDF files in ./tmp should not be ignored:

# Ignore everything in ./tmp ...
/tmp/*

# ... but do not ignore PDF files in ./tmp
!/tmp/*.pdf

 

Working with UTF-8-encoded PHP files in web applications, a common, hard-to-track-down error is the following: “Headers already sent” or “Cannot modify header information“. This usually happens during a call to the function header(), which manipulates the HTTP header.

One reason for this is that the UTF-8 file starts with an invisible(!) byte order mark (BOM) consisting of the three bytes 0xEF,0xBB,0xBF. The BOM can be removed by opening the file in a suitbale text editor and unticking the Add Byte Order Mark (BOM) .option (or similar).

A more convenient way using sed is the following:

sed -i '1 s/^\xef\xbb\xbf//' utf8_file.txt

(-i enables in-place operation of sed; 1 denotes that one replacement should happen; ^ denotes the start of a line)

Example

Let’s consider a file consisting of two lines (‘A’, ‘B’) stored with the BOM:

<BOM>A
B

Investigating this file with the hex tool od, :

$ od -t c -t x1 testfile.txt

we obtain the following output:

0000000 357 273 277   A  \n   B  \n
         ef  bb  bf  41  0a  42  0a
0000007

The three BOM bytes are clearly visible.

After running

sed -i '1 s/^\xef\xbb\xbf//' testfile.txt

The output looks as follows, proving that the BOM is gone:

0000000   A  \n   B  \n
         41  0a  42  0a
0000004

References