<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;D0QAQX45eSp7ImA9WhRUFEQ.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616</id><updated>2012-01-25T13:42:20.021+01:00</updated><category term="wcf" /><category term="javafx" /><category term="TripleDES" /><category term="android authentication gae" /><category term="reflection" /><category term="flickcurl" /><category term="opensuse" /><category term="java" /><category term="cloud computing" /><category term="netsh" /><category term="windows 2008" /><category term="TFS" /><category term="tutorial" /><category term=".Net" /><category term="azure" /><category term="nunit" /><category term="delegates" /><category term="kde" /><category term="kde4" /><category term="C#" /><category term="visual studio" /><category term="nmock" /><category term="encryption" /><category term="android" /><category term="blogger" /><category term="groovy" /><category term="flickr" /><category term="groosh" /><category term="collections" /><category term="build service" /><category term="JEE" /><category term="test first" /><title>Alexander Egger's Notes and Stuff</title><subtitle type="html">Quick notes on software development and stuff I am working on.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://eggeral.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>39</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/AlexanderEggersNotesAndStuff" /><feedburner:info uri="alexandereggersnotesandstuff" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CEIFQHYyfip7ImA9WhZQE0w.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-6817148786133943314</id><published>2011-04-20T17:15:00.000+02:00</published><updated>2011-04-20T17:15:11.896+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-20T17:15:11.896+02:00</app:edited><title>Disper indicator for switching Nvidia display modes on Ubuntu 11.04 Natty</title><content type="html">This is a small Pyhton script which displays an indicator for Disper in Ubuntu 11.04 Natty (Unity desktop).&lt;br /&gt;
&lt;br /&gt;
Disper can be found at&amp;nbsp;&lt;a href="https://launchpad.net/disper"&gt;http://launchpad.net/disper&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
As far as I know this is the only command line utility which can handle the TwinView settings for Nvidia cards.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;
import gobject
import gtk
import appindicator
import commands

def single(w):
    commands.getstatusoutput('disper -s')

def extend(w):
    commands.getstatusoutput('disper -e')

def clone(w):
    commands.getstatusoutput('disper -c')

def add_menu_item(name, action):
  menu_item = gtk.MenuItem(name)
  menu.append(menu_item)
  menu_item.connect("activate", action)
  menu_item.show()
    
if __name__ == "__main__":
  ind = appindicator.Indicator ("disper-indicator",
                              "gsd-xrandr",
                              appindicator.CATEGORY_HARDWARE)
  ind.set_status (appindicator.STATUS_ACTIVE)

  menu = gtk.Menu()
 
  add_menu_item('Single', single)
  add_menu_item('Extend', extend)
  add_menu_item('Clone', clone)

  ind.set_menu(menu)

  gtk.main()
&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-6817148786133943314?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/BKUUCC35bYo97THZ3y4eRKDlR5U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BKUUCC35bYo97THZ3y4eRKDlR5U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/BKUUCC35bYo97THZ3y4eRKDlR5U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BKUUCC35bYo97THZ3y4eRKDlR5U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/8PJg7u-ZAtY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/6817148786133943314/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=6817148786133943314" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/6817148786133943314?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/6817148786133943314?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/8PJg7u-ZAtY/disper-indicator-for-switching-nvidia.html" title="Disper indicator for switching Nvidia display modes on Ubuntu 11.04 Natty" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2011/04/disper-indicator-for-switching-nvidia.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0AFQHo6eSp7ImA9Wx9XFks.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-2493465733146078801</id><published>2011-01-10T15:28:00.000+01:00</published><updated>2011-01-10T15:28:31.411+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-10T15:28:31.411+01:00</app:edited><title>Android AppEngine Login Error 500</title><content type="html">Android caches authentication tokens. Therefore when getting a 500 error while authenticating against AppEngine the reason might be a timed out authentication token. In this case the token has to be invalidated and a new login request has to be send.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;if (response.getStatusLine().getStatusCode() != 302) {
  Log.d(TAG, "Login failed. Trying again with new token.");
  AccountManager accountManager = AccountManager.get(context);
  accountManager.invalidateAuthToken("com.google",getAuthenticationToken(context));
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-2493465733146078801?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8PRaq1DAKQXQF3yszLe2ULyepqw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8PRaq1DAKQXQF3yszLe2ULyepqw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8PRaq1DAKQXQF3yszLe2ULyepqw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8PRaq1DAKQXQF3yszLe2ULyepqw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/EbC9mrY_2oE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/2493465733146078801/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=2493465733146078801" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/2493465733146078801?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/2493465733146078801?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/EbC9mrY_2oE/android-appengine-login-error-500.html" title="Android AppEngine Login Error 500" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2011/01/android-appengine-login-error-500.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUBQ3g4fCp7ImA9Wx9RGUs.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-733532539367566183</id><published>2010-12-21T21:44:00.000+01:00</published><updated>2010-12-21T21:44:12.634+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-21T21:44:12.634+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="android authentication gae" /><title>Android Google App Engine Authentication</title><content type="html">Using GAE together with Android is nice because the Google account on the Android device can be used to authenticate users in a Google App Engine application. The user does not have to create a new login or enter username and password.&lt;br /&gt;
&lt;br /&gt;
In order to make this work an authentication token has to be retrieved from Google Account on the device. Using this token a cookie from GAE is requested which can be used to authenticate HTTP connections.&lt;br /&gt;
&lt;br /&gt;
Doing all this can be tricky so I implemented the following HttpContext which gets the authentication cookie and makes working with GAE easier.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;
package axegr.android.net.http;

import java.io.IOException;

import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthenticationException;
import org.apache.http.client.CookieStore;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.params.ClientPNames;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerFuture;
import android.accounts.AccountsException;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.Context;
import android.net.http.AndroidHttpClient;
import android.os.Bundle;

public final class AuthenticatedAppEngineContext implements HttpContext {
  private HttpContext delegate_;
  private CookieStore cookieStore_;

  public static HttpContext newInstance(Context context, String uri)
      throws AccountsException, AuthenticationException {
    if (context == null)
      throw new IllegalArgumentException(&amp;quot;context is null&amp;quot;);
    return new AuthenticatedAppEngineContext(context, uri);
  }

  private AuthenticatedAppEngineContext(Context context, String uri)
      throws AccountsException, AuthenticationException {
    delegate_ = new BasicHttpContext();
    String authToken = getAuthenticationToken(context);
    AndroidHttpClient httpClient = AndroidHttpClient.newInstance(
        &amp;quot;GetAuthCookieClient&amp;quot;, context);
    try {
      httpClient.getParams().setBooleanParameter(
          ClientPNames.HANDLE_REDIRECTS, false);
      cookieStore_ = new BasicCookieStore();
      setAttribute(ClientContext.COOKIE_STORE, cookieStore_);
      HttpGet http_get = new HttpGet(uri
          + &amp;quot;/_ah/login?continue=http://localhost/&amp;amp;auth=&amp;quot; + authToken);
      HttpResponse response = httpClient.execute(http_get, this);
      checkResponse(cookieStore_, response);
    } catch (IOException e) {
      throw new AuthenticationException(
          &amp;quot;error getting the authentication cookie&amp;quot;, e);
    } finally {
      httpClient.close();
    }

  }

  private void checkResponse(CookieStore cookieStore, HttpResponse response)
      throws AuthenticationException {
    if (response.getStatusLine().getStatusCode() != 302) {
      throw new AuthenticationException(
          &amp;quot;authentication response was not a redirect&amp;quot;);
    }
    if (!isAuthenticationCookiePresent(cookieStore)) {
      throw new AuthenticationException(
          &amp;quot;authentication cookie not found in cookie store&amp;quot;);
    }
  }

  private String getAuthenticationToken(Context context)
      throws AccountsException {
    AccountManager accountManager = AccountManager.get(context);
    Account[] accounts = accountManager.getAccountsByType(&amp;quot;com.google&amp;quot;);

    if (accounts == null &amp;#124;&amp;#124; accounts.length == 0) {
      throw new AccountsException(
          &amp;quot;no account of type 'com.google' found on this device&amp;quot;);
    }

    try {
      Account account = accounts[0];
      AccountManagerFuture&amp;lt;Bundle&amp;gt; accountManagerFuture = accountManager
          .getAuthToken(account, &amp;quot;ah&amp;quot;, true, null, null);
      Bundle authTokenBundle = null;
      authTokenBundle = accountManagerFuture.getResult();
      String authToken = authTokenBundle
          .get(AccountManager.KEY_AUTHTOKEN).toString();
      return authToken;

    } catch (OperationCanceledException e) {
      throw new AccountsException(
          &amp;quot;could not get authentication token from account 'com.google'&amp;quot;,
          e);
    } catch (AuthenticatorException e) {
      throw new AccountsException(
          &amp;quot;could not get authentication token from account 'com.google'&amp;quot;,
          e);
    } catch (IOException e) {
      throw new AccountsException(
          &amp;quot;could not get authentication token from account 'com.google'&amp;quot;,
          e);
    }
  }

  private boolean isAuthenticationCookiePresent(CookieStore cookieStore) {
    for (Cookie cookie : cookieStore.getCookies()) {
      if (cookie.getName().equals(&amp;quot;ACSID&amp;quot;)
          &amp;#124;&amp;#124; cookie.getName().equals(&amp;quot;SACSID&amp;quot;))
        return true;
    }
    return false;
  }

  public Object getAttribute(String id) {
    return delegate_.getAttribute(id);
  }

  public Object removeAttribute(String id) {
    return delegate_.removeAttribute(id);
  }

  public void setAttribute(String id, Object obj) {
    delegate_.setAttribute(id, obj);
  }

}

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
And here is an example on how to use it:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;
    AndroidHttpClient client = AndroidHttpClient.newInstance(
        &amp;quot;IntegrationTestAgent&amp;quot;, this.getContext());
    try {
      String baseUri = &amp;quot;https://android-gae-http-test.appspot.com&amp;quot;;
      HttpContext httpContext = AuthenticatedAppEngineContext
          .newInstance(this.getContext(), baseUri);
      HttpGet get = new HttpGet(baseUri + &amp;quot;/authenticated/get&amp;quot;);
      HttpResponse response = client.execute(get, httpContext);
      String result = EntityUtils.toString(response.getEntity());
    } finally {
      client.close();
    }
&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-733532539367566183?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/543fvsbGM2pGRWJgbpj9nEfdH-8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/543fvsbGM2pGRWJgbpj9nEfdH-8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/543fvsbGM2pGRWJgbpj9nEfdH-8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/543fvsbGM2pGRWJgbpj9nEfdH-8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/UW5cxOSADO4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/733532539367566183/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=733532539367566183" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/733532539367566183?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/733532539367566183?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/UW5cxOSADO4/android-google-app-engine.html" title="Android Google App Engine Authentication" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2010/12/android-google-app-engine.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YDRnw6fip7ImA9Wx9TGEg.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-2441003196498201594</id><published>2010-11-27T11:52:00.000+01:00</published><updated>2010-11-27T11:52:57.216+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-27T11:52:57.216+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="android" /><title>Android Color Spinner</title><content type="html">A quick hack for choosing colors with a Spinner. The color names are not displayed, instead the values of a string array are parsed as color values.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MGZ6_RVWw6Q/TPDikR7p95I/AAAAAAAAAIY/Nae93MEF5w8/s1600/color_spinner.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_MGZ6_RVWw6Q/TPDikR7p95I/AAAAAAAAAIY/Nae93MEF5w8/s320/color_spinner.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span id="goog_1904304157"&gt;&lt;/span&gt;&lt;span id="goog_1904304158"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Lets start with the spinner&amp;nbsp;declaration:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;Spinner spinner = (Spinner) findViewById(R.id.color_spinner);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;ArrayAdapter&lt;string&gt; adapter = new ArrayAdapter&lt;string&gt;(this,&lt;/string&gt;&lt;/string&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;R.layout.color_spinner_item, new String[] { "#F5F6F6",&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"#FFC0CB", "#FF0000", "#C00000" });&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;adapter.setDropDownViewResource(R.layout.color_spinner_dropdown_item);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;spinner.setAdapter(adapter);&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Next thing is the layout definitions for the item and the dropdown item:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #0b5394;"&gt;color_spinner_dropdown_item.xml&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;view xmlns:android="http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; android:id="@android:id/text1"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; class="net.eggeral.CheckedColorTextView"&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; style="?android:attr/spinnerDropDownItemStyle"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; android:singleLine="true"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; android:layout_width="fill_parent"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; android:layout_height="?android:attr/listPreferredItemHeight"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; android:ellipsize="marquee" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #0b5394; font-family: inherit;"&gt;color_spinner_item.xml&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;view&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;class="net.eggeral.ColorTextView"&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;xmlns:android="http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;android:layout_width="fill_parent"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;android:layout_height="fill_parent"/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;And two custom views for item and dropdown item:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #0b5394; font-family: inherit;"&gt;CheckedColorTextView.java&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;package net.eggeral;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.content.Context;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.graphics.Canvas;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.graphics.Color;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.graphics.Paint;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.graphics.RectF;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.util.AttributeSet;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.widget.CheckedTextView;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;public class CheckedColorTextView extends CheckedTextView {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public CheckedColorTextView(Context context) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;super(context);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public CheckedColorTextView(Context context, AttributeSet attrs) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;super(context, attrs);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;@Override&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public void onDraw(Canvas canvas) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int color = Color.parseColor(getText().toString());&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Paint paint = new Paint();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;paint.setColor(color);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;setTextColor(color);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;canvas.drawRoundRect(new RectF(0, 0, getWidth(), getHeight()), 5, 5,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;paint);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;super.onDraw(canvas);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #0b5394; font-family: inherit;"&gt;ColorTextView.java&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;package net.eggeral.marmind;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.content.Context;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.graphics.Canvas;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.graphics.Color;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.graphics.Paint;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.graphics.RectF;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.util.AttributeSet;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;import android.widget.TextView;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;public class ColorTextView extends TextView {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public ColorTextView(Context context) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;super(context);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public ColorTextView(Context context, AttributeSet attrs) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;super(context, attrs);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;@Override&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public void onDraw(Canvas canvas) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Paint paint = new Paint();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;paint.setColor(Color.parseColor(getText().toString()));&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;canvas.drawRoundRect(new RectF(0, 0, getWidth(), getHeight()), 5, 5,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;paint);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-2441003196498201594?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xuNEWf7uQHWk5iLAYhBXtt25IUw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xuNEWf7uQHWk5iLAYhBXtt25IUw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xuNEWf7uQHWk5iLAYhBXtt25IUw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xuNEWf7uQHWk5iLAYhBXtt25IUw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/bTfQrKlGKBs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/2441003196498201594/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=2441003196498201594" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/2441003196498201594?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/2441003196498201594?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/bTfQrKlGKBs/android-color-spinner.html" title="Android Color Spinner" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_MGZ6_RVWw6Q/TPDikR7p95I/AAAAAAAAAIY/Nae93MEF5w8/s72-c/color_spinner.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2010/11/android-color-spinner.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYHQ305fSp7ImA9Wx5RE08.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-8971374312171211742</id><published>2010-08-20T18:32:00.003+02:00</published><updated>2010-08-20T18:35:32.325+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-20T18:35:32.325+02:00</app:edited><title>Wait for ExtJs Ajax Request  to Finish with Selenium</title><content type="html">To wait for an ExtJs Ajax call to finish in Selenium the following statement can be used:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;code&gt;&lt;br /&gt;_selenium.WaitForCondition("selenium.browserbot.getCurrentWindow().Ext.Ajax.isLoading() == false;", _defaultTimeout);&lt;/div&gt;&lt;div&gt;&lt;/code&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-8971374312171211742?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iSsewTlc40vVaDte4S3XQns6oqs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iSsewTlc40vVaDte4S3XQns6oqs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/iSsewTlc40vVaDte4S3XQns6oqs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iSsewTlc40vVaDte4S3XQns6oqs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/t4rjMqqPOcY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/8971374312171211742/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=8971374312171211742" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/8971374312171211742?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/8971374312171211742?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/t4rjMqqPOcY/wait-for-extjs-ajax-request-to-finish.html" title="Wait for ExtJs Ajax Request  to Finish with Selenium" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2010/08/wait-for-extjs-ajax-request-to-finish.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUUNSXk8fCp7ImA9Wx9VEkw.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-5042257092310576088</id><published>2010-06-28T10:11:00.004+02:00</published><updated>2011-01-28T13:21:38.774+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-28T13:21:38.774+01:00</app:edited><title>Powershell Remote Execution (invoke-command) with Username Password Authentication</title><content type="html">Powershell adds remote execution with 2.0. The commands are executed on the remote shell using the current local user or some other domain user specified using the &lt;code&gt;-credential&lt;/code&gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Using just username and password is not as easy and of course not very secure because the password is saved in the script. Nevertheless sometimes you just have to and here is how.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
$pass = convertto-securestring "P@ssW0rd" -asplaintext -force&lt;br /&gt;
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist "DOMAIN\User",$pass&lt;br /&gt;
invoke-command remote-machine {get-process} -credential $mycred&lt;br /&gt;
&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-5042257092310576088?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PGXpdcmWQr9Zr0zjKo-MtcKfM7g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PGXpdcmWQr9Zr0zjKo-MtcKfM7g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PGXpdcmWQr9Zr0zjKo-MtcKfM7g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PGXpdcmWQr9Zr0zjKo-MtcKfM7g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/ygSsmjwB3HM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/5042257092310576088/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=5042257092310576088" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/5042257092310576088?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/5042257092310576088?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/ygSsmjwB3HM/powershell-remote-execution-invoke.html" title="Powershell Remote Execution (invoke-command) with Username Password Authentication" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2010/06/powershell-remote-execution-invoke.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8DSHo_cCp7ImA9WxFUEUQ.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-8886247127400781971</id><published>2010-06-22T09:05:00.005+02:00</published><updated>2010-06-22T09:14:39.448+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-22T09:14:39.448+02:00</app:edited><title>Start Stop IIS7 or Any Other Service With Powershell</title><content type="html">The IIS7 service can be controlled via Powershell using the following commandline.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;(Get-WmiObject Win32_Service -Filter "Name='w3svc'").InvokeMethod("StopService",$null)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Use &lt;code&gt;StopService&lt;/code&gt; to stop the service and &lt;code&gt;StartService&lt;/code&gt; to start the service.&lt;br /&gt;&lt;br /&gt;Use any other service name instead of &lt;code&gt;w3svc&lt;/code&gt; to start or stop an arbitrary service.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-8886247127400781971?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ZKUH7gwEwaGRloxu450ArIwmooE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZKUH7gwEwaGRloxu450ArIwmooE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ZKUH7gwEwaGRloxu450ArIwmooE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZKUH7gwEwaGRloxu450ArIwmooE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/0tL6AQwdShg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/8886247127400781971/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=8886247127400781971" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/8886247127400781971?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/8886247127400781971?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/0tL6AQwdShg/start-stop-iis7-or-any-other-service.html" title="Start Stop IIS7 or Any Other Service With Powershell" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2010/06/start-stop-iis7-or-any-other-service.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4HQHw4eyp7ImA9WxNSEUU.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-6337913336754141589</id><published>2009-08-25T08:12:00.002+02:00</published><updated>2009-08-25T08:15:31.233+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-25T08:15:31.233+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>JavaFX onKeyTyped for a Scene [Update]</title><content type="html">[Update]&lt;br /&gt;Since javaFX 1.2 nodes have to set the "focusTraversable" property to "true" in order the receive key events.&lt;br /&gt;[/Update]&lt;br /&gt;&lt;br /&gt;keyTyped events are easy to use in JavaFX. Just add a function to onKeyTyped on a node and this node will be notified if a key is typed.&lt;br /&gt;&lt;br /&gt;But what if you start with an empty scene. There are no nodes which can receive the event. And there is no onKeyTyped for a scene or stage.&lt;br /&gt;&lt;br /&gt;I found two solutions for this problem. Both are some kind of a hack but they work:&lt;br /&gt;&lt;br /&gt;1. Create a CustomNode without any graphics and just a onKeyTyped and add this to the scene content.&lt;br /&gt;&lt;br /&gt;2. (my preferred solution) Use a Group which is empty at the beginning and later contains the scenes nodes. Groups do have onKeyTyped.&lt;br /&gt;&lt;br /&gt;Here is an example:&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;var stage = Stage {&lt;br /&gt;   title: "Application title"&lt;br /&gt;   fullScreen: true&lt;br /&gt;   scene: Scene {&lt;br /&gt;       content: [&lt;br /&gt;           Group {&lt;br /&gt;               focusTraversable: true&lt;br /&gt;               content: [&lt;br /&gt;               ]&lt;br /&gt;               onKeyTyped: function( e: KeyEvent) : Void {&lt;br /&gt;                   System.out.println("Hello");&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;       ]&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-6337913336754141589?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/R84PBSl-TK06LsXgAAKs0Um4g0g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R84PBSl-TK06LsXgAAKs0Um4g0g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/R84PBSl-TK06LsXgAAKs0Um4g0g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R84PBSl-TK06LsXgAAKs0Um4g0g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/9aJxW1yOvzk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/6337913336754141589/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=6337913336754141589" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/6337913336754141589?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/6337913336754141589?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/9aJxW1yOvzk/javafx-onkeytyped-for-scene-update.html" title="JavaFX onKeyTyped for a Scene [Update]" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/08/javafx-onkeytyped-for-scene-update.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4MQnc8eSp7ImA9WxNSEUU.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-9154712092920637443</id><published>2009-08-24T11:20:00.005+02:00</published><updated>2009-08-25T08:16:23.971+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-25T08:16:23.971+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="azure" /><category scheme="http://www.blogger.com/atom/ns#" term="cloud computing" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>Restful AtomPub Services with HTTP Basic Authentication in Azure</title><content type="html">Implementing a service with an AtomPub interface on Azure is quite easy. As a starting point I used the PictureRestService example from:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/wcfazure/Wiki/View.aspx?title=PictureRestService"&gt;http://code.msdn.microsoft.com/wcfazure/Wiki/View.aspx?title=PictureRestService&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Next step is to restrict the access to the interface methods to a set of authorized users. &lt;br /&gt;&lt;br /&gt;As a starting point for this I used:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd203052.aspx"&gt;http://msdn.microsoft.com/en-us/library/dd203052.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As mentioned in this guide the first thing to do is to check if the request contains an user authentication. For this the HTTP request has to contain an "Authorization" header. For a basic user name password authentication the value of this header has to be the string "basic" followed by the user name a ":" and the password. User name, ":" and password are stored in a Base64 encoded string.&lt;br /&gt;&lt;br /&gt;Here is an example which checks if the user is "eggeral" or "sven":&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;private bool AuthenticateUser(out string userName)&lt;br /&gt;        {&lt;br /&gt;            userName = null;&lt;br /&gt;            WebOperationContext ctx = WebOperationContext.Current;&lt;br /&gt;            string authHeader = ctx.IncomingRequest.&lt;br /&gt;               Headers[HttpRequestHeader.Authorization];&lt;br /&gt;            if (authHeader == null)&lt;br /&gt;            {&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;            if (!string.IsNullOrEmpty(authHeader))&lt;br /&gt;            {&lt;br /&gt;                if (authHeader.StartsWith(&amp;quot;basic &amp;quot;,&lt;br /&gt;                      StringComparison.InvariantCultureIgnoreCase))&lt;br /&gt;                {&lt;br /&gt;&lt;br /&gt;                    string userNameAndPassword = Encoding.Default.GetString(&lt;br /&gt;                        Convert.FromBase64String(authHeader.Substring(6)));&lt;br /&gt;                    string[] parts = userNameAndPassword.Split(':');&lt;br /&gt;                    userName = parts[0];&lt;br /&gt;                    string password = parts[1];&lt;br /&gt;&lt;br /&gt;                    if (userName == &amp;quot;eggeral&amp;quot; &amp;amp;&amp;amp; password == &amp;quot;secret&amp;quot;)&lt;br /&gt;                    {&lt;br /&gt;                        return true;&lt;br /&gt;                    }&lt;br /&gt;                    if (userName == &amp;quot;sven&amp;quot; &amp;amp;&amp;amp; password == &amp;quot;sven&amp;quot;)&lt;br /&gt;                    {&lt;br /&gt;                        return true;&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If the request does not contain an "Authorization" header we have to request one from the client (for example Firefox or Internet Explorer). This is done be answering the request with the status 401 Unauthorized and a "WwwAuthenticate" header which specifies the authentication mechanism. The client will then prompt the user for user name and password and resend the request to the service. &lt;br /&gt;&lt;br /&gt;Here is the code which handles this for the "PutEntry" method:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;protected override SyndicationItem PutEntry(string collection,&lt;br /&gt;     string id, &lt;br /&gt;     SyndicationItem entry)&lt;br /&gt;        {&lt;br /&gt;            string userName;&lt;br /&gt;            if (!AuthenticateUser(out userName))&lt;br /&gt;            {&lt;br /&gt;                WebOperationContext.Current.OutgoingResponse.StatusCode =&lt;br /&gt;                    HttpStatusCode.Unauthorized;&lt;br /&gt;                WebOperationContext.Current.OutgoingResponse.&lt;br /&gt;                    Headers.Add(&lt;br /&gt;                      HttpResponseHeader.WwwAuthenticate, &lt;br /&gt;                      &amp;quot;Basic realm=\&amp;quot;Task Management\&amp;quot;&amp;quot;);&lt;br /&gt;                return null;&lt;br /&gt;            }&lt;br /&gt;            // Do some stuff and return an entry.&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Of course basic authentication is not secure, but its an easy way to get started. For production systems implement a more secure method as described in Microsofts guide for Restful web services (link above).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-9154712092920637443?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kA_7JbLdMp_c4ocaZzw7B1Hb_NU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kA_7JbLdMp_c4ocaZzw7B1Hb_NU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kA_7JbLdMp_c4ocaZzw7B1Hb_NU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kA_7JbLdMp_c4ocaZzw7B1Hb_NU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/IKfzm15Dq4k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/9154712092920637443/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=9154712092920637443" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/9154712092920637443?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/9154712092920637443?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/IKfzm15Dq4k/restful-atompub-services-with-http.html" title="Restful AtomPub Services with HTTP Basic Authentication in Azure" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/08/restful-atompub-services-with-http.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cGRXg8fyp7ImA9WxNSEUU.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-6883709840874719183</id><published>2009-08-11T09:11:00.003+02:00</published><updated>2009-08-25T08:17:04.677+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-25T08:17:04.677+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="visual studio" /><category scheme="http://www.blogger.com/atom/ns#" term="build service" /><category scheme="http://www.blogger.com/atom/ns#" term="TFS" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>Using devenv.exe in MSBuild Files and TFS</title><content type="html">I need to run devenv.exe on our team build (TFS) in order to compile certain projects (for example: setups).&lt;br /&gt;&lt;br /&gt;If, like in our case, the tfsbuld.proj file is not only used on the TFS but also for local builds you have to find out here devenv.exe actually is (it depends on your Windows version an language).&lt;br /&gt;&lt;br /&gt;The trick is that MSBuild can read registry information. So you can get the install directory for Visual Studio from the registry and then use an Exec task to run devenv.exe.&lt;br /&gt;&lt;br /&gt;Here is how this works:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&amp;lt;Exec Command="&amp;amp;quot;$(Registry:HKEY_LOCAL_MACHINE\\Software\Microsoft\VisualStudio\9.0@InstallDir)\Common7\IDE\devenv&amp;amp;quot; &amp;amp;quot;$(SolutionRoot)\mysolution.sln&amp;amp;quot; /Build Release /project &amp;amp;quot;setupdir\setupproj.vdproj&amp;quot; /projectconfig Release"/&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-6883709840874719183?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1G-A8TUJ7q3nxMF86LcxXU3PPsk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1G-A8TUJ7q3nxMF86LcxXU3PPsk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1G-A8TUJ7q3nxMF86LcxXU3PPsk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1G-A8TUJ7q3nxMF86LcxXU3PPsk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/TD4IWWuYGAE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/6883709840874719183/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=6883709840874719183" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/6883709840874719183?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/6883709840874719183?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/TD4IWWuYGAE/using-devenvexe-in-msbuild-files-and.html" title="Using devenv.exe in MSBuild Files and TFS" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/08/using-devenvexe-in-msbuild-files-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUUAQ3k6eSp7ImA9WxJUF08.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-2497318556493959406</id><published>2009-07-16T08:38:00.002+02:00</published><updated>2009-07-16T08:54:02.711+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-16T08:54:02.711+02:00</app:edited><title>Multi-Tenant Systems (Mandantenfähigkeit)</title><content type="html">I am currently searching for design patterns and good practices for developing multi-tenant systems. &lt;br /&gt;&lt;br /&gt;The problem I try to solve is how to design a system so I do not have to add the tenant id to each and every method call.&lt;br /&gt;&lt;br /&gt;The first resource I found was &lt;a href="http://msdn.microsoft.com/en-us/library/aa479086.aspx"&gt;&lt;/a&gt;. This describes different approaches on how to design the data layer for multi-tenant systems. Basically you may choose between a database for each tenant, a schema for each tenant or a shared database with tenant ids stored in each table.&lt;br /&gt;&lt;br /&gt;The second resource is a design pattern at &lt;a href="http://www.ibm.com/developerworks/webservices/library/ws-multitenantpart4/index.html"&gt;&lt;/a&gt; which has a broader view on the topic and does not only discuss data but resources in general.&lt;br /&gt;&lt;br /&gt;Accessing a resource is done using the following steps:&lt;br /&gt;&lt;br /&gt; * Get the current users tenant&lt;br /&gt; * Build a filter for the resource&lt;br /&gt; * Get the resource using the filter&lt;br /&gt;&lt;br /&gt;Of course this does not solve my parameter per method problem. But maybe it brings me a step closer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-2497318556493959406?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gkrzMzKySsdNen1iMPHf50VlFGY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gkrzMzKySsdNen1iMPHf50VlFGY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gkrzMzKySsdNen1iMPHf50VlFGY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gkrzMzKySsdNen1iMPHf50VlFGY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/Df-xZNoLqqU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/2497318556493959406/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=2497318556493959406" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/2497318556493959406?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/2497318556493959406?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/Df-xZNoLqqU/multi-tenant-systems-mandantenfahigkeit.html" title="Multi-Tenant Systems (Mandantenfähigkeit)" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/07/multi-tenant-systems-mandantenfahigkeit.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cCRHY4eSp7ImA9WxNSEUU.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-4502479725353163651</id><published>2009-07-02T10:59:00.002+02:00</published><updated>2009-08-25T08:17:45.831+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-25T08:17:45.831+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>JavaFX Examples Site</title><content type="html">Found some JavaFX samples at &lt;a href="http://sites.google.com/site/javafxcodesamples/"&gt;http://sites.google.com/site/javafxcodesamples/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-4502479725353163651?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Y28MJaYqoF3XADujsNHm1pnGZj8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y28MJaYqoF3XADujsNHm1pnGZj8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Y28MJaYqoF3XADujsNHm1pnGZj8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y28MJaYqoF3XADujsNHm1pnGZj8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/UQEr1vxhHiw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/4502479725353163651/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=4502479725353163651" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/4502479725353163651?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/4502479725353163651?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/UQEr1vxhHiw/javafx-examples-site.html" title="JavaFX Examples Site" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/07/javafx-examples-site.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUFQXw4fSp7ImA9WxJQEE8.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-1945790459328099049</id><published>2009-05-22T04:19:00.006+02:00</published><updated>2009-05-22T21:56:50.235+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-22T21:56:50.235+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blogger" /><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>Post JavaFX Applications on Blogger</title><content type="html">There are several examples of blogs out there where people post JavaFX examples and applications as part of a blog post.&lt;br /&gt;&lt;br /&gt;I wanted to do this on Blogger too but there are some problems with that.&lt;br /&gt;&lt;br /&gt;The suggested method to deploy JavaFX applications via a web site is to upload the .jar and use some JavaScript which places an Applet tag into your page.&lt;br /&gt;&lt;br /&gt;First problem: You can not upload .jar files to Blogger. (As far as I know).&lt;br /&gt;&lt;br /&gt;Second problem: You can not use JavaScript in a blog post. You can add JavaScript to your template but that does not help with JavaFX applications.&lt;br /&gt;&lt;br /&gt;I do not have a real solution for the first problem. But you can of course put your .jar on any website you want. I chose my Google Pages account to do so.&lt;br /&gt;&lt;br /&gt;For the second problem I used Firebug. With Firebug you can extract the code added to your page by the JavaFX JavaScripts. I then just added this directly to my post which seams to work (well it does if you see Splash at the and of this post).&lt;br /&gt;&lt;br /&gt;The code for my Splash example is:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&amp;lt;div id=&amp;quot;deployJavaApplet1Overlay&amp;quot; style=&amp;quot;background: white none repeat scroll 0% 0%; position: absolute; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; visibility: hidden;&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;table margin=&amp;quot;0&amp;quot; padding=&amp;quot;0&amp;quot; border=&amp;quot;0&amp;quot; height=&amp;quot;200&amp;quot; width=&amp;quot;200&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;tbody&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td align=&amp;quot;center&amp;quot; valign=&amp;quot;middle&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;img imgheight=&amp;quot;100&amp;quot; src=&amp;quot;http://dl.javafx.com/javafx-loading-100x100.gif&amp;quot; width=&amp;quot;100&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/tbody&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;deployJavaApplet1&amp;quot; style=&amp;quot;position: relative; left: 0px;&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;applet archive=&amp;quot;http://alexander.egger.googlepages.com/Splash.jar,http://dl.javafx.com/applet-launcher__V1.1.1.jar,http://dl.javafx.com/javafx-rt__V1.1.1.jar,http://dl.javafx.com/fxdloader__V1.1.1.jar,http://dl.javafx.com/jmc__V1.1.1.jar,http://dl.javafx.com/emptyJarFile-1242958365842__V1.1.1.jar&amp;quot; code=&amp;quot;org.jdesktop.applet.util.JNLPAppletLauncher&amp;quot; mayscript=&amp;quot;&amp;quot; height=&amp;quot;200&amp;quot; width=&amp;quot;200&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;param name=&amp;quot;subapplet.classname&amp;quot; value=&amp;quot;com.sun.javafx.runtime.adapter.Applet&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;param name=&amp;quot;MainJavaFXScript&amp;quot; value=&amp;quot;eggeral.splash.Main&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;/applet&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Well I don't know which tricks the JavaFX JavaScripts use to get around Browser compatibility problems and alike. So I think this method might not work everywhere.  &lt;br /&gt;&lt;br /&gt;&lt;div id="deployJavaApplet1Overlay" style="background: white none repeat scroll 0% 0%; position: absolute; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; visibility: hidden;"&gt;&lt;br /&gt;&lt;table margin="0" padding="0" border="0" height="200" width="200"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td align="center" valign="middle"&gt;&lt;br /&gt;&lt;img imgheight="100" src="http://dl.javafx.com/javafx-loading-100x100.gif" width="100" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div id="deployJavaApplet1" style="position: relative; left: 0px;"&gt;&lt;br /&gt;&lt;applet archive="http://alexander.egger.googlepages.com/Splash.jar,http://dl.javafx.com/applet-launcher__V1.1.1.jar,http://dl.javafx.com/javafx-rt__V1.1.1.jar,http://dl.javafx.com/fxdloader__V1.1.1.jar,http://dl.javafx.com/jmc__V1.1.1.jar,http://dl.javafx.com/emptyJarFile-1242958365842__V1.1.1.jar" code="org.jdesktop.applet.util.JNLPAppletLauncher" mayscript="" height="200" width="300"&gt;&lt;br /&gt;&lt;param name="subapplet.classname" value="com.sun.javafx.runtime.adapter.Applet"&gt;&lt;br /&gt;&lt;param name="MainJavaFXScript" value="eggeral.splash.Main"&gt;&lt;br /&gt;&lt;/applet&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-1945790459328099049?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PXsmWwm6M3TXwu8oZBOoZhon42s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PXsmWwm6M3TXwu8oZBOoZhon42s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PXsmWwm6M3TXwu8oZBOoZhon42s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PXsmWwm6M3TXwu8oZBOoZhon42s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/dK2SZl6ZBok" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/1945790459328099049/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=1945790459328099049" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/1945790459328099049?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/1945790459328099049?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/dK2SZl6ZBok/javafx-on-blogger.html" title="Post JavaFX Applications on Blogger" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/05/javafx-on-blogger.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIMQnw5cCp7ImA9WxVXEko.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-3126974394181920057</id><published>2009-02-10T15:44:00.003+01:00</published><updated>2009-02-10T15:53:03.228+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-10T15:53:03.228+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>JavaFX Scale and Rotate About Center</title><content type="html">The transforms property of a JavaFX scene node use the default pivot point 0,0 for scaling or rotating. This means scaling a rectangle grows it to the right and down.&lt;br /&gt;&lt;br /&gt;If you want to scale or rotate about the center you can use the scaleX, scaleY and rotate properties of a node which use the center point of the node as default pivot point:&lt;br /&gt;&lt;br /&gt;The following example shows an animation of a rectangle growing and rotating about its center.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;var scale : Number = 1.0;&lt;br /&gt;var angle : Number = 10;&lt;br /&gt;var animation = Timeline {&lt;br /&gt;   repeatCount: 50&lt;br /&gt;   keyFrames: [&lt;br /&gt;       KeyFrame {&lt;br /&gt;           time: 0.2s&lt;br /&gt;           canSkip: false&lt;br /&gt;           action: function() {&lt;br /&gt;               scale += 0.1;&lt;br /&gt;               angle += 5;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;   ]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Stage {&lt;br /&gt;   title: "Scale Rectangle Over Center"&lt;br /&gt;   width: 300&lt;br /&gt;   height: 300&lt;br /&gt;   scene: Scene {&lt;br /&gt;       content: [&lt;br /&gt;           Rectangle {               &lt;br /&gt;               translateX: 10,&lt;br /&gt;               translateY: 10,&lt;br /&gt;               scaleX: bind scale,&lt;br /&gt;               scaleY: bind scale,&lt;br /&gt;               rotate: bind angle,&lt;br /&gt;               width: 140,&lt;br /&gt;               height: 90&lt;br /&gt;               fill: Color.BLACK&lt;br /&gt;           }&lt;br /&gt;       ]&lt;br /&gt;&lt;br /&gt;   }  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;animation.play()&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-3126974394181920057?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7fCi7Yhl9TNb7qtU3ezxKrq3a3w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7fCi7Yhl9TNb7qtU3ezxKrq3a3w/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7fCi7Yhl9TNb7qtU3ezxKrq3a3w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7fCi7Yhl9TNb7qtU3ezxKrq3a3w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/iv-2mQ-w6CY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/3126974394181920057/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=3126974394181920057" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/3126974394181920057?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/3126974394181920057?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/iv-2mQ-w6CY/javafx-scale-and-rotate-about-center.html" title="JavaFX Scale and Rotate About Center" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/02/javafx-scale-and-rotate-about-center.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUINRnwzeyp7ImA9WxVXEko.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-9121160927224410576</id><published>2009-02-09T07:47:00.004+01:00</published><updated>2009-02-10T15:53:17.283+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-10T15:53:17.283+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>Dynamically Adding UI Elements to JavaFX Scene Content</title><content type="html">JavaFX is nice to statically describe your UI elements. But what if you have to add something to the UI dynamically. E.g. The user presses a button and a new text should be added to the scene.&lt;br /&gt;&lt;br /&gt;Well this is easy too. Just create the new element in the action code of the button and add it to the content using JavaFX's sequential (list) handling operations.&lt;br /&gt;&lt;br /&gt;Here is an example: (Note: You have to create a variable for the stage in order to be able to access it).&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;var myX : Number = 50;&lt;br /&gt;var myY : Number = 50;&lt;br /&gt;&lt;br /&gt;var stage : Stage = Stage {&lt;br /&gt; title: "Add text"&lt;br /&gt; width: 250&lt;br /&gt; height: 250&lt;br /&gt; scene: Scene {&lt;br /&gt;     content: [&lt;br /&gt;         SwingButton {&lt;br /&gt;             text: "Add char"&lt;br /&gt;             action: function() {&lt;br /&gt;                 var myChar = Text {&lt;br /&gt;                     x: myX += 10,&lt;br /&gt;                     y: myY += 10&lt;br /&gt;                     content: "A"&lt;br /&gt;                 }&lt;br /&gt;                 insert myChar into&lt;br /&gt;                     stage.scene.content;&lt;br /&gt;             }&lt;br /&gt;         }&lt;br /&gt;     ]&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-9121160927224410576?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/35rfzpro3nXLxDeoO8vCwtYUxg8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/35rfzpro3nXLxDeoO8vCwtYUxg8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/35rfzpro3nXLxDeoO8vCwtYUxg8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/35rfzpro3nXLxDeoO8vCwtYUxg8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/WjPsmUgN-d0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/9121160927224410576/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=9121160927224410576" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/9121160927224410576?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/9121160927224410576?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/WjPsmUgN-d0/dynamically-adding-ui-elements-to.html" title="Dynamically Adding UI Elements to JavaFX Scene Content" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/02/dynamically-adding-ui-elements-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEEDSHY_fyp7ImA9WxVQFkw.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-2106786263576523985</id><published>2009-02-02T23:54:00.002+01:00</published><updated>2009-02-03T00:17:59.847+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-03T00:17:59.847+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>JavaFX onKeyTyped for a Scene</title><content type="html">keyTyped events are easy to use in JavaFX. Just add a function to onKeyTyped on a node and this node will be notified if a key is typed.&lt;br /&gt;&lt;br /&gt;But what if you start with an empty scene. There are no nodes which can receive the event. And there is no onKeyTyped for a scene or stage.&lt;br /&gt;&lt;br /&gt;I found two solutions for this problem. Both are some kind of a hack but they work:&lt;br /&gt;&lt;br /&gt;1. Create a CustomNode without any graphics and just a onKeyTyped and add this to the scene content.&lt;br /&gt;&lt;br /&gt;2. (my preferred solution) Use a Group which is empty at the beginning and later contains the scenes nodes. Groups do have onKeyTyped.&lt;br /&gt;&lt;br /&gt;Here is an example:&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;var stage = Stage {&lt;br /&gt;   title: "Application title"&lt;br /&gt;   fullScreen: true&lt;br /&gt;   scene: Scene {&lt;br /&gt;       content: [&lt;br /&gt;           Group {&lt;br /&gt;               content: [&lt;br /&gt;               ]&lt;br /&gt;               onKeyTyped: function( e: KeyEvent) : Void {&lt;br /&gt;                   System.out.println("Hello");&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;       ]&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-2106786263576523985?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GOz-R-e0mWSbCUeiHuApxJsHgXs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GOz-R-e0mWSbCUeiHuApxJsHgXs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/GOz-R-e0mWSbCUeiHuApxJsHgXs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GOz-R-e0mWSbCUeiHuApxJsHgXs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/FIuW0Z_rAVc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/2106786263576523985/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=2106786263576523985" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/2106786263576523985?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/2106786263576523985?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/FIuW0Z_rAVc/javafx-onkeytyped-for-scene.html" title="JavaFX onKeyTyped for a Scene" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/02/javafx-onkeytyped-for-scene.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4EQHo4fip7ImA9WxJQEUk.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-4286526689328180020</id><published>2009-02-02T07:37:00.005+01:00</published><updated>2009-05-24T07:28:21.436+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-24T07:28:21.436+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javafx" /><title>JavaFX fullScreen</title><content type="html">Writing a JavaFX full screen application is easy. Just set the fullScreen property of a Stage to true.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;Stage {&lt;br /&gt;  title: "Application title"&lt;br /&gt;  fullScreen: true&lt;br /&gt;  scene: Scene {&lt;br /&gt;      content: [&lt;br /&gt;          SwingButton {&lt;br /&gt;              text: "Exit"&lt;br /&gt;              action: function() {&lt;br /&gt;                  System.exit(0)&lt;br /&gt;              }&lt;br /&gt;          }&lt;br /&gt;      ]&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;There are some problems with that documented in the documentation of the fullScreen property.&lt;br /&gt;&lt;br /&gt;Setting the property to true tries to set the application to full screen using various techniques. All of which you would have to write on your own if you want to support multiple platforms.&lt;br /&gt;&lt;br /&gt;The consequence of that is that in the current version of JavaFx you can not switch an application to full screen and then switch it back again.&lt;br /&gt;&lt;br /&gt;There is a workaround for that mentioned in the documentation of the fullScreen property. You have to use two stages. One for full screen one for windowed and switch between these two.&lt;br /&gt;&lt;br /&gt;I have not tried out that but it seams to be easy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-4286526689328180020?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CO64iLD9zpYpOJcdVxMBTcRD6sg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CO64iLD9zpYpOJcdVxMBTcRD6sg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CO64iLD9zpYpOJcdVxMBTcRD6sg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CO64iLD9zpYpOJcdVxMBTcRD6sg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/Ud9AneO68VE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/4286526689328180020/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=4286526689328180020" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/4286526689328180020?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/4286526689328180020?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/Ud9AneO68VE/javafx-fullscreen.html" title="JavaFX fullScreen" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/02/javafx-fullscreen.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQFRn04fCp7ImA9WxVSGUw.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-3489111756133578272</id><published>2009-01-14T07:45:00.004+01:00</published><updated>2009-01-14T07:58:37.334+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-14T07:58:37.334+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="JEE" /><category scheme="http://www.blogger.com/atom/ns#" term="java" /><title>Serializing Inputstreams</title><content type="html">Obviously input streams can not be serialized, nevertheless I recently had a similar problem.&lt;br /&gt;&lt;br /&gt;I had to read the contents of a file (some random bytes) and call a JEE remote method with this bytes as parameter.&lt;br /&gt;&lt;br /&gt;Just calling the remote method with the FileInputStream as parameter is what you do without remoting but what to do in this case?&lt;br /&gt;&lt;br /&gt;As I was lucky and the files are small I used the following trivial solution where I just read the file into a byte array call the method with this byte array.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;FileInputStream fis = new FileInputStream(file);&lt;br /&gt;byte[] buffer = new byte[(int) file.length()];&lt;br /&gt;&lt;br /&gt;int read = fis.read(buffer);&lt;br /&gt;&lt;br /&gt;if (read != file.length())&lt;br /&gt;{&lt;br /&gt; throw new IOException("Error reading file. Only read " +&lt;br /&gt;     read + " bytes instead of "+ file.length());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sessionBean.remoteMethod(buffer);&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;This only works for small files that fit into a byte array. And I still look for a more general purpose solution. But for now it works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-3489111756133578272?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dGwRU8J_Pj7WadTff-rQV9QtGj4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dGwRU8J_Pj7WadTff-rQV9QtGj4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dGwRU8J_Pj7WadTff-rQV9QtGj4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dGwRU8J_Pj7WadTff-rQV9QtGj4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/RCY3Tc-Mhx8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/3489111756133578272/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=3489111756133578272" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/3489111756133578272?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/3489111756133578272?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/RCY3Tc-Mhx8/serializing-inputstreams.html" title="Serializing Inputstreams" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2009/01/serializing-inputstreams.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEGRnc9fCp7ImA9WxRaFk8.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-1936122392632417877</id><published>2008-12-16T14:43:00.005+01:00</published><updated>2008-12-18T18:50:27.964+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-12-18T18:50:27.964+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="windows 2008" /><category scheme="http://www.blogger.com/atom/ns#" term="netsh" /><category scheme="http://www.blogger.com/atom/ns#" term="wcf" /><title>System.Net.HttpListenerException: Access Denied Windows 2008</title><content type="html">To solve this problem:&lt;br /&gt;&lt;br /&gt;Login as Administrator and run &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;cmd &lt;/span&gt;&lt;/span&gt;or execute &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;runas /user:DOMAIN\Administrator cmd&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Execute the following line (change the URL and the user)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;netsh http add urlacl url=http://+:8081/Service user=DOMAIN\user&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thats it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-1936122392632417877?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_wkmdCbYxLqIdT9Luo_7gw7xT1U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_wkmdCbYxLqIdT9Luo_7gw7xT1U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_wkmdCbYxLqIdT9Luo_7gw7xT1U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_wkmdCbYxLqIdT9Luo_7gw7xT1U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/ruAnKm8Xr0M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/1936122392632417877/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=1936122392632417877" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/1936122392632417877?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/1936122392632417877?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/ruAnKm8Xr0M/systemnethttplistenerexception-access.html" title="System.Net.HttpListenerException: Access Denied Windows 2008" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2008/12/systemnethttplistenerexception-access.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0EGQH48fCp7ImA9WxRaEUg.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-245078770760051526</id><published>2008-12-12T14:18:00.004+01:00</published><updated>2008-12-13T08:00:21.074+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-12-13T08:00:21.074+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TripleDES" /><category scheme="http://www.blogger.com/atom/ns#" term="encryption" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>Encrypting a String in C# (.Net)</title><content type="html">There are many options to encode a string in C# (.Net).&lt;br /&gt;&lt;br /&gt;Here is mine using TripleDES encryption.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;using System;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Security.Cryptography;&lt;br /&gt;&lt;br /&gt;namespace StringEncrypter&lt;br /&gt;{&lt;br /&gt;   internal class Program&lt;br /&gt;   {&lt;br /&gt;       private static ICryptoTransform _decryptor;&lt;br /&gt;       private static ICryptoTransform _encryptor;&lt;br /&gt;&lt;br /&gt;       private static void Main()&lt;br /&gt;       {&lt;br /&gt;           var TDES = TripleDES.Create();&lt;br /&gt;&lt;br /&gt;           TDES.GenerateIV();&lt;br /&gt;           TDES.GenerateKey();&lt;br /&gt;           _encryptor = TDES.CreateEncryptor();&lt;br /&gt;           _decryptor = TDES.CreateDecryptor();&lt;br /&gt;&lt;br /&gt;           byte[] encrypted = Encrypt("secret string");&lt;br /&gt;           string decrypted = Decrypt(encrypted);&lt;br /&gt;           Console.WriteLine(decrypted);&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       private static byte[] Encrypt(string plain)&lt;br /&gt;       {&lt;br /&gt;           using (MemoryStream memoryStream = new MemoryStream())&lt;br /&gt;           {&lt;br /&gt;               using (CryptoStream cryptoStream =&lt;br /&gt;                   new CryptoStream(memoryStream, _encryptor, CryptoStreamMode.Write))&lt;br /&gt;               using (StreamWriter writer = new StreamWriter(cryptoStream))&lt;br /&gt;               {&lt;br /&gt;                   writer.Write(plain);&lt;br /&gt;               }&lt;br /&gt;               return memoryStream.ToArray();&lt;br /&gt;           }&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;       private static string Decrypt(byte[] encrypted)&lt;br /&gt;       {&lt;br /&gt;          &lt;br /&gt;           using (MemoryStream memoryStream = new MemoryStream(encrypted))&lt;br /&gt;           using (CryptoStream cryptoStream =&lt;br /&gt;               new CryptoStream(memoryStream, _decryptor, CryptoStreamMode.Read))&lt;br /&gt;           using (StreamReader reader = new StreamReader(cryptoStream))&lt;br /&gt;           {&lt;br /&gt;               return reader.ReadToEnd();&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-245078770760051526?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/A5GBRcJ8zE3_8MnwoT_V7IvWf88/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/A5GBRcJ8zE3_8MnwoT_V7IvWf88/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/A5GBRcJ8zE3_8MnwoT_V7IvWf88/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/A5GBRcJ8zE3_8MnwoT_V7IvWf88/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/0Uk0ezmtuZE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/245078770760051526/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=245078770760051526" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/245078770760051526?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/245078770760051526?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/0Uk0ezmtuZE/encrypting-string-in-c-net.html" title="Encrypting a String in C# (.Net)" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2008/12/encrypting-string-in-c-net.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEMQng8fCp7ImA9WxRXFk0.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-416796716162914912</id><published>2008-10-21T17:39:00.002+02:00</published><updated>2008-10-21T17:41:23.674+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-21T17:41:23.674+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="visual studio" /><category scheme="http://www.blogger.com/atom/ns#" term="nmock" /><category scheme="http://www.blogger.com/atom/ns#" term="test first" /><category scheme="http://www.blogger.com/atom/ns#" term="nunit" /><title>Introduction Into Unit Testing Using Visual Studio And NMock</title><content type="html">I posted some notes on Unit Testing with Visual Studio and NMock here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/View?docid=dc5v867t_140cr94fqfj"&gt;http://docs.google.com/View?docid=dc5v867t_140cr94fqfj&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have some problems to get the formatting right in Blogger. So this link is a better read.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-416796716162914912?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1jxIaxc297LlqfyaVEQvcqJriIg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1jxIaxc297LlqfyaVEQvcqJriIg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1jxIaxc297LlqfyaVEQvcqJriIg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1jxIaxc297LlqfyaVEQvcqJriIg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/SxO3_6zCZSY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/416796716162914912/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=416796716162914912" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/416796716162914912?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/416796716162914912?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/SxO3_6zCZSY/introduction-into-unit-testing-using.html" title="Introduction Into Unit Testing Using Visual Studio And NMock" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2008/10/introduction-into-unit-testing-using.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IHQXo-eSp7ImA9WxRXFUQ.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-881188669196474979</id><published>2008-10-06T18:09:00.000+02:00</published><updated>2008-10-21T16:32:10.451+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-21T16:32:10.451+02:00</app:edited><title /><content type="html">&lt;h1&gt;Discussing Software Design Decisions &lt;br&gt;&lt;/h1&gt;Having joined a new development team recently, I found myself frequently discussing rather trivial design issues with        the other team members.&lt;br&gt;&lt;br&gt;I do enjoy this discussions a lot and they do provide value to the project as the design is thought through thoroughly by several people.&lt;br&gt;&lt;br&gt;Nevertheless I was asking myself why we did not have these discussions in such depth in my previous teams. &lt;br&gt;&lt;br&gt;My answer for now is that the teams I worked with until now fell in one of three categories:&lt;br&gt;&lt;br&gt;&lt;b&gt;A&lt;/b&gt; A chief architect, technical lead, etc. made all the design decisions down to the lowest level. His decisions where never questioned as he was considered some kind of genius who was not to be questioned.&lt;br&gt;&lt;br&gt;&lt;b&gt;B&lt;/b&gt; No one really cared about the design. Everyone just did what he thought was best or maybe was the easiest way.&lt;br&gt;&lt;br&gt;&lt;b&gt;C&lt;/b&gt; The team developed a common sense for good and bad design. Smaller design decisions did not need to be discussed as everyone had the same opinion anyway.&lt;br&gt;&lt;br&gt;As much as I enjoy the discussions in my current team (category &lt;b&gt;D&lt;/b&gt;), I think the teams in category &lt;b&gt;C&lt;/b&gt; worked much more efficiently. &lt;br&gt;&lt;br&gt;Still category &lt;b&gt;D&lt;/b&gt; is better than &lt;b&gt;A&lt;/b&gt; and &lt;b&gt;B&lt;/b&gt;.&lt;br&gt;&lt;br&gt;Obviously &lt;b&gt;B&lt;/b&gt; leads to a huge pile of chunk.&lt;br&gt;&lt;br&gt;&lt;b&gt;A&lt;/b&gt; works very efficient too, but if the genius leaves the project (happened to me once) the team is left more or less clueless on how to continue. The team becomes a team of category &lt;b&gt;B&lt;/b&gt; or &lt;b&gt;D&lt;/b&gt;.&lt;br&gt;&lt;br&gt;Category &lt;b&gt;D&lt;/b&gt; teams should have to potential to evolve to a category C team and therefore become more efficient in creating software designs.&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-881188669196474979?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/idzFrz2QOQhlp_xjj6CNoh06Dfk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/idzFrz2QOQhlp_xjj6CNoh06Dfk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/idzFrz2QOQhlp_xjj6CNoh06Dfk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/idzFrz2QOQhlp_xjj6CNoh06Dfk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/ioaojdF1TPs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/881188669196474979/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=881188669196474979" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/881188669196474979?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/881188669196474979?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/ioaojdF1TPs/discussing-software-design-decisions.html" title="" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2008/10/discussing-software-design-decisions.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IHQXo9eCp7ImA9WxRXFUQ.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-701475927463409084</id><published>2008-09-30T08:57:00.000+02:00</published><updated>2008-10-21T16:32:10.460+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-21T16:32:10.460+02:00</app:edited><title /><content type="html">&lt;br /&gt;&lt;h1&gt;&lt;br /&gt;  Getting Started with Performance Testing in Visual Studio 2008&lt;br /&gt;&lt;/h1&gt;&lt;br /&gt;Analizing the performance of an application is not an easy task. Visual Studio 2008 Team System comes with a set of tools which make it easier to find the bottle necks of a system.&lt;br&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;Here is a walk through for the very basic first steps.&lt;br&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;I wrote the following program which calculates the &lt;a href="http://en.wikipedia.org/wiki/Fibonacci_number" id="diz8" title="Fibonacci"&gt;Fibonacci&lt;/a&gt; number for a given number.&lt;br&gt;&lt;br /&gt;&lt;pre id="ycrw" style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;"&gt;using System;&lt;br&gt;&lt;br&gt;namespace Fibonacci&lt;br&gt;{&lt;br&gt;  internal class Program&lt;br&gt;&amp;nbsp; {&lt;br&gt;  &amp;nbsp; private static void Main(string[] args)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   int x = 40;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Calculating the Fibonacci number for {0}.", x);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int result = Fibonacci(x);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("The Fibonacci number of {0} is {1}.",&lt;br&gt;&amp;nbsp;                       x, &lt;br&gt;                        result);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static int Fibonacci(int x)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp; if (x &amp;lt; 0)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new ArgumentException("x has to be &amp;gt;= 0", "x");&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (x == 0)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (x == 1)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Fibonacci(x - 1) + Fibonacci(x - 2);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp; }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;The calculation takes really long and I want to know where the program spends it time.&lt;br&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;So I use the Performance Wizard of Visual Studio to get some performance number for the program.&lt;br&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;div id="huia" style="padding: 1em 0pt; text-align: left;"&gt;&lt;br /&gt;  &lt;img src="http://docs.google.com/File?id=dc5v867t_133dstqnpgk_b" style="width: 300px; height: 225px;"&gt;&lt;br&gt;&lt;br /&gt;  &lt;br&gt;&lt;br /&gt;  The wizard lets me choose what to profile. I can choose almost any type of applications and libraries (even existing ones) but in this case I just go with the default selection which is my current program.&lt;br&gt;&lt;div id="x2r3" style="padding: 1em 0pt; text-align: left;"&gt;&lt;div id="xz9t" style="padding: 1em 0pt; text-align: left;"&gt;&lt;img src="http://docs.google.com/File?id=dc5v867t_134hh9whrgq_b" style="width: 647px; height: 621px;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;    Next I have to choose the profiling method, Sampling or Instrumentation. The dialog explains the pros and cons of each method. Sampling is selected by default but I tend to use Instrumentation. For my example I use Instrumentation. &lt;br&gt;&lt;br&gt;&lt;img style="width: 647px; height: 621px;" src="http://docs.google.com/File?id=dc5v867t_135fcsh25dz_b"&gt;&lt;br&gt;Thats it for this wizard. Just click Finish on the next page and you are ready for profiling.&lt;br&gt;&lt;br&gt;The next image shows the Performance Explorer which popped up after finishing the performance wizard. For my performance session (Fibonacci) the instrumented targets (binaries) are shown and an empty report. &lt;br&gt;&lt;br&gt;&lt;div id="usds" style="padding: 1em 0pt; text-align: left;"&gt;&lt;img style="width: 348px; height: 447px;" src="http://docs.google.com/File?id=dc5v867t_136fbtjd4c8_b"&gt;&lt;/div&gt;Next thing to do is launching my program with the profiler to get some performance data.&lt;br&gt;&lt;br&gt;&lt;div id="m-of" style="padding: 1em 0pt; text-align: left;"&gt;&lt;img style="width: 252px; height: 99px;" src="http://docs.google.com/File?id=dc5v867t_137dd238hcd_b"&gt;&lt;/div&gt;This first starts up the Visual Studio Performance Monitor (vsperfman.exe) and then my Fibonacci program. As the Fibonacci program is instrumented with performance probes these probes report performance data back to the Performance Monitor.&lt;br&gt;&lt;br&gt;After the Fibonacci program is finished the Performance Monitor is shut down and a performance report is generated.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;  &lt;br&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-701475927463409084?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FR1eaxdliSvMamGKGCy7FaMnU5Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FR1eaxdliSvMamGKGCy7FaMnU5Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/FR1eaxdliSvMamGKGCy7FaMnU5Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FR1eaxdliSvMamGKGCy7FaMnU5Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/gV-dyF0DSBE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/701475927463409084/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=701475927463409084" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/701475927463409084?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/701475927463409084?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/gV-dyF0DSBE/getting-started-with-performance.html" title="" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2008/09/getting-started-with-performance.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IHQXo9cSp7ImA9WxRXFUQ.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-3526237539296267771</id><published>2008-09-22T10:08:00.000+02:00</published><updated>2008-10-21T16:32:10.469+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-21T16:32:10.469+02:00</app:edited><title /><content type="html">&lt;h1&gt;Referencing DLLs in Visual Studio 2008&lt;/h1&gt;&lt;br&gt;&lt;b&gt;Following problem: &lt;br&gt;&lt;br&gt;&lt;/b&gt;In my project I have to reference the Microsoft.VisualStudio.Profiler.dll, which on my computer is at:&lt;br&gt;&lt;br&gt;C:Program FilesMicrosoft Visual Studio 9.0Team ToolsPerformance Tools&lt;br&gt;&lt;br&gt;As some of your developer machines use a German setup, on these machines this DLL is at:&lt;br&gt;&lt;br&gt;C:ProgrammeMicrosoft Visual Studio 9.0Team ToolsPerformance Tools&lt;br&gt;&lt;br&gt;So how can I tell Visual Studio to search for the DLL in different directories depending on the machine it is installed?&lt;br&gt;&lt;br&gt;The solution is easy. &lt;br&gt;&lt;br&gt;Just add the directory to the "Reference Path" in the projects properties. &lt;br&gt;&lt;br&gt;&lt;div id="dtou" style="padding: 1em 0pt; text-align: left;"&gt;&lt;img style="width: 649px; height: 381px;" src="http://docs.google.com/File?id=dc5v867t_131fftxsmc3_b"&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;The "Reference Path" is stored in "fooproject.csproj.user" so every user can set it differently without interfering with each other.&lt;br&gt;&lt;br&gt;The downside of this is that every user has to set the "Reference Path". &lt;br&gt;&lt;br&gt;It would be a better solution to be able to use the %ProgramFiles% system variable in the "Reference Path" and share this setting among all users.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-3526237539296267771?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zBJ6j-5D9QWbkOcJ42SylH6H4ho/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zBJ6j-5D9QWbkOcJ42SylH6H4ho/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zBJ6j-5D9QWbkOcJ42SylH6H4ho/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zBJ6j-5D9QWbkOcJ42SylH6H4ho/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/0kXT9jQ7A9I" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/3526237539296267771/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=3526237539296267771" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/3526237539296267771?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/3526237539296267771?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/0kXT9jQ7A9I/referencing-dlls-in-visual-studio-2008.html" title="" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2008/09/referencing-dlls-in-visual-studio-2008.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IHQXo8cSp7ImA9WxRXFUQ.&quot;"><id>tag:blogger.com,1999:blog-2713516431940312616.post-3153402975658166039</id><published>2008-08-22T22:37:00.000+02:00</published><updated>2008-10-21T16:32:10.479+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-21T16:32:10.479+02:00</app:edited><title /><content type="html">&lt;h1 id="fgle"&gt;How to Replace Nested foreach Loops With a LINQ Expression&lt;/h1&gt;The following nested foreach loops search for all test methods in an assembly:&lt;br id="hdib"&gt;&lt;br id="hdib0"&gt;&lt;pre id="ycrw" style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;"&gt;IEnumerable&amp;lt;String&amp;gt; tests = new List&amp;lt;String&amp;gt;();&lt;br id="uy0c1"&gt;&lt;br id="j_fw"&gt;Assembly a = Assembly.LoadFrom(dll);&lt;br id="uy0c3"&gt;Type[] types = a.GetTypes();&lt;br id="uy0c4"&gt;&lt;br id="j_fw1"&gt;foreach (Type type in types)&lt;br id="uy0c5"&gt;{&lt;br id="uy0c6"&gt;  if (type.IsDefined(typeof (TestClassAttribute), true))&lt;br id="uy0c7"&gt;  {&lt;br id="uy0c8"&gt;    MethodInfo[] methods = type.GetMethods();&lt;br id="uy0c9"&gt;  &lt;br id="m3bi"&gt;    foreach (MethodInfo method in methods)&lt;br id="uy0c10"&gt;    {&lt;br id="uy0c11"&gt;      if (method.IsDefined(typeof (TestMethodAttribute), true))&lt;br id="uy0c12"&gt;      {&lt;br id="uy0c13"&gt;        tests.Add(method.Name);&lt;br id="uy0c14"&gt;      }&lt;br id="uy0c15"&gt;    }&lt;br id="uy0c16"&gt;  }&lt;br id="uy0c17"&gt;}&lt;br id="uy0c18"&gt;&lt;br id="j_fw15"&gt;return tests;&lt;br id="j_fw16"&gt;&lt;/pre&gt;Using LINQ this function can be rewritten in a very compact yet very readable form:&lt;br id="fjju"&gt;&lt;pre id="fjju0" style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;"&gt;return from type in Assembly.LoadFrom(dll).GetTypes()&lt;br id="fjju1"&gt;       where type.IsDefined(typeof (TestClassAttribute), true)&lt;br id="fjju2"&gt;         from method in type.GetMethods()&lt;br id="fjju3"&gt;         where method.IsDefined(typeof (TestMethodAttribute), true)&lt;br id="fjju4"&gt;           select method.Name;&lt;/pre&gt;The first from - where part selects all types which are test classes. The second from where part walks through this list and searches for all methods which are test methods. From these methods the method name is added to the return value.&lt;br id="hqpb"&gt;&lt;br id="hqpb0"&gt;Note that in LINQ you can combine from - where clauses to generate nested queries.&lt;br id="uy0c25"&gt;             &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2713516431940312616-3153402975658166039?l=eggeral.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/NK5v5SkDMLvP_XEe2qHnchQJwrs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NK5v5SkDMLvP_XEe2qHnchQJwrs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/NK5v5SkDMLvP_XEe2qHnchQJwrs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NK5v5SkDMLvP_XEe2qHnchQJwrs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AlexanderEggersNotesAndStuff/~4/40bHbhxrPTg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://eggeral.blogspot.com/feeds/3153402975658166039/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2713516431940312616&amp;postID=3153402975658166039" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/3153402975658166039?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2713516431940312616/posts/default/3153402975658166039?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AlexanderEggersNotesAndStuff/~3/40bHbhxrPTg/how-to-replace-nested-foreach-loops.html" title="" /><author><name>Alexander Egger</name><uri>https://profiles.google.com/106928350324786627679</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-gLFyuEiTjr4/AAAAAAAAAAI/AAAAAAAAAAA/zpzAG7G4EyA/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://eggeral.blogspot.com/2008/08/how-to-replace-nested-foreach-loops.html</feedburner:origLink></entry></feed>

