Archive for July, 2012
Here’s one I forget every so often. What hot key combination will let you create a new folder in Windows Explorer?
In all versions of Windows, with a folder opened in Windows Explorer use
Windows 7 has added a hot key combination specifically for this task.
Thanks to How-To Geek for the tip!
I created a TrueCrypt partition on my machine that is assigned a letter when mounted through TrueCrypt. Through this drive letter TrueCrypt gives access to the files as if they were on any other drive, performing the encryption and decryption behind the scenes.
However, the encrypted partition itself is also recognized by windows and is given its own drive letter. Windows sees the partition and thinks it is unformatted and gives you the option to format it. I’d rather this “unformatted” partition not show up in Windows Explorer at all. To get rid of this drive letter do the following:
(This is for Windows XP. Vista and Windows 7 may be slightly different. If they are VERY different, email me or leave a comment with the correct procedure and I’ll update this post.)
- Right-click “My Computer” and select Manage.
- Select “Disk Management”.
- Right-click the encrypted partitionand select “Change Drive Letter and Paths…”
- Click Remove.
- Click Yes to confirm.
While working on a Java web application I was trying to import an XML file into a Microsoft SQL Server database table with an XML type column. Everything seemed to be OK except I was running into the following error:
java XML parsing: line 1, character 38, unable to switch the encoding
After much googling the consensus was that this error is raised because SQL Server stores XML in the XML type column using UTF-16 character encoding while the file I was trying to insert was UTF-8 encoded. So, I had to convert my input data from UTF-8 to UTF-16.
My original code was doing this:
String str = new String(data);
String class defaults to UTF-16 unless specified otherwise. However, to be sure I changed the above to:
String str = new String(data, "UTF-16");
Nope, didn’t work… Well, the documentation for the String constructor isn’t the greatest so maybe the encoding parameter is just used as a hint at what the input data is supposed to be. The behavior of this constructor when the given bytes are not valid in the given charset is unspecified. Not entirely clear… Just to be sure, I changed it to this:
String str = new String(data); str = new String(str.getBytes("UTF-16"), "UTF-16");
Still no luck. Ok, how about using
Charset utf8= Charset.forName("UTF-8"); Charset utf16= Charset.forName("UTF-16"); CharBuffer cb = utf8.decode(new ByteBuffer.wrap(data)); ByteBuffer outputBuffer = utf16.encode(cb); String str = new String(outputBuffer.array(), "UTF-16");
Well, looking at the XML document itself I see the XML declaration is specifying the encoding attribute as
encoding="UTF-8". I delete it and finally it works.
So, even though I changed the input to the correct encoding, the fact that this attribute was specified in the XML document itself caused SQL Server to complain. Ok fine… However, I ended up removing all the encoding conversion code that I had been playing with and reverted back to the original code:
String str = new String(data);
Tried the import again but without the encoding attribute and it still works. SQL server will do the conversion for you if the encoding attribute isn’t specified. It won’t touch it however if it is.
So, options now are, 1) either remove the encoding attribute altogether, or 2) make sure the file is UTF-16 encoded with the encoding attribute set accordingly.
It seems someone at Facebook has broken the BigPipe. Currently, the site is broken for me on both Firefox and IE8. Looks like this problem has been around for a while. Something seems to get screwed up client side but I can’t tell what. Clearing the cache and other temporary data doesn’t seem to fix it. So far, the only thing that seems to work is to reboot the machine.
Doxygen is a tool for generating documentation by extracting code structure and relations, code signatures and specially formatted comments from application source code. It’s a very powerful tool that I’ve used on several personal and work related projects.
One of the features it provides is customizability. For example, it can be configured to generate separate documentation for internal or external use. Internally used documentation may include all public and private methods of classes while external documentation my only provide documentation for public APIs.
To exclude private class members the configuration option
EXTRACT_PRIVATE which defaults to
YES should be set to
NO. If you really want to generate public documentation you likely want to exclude protected members as well. There is no
EXTRACT_PROTECTED configuration option but you can work around it by using the following:
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED = protected=private
This will cause the Doxygen engine to treat the
protected keyword as a macro and replace it with
private during processing. With
EXTRACT_PRIVATE set to
NO, protected members will also be excluded.
Fourth Woods Blog
- Culture and Copyright (1)
- Database (5)
- Emulation (1)
- Programming (44)
- Tips and Tricks (24)
- Uncategorized (3)
- December 2013
- July 2013
- June 2013
- April 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- July 2012
- May 2012
- April 2012
- March 2012
- February 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011