Tuesday, June 11, 2013

ALT TAB with Citrix ICA Remote Access Client

For some reason, the folks at Citrix don't feel that settings should be easily configurable nor should experiences be consistent.  If you are remoting into a machine, its my assumption that for the majority of cases, you would want to assume that remote machine as your own, ergo, all the commands you are used to using should be passed through and just work.  Alas, this is not the case.  Its very jarring when connected to a remote session, especially in full screen view, and you hit a key combination like ALT + TAB and you get thrown back into your host desktop.  Since I perform a lot of after hours support through Remote Access to my work, I want to ensure my experience is seamless since I often have dozens of windows open at a time.

The most reliable way to enable ALT+TAB I have found is to edit the wfclient.ini file.  This file is available whenever you install the Citrix Receiver client.

It can be found in the following locations:

Windows
%appdata%\ICAClient\WFCLIENT.INI

Linux and OSX
~/.ICAClient/wfclient.ini

In that file you want to find the [WFClient] and add the following to the end of the file.
TransparentKeyPassthrough=Remote

Restart your ICA or Remote Access session and enjoy.  This should work whenever the session has focus regardless of if it is full screen or not.  If you only want it to pass through when its full screen, then change Remote to FullScreenOnly.

Thursday, April 04, 2013

Updating Time over HTTP on Raspberry Pi

The Raspberry Pi is a wonderful device that lends itself to creating all sorts of projects in remote locations. Network connectivity is the way to make the Pi sing and with the addition of a cheap wireless adapter based on a RTL8188CUS chipset, you can shove the Pi into some very non traditional installations.  Unfortunately, the Pi does not include a realtime clock due to cost and complexity concerns so network connectivity is required to bootstrap the current time and date.  By default, Raspbian ships with a NTP (Network Time Protocol) dameon which will fetch and set the current time and date from the configured network time servers.  The challenge arises if you need to set the time while connected behind a very restrictive proxy that doesn't allow for anything other than HTTP (TCP 80).  Welcome htpdate to the rescue which will allow you to set the system time within a second or two based on the http response headers of ordinary websites.  Unfortunately, there is no ARM based debian package for htpdate currently so apt-get install htpdate will say package not found.  I will show you a good way to get htpdate up and running on a raspberry pi running raspbian by building your own debian package which makes for easy uninstalls.  I recommend SSHing into your Raspberry Pi to make this as easy as possible.

Building and Installing htpdate as a Package

After ensuring you have a network connection, install checkinstall

sudo apt-get install checkinstall

mkdir ~/download/htpdate && cd  ~/download/htpdate

Find the URL to the current version of htpdate-xxx.tar.gz here.  I am currently using htpdate-1.0.5.tar.gz for this example.

Now download the current version using the URL you discovered above and extract it (of course change the version number if you are not downloading 1.0.5)

wget http://www.vervest.org/htp/archive/c/htpdate-1.0.5.tar.gz && tar -xvfz htpdate-1.0.5.tar.gz

Lets change into the extracted directory and compile the project (takes about 15s on the Model B)

cd htpdate-1.0.5 && make

Now we are ready to build the debian ARM package.  (Running this as root is very important)

sudo checkinstall -D make install

Accept the default set of package docs when asked

Should I create a default set of package docs?  [y]: y

You will be asked to provide a short description; I chose HTTP Time Protocol. (Note you have to hit ENTER twice)

Please write a description for the package.
End your description with an empty line or EOF.
>> HTTP Time Protocol
>>


You will be asked if you want to change any of the default package values.  I opted not to since I am not publishing this package so just hit ENTER to continue.

Congrats.  The package has been built and installed.  You could even copy the resulting .deb file to another Pi and install it, changing the dir to the dir of your copied deb file.

sudo dpkg -i /home/pi/download/htpdate/htpdate-1.0.5/htpdate_1.0.5-1_armhf.deb

Testing and Verification of htpdate

Now that we have a package and its installed, we can move on to testing that htpdate does what we need.
Lets ensure that htpdate can reach out and fetch the dates from some websites that are geographically close to you.  -d infers debug and -q says to merely query the sites, don't set the time.

sudo htpdate -d -q  www.google.com wwww.nist.gov www.uic.edu

You should see some output similar to the below



#: 3 mean: 0 average: 0.333
Timezone: GMT-6 (CST,CDT)
Offset 0.333 seconds


Looks good.  Now lets commit and set the date and keep it up to date by running this as a dameon. -D runs htpdate as a dameon, -s will force change the clock on the first poll and then provide adjustments there after, and -l will log the status to the syslog (/var/log/syslog)

sudo htpdate -D -s -l www.google.com wwww.nist.gov www.uic.edu


Making htpdate Startup on Boot

So far we have downloaded the source code, compiled it, created a nice installable and removable debian package, and shown how to query and set the date using htpdate.  Unfortnately, if you reboot or have the pi off for long periods of time, your system time will quickly drift.  To fix that, we can start the htpdate in dameon mode on boot.  This section assumes you have familarity editing text files on linux and I will use nano for my examples but feel free to use your favorite text editor such as vim or emacs.

Lets become root

sudo -s

Enter into the init.d directory, and create a new startup script for htpdate, and make it executable

cd /etc/init.d/ && nano htpdate && chmod +x htpdate

Paste the below into your text editor (modify HTPHOSTS with a list of your own geographically close sites if you wish) and then save (CTRL + O) and exit (CTRL + X)

#!/bin/sh

### BEGIN INIT INFO
# Provides:        htpdate
# Required-Start:  $network$remote_fs $syslog # Required-Stop:$network $remote_fs$syslog
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Start htpdate in daemon mode
### END INIT INFO

# RUNASUSER will generally be pi, unless you've created your specific user account
export RUNASUSER='pi'
# Space delimited list of sites to pull time info from without the http://
export HTPHOSTS='www.google.com wwww.nist.gov www.uic.edu'

case "$1" in start) # if it's start, then start htpdate su$USER -c "/usr/bin/htpdate -D -s -l -i /tmp/htpdate.pid -u nobody:nogroup $HTPHOSTS" echo "Started htpdate for$RUNASUSER using /usr/bin/htpdate -D -s -l -i /tmp/htpdate.pid -u nobody:nogroup $HTPHOSTS" ;; stop) # if it's stop, then just kill the process and delete the pid file pkill -F /tmp/htpdate.pid rm -rf /tmp/htpdate.pid #kill any rogue instances of htpdate killall -q -w htpdate echo "htpdate stopped" ;; *) echo "Usage: /etc/init.d/htpdate {start|stop}" exit 1 ;; esac exit 0 Make sure that you have no mistakes by stopping and starting htpdate /etc/init.d/htpdate stop && /etc/init.d/htpdate start You should see that the process started Started htpdate... Now lets add it to the startup process update-rc.d htpdate defaults Congratulations! You can now reboot and htpdate will automatically update the time even if you have a restrictive firewall and will only do so after the network connection has been established. Sunday, February 03, 2013 Issues with VirtualBox on Ubuntu 12.10 Problem: Are you having issues starting virtual box after installing updates? Annoying isn't it? Errors like the following: Kernel driver not installed (rc=-1908)The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing'/etc/init.d/vboxdrv setup'as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary. Maybe you have an issue with the networking card when operating in bridged mode and get an error similar to the following (note might also say HostInterfaceNetworking-wlan0) : Failed to open/create the internal network 'HostInterfaceNetworking-eth0' (VERR_PERMISSION_DENIED). Failed to attach the network LUN (VERR_PERMISSION_DENIED) Solution: VirtualBox recommends you run sudo /etc/init.d/vboxdrv setup but unfortunately this is not available on most Ubuntu installations. I would recommend running the following: sudo apt-get install linux-headers-$(uname -r)
sudo apt-get --reinstall install virtualbox virtualbox-dkms
sudo modprobe vboxdrv
sudo modprobe vboxnetflt

Good luck!

Saturday, January 12, 2013

How to set Full Pixel on a Sony KDL-55EX720

I recently got a Monoprice mini DisplayPort to HMDI w/Audio adapter for my Dell XPS 13 running Ubuntu 12.10 Quantal Quetzal.  I am happy to report that audio over HDMI works just fine out of the box with no software to install as long as the device receiving the signal supports audio over HDMI such as my Sony KDL-55EX720. Unfortunately, the picture was overscanned (cut off on the edges).

In order to fix this, you have to set your Display Area to full pixel.  Unfortunately I could not find out for the life of me how to get to this option on my TV.  Fortunately, I ended up stumbling onto it.

1. Hit the HOME button on your Sony remote.
2. Scroll to the input connection that your computer or other overscanned device is on (mine is HDMI 3).
3. Hit the RIGHT arrow on the circle pad until you get to the options menu (i-Manual, Preferences, Sound, Picture and Display, etc)
4. Select Picture & Display by hitting the Select button (center of circle pad)
5. Scroll down to Screen and hit Select
6. Scroll down to Auto Display Area and hit Select and turn that option Off.
7. Scroll down to Display Area and set this to Full Pixel
8. Hit RETURN until you exit the menu.  Your display should now full fill the screen.
If you have issues with getting the picture to show up at all, then open you Display control panel and click Detect Displays.

Sunday, December 23, 2012

dpkg: error processing icaclient (--configure)

When trying to install the Citrix Receiver application (icalient) on Ubuntu 12.10 x64, ran into an issue with one of the post installation scripts (thanks Citrix!?).

You will notice that when setting up the icaclient or any package thereafter you get a post installation error as seen below:
dpkg: error processing icaclient (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
icaclient
To fix this, you have to make a simple change to the following file
/var/lib/dpkg/info/icaclient.postinst
Open the file in your favor text editor and find the following line (typically Line Num: 2648)
echo $Arch|grep "i[0-9]86" >/dev/null Change it to the following (pay close attention to the -E, changes have been bolded) echo$Arch|grep -E "i[0-9]86|x86_64" >/dev/null
Now the setup should complete successfully after running the following command
dpkg --configure icaclient

Saturday, December 22, 2012

Challenges when configuring i1 Profiler Display Pro

Recently I was requested to assist with developing a color correction profile for photo editing workstation.  I used a XRite i1 Display Pro to develop the profile against a Dell U2410 and a Dell 1907FP dual monitor setup.  I thought this would be an easy 5 minute process.  I was wrong.

Couple of things you need to remember:

1. Turn UAC off.  Seems that i1Profiler needs to read in LUT values and write new system ICC profiles.  UAC sometimes interferes with that.  You can turn it back on when you have finished with the calibration process.
2. Make sure that "Use Windows display calibration is set" otherwise you might get the dreaded "Failed to apply video LUTS" error message after the calibration sequence finishes.  Follow the instructions from XRite on how to correct this.
1. Open Control Panel and then"‘Color Management", a Color Management setup window for the User Level appears. In the "Devices" tab, add a check to "Use My Settings for this Device". Make sure that the X-Rite created monitor profile is selected as the default. Click on the "Advanced" tab and check the box to "Use Windows Display Calibration" to control loading the video LUTs. Note: if the option "Use Windows Display Calibration" is grayed out, click on "Change System Defaults" bottom left in the window. A Color Management setup window for the System Level appears. Do not apply any changes for assigned profiles here. Click on "Advanced" tab and select the option to "Use Windows Display Calibration". Select "Close" and the exit "Color Management".

After you get everything calibrated, you still might run into issues such as Windows Photo Viewer showing your images a lot darker than you would expect.  Photoshop and Lightroom will show the proper color, luminance and saturation but Windows Photo Viewer will show images that are dark unless you "play" then in Slideshow mode.  If so, the reason is you need to tell i1 Profiler to save the ICC profile in version 2 format.  The instructions here are a little dated but will get you down the right path.

Once you create the ICC profile, verify the profile by opening up the Color Management control page, clicking All Profiles, then selecting your custom profile under ICC Profiles and verifying the version.

Thursday, August 30, 2012

Suppress or Hide Network Error Dialog Boxes

If you are like me, you often work with a portable computer and sleep your computer between commutes from the office, home, and road.  If you wake up your computer on a different network than the one you were on previously, you might be in for quite the annoyance if you had bunch of Explorer windows with UNC paths open.  Suddenly those paths are not found and potentially dozens of "Network Error Windows cannot access \\serverfoo\some\path\bar" messages. Of course, they cannot be accessed, that network is no longer available.  Clicking Cancel on each dialog is annoying.  This is where AutoHotKey can step in.

This nifty program allows you to script all sorts of "macros" to automate various tasks on your computer.  In many ways its similar to AppleScript but more powerful.  You can create shortcuts, remap keys, or in this case, eliminate pesky dialog boxes.

In this script, we are going to create a persistent script, one that will stay running and continue to refire the timer using the interval we specify:

#Persistent
SetTimer, CloseNetworkErrorDialog, 20000
return

CloseNetworkErrorDialog:
SetTitleMatchMode, 2
WinGet, id, list, Network Error
Loop, %id%
{
this_id := id%A_Index%
WinGetTitle, this_title, ahk_id %this_id%
PostMessage, 0x112, 0xF060,,, %this_title%
}
Return

As you can see, this is a really simple script that has a function named CloseNetworkErrorDialog that is called every 20 seconds.  CloseNetworkErrorDialog loops through the open windows whose title contain the phrase "Network Error", gets the exact title of the window, and sends it a Close Window command.  You can read more about creating AutoHotKey scripts here.

Peace at last and it only took 5 minutes to write.