April 11, 2007

Implement Parallel Processing in Your Java Applications

omputing today is moving toward multi-core systems. A multi-core CPU allows the containing computer to exhibit the same thread-level parallelism as a system with multiple CPUs (see Figure 1), which represents a huge benefit in overall system throughput for properly designed applications. Figure 1. A Multi-Core CPU Architecture With manufacturers

Returning a Random set of Records

The NEWID() function returns a uniqueidentifier for each row of data that is returned. Execute the following query in the AdventureWorks database: select top 5 productid, name from production.productorder by newid() Here are the results: productid name———– ————————————————–917 LL Mountain Frame – Silver, 42722 LL Road Frame – Black, 58372

Declare the Coolest XQuery Variables

Here’s how to declare some important variables in XQuery: declare variable $v as document-node(element(*,xdt:untyped)) external;: Use this variable to pass an XML tree to a XQuery query. declare namespace nameSpace=”http://nameSpace.org”; and declare variable $nameSpace:v as xs:decimal:= 0.19;: These declare an XQuery variable into a namespace. declare variable $v as node()

Finding the Namespace for a .NET Class in Visual Studio

The following four steps outline a shortcut to finding the namespace for a .NET class. Type the name of the class in the CodeWindow. Place the cursor in this name. Press Alt+Shift+F12. A window will open and show the appropriate namespaces for the class. This is only applicable in VS

Emitting a Beep in Java

There are three ways to emit a beep in Java: Use an AU audio file: In Java, AU files need to be created at a sample rate of 8000. Higher sample rates will not work. Print the ASCII Bell character to the console, like this: public class testBeep { public

Quickly Create Incremental Numbers in an Excel Column

Normally, in Excel, you enter ‘1’ in a cell, and drag the ‘+’ sign in that cell’s border. This puts the value ‘1’ in all the cells in the drag range. Now suppose you need incremental numbers in the cells instead of the same number; hold ‘CTRL’ and drag. Excel