Tuesday, January 08, 2013

Parallels desktop 8 for Mac keyboard switching and painting issues

In this post I'll describe the solutions for two issues encountered after upgrading to Parallels Desktop 8 on my Mac 10.7 (with Win XP as the guest OS).

Windows not painting fully

The first problem was that popups and windows (such as the Windows Start menu or task manager) were not always displayed correctly in Coherence. Part or all of the window was blank (white) until something caused it to repaint (see a related thread on Parallels forums):

This was fixed by turning 3D acceleration on (Virtual Machine menu -> Configure... -> Hardware tab -> Video).

The fix was suggested by Parallels' support, who said the glitch was an unintended side-effect of other improvements that went into PD 8 and that unless turning 3D acceleration on causes other problems, this is the fix (i.e. keeping 3D acceleration on will be required).

Keyboard layout / input language not switching

Another problem was with switching input languages in the guest OS. Command+Space (the shortcut I use to switch languages ("input sources") on Mac) could not change the language to English while Parallels was focused.

Turned out this was due to keyboard configuration in the Win XP "Text services and input languages" dialog. I somehow ended up with "United Kingdom (Apple) - Parallels" as the only keyboard for the "English (United States)" language:

The problem disappeared when there was a "US" or a parallels US keyboard in the list of available layouts for the language:

Sunday, July 01, 2012

Windows 7 - Resuming from hibernation is slow on Thinkpad

This post describes the solution to a hibernation issue I had with Lenovo Thinkpad L412 laptop running Windows 7.

When waking up from hibernation the system resumed relatively fast, but then, for a minute or two after resuming, many applications (e.g. Explorer, Firefox) would be "not responding".

Additional symptoms:

  • During this period the disk activity was unexpectedly high, Resource Monitor indicated that most of it was paging (see the high "Hard faults" figure, and the c:\pagefile.sys requests on the screenshot), even though there was more than enough RAM available before hibernating.
  • The task manager also showed a drop in memory utilization -- the system used fewer memory after hibernating and resuming than before.

The program to blame for this behavior turned out to be this fine piece of software engineering:

"ThinkVantage Technologies Power Manager 6"

Just uninstall it and the problem is gone. You'll lose the large battery widget in the task bar and the confusing power management UI that mostly duplicates existing Windows functionality:

(If anyone wonders. the latest version at the time of writing (6.32) had this problem too.)

Troubleshooting tips that helped to identify the issue can be found here: Trace Windows 7 boot/shutdown/hibernate/standby/resume issues.

Sunday, May 13, 2012

Troubleshooting python packages installation

This post lists some of the problems encountered while trying to set up development environment for kuma, a Python (django-) based wiki engine.

I'm using Mac OS X 10.7, Macports as the package manager.

A note about virtualenv

virtualenv lets you install python packages for a particular project into an isolated environment.

When relying on macports to install dependencies, it's a good idea to use Python provided by Macports, otherwise the system might not see some of the dependencies you installed with Macports.

Using virtualenvwrapper, you can specify the python binary to use when creating the environment like this:

#assuming python2.7 is a macports binary (typically in /opt/local/bin)
mkvirtualenv kuma-test-py2.7 -p python2.7

Problems and solutions

Error installing MySQL-python: EnvironmentError: mysql_config not found

Via http://blog.infoentropy.com/MySQL-python_EnvironmentError_mysql_config_not_found: you need to edit site.cfg to point to the right mysql_config path.

In my case (with virualenv and macports mysql), I ended up modifying /Users/nickolay/.virtualenvs/<environment-name>/build/MySQL-python/site.cfg to point to /opt/local/bin/mysql_config5).

Errors involving pylibmc and memcached

_pylibmcmodule.h:42:36: error: libmemcached/memcached.h: No such file or directory

First make sure you installed libmemcached, e.g. using Macports:

sudo port install libmemcached

For some reason on my system I also needed to explicitly set the path to headers before retrying pylibmc installation:

export CPATH=/opt/local/include/

ld: library not found for -lmemcached, collect2: ld returned 1 exit status

This happened for me when trying to install into a virtualenv using system python, not macports one. (See the section on virtualenv above.)

ImportError: failed to find libmagic.  Check your installation

To install libmagic in Macports, use:

port install file

Saturday, November 19, 2011

f1upgradeutility.exe using 100% CPU

In the hope of making the Google results for f1upgradeutility.exe a little more helpful, I'd like to note that this application using 100% (or 50% or 25% depending on the number of cores you have) of CPU is usually found in c:\Program Files\NSS\f1upgradeutility.exe and belongs to the Nemesis Service Suite, which you've probably installed to flash your Nokia device.

Saturday, September 24, 2011

Sublime Text 2: diff syntax highlighting with a light background color scheme

I recently discovered a new text editor, Sublime Text 2, which I quite like. By default it uses a dark-background color scheme, and while it comes with a few light schemes, none of them have proper syntax highlighting for "diff" files. Fortunately it turned out to be easy to fix:
  1. cd into the Packages/Color Scheme - Default directory.
  2. Copy the scheme you like, e.g. cp iPlastic.tmTheme iPlastic-my.tmTheme.
  3. Change the new file as follows.
  4. To change the theme, edit your preferences file to say
    "color_scheme": "Packages/Color Scheme - Default/iPlastic-my.tmTheme",
    To see the effect of your changes, just save the preferences file.

--- iPlastic.tmTheme	2011-07-31 02:14:25.000000000 +0400
+++ iPlastic-my.tmTheme	2011-09-25 01:29:18.000000000 +0400
@@ -6,5 +6,5 @@
 	<string>Jeroen van der Ham</string>
-	<string>iPlastic</string>
+	<string>iPlastic-my</string>
@@ -280,4 +280,50 @@
+		<dict>
+			<key>name</key>
+			<string>diff.header</string>
+			<key>scope</key>
+			<string>meta.diff.header</string>
+			<key>settings</key>
+			<dict>
+				<key>foreground</key>
+				<string>#ffffff</string>
+				<key>background</key>
+				<string>#77aadd</string>
+			</dict>
+		</dict>
+		<dict>
+			<key>name</key>
+			<string>diff.deleted</string>
+			<key>scope</key>
+			<string>markup.deleted</string>
+			<key>settings</key>
+			<dict>
+				<key>foreground</key>
+				<string>#F92672</string>
+			</dict>
+		</dict>
+		<dict>
+			<key>name</key>
+			<string>diff.inserted</string>
+			<key>scope</key>
+			<string>markup.inserted</string>
+			<key>settings</key>
+			<dict>
+				<key>foreground</key>
+				<string>#11aa11</string>
+			</dict>
+		</dict>
+		<dict>
+			<key>name</key>
+			<string>diff.changed</string>
+			<key>scope</key>
+			<string>markup.changed</string>
+			<key>settings</key>
+			<dict>
+				<key>foreground</key>
+				<string>#ff2222</string>
+			</dict>
+		</dict>

Wednesday, March 23, 2011

Debugging crashes

Two interesting posts on debugging crashes I came across this month:

Sunday, March 13, 2011

Startup performance of Addon SDK-based extensions

The addons.mozilla.org roadmap for 2011 has improving the add-ons performance as one of this year's goals, so after finishing with my XUL extensions project for the weekend, I did some quick measurements to see what effect add-ons built with the SDK have on the Firefox startup time.

I posted this message to the Add-on SDK discussion group, but reproducing it here anyway.

According to my tests (Mac OS X (10.5) with the latest Minefield and the latest Add-on SDK using getStartupInfo()):
  • an empty SDK-based extension (empty main.js) adds ~20 ms to the 700 ms baseline warm startup time (3%), which is tolerable, but
  • the default extension created with 'cfx init' (adds a simple widget and loads the tabs module) adds more than 200 ms (28%) to the warm startup!
I ran some poor man profiling to check a hypothesis that most of this cost is in the module system (require()). It is very rough, but it showed how most (75%) of the time was spent:
  • 25% (50ms) running es5.js in each of the 38 distinct modules loaded
  • 15% (30ms) is other initialization operations with the sandbox (creating sandboxes, setting properties)
  • 10% (20ms) is spent in fs.getFile(), presumably loading the modules from disk
  • 25% (50ms) spent evaluating the module code itself, not counting the require() costs listed above.
Here are the details of my instrumentation and the results: legend, data:

Counter Hit count Time spent, msAttributed to the
securable-module infrastructure /
to the user-level code?
start loading 3837user
up to createSandbox380s-m
setupSandbox, part 1381s-m
setupSandbox, part 2 - modifyModuleSandbox3854s-m
setupSandbox, part 33815s-m
before evaluate380s-m
after evaluate3852user

The list of all 38 modules loaded by a simple extension using widget and tabs (indenting shows require() dependencies):

  • plain-text-console
  • memory
    • unload
  • main
    • widget
      • xul-app
      • api-utils
      • panel
        • content
          • content/loader
            • events
              • traits
                • traits/core
            • url
            • file
              • byte-streams
              • text-streams
              • xpcom
          • content/symbiont
            • ./worker
              • cuddlefish
                • securable-module
              • timer
            • hidden-frame
              • errors
            • observer-service
      • window-utils
    • tabs
      • windows
        • list
        • windows/tabs
          • tabs/tab
            • utils/function
            • tabs/events
            • utils/thumbnail
            • utils/data
        • windows/dom
        • windows/loader