Monday, July 26, 2010

MS SQL Column Alias

T-SQL used in Microsoft SQL Server seem to have very limited support for column alias. If you have a complex calculated column that you want to re-use in GROUP, SELECT or another expression, it will be desirable to use alias to reference the same definition everywhere so that we can have a clear and easier to understand SQL statement.


Here is an article that is very helpful in this matter: Avoid Transact-SQL's Column Alias Limitations

Key points:
  • MS SQL only allow alias in SELECT and ORDER BY
  • Use sub-query, can help in some cases to re-use column alias

Thursday, July 15, 2010

Coldfusion web services call return error: java.lang.NullPointerException

Turns out Coldfusion web services return data may contain pointer, and the receiving side will try to interpret that pointer. Once we commented out the offending data (a 2D array) in return, the error is gone.

Wednesday, July 14, 2010

DELL Quickset for Latitude E-Family

Just got a new Dell Latitude E6510 laptop. However, cannot find the familiar Dell Quickset on it.

After a couple of days' casual research, I finally found the answer: Dell Control Point is the new Quickset for Latitude E-Family.

As a side note, I like E6510.
Pros:
  • Fast
  • Bright screen
  • Nice keyboard: backlight, good touch
  • Multi-touch, allow pinch zoom, rotations, and other gesture
  • ... more
Cons: none so far.

Wednesday, July 07, 2010

Syntax Highlighting on Blogger - Gist

Here is another way to paste code into blogger with nice syntax highlighting.
  1. Go to http://gist.github.com
  2. Past the code you want to post
  3. Copy the embed tag
  4. Go back to blogger, and select "Edit Html"
  5. Paste the embed tag into your post
Below is the example source code using this tag: <script src="http://gist.github.com/467670.js?file=gistfile1.sql"></script>




A potential drawback of this approach might be the stability of github as a company. In a downturn, it may shut down with very short notice.

Compare to using SyntaxHighlighter, personally, I think this approach is way better:
  1. No setup required (in a previous post I documented how to setup syntaxhighlighter for blogger, it took me half an hour to setup everything correctly. Now with gist, there is zero setup required );
  2. Faster to create code snippet in a post;
  3. Supports more languages;
  4. No need to worry about pasting XML, HTML, or other special characters;


To paste script like below used to require replacing '<' with &lt; and '>' with &gt; manually. Now is simply copy paste without any manual changes:

Flex Builder Error 1046: "Type was not found or was not a compile-time constant"

Problem:
While editing a big .as file in Flex Builder 3, the compile is broken suddenly. Got this error:
1046: Type was not found or was not a compile-time constant: ?????.


Cause:
Seems like Flex editor tend to wrongly remove import statement at the top of .as file without user consent.

Solution:
Disable Flex Builder feature:
Windown > Preferences > Flex > Editors > ActionScript Code, uncheck "Remove unused imports when organizing"