2008-09-20
2008-09-05
Quick way to rename objects on WinForms with Visual Studio
- Open the windows forms designer.
- Open the Document Outline (View|Other Windows|Document Outline)
- Select the objects using Document Outline and rename them using F2 (edit)

Better than renaming from Properties window?
Vista and Bluetooth Headsets
I decide to pair my Nokia BH-208 Bluetooth headset with my Compaq NX8220 laptop (running Vista Business SP1) to watch some cool videos from mix conference. I open the headset, enable the wireless and Bluetooth device and try to pair the headset. BUT the headset is not list of devices. Why? I try to understand what is going on.
A quick search on the web provides the answer.
Windows Vista RTM doesn’t support Bluetooth headsets. They include the functionality in beta versions, but they removed in RTM versions. This also includes the SP1 release which is already installed in my laptop.
I am pissed off, and decide to found a solution.
- I found that Microsoft release Windows Vista Feature Pack for Wireless for OEM vendors only, and not for general public, but the update can be found on the internet.
I download and installed it. Beware that feature pack requires SP1. - Download and install the Bluetooth device drivers from HP because headset is a Bluetooth Peripheral Device and Vista needs drivers for this.
After that the headset appears in the list of devices and paired successfully.
2008-03-20
2008-03-13
Great blog for WPF Data Binding
2007-12-13
Wallpaper Generator
Download the application from here.
FlowDocument and multiple threads

The refresh button clears the contents of the documentPanel, and creates and displays a random number of flow documents.

This works as expected and creates a random number of flow documents on window.
My next step is to make this work in asynchronous manner. How is that possible? Enter DispatcherObject and WPF Threading model.
The basic technique is to use the Dispatcher methods and delegates to do the heavy operations in a different thread.
To demonstrate this, I create a new "Refresh Async" button and modify the flow document creation to include a 5 sec Sleep.
The next step is to add the delegate and dispatcher calls. The refresh async button handler uses the Dispatcher to asynchronously call the GenerateAndShowFlowDocumentHandler method which creates and displays the flow document.

This also works fine.
The next step is to create the FlowDocument in a separete thread and use the main UI thread for UI update.

When I try this I get exceptions!.

To resolve this issue, I should serialize the FlowDocument as Memory stream since FlowDocument's seems that they can’t serialize themselves on different threads.
Add the following before passing the flow document.

And to the handler :

And it works great!!
2007-12-06
2007-10-03
More on Vista's File Copy
2007-09-13
How to port SQL Server OPENXML to Oracle PL/SQL
In my case, I use the XML document to pass an array of primary keys, use them as a filter for a table and join and return them.
For example suppose an application based on SQL Server TSQL has:
A table "BRANDS" contain a BRAND_ID (INT) and a TITLE (VARCHAR)
such as:
BRAND_ID TITLE
1 Nokia
2 Siemens
3 Other
4 IBM
5 HP
A stored procedure GET_BRAND_LIST as:
CREATE PROCEDURE dbo.GET_BRAND_LIST(@IDLIST NTEXT )
AS
DECLARE @hDoc int
EXEC sp_xml_preparedocument @hDoc OUTPUT, @IDLIST
SELECT BRAND_ID, TITLE FROM BRANDS
INNER JOIN OPENXML (@hDoc, '/s/k',2) WITH (I int) AS ResultSet
ON BRANDS.BRAND_ID = ResultSet.I
EXEC sp_xml_removedocument @hDoc
RETURN
GO
And an XML input similar to:
where:
- s is the root element
- k specifies a primary key and
- I the value of the primary key
such as:
calling GET_BRAND_LIST will return the brands with BRAND_ID equal to 1, 3 and 4.
Here is how to do the same in Oracle:
- Use CBLOB instead on NTEXT to pass the XML value.
- Use XMLType instead on sp_xml_preparedocument and sp_xml_removedocument calls.
- Use XMLSequence to convert and create a temporary table filled with the primary keys.
- Use EXTRACT to get the primary key value to perform the Join.
The complete Oracle code:
PROCEDURE GET_BRAND_LIST (cur_OUT OUT T_CURSOR, pIDLIST CLOB)
IS
anXmlType XmlType;
V_CURSOR T_CURSOR;
BEGIN
anXmlType := XmlType(pIDLIST);
OPEN V_CURSOR FOR
SELECT BRANDS.BRAND_ID, BRANDS.TITLE
FROM BRANDS,
table(XMLSequence(extract(anXMLType, '/s/k/*'))) ResultSet
WHERE BRANDS.BRAND_ID = TO_NUMBER(EXTRACT(value(ResultSet), 'I/text()'));
cur_OUT := V_CURSOR;
END;
2007-04-01
2006-05-30
The Antikythera Mechanism Research Project
2006-05-22
Game Innovation Database.
Well, GIdb goal is to classify and record every innovation in the entire history of computer and videogames.
2006-05-17
Five Years of Design
Thanks Martin.
2006-05-16
Development (Print) magazines are disappearing…
Several years ago, CMP has also ceased the publication of the “legendary” BYTE magazine which makes me very angry (back in 1998) because a valuable source of information has been lost.
Obviously big publishing companies began to realize the importance of getting all the information directly from the provider using its blog, from a Usenet forum, or from a web site found be Google Search, and they make major efforts to create software development portals to replace the gap.
The difference is obvious.