Google
 

Monday, February 13, 2012

Hotkeys for Banshee Media Player on Ubuntu without multimedia keyboard

My keyboard lacks multimedia keys. So controlling Banshee media player becomes annoying, because I have to switch to it to pause or resume playing or performing other actions on the play list currently running.
Banshee has shortcut keys for playback (space to play/pause) but the Banshee window must be active.
So here is how to make the hotkeys:

Step 1: Install CompizConfig Settings manager:
Using terminal:

sudo apt-get install compizconfig-settings-manager

Or you can install it from the software center.

Step 2: Know the actions you want to create shortcuts for:
Banshee has a command line interface. To discover the correct shortcut, we use man at terminal:
man banshee
This will let us know that, for example, the --toggle-playing option will toggle from play to pause and vice versa.


Step 3: Use CompizConfig to configure Hotkeys
Open CompizConfig, and click Commands.


In the commands tab write:

banshee --toggle-playing
In the Key Bindings tab, click one of the buttons with Disabled label that corresponds to the command line number you previously edited. In the dialog, check Enabled. Then enter the key combination of your choice.


You can add any other hotkeys for other functions as you need. And that's it.
Enjoy!!

Monday, January 2, 2012

Articles I read in 2011

Welcome 2012 !!
As usual, I'm interested in sharing articles I read during the past year, hopefully you'll find something useful in it.

2010's list can be found here
2009's list can be found here
2008's list can be found here 
2007's list can be found here

Monday, August 15, 2011

Linking using history.back()

Easy navigation and discoverability are very important aspects of website or application usability. The user should be able to easily dig deep in the content as well as to navigate to broader category of content.

I stumbled upon a site that has a "Back" link in a leaf level content page. As a user I thought it might be a way to go up and visit the related content or the parent category. Unfortunately, history.back() was used. And since I reached this page using a search or a direct link and opened it in a new tab, it led me nowhere.

The designer / developer assumed that the user will reach this page using a specific path and will open it in the same window and tab.

That was a very bad idea as the most of the content nowadays is reached using search engines. And you don't your visitors to leave your site back to Google after getting him to your site!!. Also the design is broken in case the page is opened in a new window or tab.

Maybe the rationale behind using this technique was to get the user back (within the site) to the location from where he got to the current page, be it direct navigation links or internal site search page. If so, a better implementation should be using HTTP referrer, or explicit query string value to indicate the source of the request.

Small details can make big changes in usability. Different scenarios should be taken into consideration when designing the navigation.

Saturday, July 9, 2011

PowerShell 32 and 64 bit have different execution policy settings

I use PowerShell to automate many repetitive tasks. And build automation is one of the areas I like most.
I faced a stiuation when I get this error with a PowerShell script running in visual studio project post build event:
File XXX.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about _signing" for more details.
I know this error is usually caused by an execution policy that denies execution of scripts. So I made sure the Execution Policy is set to RemoteSigned. But This did not work!!

I added this to the batch file that calls the PowerShell script:

powershell "Get-ExecutionPolicy -List"

And the result was:
Scope                         ExecutionPolicy

----- ---------------

MachinePolicy Undefined

UserPolicy Undefined

Process Undefined

CurrentUser Undefined

LocalMachine Undefined

After some research I found that since the machine is 64-bit, there were 2 versions of PowerShell, 32 and 64-bit. Again I edited the batch file adding :

Powershell.exe "Get-Variable PSHOME"

And ran a build from visual studio, the result was:

Name Value
---- -----
PSHOME C:\Windows\SysWOW64\WindowsPowerShell\v1.0

This shows that the version invoked was the 32-bit version, while the version I used to Set-ExecutionPolicy was the 64-bit version. I determined the paths from start menu shortcuts to Powershell:

Windows PowerShell (x86): %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe
And Windows PowerShell: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe

So I opened Windows PowerShell (x86) and executed:

Set-ExecutionPolicy RemoteSigned

And it worked.

So, did Visual Studio post build event call the 32-bit version because it's a 32-bit application?

Wednesday, July 6, 2011

SSMS and Deleting all records from a self referencing table

Clearing all data from a self referencing table using SSMS can be tricky. Selecting all records in SSMS results grid and pressing DEL just won't work in many times.

Take the common example of Employee - Manager relationship:

If you try using SSMS results grid to delete all records, you may get this error:

No rows were deleted.

A problem occurred attempting to delete row 1.
Error Source: .Net SqlClient Data Provider.
Error Message: The DELETE statement conflicted with the SAME TABLE REFERENCE constraint "FK_Employee_Employee". The conflict occurred in database "test", table "dbo.Employee", column 'ManagerId'.

The statement has been terminated.

Using the Query window and running:
DELETE employee
Will work however.

The difference is that SSMS actually tries to delete row by row, which will violate the constraint. But when using a query to delete all records. SQL Serve is smart enough to clear all data.

Friday, January 7, 2011

Failed to extract the cab file in the solution error in SharePoint

When deploying SharePoint solutions, you may encounter an error message like:
Failed to extract the cab file in the solution.
(FYI, the wsp solution file is a cab file. just try to rename *.wsp to *.cab)
There are two reasons that I found causing this kind of error:
  1. Having some special characters in files names in the solution, in my case it was "(" and ")".
  2. Having two DLLs with the same name even if one is in the GAC folder and the other in bin folder, this happened in my case by mistake, but it's good to know anyway.
Have a nice deployment, without uninformative error messages.

Saturday, January 1, 2011

Articles I read in 2010

New year, new list :)
Seems I'm good at keeping old habits, I've even created the draft of 2011's list sending this post.

2009 list can be found here
2008 list can be found here
2007 list can be found here