Opening tab separated file in Excel: Excel has detected that ‘file.txt’ is a SYLK file, but cannot load it

You try to open a tab separated file in Excel and get error ‘Excel has detected that ‘test.txt’ is a SYLK file, but cannot load it. Either the file has errors or it is not a SYLK file format. Click OK to try to open the file in a different format.’

The file looks something like:
ID DATA
1 data1
2 data2

The problem is caused by the first field name, that is ‘ID’ in this case. Change it to something else and problem will go away.

Update: there is a Microsoft Support article “SYLK: File format is not valid” error message when you open file that describes this behavior.

Update 2: SYmbolic LinK (SYLK)

Change timezone with TZ environment variable in Windows

If your program uses one of the following MFC or CRT function, then you can change timezone using TZ environment variable:

  • CTime::GetLocalTm
  • CTime::Format
  • COleDateTime::operator=
  • ctime
  • _wctime
  • _tctime
  • _ctime64
  • _wctime64
  • _tctime64
  • mktime
  • _mktime64
  • _utime
  • _wutime
  • _tutime
  • _utime64
  • _wutime64
  • _tutime64

For example, to set the TZ environment variable to correspond to the current time zone in Germany, enter the following on the command line:
set TZ=GST-1GDT
This will add environment variable TZ with value ‘GST-1GDT’.

More about TZ environment variable:
Specifying the Time Zone with TZ
MSDN _tzset from Time Management

PHP $_POST returns only one item for SELECT multiple HTML tag

PHP developers decided that values posted from HTML select tag with attribute multiple, somehow overwrites some internal variable data. Basically it goes like this – you have the following form with a select tag:
<form action="/post.php" method="post">
  <select name="MyMultiSelect" multiple>
    <option>one</option>
    <option>two</option>
    <option>three</option>
    <option>four</option>
  </select>
  <input type="submit" value="send">
</form>

and in PHP you try to access $_POST (An associative array of variables passed to the current script via the HTTP POST method):
var_dump($_POST);

And guess what? When you select, lets say one, two and three in browser, the array looks something like:
array(1) { ["MyMultiSelect"]=> string(5) "three" }

Strangely, the cause is some overwrite that is described in PHP FAQ: How do I get all the results from a select multiple HTML tag? For me it is mystery, why did PHP developers choose to overwrite values posted by HTTP standard post?

The problem is, that they propose to add square brackets to HTML code, like:
<select name="MyMultiSelect[]" multiple>

Beside, that I do not like ‘[]’ in my Valid HTML 4.01 Strict code, the problem is, that you may not have access to that HTML code. In my case it is legacy application, that is available in binary form only.

The solution that I come up is, to use raw $_POST data using PHP file_get_contents in combination with PHP input/output streams namely php://input

php://input allows you to read raw POST data.

Here is a sample code:
$data_from_post = file_get_contents("php://input");
var_dump($data_from_post);

And output is:
string(...) "MyMultiSelect=one&MyMultiSelect=two&MyMultiSelect=three"