2014-12-19

Eclipse ADT woes


Eclipse ADT woes

I have recently decided to update my Eclipse ADT development environment with the latest Google updates and SDK’s. Well, even though that process seem to complete flawlessly (thanks to SDK Manager) in reality my whole Eclipse installation has been damaged in such a way that I could not even possibly create a simple, one-activity application.

It appears that the problems are related to the SDK installation of Android and I’ve decided to dig into and try to find out what’s going on.

So, I install everything from scratch (adt-bundle-windows-x86_64-20140702.zip) and do some tests to find out what occurred. My initial ADT Eclipse installation which I used to create, build and run apps without any problems includes the following:

o    Tools:

·   Android SKD Tools: Rev 23.0.2

·   Android SDK Platform-tools: Rev 20

·   Android SDK Build-Tools: Rev 20

o    Android 4.4W (API 20)

·   SDK Platform : API 20, Rev 1

o    Extras

·   Android Support Library: Rev 20

 

The issues are related to the latest (as of 2014 December 19th) Android SDK Tools, Platform tools, Build tools and the (famous) support library which are displayed below:

o    Tools:

·   Android SDK Tools, Rev 24.0.2

·   Android SDK Platform tools, Rev 21

o    Android 4.4W (API 20)

·   SDK Platform, Rev 2

o    Extras

·   Android Support Library, Rev 21.0.3

 

After installing these updates, Eclipse ADT fail to create and build apps correctly giving a wealth of different error messages (related to appcompat, R generated files, null pointers, etc.)

The only way to avoid all these issues is to AVOID the update and stick to the original API 20 or the API 19 release (Android 4.4.2 (API 19) SDK Platform, Rev 4).

 

2008-12-03

WPF applications and CA2104 rule

If you are using static fields such as:

 public static class Constants

    {

        public static readonly FontFamily MyFontFamily  = new  FontFamily("Segoe UI");

    }

with “{x:Static}” markup extensions such as:

FontFamily="{x:Static this:Constants.MyFontFamily  }"

you will get the following warning:

CA2104 : Microsoft.Security : Remove the read-only designation from 'Constants.MyFontFamily' or change the field to one that is an immutable reference type. If the reference type 'FontFamily' is, in fact, immutable, exclude this message.


If you remove the “readonly” modifier you get a different warning:

CA2211 : Microsoft.Usage : Consider making 'Constants.MyFontFamily' non-public or a constant.             

In order to solve the problem convert the field, to a property with get accessor only, such as:

public static FontFamily MyFontFamily

        {

            get

            {

                return new FontFamily("Segoe UI");

            }

        }

2008-09-20

Cool way to show crashed plugins

Google’s Chrome has a cool way to display crashed plugins such as Flash.
A sad puzzle piece icon!




2008-09-05

Quick way to rename objects on WinForms with Visual Studio

Here is a quick way to rename objects of windows forms:

  1. Open the windows forms designer.
  2. Open the Document Outline (View|Other Windows|Document Outline)
  3. 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.

  1. 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.
  2. 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-13

Read the news in a different way!

Great blog for WPF Data Binding

Beatriz Costa works in the Data Binding Test Team and has great information for data binding.

2007-12-13

Wallpaper Generator

A nice WPF application that creates a wallpaper based on a photo folder.

Download the application from here.

FlowDocument and multiple threads

Recently, I try to use the FlowDocumentScrollViewer to display FlowDocument's. So I create WPF window application that creates and displays flow documents with FlowDocumentScrollViewer.





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!!