Showing posts with label Software. Show all posts
Showing posts with label Software. Show all posts

2009-04-21

Open WinCVS in a Directory or Folder

WinCVS' tips.txt file includes this tip: If you run WinCvs with a file or directory name as a command line argument, then WinCvs will locate and select it for you so you can operate on it right away. To use this feature in Windows, create a new shortcut, and in the shortcut's Target field, enter: <path to wincvs.exe> <directory path>. When you click on this shortcut, WinCvs will open in the specified folder.

Note that you start WinCvs with a path argument, the folder shown in the Workspace pane shows the correct folder but the path shown in Browser Bar is not updated; it shows the last one you chose in a previous session.

2009-04-20

Outlook 2003 Paste Special disabled

When you write or respond to a HTML-formatted message in Outlook 2003, and paste some text from another source (e.g. a Web page), the pasted text looks out of place because Outlook uses the string's original formatting, which is almost always different from the formatting in the message. If, like me, you find multiple fonts in a message ugly, you'd want to paste the text into the message without any formatting, as in MS Word's Paste Special command. However, when editing a message in Outlook 2003 in HTML format, the Edit / Paste Special menu item is disabled. According to this thread, it's only enabled if you use MS Word as your editor!

One workaround is to use GnuWin32 commands and a pipe: getclip | putclip. getclip outputs the unformatted string from the clipboard and putclip copies its input string back into the clipboard. Now, when you paste your text, it won't have any formatting.

2009-01-29

Outlook 2003 rules don't support wildcards

I use MS Outlook 2003's rules to sort notification e-mail from a bug reporting system into different folders, one folder for each combination of product and major customer. Each message is sorted based on a keyword in the message subject or body. Sorting by product name easy because it is a sub-string in the subject. Sorting by customer name requires a rule to examine the body of message and find a string whose pattern is release: <version> <customer>. Here's a simple regular expression to match this string: release: ... name (assuming that version numbers are always in the form x.y).

But I got ahead of myself. After a fruitless half an hour, I realised that Outlook 2003 rules don't support regular expressions, nor do they support wildcards, for pattern matching. If you can find a reference, please send it to me.

Rather than spend more time hacking a VBA script, I just created rules that matched the product name in the subject and the customer name anywhere in the body of the e-mail. These rules work almost all the time, and only fail when someone enters the customer name somewhere in the body of the e-mail, which is different from the release name generated by the bug reporting system.

2009-01-12

Microsoft Word 2003 symbol dialog

By accident, I found that if you double-click on a symbol character in your document in Microsoft Word 2003, the Symbol dialog is displayed. However, how does MS Word define a symbol? For instance, the dialog doesn't appear if you click on a copyright symbol but it appears if you click on a smiley face symbol.

References

2008-12-13

Gimp 2.6: Order drawing tools by keyboard accelerators

It may be easier to remember keyboard accelerators (or shortcuts) if an application's tools follow the arrangement of the keys in the keyboard. Here's how to apply that idea to the Gimp 2.6 Toolbox.

The default arrangement of tools has this key order: E (ellipse select), R (rectangle select), F (free select), U (fuzzy select), Shift+O (select by colour) …

Gimp Default Toolbox

The new arrangement follows the QWERTY layout: Q (align), E (ellipse select), R (rectangle select), T (text), U (fuzzy select) …

Gimp Rearranged Toolbox

Here's how to find and move Gimp's drawing tools:

    Gimp Tool Dialog
  1. Open the Tools dialog (see picture on the right) by select menu item Windows / Dockable Dialogs / Tools.
  2. When you type a key, Gimp will highlight the tool in the Toolbox. For example, Q highlights the Align tool.
  3. Press the up or down arrow button in bottom of the Tools dialog to move the required tool to the desired position.

It's easier to customize Gimp's toolbox than Visio's toolbar because you can find a tool by typing its keyboard accelerator, while in Visio you have to browse through the tools in the Command menu until you find the required one.

See Also

2008-12-12

Visio 2003: Order drawing tools by shortcut keys

By default, Visio 2003's drawing tools are in divided between two toolbars, Standard and Drawing, and the tools are ordered by importance or frequency.

Julian W. and I worked out that it's easier to remember the tools' shortcut keys if you move all of them into a single toolbar and arrange them by the shortcut keys, i.e. from Ctrl+1 (Pointer) to Ctrl+9 (Ellipse). Drawing tools which use Ctrl+Shift go into another group and drawing tools which don't have any shortcut keys go into a third group. Another advantage of this arrangement is that you get visual feedback when a tool is selected using its keyboard shortcut (it's highlighted); in the default arrangement, the tool selected by the keyboard shortcut is not shown if it is not the first tool in a drop-down control.

See Also

2008-12-04

Microsoft Project 2007 print time scale problem

It seemed like a simple job: print Gantt Chart of my project such that the time scale fits on one page in Microsoft Project 2007. Below is a picture of what I wanted to do:

+------+
|Page 1|
+------+
|Page 2|
+------+
|Page n|
+------+

Yet MS Project 2007 always printed the final milestone on an even page, so that I ended with twice the number of pages:

+---------+-------+
|Page 1   |Page 2 |
+---------+-------+
|Page 3   |Page 4 |
+---------+-------+
|Page 2n-1|Page 2n|
+---------+-------+

A hack by Pak K. was to shrink the view such that the scale in the top tier of dates in the Gantt Chart is in quarters. A related hack I found is to specify only one tier in the Timescale dialog (select menu item Format / Timescale).

The notes in Print a view on-line help suggests that when printing, the timescale should be scaled down little to fit a small amount of overflow, but that is not the case.

2008-12-01

Microsoft Word 2003 extra find next and find previous keyboard shortcuts

Unexpectedly found some extra keyboard shortcuts for Find Next and Find Previous functions in Microsoft Word 2003. The online help only lists Alt+Ctrl+Y for Find Next and no shortcut for Find Previous. You can also use Ctrl+PgDn for Find Next and Ctrl+PgUp for Find Previous. Bonus!

Later … Julian W. pointed out that this is part of the Browse Object feature. Press the circle icon below the page's scroll bar or type Atl+Ctrl+Home and Word displays the Browse Object panel. Select the object type you want to browse, e.g. Browse by Heading, then press the double-up or double-down arrowheads in the scrollbar to go to the previous or next object (in this case, heading). The tooltip displays the keyboard shortcuts, which are Ctrl+PgUp and Ctrl+PgDn, respectively.

Even later … Found Microsoft reference.

See Also

2008-11-20

Foxit PDF Reader Page Navigation

The Foxit PDF reader lets you can turn to the next page using Space or Right, or to previous page using Shift+Space, Left or Backspace shortcut keys. If you scroll a page, the page is moved up or down by the height of the view, so the next or previous page is always slightly shifted vertically in the view because the view is not the same height as the page. After scolling several pages, you have to adjust the view to display the whole of a page again. When reading paginated documents, it's easier to turn pages instead of scrolling through pages.

Foxit developers: The function names in italics are swapped in the on-line help.

Note: Maria H. reports that the same keys also work for the Adobe PDF Reader.

2008-09-17

Cannot Open EAP (MDB) File

When I tried to open an old EAP file, EA displayed this error message: An Error has Occurred: The Microsoft Jet database engine cannot open the file '…'. It is already opened exclusively by another user, or you need permission to view its data.. I copied the EAP file to my hard disk and tried to open it again but EA displayed the same message. Maybe there's an internal lock on the file?

An EAP file is a Microsoft Access database, so I renamed the extension from '.eap' to '.mdb' and opened it in MS-Access to see if I could unlock the file. When MS-Access displayed this warning: The database '…' is read-only., I wondered if the solution was as simple as just removing the 'Read-only' attribute from the file. Tried it and now I can open my EAP file.

2008-08-05

Change Default for Show Markup in MS-Word 2003

An annoying feature in Microsoft Word 2003 is that the default setting for the Reviewing toolbar is Final Showing Markup, so that all changes in your documents are highlighted when you open it, even after you accept all changes and saved the document previously. The solution is to unset your Security option Make hidden markup visible when opening or saving.. See How to turn off annoying MS Word Features, 'Change Default for "Show Markup" Box' for this and other solutions to Word annoyances.

2008-06-18

Creating UML Composite States in Sparx Enterprise Architect

How to create a UML composite state element using Sparx Systems' Enterprise Architect application:

  1. In a state machine diagram, create a new state element.
  2. Select the state element's context menu item Advanced / Composite Element.

The selected state element is converted into a composite state element (the image has a infinity symbol) with its own state machine diagram (check the Project Browser). Now you can draw a transition line to and from this composite state and include it in state transition tables.

Annoyingly, Enterprise Architect's on-line help describes a composite element but doesn't show to make one!

2008-06-10

Visio 2003 Cannot Resize Shape Directly with Keyboard

Microsoft Visio 2003 doesn't provide keyboard shortcut for the user to resize a shape instance. You have to use the mouse pointer or (shudder) enter the required height and width of the shape in the Size & Position window.

2008-05-24

Fix Incorrectly Encoded Unicode Files with Python

The Problem

We had a lot of text files committed into our CVS repository as Unicode format. When these files were checked out later, we found that they weren't really text files nor Unicode files because CVS had only prepended two bytes to the start of these files, FF FE, but left only one byte for encoding each character. Some text editors such as Vim could open these files but other applications such as Notepad and Excel showed only gibberish.

Unicode Encoded Text in Files

Unicode is an encoding standard … for processing, storage and interchange of text data in any language. For the purpose of fixing this problem, we just have to know how to identify and write valid Unicode files.

We use two tools to experiment and visualize the effect of different encoding methods:

  1. Microsoft Notepad editor, because it can save text files using different encoding methods.
  2. GnuWin32 od utility to output the data in a file as byte values.

Open Notepad and enter this text: Hello World. Select the File / Save As menu item. In the Save As dialog, there are four encoding methods in the Encoding drop down list: ANSI, Unicode, Unicode big endian and UTF-8. Save the same text using each of the encoding methods into four files, say TestANSI.txt, TestUnicode.txt, TestUnicodeBigEndian.txt and TestUTF8.txt, respectively.

Examine the contents of each file using od:

>od -A x -t x1 HelloANSI.txt
000000 48 65 6c 6c 6f 20 57 6f 72 6c 64
00000b

>od -A x -t x1 HelloUnicode.txt
000000 ff fe 48 00 65 00 6c 00 6c 00 6f 00 20 00 57 00
000010 6f 00 72 00 6c 00 64 00
000018

>od -A x -t x1 HelloUnicodeBigEndian.txt
000000 fe ff 00 48 00 65 00 6c 00 6c 00 6f 00 20 00 57
000010 00 6f 00 72 00 6c 00 64
000018

>od -A x -t x1 HelloUTF8.txt
000000 ef bb bf 48 65 6c 6c 6f 20 57 6f 72 6c 64
00000e

The ANSI encoded file contains 11 bytes representing the characters you typed. The Unicode encoded files contain 24 bytes, starting with a two-byte BOM and using two bytes to represent each character. If the first two bytes are FF FE, then the two bytes are stored in low-byte, high-byte order. Conversely, if the first two bytes are FE FF, then the two bytes are stored in high-byte, low-byte order. Finally, when a file starts with byte EF BB BF, only one byte is used to encode each ANSI character and two or more bytes are used to encode non-ANSI characters (not demonstrated).

Fixing Incorrectly Encoded Files in Python

Now we know the format of a Unicode encoded file: it starts with FF FE and stores each character in low-byte, high-byte order. Our text files in CVS just have ANSI characters, so we just have to insert a 0 byte between each character, starting from the third byte. Julian W. wrote a short Python script that to do this. I don't have his code right now, so here's my version for correcting the Unicode encoding for a file:

import codecs
raw = map(ord, file(r'HelloBadUnicode.txt').read())
if raw[0] == 255 and raw[1] == 254 and raw[3] != 0:
  output = codecs.open(r'HelloFixedUnicode.txt', 'w', 'UTF-16')
  for i in raw[2:]:
    output.write(chr(i))
  output.close()

References

Postscript

I started with a more complicated piece of Python code using lists and generators:

from itertools import repeat
from operator import concat

raw = map(ord, file(r'HelloBadUnicode.txt').read())
if raw[0] == 255 and raw[1] == 254 and raw[3] != 0:
  output = file(r'HelloFixedUnicode.txt','w')
  output.write(chr(255))
  output.write(chr(254))
  for i in reduce(concat, zip(raw[2:], repeat(0, len(raw)-2))):
    output.write(chr(i))
  output.close()

But then I realised I just had to write a 0 byte after each ANSI character, so here's a simpler version:

raw = map(ord, file(r'HelloBadUnicode.txt').read())
if raw[0] == 255 and raw[1] == 254 and raw[3] != 0:
  output = file(r'HelloFixedUnicode.txt','w')
  output.write(chr(255))
  output.write(chr(254))
  for i in raw[2:]:
    output.write(chr(i))
    output.write(chr(0))
  output.close()

2008-05-25. I remembered that Python had no problems with writing Unicode files, resulting in the even simpler code in the body of this article.

2008-05-13

Outlook 2003 Save HTML Limitation

If want to save an e-mail message in HTML format in Microsoft Outlook 2003, you may find that Outlook, unlike MSIE or Firefox browsers, only saves the text in the message but not any of the embedded images or attachments. Worse, Outlook doesn't warn you that it is not saving the entire message.

Another annoyance is that if you try to save an image in the message using the context menu item Save Picture As, then you can only save using BMP format.

2008-05-11

Assign USB Drives to Folder

Each time you plug in a USB device to your Windows computer, Windows can assign a different drive letter to your device. If you have programs that rely on a fixed drive letter (e.g. portable applications on a USB drive or backups) or if you use more than one computer regularly, then it gets annoying to reset the programs' configuration after plugging in your drive or remember to plug in devices in a particular sequence. Assign USB Drives to Folder describes how to use Window's Disk Management to assign a fixed path to each device.

I wonder if it's possible to refer to a device using its volume name, which would make this method redundant?

2008-02-29

Microsoft Access Export Truncates Numbers

Introduction

I wanted to export all tables from an Access database into a folder of CSV formatted text files. For most data types, such as Text or Integer, all data was exported without any loss. However, floating point numbers (Float or Double) were exported with only two decimal places.

Approach

You can export a Microsoft Access table to a text file using either the menu item File / Export or this Access SQL statement from KB208408

SELECT * INTO [Text;FMT=Delimited;HDR=Yes;Database=<Path>].[<Table>.csv] FROM <Table>

Solutions

Here's three solutions with varying advantages:

  • KB153364 article suggests formatting the number column to define the required decimal places. This solution requires writing a SQL statement for each table you're exporting.
  • You can add a schema.ini into the destination export folder and specify the number of decimal places for all floating point numbers in a table using the NumberDigits keyword. This solution requires creating or copying a schema.ini file into the export directory before exporting the tables.
  • You can change the No. of digits after decimal in your Regional and Language Options of your computer. This solution means you or your user has to remember to the change that setting on their computer before exporting the tables.

About Schema.ini File

A slight digression: schema.ini is a file used by the Text Driver to determine the characteristics of tables and columns of a database. You can find the syntax and properties of the schema.ini file in Schema.ini File (Text File Driver).

When exporting tables, Access creates a schema.ini file in the export folder if that file does not exist. If there is an existing schema.ini file and the section for the output CSV file does not exist, Access will add a new section for the output CSV file. Otherwise, Access does not change the schema.ini file.

Conclusion

None of the solutions are very satisfactory for writing a general program to export tables from an Access database into a folder of text files. The simplest solution is to define the required number of decimal places in the database connection string (the part between the square brackets in the SQL statement). However, I couldn't find any formal specification of this string on the Web.

2008-02-26

Edit Base Calendar in Project 2000

How to edit a base calendar in Microsoft Project 2000:

  1. Ensure that no or all rows in the Resource Sheet are selected.
  2. Select menu item Tools / Change Working Time.
  3. In Change Working Time dialog, select the required calendar from the drop down list, then edit the calendar.

Note that if some rows are selected in the Resource Sheet is selected, you can only change the calendar for the first resource in the selection, not a base calendar.

2008-02-12

Copy-Paste Image from CHM to Microsoft Word

If you copy-paste an image from a CHM file to Microsoft Word, you end up with a blank rectangle in your Word document. The workaround is to paste the image to a drawing program (e.g. MSPaint), then copy-paste from the drawing program into Word. Why you need to do this two-step process?

2008-02-11

Microsoft Outlook Rules and Duplicated E-mail

If you use Microsoft Outlook's rules to move incoming messages into folders, you could end up with duplicate e-mail messages if two or more rules can be applied.

Recently, I made new rules to move bug reports for some products into special product folders and I also had a "catch-all" rule to move all remaining bug reports into a general bug report folder. In other words, I had the following rules:

From bugsystem, Subject "product_1", move to "product_1" folder.
From bugsystem, Subject "product_2", move to "product_2" folder.
From bugsystem, move to "general" folder.

I thought once a rule was "fired" for a message, Outlook would process the next message. However when new bug reports arrived, Outlook created two copies of each message, one in the product's folder and one in the general bug report folder. It appears that Outlook processes all rules for a message before proceeding to the next message. Select the stop processing more rules action for each rule to make Outlook stop processing further rules for that message:

From bugsystem, Subject "product_1", move to "product_1" folder and "stop processing more rules".
From bugsystem, Subject "product_2", move to "product_2" folder and "stop processing more rules".
From bugsystem, move to "general" folder.

In Outlook 2003, Rules and Alerts dialog, you can see a hammer and spanner icon for each rule containing the stop processing more rules action.