Category: Tips

  • Cannot remove/cancel/delete Print jobs

    I did recently had to restart the “Print Spooler” Service to clear the Print job queue where a job was stuck and refused to abort.

    Click to Read More

    I did download the free software – HP Photo Creations – from HP to print at home calendars, greetings cards, etc… It’s missing some essentials features IMO, like “align” pictures/text/etc… but it’s not that bad.

    I just add one issue while printing one of my creation on my PhotoSmart C6280, which is most probably related neither to that model nor to HP Photo Creations, but to the HP Drivers and/or Windows 7: One of the print job in the queue never started to print…

    When print jobs are currently queued/printing, you should see a printer icon :printer: in the notification area. Click on this one to open the print queue. If you don’t see this icon, you can still open the queue  by clicking the Start button :start:, clicking Control Panel, clicking Hardware and Sound, and then clicking Devices and Printers. There, double-click your Printer to open its status window and access the Print Job Queue.

    In that queue, I found my print job in first position, apparently stuck… So I decided to cancel it (right click the job and select “Cancel”). Its status became something like “Deleting – Error – Printing” but the job never disappeared from the queue. Usually, the printer is displaying an error message (e.g.: no paper or ink any more) and once this error solved, the job disappears. But if you don’t find what’s wrong, the easiest solution consists in clearing the queue (including all the other pending jobs if any):

    1. Click Start-R to run a command and type services.msc to open the Service Administration console.
    2. Find the services “Print Spooler” in the list of services (As a tip: Select the first service and type “Print”. The cursor will move directly to the first matching name in the list)
    3. Right-click this “Print Spooler” service and Select “Restart”
    Et voilà. The Print Job Queue is now empty…


  • Target multiple environments with only one TFS Build Server

    I had customize our Build Process Template to support multiple target environments on a single Build Machine. I.e.: to resolve the “file references” at Build time depending on the environment targeted for the deployment.

    Click to Read More

    At work, we have mainly four distinct environments: Integration, Qualification, Pre-Production and Production. Each application (and its referenced assemblies) are promoted from one environment to the next one via tasks (Release Distribution jobs) scheduled according to a predefined monthly Release Plan…

    TFS Build Machines not only compile the applications to be deployed via the standard Release Distribution, but also the urgent fixes to be deployed directly in Pre-Production without passing through Integration and Qualification environments. It also happens, although really quite seldom, that a Build skips the Integration and goes directly to Qualification.

    It’s also to be noticed that none of our applications (assemblies) are strong named and deployed in the GAC, neither on development workstations nor on servers. Instead, all referenced assemblies are always copied within the application’s bin folders, also on the servers.

    Therefore, basically, we would need Build Machines dedicated for each target environment with the adequate assemblies made available on them, for reference resolution purpose. That would be a pity to have such Build Machines (and the related setup, maintenance, backup costs, …) for at most one build per month (Fix in Production and Qualification are fortunately not common).

    To avoid that,  I did customize our Build Process Template to take a Reference Path as input and to pass it to MSBuild. Actually, when editing a Build Definition, the Builder can select the target Environment, and the Build will simply receive a path to the location containing the related assemblies.

    Ex.: MSBuild mySolution.sln /p:ReferencePath=”c:\RefAssemblies\Qualification\”

    How can I be sure that this Reference Path won’t interfere with any Hint Paths defined in the Visual Studio projects?

    First, note that the location provided to MSBuild via the “ReferencePath” parameter will be probed to resolve all “file references” before any other location on the standard probing path. But we also pay attention to not make the assemblies available on the Hint Path on the Build Machines:

    • On Development Workstations, all our assemblies are made available in a single “Reference Assemblies” folder. Developers add references on assemblies in there for development and local testing purpose. They can also start a task at will to update this “Reference Assemblies” folder with the latest version of the assemblies (the versions used in the Integration Environment) or with the version currently deployed in the Qualification or Production Environments (e.g.: for bug fixing purpose).
    • On the Build Machines, there is one “Reference Assemblies” folder per environment (i.e.: updated by the Release Distribution with the assemblies currently in use in that environment). None of those folders is located at the same path as the “Reference Assemblies” folder of the Development Workstations. As a result, MSBuild cannot use the Hint Paths found in the Visual Studio projects to locate the referenced assemblies. Instead, it uses the path of the “Reference Assemblies” folder passed to it via its parameter /p:ReferencePath.

    In addition to the “Reference Assemblies” folders per environment, we also have one  extra folder containing the output of each latest successful Build. This one is used for “Continuous Integration“. No need to update the references in the Visual Studio Projects, MSBuild always find in that folder the latest version of each assembly recently built on any Build Machine (if requested to do so via the Build Definition). This is by the way the default “target environment” for all “Rolling Builds” defined on “Development Branches”, so any breaking features in a new version of a referenced assembly is immediately detected. Builds “candidate” to be promoted use by default the Reference Path with the assemblies from the Integration environment.


  • .Net: Do not Split your Strings

    It could result in an “Out of Memory Exception” on really large strings as a colleague experienced last week.

    Click to Read More

    I admit I used to call Split a lot too as it’s really easy and spares me a bunch of code. Ex.: to parse lines of a CSV file. And yet, the documentation on MSDN is clear about Split performances:

    The Split methods allocate memory for the returned array object and a String object for each array element. If your application requires optimal performance or if managing memory allocation is critical in your application, consider using the IndexOf or IndexOfAny method, and optionally the Compare method, to locate a substring within a string.

    Here is a guy who deeply analyzed the memory issue which occurs when splitting a very large string : “Out of Memory Exception

    And if you need to parse the content of a large .csv, here is an efficient custom parser that can be used instead of calling Split on each line: “Fast CSV Reader


  • Line Break versus Paragraph in WordPress

    For a WordPress beginner (at least for me, who used to write html in notepad++), when editing a post, it is irritating that the ‘Enter’ key is not simply adding a line break but starting automatically a new paragraph instead, especially when typing some pieces of code.

    Fortunately, there is a trick to add a line break without starting a new paragraph.

    Click to Read More

    A new paragraph is usually started after a “Hard break” also known as a “Carriage Return”, which is indeed the default when typing “Enter” in a Word Processor. At the opposite, a simple “Line break” also known as “Soft Break” does not start a new paragraph and result in a normal line-spacing.

    Ex.: The white-space between the previous text and this line is due to a “paragraph separator”. But here after, you will see two lines A. and B. separated by a simple line break.

    A. first line of text
    B. second line of text

    Instead of typing “Enter” at the end of the line A., press “Shift-Enter” instead. That wilt result in a “soft break” (line break) instead of a “hard break” (carriage return).


  • Connect to TFS from VS with multiple accounts

    Assuming that you are using Windows Integration Authentication to access TFS, any instances of Visual Studio run during a Windows session will always use the current user to access TFS… Fortunately, there is a simple trick to connect on TFS with multiple accounts without starting new Windows sessions with other users.

    Click to Read More

    If like me you are a TFS administrator, you could indeed need to switch quite often from one user account to another. e.g.: to work in TFS with another profile (Contributor or Builder) and validate various configuration settings (security, etc…).

    In such a case, the easiest is to right-click on the Visual Studio Shortcut (e.g.: in the Start Menu >  All Programs > etc…) and select “Run As…”. Then enter the windows account to be used to connect to TFS.

    Notice: Each time you will do that for the first time with a new account, Visual Studio could start much slower than usually as it has to create a new profile…

    Notice: The account used to “Run As…” Visual Studio won’t become the new default account. I.e.: it won’t be reused the next time you run Visual Studio!

    You can also edit the properties of the shortcut to Visual Studio (or create a copy of that shortcut). Then, click on the “Advanced” button in the “Shortcut” tab and tick the option box “Run with different credentials”. Doing that, you will always be prompted to enter an account when running Visual Studio.

    To permanently change the default account used by Visual Studio to connect on TFS, I read that we have to change the credentials used for the that TFS server in the “Credentials Manager” (Control Panel > User Accounts > Credential Manager). Unfortunately  I may not do that here at the office :/

    To check with which user you are connected to TFS, check-out any file and have a look on the “User” column in the “Source Control Explorer”.

    Notice: You may run two instances of Visual Studio with distinct accounts simultaneously. There won’t be any “conflict”.


  • Samsung Kies licence agreement: “Accept” button not visible

    I am starting to hate Samsung’s softwares as much as those of HP (I experience too many issues with their softs on my PC, mainly due to my atypical hardware, I admit) !

    I have been stuck on the “licence agreement” dialog window of the latest Samsung Kies update for a while because this stupid window does not auto-resize on PC with small display (e.g.: Mini-Laptop). As a consequence, the “accept” button is not visible. And no, it’s not possible to move the window, it’s a fixed size not movable dialog box 🙁

    Fortunately, you can accept the licence agreement with the keyboard.

    Click to Read More

    1. Click on the licence agreement screen to give it the focus.
    2. Press on “Tab” and “Enter” successively until you get a message “do you really want to cancel” (“Tab” move the focus to the next control in the screen. You get the message when the focus reach the “accept” button).
    3. Click “No” (The focus goes back to the “accept” button).
    4. Press “Shift-Tab” to go back to the previous control. This one is the checkbox “I agree” (I guess :))
    5. Press the “Space Bar” to check the checkbox.
    6. Press “Tab” and “Enter” to accept the licence agreement

    That’s it.


  • Galaxy S2: Hardware ID Missing

    Since a recent Kies update, my Galaxy S2 started to throw the exception “Hardware ID Missing” every time it was plugged into my PC.

    The reason is a “bug” in the version of the SAMSUNG USB Driver for Mobile Phones installed with the Kies update. Fortunately, there is a elementary solution.

    Click to Read More

    This solution consists in installing an older version of the Samsung Driver. E.g.:  v1.4.8.0 available here, or 1.4.103 available here. I did use the 1.4.103 with success. No need to uninstall first the version currently installed. You will simply have to confirm during the setup that you want to install that version although another one is already installed.

    This issue prevents Kies to connect with the phone via USB. Concretely you see the “connecting” message for a while as well as a spinning icon looping indefinitely.


  • Samsung Kies error: PDLR has stopped working

    After a recent update, Kies started to throw the exception “PDLR has stopped working”.

    If you are looking how to solve that issue, I did google on that too and found a radical solution.

    Click to Read More

    A solution often mentioned on the web is to remove the following line from the config file (or to completely delete the file) :


    This config file is located in “%programfiles%\Samsung\Kies\External\FirmwareUpdate\KiesPDLR.exe.config” (on x64 platform: “%programfiles% (x86)”).

    This fix didn’t work for me. But another one did the trick: I did an “advanced” uninstall of Kies using the free “Revo Uninstaller” and did next a fresh re-install.


  • Syntax highlighting in WordPress

    I am using the plugin “Syntax Highlighter Evolved” to color the code samples embedded in my posts.

    This one is based, as many others, on the code syntax highlighter developed in java-script by Alex Gorbatchev.

    Click to Read More

    Here is the list of supported syntaxes [syntax name: tag]:

    ActionScript3: as3, actionscript3
    Bash/shell: bash, shell
    ColdFusion: cf, coldfusion
    C#: c-sharp, csharp
    C++: cpp, c
    CSS: css
    Delphi: delphi, pas, pascal
    Diff: diff, patch
    Erlang: erl, erlang
    Groovy: groovy
    JavaScript: js, jscript, javascript
    Java: java
    JavaFX: jfx, javafx
    Perl: perl, pl
    PHP: php
    Plain Text: plain, text
    PowerShell: ps, powershell
    Python: py, python
    Ruby: rails, ror, ruby
    Scala: scala
    SQL: sql
    Visual Basic: vb, vbnet
    XML: xml, xhtml, xslt, html, xhtml

    The easiest it to use the tags here above as shortcode around your “code”, like this: [tag]my code[/tag] where tag can be php, vb, shell, ….

    Here is a sample from Alex G.’s website using the tag “php” as a shortcode:

    [php]// SyntaxHighlighter makes your code snippets
    // beautiful without tiring your servers.
    var setArray = function(elems) {
    this.length = 0;
    push.apply(this, elems);
    return this;

    There are various options than can be set using parameters: [tag parameter=”value”]my code[/tag]. Those options are listed in the “settings” page of the plugin (See via the WordPress admin dashboard).

    The various issues I found are:

    1. Although using the parameter gutter=”true”, I cannot remove the line numbering but keep the toolbar.
    2. Copy/Paste code from an IDE does not provide a nice output:
      • The indentation is lost,
      • some lines of code become formatted as “paragraphs” and extra blank lines appears therefore
    There is however a trick to keep the original formatting of the code when copy/pasting this one.
    1. Copy first your code from the IDE
    2. Next, in your post, select the HTML view
    3. Then, in this view, add your tags [tag][/tag]
    4. Finally, paste your code between those tags and switch back to the Visual view

    If you prefer to convert your code into HTML+CSS, the best online tool I found is Pygments (Python Syntax Highlighter) which supports for free much more languages than most others, has a simple interface and display not  advertisement.


  • Synchronize with an array of disks

    Months ago, I did backup a very large disk of my PC (E:\) to multiple smaller disks connected one after one, using a e-sata cradle (G:\).

    Recently one of those small backup disk started to experience NTFS Errors and I did lost its content. To avoid restarting a complete backup of E:\, I had to find which data were lost to redo a backup of those only.

    Click to read more

    First, I did recreate the complete folder structure (i.e.: without the files) of the remaining backup disks in one folder of my PC (C:\Temp\Backups). I did reconnect the disks one after one via the e-sata Cradle and did execute each time the following command in a MS-DOS console:

    [powershell gutter=”true”] MkDir C:\Temp\Backups
    XCopy G:\ C:\Temp\Backups /T /E[/powershell]

    More details typing “XCopy /?” in your console:

    /T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories.

    The result was 22.036 folders – 0 bytes.

    Notice that the target folder (C:\Temp\Backups) must exists !

    Next, using BeyondCompare, I did a “Folder Compare” between “C:\Temp\Backups” and “E:\”.

    I did first select the option to see only the orphans, via the menu “View/Show Orphans“.

    And I did next add a “Filter” to “Exclude files”  with a name “*.*”, via the “glasses” icon (i.e.: I did exclude all the files – in order to only compare the directory structure and backup the missing ones. Otherwise, no folder in C:\Temp\Backups would have appeared as orphans as they are all empty while their equivalent folders on E:\ have content).

    Finally, in BeyondCompare, I did select all the orphan folders on E:\ and used the contextual menu “Copy To Folder…“. In the “Action” field of the “Copy to Folder” dialog box, I did pick G:\ as a destination folder.

    Et voilà.