Archive

Archive for the ‘Missing Answers’ Category

Import CSV with UTF-8 into Excel for Mac

June 28th, 2013 3 comments

Excel for Mac 2011  does not support UTF-8 in CSV files. On Windows you can simply add Byte Order Mark (BOM) to the file and it will open correctly in Excel. This does not work on Mac. You can try importing the file with different encoding and some people declare success with UTF-16 Little Endian, but for me this simply does not work.

The best solution that I have found is a script made by Konrad Foerstner, which I have improved little bit, to support different colum delimiters.

Download the script from Github https://github.com/brablc/clit/blob/master/csv2xlsx.py, install library for writing Excel format sudo easy_install openpyxl.

Now you can covert the file from CSV to XLSX.

Categories: MacOSX, Missing Answers Tags:

Mac OS X: Cannot edit crontab

February 26th, 2013 4 comments

I wanted to edit crontab for a user on Mountain Lion and it did not work. Repairing permissions with Disk Utility did not help. I saw following error messages:

$ crontab -e
crontab: no crontab for player - using an empty one
crontab: "/usr/bin/vi" exited with status 1

$ EDITOR=vim crontab -e
crontab: no crontab for player - using an empty one
crontab: temp file must be edited in place

$ EDITOR=mcedit crontab -e
crontab: no crontab for player - using an empty one
crontab: installing new crontab
crontab: tmp/tmp.13840: No such file or directory
crontab: edits left in /tmp/crontab.Gyxvel8v43

$ crontab path-to-file-to-replace-current-tab
crontab: tmp/tmp.13784: No such file or directory

To reduce the problem, I have used mcedit. I have found that someone had this issue in 2007 – UNSOLVED. If you were a programmer you would be suspicious about the path without the leading slash. But how to find the real path? I made me comfortable with dtruss (strace for Mac) but it did not move me forward, I just saw that it is problem when opening the file for writing. But hey, this is BSD! We should find sources … and indeed they are available. Now it took just a while to go through the C code and finally find file install_misc.sh.

The solution of this problem is to create missing tmp directory in /var/at!

mkdir /var/at/tmp
chmod 700 /var/at/tmp

I have no idea where I have lost the tmp directory. But I should not be supposed to drill into the source code. Am I?

UPDATED: I believe this problem was caused by my attempt to wipe Parallels out of the system. I was deleting all files installed by the package and afterwards I was deleting empty directories system wide.

Categories: MacOSX, Missing Answers Tags:

Windows phone registration problems

February 23rd, 2012 No comments

I spent many hours to figure out why I cannot register my developer device HTC HD7 to the App Hub:

An error occurred registering your phone.  Please try again.

The help forum does not really help:

The phone registration service returned an unexpected ErrorCode value.
Try this:
Check App Hub site for service alerts and/or retry after a few hours.

I have discovered that when the phone is connected to Zune, the internet connection in the telephone is broken, although it has wifi connected. So I became suspicious and finally started Wireshark. And indeed, Wireshark has answer to all your network questions. Zune bypasses proxy settings of the Windows 7 system. My setting say, it should neither use proxy nor try to discover one. I do this on purpose, because the default company proxy is too restrictive (Facebook blocking). But hey, this is not a forbidden site:

CONNECT developerservices.windowsphone.com:443 HTTP/1.0
Host: developerservices.windowsphone.com:443
Content-Length: 0
Proxy-Connection: Keep-Alive
Pragma: no-cache

HTTP/1.1 407 Proxy Authentication Required (Access is denied)
Via: 1.1 GFI WebMonitor Proxy
Proxy-Authenticate: Kerberos
Proxy-Authenticate: Negotiate
Proxy-Authenticate: NTLM
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 0

Of course, it bypasses settings, discovered a proxy but it is not able to authenticate – even though it offers NTLM!

In order to make any debugging even worse, it does some connections directly. So Zune will let you login to your account. It just uses different way how connect your phone to the internet – it will not let you even update the software if you are connected over proxy which requires authentication.

Registration of the company developer account has been a nightmare too, days of waiting. Support finally contacted us, but apparently things got fixed without their intervention.

Should I mention 10 steps of software update, which took 30 minutes, 3 automatic restarts and at the end told me it has more updates for me? How many of them were there waiting in the queue? Cancel.

Categories: Missing Answers Tags:

Disable password expiration in Windows 7 Home Premium

January 30th, 2012 20 comments

It looks like admin accounts in Windows 7 Home Premium have password expiration set on. However, Windows 7 in Home Premium edition does not have a GUI tool to remove it. There is, however, a command line tool which allows to do it over Windows Management Instrumentation – its name is wmic.

If you want to remove password expiration do the following:

  1. Click on Start button.
  2. Type wmic
  3. Right click listed program wmic and “Run as Administrator”
  4. Now paste this commmand:
    UserAccount where PasswordExpires=TRUE set PasswordExpires=FALSE
  5. Confirm change for each account with password expiration.

This is not really a missing answer, however, there are plenty of solutions which do not work well, or contain typos – mostly because of different quotes used in the command. This script allows changing the expiration at once for all users that have it set – and it does not contain any quotes 😉

Anyway, this is so far the biggest failure I have encountered when using Windows 7 Home Premium edition: Force password expiration in home environment and do not provide a GUI how to disable it.

Categories: Missing Answers Tags:

Write into multiple ssh screens at once

September 15th, 2011 No comments

Sometimes I need to write commands to a handful of SSH sessions at once. I use putty terminal from Windows and did not find anything useful. So I let myself inspired by Rusty Klophaus’s pecho and wrote a Perl script, which is little bit more gentle to the escape sequences and than a small bash script which will nicely open multiple SSH sessions to given list of hosts. The nice think is that this works almost everywhere and does not need more than one standard Perl library on the writer side (on CentOS just run yum install perl-TermReadKey).

Categories: Missing Answers, Tools Tags:

Internal cryptographic library error when signing document

June 25th, 2011 No comments

Adobe Reader marked document signed with PDFCreator as invalid with this error message:

Error during signature verification.
Error encountered while validating:
Internal cryptographic library error.
Error Code: 0x2711

— Czech equivalent —
Chyba v průběhu ověřování podpisu.
Při ověřování se vyskytla chyba:
Interní chyba šifrovací knihovny.
Kód chyby: 0x2711

There is no info available on the internet what does it mean, so I contacted support and the answer was easy – I was signing the document with backup of my private key – there was no certificate present in that file, so there was not way how to calculate hash of the document. The solution is to export the private key including your certificate.

Categories: Missing Answers Tags:

How to use own vim configuration after sudo to shared account

June 17th, 2011 3 comments

Recently I became a fan of vim – and after storing my tuned dotvim on github, I found out, that I miss my configuration when I sudo to the root account. However, I’m not the only sudo user and I we have our own dotvim configuration. In the root’s .bashrc I put this line (it makes it a lot safer afterwards):

export SUDO_HOME=$(eval "echo ~$SUDO_USER")

In the root’s .vimrc following code is added (you may need to add more paths):

if !empty($SUDO_HOME)
    set runtimepath+=${SUDO_HOME}/.vim/bundle/vundle,${SUDO_HOME}/.vim
    let $MYVIMRC=$SUDO_HOME.'/.vimrc'
    source $MYVIMRC
endif

When logging as root using a key, I put following at the beginning of the authorized_keys file:

environment="SUDO_USER=ondrej" ssh-rsa ...

This may require PermitUserEnvironment yes in your sshd configuration.

Categories: Missing Answers Tags:

How to change sar output time format to 24 (solution)

June 6th, 2011 No comments

I always forget how to change this and Google is not giving the right answer anywhere among top results, so here just for my record:
# Put into your .bashrc
export LC_TIME="POSIX"

# Or use just when needed
LC_TIME="POSIX" sar

sar is a command from systat package. It provides output in AM/PM format by default. Setting the locale LC_TIME to POSIX changes the time format to 24.

Categories: Missing Answers Tags:

Enabling Integration Features for IE Application Compatibility VPC Images on Windows 7

February 17th, 2011 No comments

We use Microsoft Internet Explorer Application Compatibility VPC Image to test compatibility with IE6, IE7 and IE8. Recently we have moved to Windows 7 and the last update of perpetually expiring images (created last time on January 18, 2011) raised some issues which made enabling of Integration Features quite difficult (BTW, the images have changed filenames, IE User does not have password stated in the IE_VPC_ReadMe.txt).

Missing drivers

When enabling the features, the installation requested usbhub.sys and usbd.sys. The first file was recommended by MS to be taken from the Windows XP SP3. I have downloaded the SP3 and extracted the file using 7zip:

7za x WindowsXP-KB936929-SP3-x86-ENU.exe i386\usb*.*

But the installation requested another file – usbd.sys, which is not part of the XP SP3 – so I have copied the file from my Windows 7 (C:\Windows\System32\drivers\usbd.sys).

Password prompt

With enabled integration features the VPC asks for password. As it turned out, it tries to do remote desktop connection to itself. It suggests Admin user but Password1 does not work – apparently the Admin account is missing completely. IE User does not work either, because this user does not have password and cannot make remote desktop connection to this PC. So the solution is to give IE User a password and to save the credentials during start up (you may need to delete credentials of the Admin user before using properties on the .VMC files.

This way I have solved all the problems I did not have when running the Compatibility images on Windows Vista with earlier images.

Categories: Missing Answers Tags:

Odstranění klávesnice Spojené státy – mezinárodní ve Windows 7

November 29th, 2010 2 comments

Přepínám mezi českou a anglickou klávesnicí, ve Windows 7 je ale super vychytávka při psaní s defaultní anglickou klávesnicí – Spojené státy (mezinárodní), kdy uvozovky a jiné podobné znaky slouží ke psaní znaků s diakritikou. Řešení je změnit klávesnici na Angličtina (Spojené státy). Nicméně to mi pouze přidá další rozložení pro psaní Anglickým jazykem. Mezi těmito rozloženími mě Windows přepínají natolik náhodně, že jsem to dodnes nepochopil.

Zatím jediný způsob jak se toho nadobro zbavit pro mě byl zásah v registrech – smazal jsem rozložení z registrů:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00020409]
“Layout Text”=”United States-International”
“Layout Display Name”=”@%SystemRoot%\\system32\\input.dll,-5026”
“Layout File”=”KBDUSX.DLL”
“Layout Id”=”0001”

Categories: Czech, Missing Answers Tags: