Archive

Archive for the ‘Missing Answers’ Category

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 1 comment

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 you can list accounts that have password expiration set:
    path Win32_UserAccount where PasswordExpires=TRUE get Name
  5. And you can disable it – you will be prompted to confirm the change:
    path Win32_UserAccount where PasswordExpires=TRUE set PasswordExpires=FALSE

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: 0×2711

– 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: 0×2711

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 No comments

Recently I become 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. Here is a simple solution to be put into root’s .bashrc:

if [ -n "${SUDO_USER}" -a -d "/home/${SUDO_USER}/.vim" ]; then
alias vim="/usr/bin/vim --cmd \"set runtimepath+=/home/${SUDO_USER}/.vim\" -u /home/${SUDO_USER}/.vimrc"
fi

It took me quite a lot of googling to find the right combintation of $VIMRC, $VIMRUNTIME, $VIMINIT, $VIMHOME – and finally as you can see, none of those variables is used. Very usefull during debugging was to run vim with -V. to see where it looks for its configuration. And yes, I have tried putting the code to set the runtimepath to the .vimrc, but it would have to be conditional and this seems more clean.

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:

Disable user authentication for subdirectory when using RewriteRule on Apache server

August 30th, 2010 No comments

If you protect your private beta release from public with AuthType and you are using RewriteRule from mod_rewrite, you will soon find, that combination of <Location> and  Satisfy does not work for you – it does not allow access to the subdirectory as expected.

<VirtualHost *:80>
 ServerName beta.example.com
 DocumentRoot /var/www/example

 <Location />
 AuthType basic
 AuthName "Top Secret Beta!"
 AuthUserFile /etc/httpd/htpasswd.beta
 Require valid-user
 </Location>

 <Location /upload-callback>
 Allow from all
 Satisfy Any
 </Location>

 <Directory /var/www/example>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule !\.(swf|pdf|php|js|ico|txt|gif|jpg|png|css|rar|zip|tar\.gz)$ /index.php [L]
 </Directory>
</VirtualHost>

With this setup, the subdirectory will require valid user – because mod_rewrite is applied before <Location> and changes the URL, which no longer matches. You can change this by adding an alias:

Alias /upload-callback /var/www/example/index.php

Now all URLs will go through your nice url generator index.php, but the specified URL will be checked against <Location> and give access based on the Allow directive (in this case to everyone).

Categories: Missing Answers Tags:

Drupal 5 and strange behavior of jQuery

June 28th, 2010 No comments

We have some jQuery code, that we use on all our company sites, however, this code did not work on Drupal sites. jQuery call to position() was returning “static” instead of expected object with top and left properties. We thought we should use newer jQuery (instead of 1.2.6), but this throwed “too much recursion” error in Firebug – which we tried to solve with patch from bug http://drupal.org/node/335741 . However, neither upgrade nor that patch really helped. The reason why position() did not work was hidden here: /sites/all/modules/jquery_update/compat.js (I was looking at linked files and this one sounded suspiciously).

And indeed, these helpers caused the problem:

// UPGRADE: The following css helpers should now be used as:
// .css("top") or .css("top","30px")
jQuery.each("top,left,position,float,overflow,color,background".split(","), function(i,n){
  jQuery.fn[ n ] = function(h) {
    return h == undefined ?
      ( this.length ? jQuery.css( this[0], n ) : null ) :
      this.css( n, h );
  };
});

We have replaced position with xposition and our jQuery works as expected even with version 1.2.6.

Categories: Missing Answers Tags: