Android automated black box testing with Robotium

Requirements

  • Android SDK (version r11)
  • Robotium (version 3.0)
  • Eclipse Helios

Introduction

Automated tests are key in maintaining high quality software. They help catch bugs immediately when introducing new code and also ensure that new features do not conflict with existing functionality. Another advantage of automated tests, specially for Android applications is that it greatly speeds up testing when you have multiple builds for different devices. In this blog post I’ll go over how we use robotium in our TASS mobile project to implement automated black box tests.

Robotium is a plugin that extends existing instrumentation tests available on Android and addresses its shortcomings. Limitations such as slow execution times and having to manually delay the application to wait for the desired screen to be ready. For example, delays caused by waiting for a network request to complete before proceeding to the next screen. Robotium works by sending screen commands such touch, swipe and keyboard input to the Android emulator running an application and verifying the resulting screen.

Create Android Test Project

We’ll first create a new Android Test project; make sure that the Android project that will be tested is currently in the workspace.

  1. File → New → Other. Select Android/Android Test Project. Click Next.
  2. Fill out next screen. Make sure that under Test Target you select the project that will be tested.
  3. Download robotium 3.0 jar and place it in your project under a lib/ folder. Create the folder if necessary.
  4. Add the robotium jar file to the build path. Right click on the project → Build Path → Configure Build Path
  5. Click Add JARs.
  6. Select robotium-solo-3.0.jar. Click OK.

Write Unit Test

  1. Create a new unit test. Right click on the test project → New → JUnit Test Case
  2. Name the unit test. I called mine, MainTest. Click OK.
  3. Insert the following snippet to TestMain.java. This snippet opens the login screen (Home.class) on our TASS mobile application and enters the username and password located at the first textbox and second textbox. It will then click the login button. It verifies the success of the authentication by looking for the username text in the authenticated screen.
package com.tallan.tass.android.test;

import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.Smoke;

import com.jayway.android.robotium.solo.Solo;
import com.tallan.tass.android.Home;

public class TestMain extends ActivityInstrumentationTestCase2<Home> {

	private Solo solo;

	public TestMain() {
		super("com.tallan.tass.android", Home.class);
	}

	@Override
	public void setUp() throws Exception {
		solo = new Solo(getInstrumentation(), getActivity());
	}

	@Smoke
	public void testLogin() throws Exception {
		solo.clearEditText(0);
		solo.clearEditText(1);
		solo.enterText(0, "ckim");
		solo.enterText(1, "p4ssword");
		solo.clickOnImageButton(0);

		boolean expected = true;
		boolean actual = solo.searchText("ckim");
		assertEquals("Logged in", expected, actual);
	}

	@Override
	public void tearDown() throws Exception {
		try {
			// Robotium will finish all the activities that have been opened
			solo.finalize();
		} catch (Throwable e) {
			e.printStackTrace();
		}
		getActivity().finish();
		super.tearDown();
	}

}

Run Unit Test

  1. First launch the test target application. Right click, Debug As → Android Application. This will launch the application in the emulator.
  2. Run the unit test. Right click the test project. Run As → Android JUnit Test.
  3. We can see the result of the test under the JUnit tab and the test passed.

    Conclusion

    Robotium makes writing unit tests a breeze and is a solid option for your Android project. Another added benefit of Robotium is that it can integrated with Maven to have a fully automated build and test process. The sample unit test can be downloaded at the link below.

Resources

TestMain.java

Posted in Uncategorized | Tagged , , | 1 Comment

SQL Server 2012 Windowing Functions Part 1 of 2: Running and Sliding Aggregates

The first windowing capabilities appeared in SQL Server 2005 with the introduction of the OVER clause and a set of ranking functions (ROW_NUMBER, RANK, DENSE_RANK, and NTILE). The term “window,” as it is used here, refers to the scope of visibility from one row in a result set relative to neighboring rows in the same result set. By default, OVER produces a single window over the entire result set, but its associated PARTITION BY clause lets you divide the result set up into distinct windows—one per partition. Furthermore, its associated ORDER BY clause enables cumulative calculations within each window.

In addition to the four ranking functions, the OVER clause can be used with the traditional aggregate functions (SUM, COUNT, MIN, MAX, AVG). This is extremely useful, because it allows you to calculate aggregations without being forced to summarize all the detail rows with a GROUP BY clause. However, prior to SQL Server 2012, running and sliding calculations with an associated ORDER BY clause was supported only for the ranking functions. Using ORDER BY with OVER for any of the aggregate functions was not allowed. This has severely limited the windowing capability of OVER since its introduction in SQL Server 2005.

Fortunately, SQL Server 2012 finally addresses this shortcoming. In this blog post, the first in a two-part article, I’ll show you how to use OVER/ORDER BY with all the traditional aggregate functions in SQL Server 2012 to provide running aggregates within ordered windows and partitions. I’ll also show you how to frame windows using the ROWS or RANGE clause, which adjusts the size and scope of the window and enables sliding aggregations. SQL Server 2012 also introduces eight new analytic functions that are designed specifically to work with ordered (and optionally partitioned) windows using the OVER clause. I will cover those new analytic functions in Part 2.

To demonstrate running and sliding aggregates, create a table and populate it with sample financial transactions for several different accounts, as shown below. (Note the use of the DATEFROMPARTS function, also new in SQL Server 2012, which is used to construct a date value from year, month, and day parameters.)

CREATE TABLE TxnData (AcctId int, TxnDate date, Amount decimal)
GO

INSERT INTO TxnData (AcctId, TxnDate, Amount) VALUES
  (1, DATEFROMPARTS(2011, 8, 10), 500),  -- 5 transactions for acct 1
  (1, DATEFROMPARTS(2011, 8, 22), 250),
  (1, DATEFROMPARTS(2011, 8, 24), 75),
  (1, DATEFROMPARTS(2011, 8, 26), 125),
  (1, DATEFROMPARTS(2011, 8, 28), 175),
  (2, DATEFROMPARTS(2011, 8, 11), 500),  -- 8 transactions for acct 2
  (2, DATEFROMPARTS(2011, 8, 15), 50),
  (2, DATEFROMPARTS(2011, 8, 22), 5000),
  (2, DATEFROMPARTS(2011, 8, 25), 550),
  (2, DATEFROMPARTS(2011, 8, 27), 105),
  (2, DATEFROMPARTS(2011, 8, 27), 95),
  (2, DATEFROMPARTS(2011, 8, 29), 100),
  (2, DATEFROMPARTS(2011, 8, 30), 2500),
  (3, DATEFROMPARTS(2011, 8, 14), 500),  -- 4 transactions for acct 3
  (3, DATEFROMPARTS(2011, 8, 15), 600),
  (3, DATEFROMPARTS(2011, 8, 22), 25),
  (3, DATEFROMPARTS(2011, 8, 23), 125)

Running Aggregations

Used by itself, the OVER clause operates over a window that encompasses the entire result set of a query. Windows can be partitioned in your queries using OVER with PARTITION BY, enabling partition-level aggregations to be calculated for each window. And with SQL Server 2012, an ORDER BY clause can also be specified with OVER to achieve row-level running aggregations within each window. The following code demonstrates the use of OVER with ORDER BY to produce running aggregations:

SELECT AcctId, TxnDate, Amount,
  RAvg = AVG(Amount) OVER (PARTITION BY AcctId ORDER BY TxnDate),
  RCnt = COUNT(*)    OVER (PARTITION BY AcctId ORDER BY TxnDate),
  RMin = MIN(Amount) OVER (PARTITION BY AcctId ORDER BY TxnDate),
  RMax = MAX(Amount) OVER (PARTITION BY AcctId ORDER BY TxnDate),
  RSum = SUM(Amount) OVER (PARTITION BY AcctId ORDER BY TxnDate)
 FROM TxnData
 ORDER BY AcctId, TxnDate

AcctId TxnDate    Amount RAvg        RCnt RMin RMax RSum
------ ---------- ------ ----------- ---- ---- ---- ----
1      2011-08-10 500    500.000000  1    500  500  500
1      2011-08-22 250    375.000000  2    250  500  750
1      2011-08-24 75     275.000000  3    75   500  825
1      2011-08-26 125    237.500000  4    75   500  950
1      2011-08-28 175    225.000000  5    75   500  1125
2      2011-08-11 500    500.000000  1    500  500  500
2      2011-08-15 50     275.000000  2    50   500  550
2      2011-08-22 5000   1850.000000 3    50   5000 5550
 :

The results of this query are partitioned (windowed) by account. Within each window, the account’s running averages, counts, minimum/maximum values, and sums are ordered by transaction date, showing the chronologically accumulated values for each account. No ROWS clause or RANGE clause is specified, so ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW is assumed by default. This yields a window frame size that spans from the beginning of the partition (the first row of each account) through the current row. When the account number changes, the previous window is “closed” and new calculations start running for a new window over the next account number.

Sliding Aggregations

You can narrow each account’s window by framing it with a ROWS BETWEEN n PRECEDING AND CURRENT ROW clause within the OVER clause. This enables sliding calculations, as demonstrated by this slightly modified version of the previous query:

SELECT AcctId, TxnDate, Amount,
  SAvg = AVG(Amount)
          OVER (PARTITION BY AcctId ORDER BY TxnDate
          ROWS BETWEEN 2 PRECEDING AND CURRENT ROW),
  SCnt = COUNT(*)
          OVER (PARTITION BY AcctId ORDER BY TxnDate ROWS 2 PRECEDING),
  SMin = MIN(Amount)
          OVER (PARTITION BY AcctId ORDER BY TxnDate ROWS 2 PRECEDING),
  SMax = MAX(Amount)
          OVER (PARTITION BY AcctId ORDER BY TxnDate ROWS 2 PRECEDING),
  SSum = SUM(Amount)
          OVER (PARTITION BY AcctId ORDER BY TxnDate ROWS 2 PRECEDING)
 FROM TxnData
 ORDER BY AcctId, TxnDate

AcctId TxnDate    Amount SAvg        SCnt SMin SMax SSum
------ ---------- ------ ----------- ---- ---- ---- ----
1      2011-08-10 500    500.000000  1    500  500  500
1      2011-08-22 250    375.000000  2    250  500  750
1      2011-08-24 75     275.000000  3    75   500  825
1      2011-08-26 125    150.000000  3    75   250  450
1      2011-08-28 175    125.000000  3    75   175  375
2      2011-08-11 500    500.000000  1    500  500  500
2      2011-08-15 50     275.000000  2    50   500  550
2      2011-08-22 5000   1850.000000 3    50   5000 5550
 :

This query specifies ROWS BETWEEN 2 PRECEDING AND CURRENT ROW in the OVER clause for the RAvg column, overriding the default window size. Specifically, it frames the window within each account’s partition to a maximum of three rows: the current row, the row before it, and one more row before that one. Once the window expands to three rows, it stops growing and starts sliding down the subsequent rows until a new partition (the next account) is encountered. The BETWEEN…AND CURRENT ROW keywords that specify the upper bound of the window are assumed default, so to reduce code clutter, the other column definitions specify just the lower bound of the window with the shorter variation ROWS 2 PRECEDING.

Notice how the window “slides” within each account. For example, the sliding maximum for account 1 drops from 500 to 250 in the fourth row, because 250 is the largest value in the window of three rows that begins two rows earlier—and the 500 from the very first row is no longer visible in that window. Similarly, the sliding sum for each account is based on the defined window. Thus, the sliding sum of 375 on the last row of account 1 is the total sum of that row (175) plus the two preceding rows (75 + 125) only—not the total sum for all transactions in the entire account, as the running sum had calculated.

Using RANGE versus ROWS

Finally, RANGE can be used instead of ROWS to handle “ties” within a window. While ROWS treats each row in the window distinctly, RANGE will merge rows containing duplicate ORDER BY values, as demonstrated by the following query:

SELECT AcctId, TxnDate, Amount,
 SumByRows = SUM(Amount) OVER (ORDER BY TxnDate ROWS UNBOUNDED PRECEDING),
 SumByRange= SUM(Amount) OVER (ORDER BY TxnDate RANGE UNBOUNDED PRECEDING)
 FROM TxnData
 WHERE AcctId = 2
 ORDER BY TxnDate

AcctId TxnDate    Amount SumByRows SumByRange
------ ---------- ------ --------- ----------
2      2011-08-11 500    500       500
2      2011-08-15 50     550       550
2      2011-08-22 5000   5550      5550
2      2011-08-25 550    6100      6100
2      2011-08-27 105    6205      6300
2      2011-08-27 95     6300      6300
2      2011-08-29 100    6400      6400
2      2011-08-30 2500   8900      8900

In this result set, ROWS and RANGE both return the same values, with the exception of the fifth row. Because the fifth and sixth rows are both tied for the same date (8/27/2011), RANGE returns the combined running sum for both rows. The seventh row (for 8/29/2011) breaks the tie, and ROWS “catches up” with RANGE to return running totals for the rest of the window.

Conclusion

Windowing functions using the OVER clause have been greatly enhanced in SQL Server 2012. In addition to the 4 ranking functions, running and sliding calculations with OVER/ORDER BY is now supported for all the traditional aggregate functions as well. SQL Server 2012 also introduces eight new analytic functions that are designed specifically to work with ordered (and optionally partitioned) windows using the OVER clause. Stay tuned for Part 2, which will show you how to use these new analytic windowing functions.

Posted in SQL Server | Tagged | 3 Comments

Build your Android project in one step with Maven

Requirements

I will assume the following has been installed and configured.

  • Android SDK (r07 or later)
  • Maven 3 (version 3.0.3)
    1. Set environment variable ANDROID_HOME to point to the root directory of the Android SDK.
    2. Add ANDROID_HOME/tools to your PATH environment variable.
  • An Android project to build

Introduction

Building an Android project consists of 3 steps. The code is compiled to create an executable apk file, then the apk is signed and finally zipaligned to optimize disk space usage on the mobile device.

Executing these steps manually is prone to human error and can lead to bad builds. This can happen due to forgetting to sign the package, missing dependencies, etc. It is also time consuming especially if you have fast iteration cycles and/or multiple build configurations for different version of the Android OS. Using Maven and android-maven-plugin we can create a one step process to manage dependencies, build, sign and zipalign your Android project.

In this post I will walk you through the setup we have for TASS Mobile, our internal Android client for our time tracking application.

Breakdown of pom.xml

Basic information

The pom.xml file is the configuration file that tells Maven how to build the Android project. The first section of the configuration file includes basic information about the project such as name, groupId and version number. This is what it looks like for our TASS mobile app.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.tallan.tass</groupId>
  <artifactId>android</artifactId>
  <version>0.35-SNAPSHOT</version>
  <packaging>apk</packaging>
  <name>TASS Android</name>

Dependencies

This is where Maven really facilitates the build process. The TASS Mobile app for Android uses the guice and roboguice libraries for dependency injection. Fortunately guice and roboguice are available in the Maven central repository so all we need to do is include them under the dependency section along with the Android library. Make sure the Android version matches your target Android version.

  <dependencies>
    <dependency>
      <groupId>com.google.android</groupId>
      <artifactId>android</artifactId>
      <version>2.1.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice</artifactId>
      <version>2.0-no_aop</version>
    </dependency>
    <dependency>
      <groupId>org.roboguice</groupId>
      <artifactId>roboguice</artifactId>
      <version>1.1</version>
    </dependency>
  </dependencies>

Build Steps

The standard maven-compiler-plugin in conjunction with maven-android-plugin will create the application apk file, it will also zipalign it after signing the apk which we cover in the next step. Make sure the platform variable is set to the target device Android OS version.

  <build>
    <finalName>${project.groupId}.${project.artifactId}-${project.version}</finalName>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3</version>
      </plugin>
      <plugin>
        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
        <artifactId>maven-android-plugin</artifactId>
        <version>2.8.4</version>
        <configuration>
          <sdk>
            <platform>7</platform>
          </sdk>
          <emulator>
            <avd>16</avd>
          </emulator>
          <sign>
            <debug>false</debug>
          </sign>
          <zipalign>
            <verbose>true</verbose>
            <skip>false</skip>
            <inputApk>${project.build.directory}/${project.build.finalName}.apk</inputApk>
            <outputApk>${project.build.directory}/${project.build.finalName}-aligned.apk</outputApk>
          </zipalign>
          <undeployBeforeDeploy>true</undeployBeforeDeploy>
        </configuration>
        <executions>
          <execution>
            <id>zipalign</id>
            <phase>verify</phase>
            <goals>
              <goal>zipalign</goal>
            </goals>
          </execution>
        </executions>
        <extensions>true</extensions>
      </plugin>

In this section we configure maven-jarsigner-plugin to sign the apk file. Set the keystore, storepass, keypass and alias parameters with you own.

      <plugin>
        <artifactId>maven-jarsigner-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <id>signing</id>
            <goals>
              <goal>sign</goal>
            </goals>
            <phase>package</phase>
            <inherited>true</inherited>
            <configuration>
              <archiveDirectory></archiveDirectory>
              <includes>
                <include>${project.build.directory}/target/*.apk</include>
              </includes>
              <keystore>c:/certs/tallan.keystore</keystore>
              <storepass>*****</storepass>
              <keypass>******</keypass>
              <alias>tallan</alias>
            </configuration>
          </execution>
        </executions>
      </plugin>

This step consolidates the application version in the pom.xml file with application version in the AndroidManifest.xml file. This will come handy when you setup a fully automated release management process.

      <plugin>
        <groupId>org.codehaus.groovy.maven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <source>
                try {
                def manifestFile = new File("AndroidManifest.xml")
                def ns = new groovy.xml.Namespace("http://schemas.android.com/apk/res/android", "ns")
                def parser = new groovy.util.XmlParser(false, true)
                def rootNode = parser.parse(manifestFile)
                def attributes = rootNode.attributes()
                attributes[ns.versionName] = "${project.version}"
                def writer = new groovy.io.GroovyPrintWriter(manifestFile)
                writer.println('&lt;?xml version="1.0" encoding="UTF-8"?&gt;')
                def xmlWriter = new groovy.util.XmlNodePrinter(writer)
                xmlWriter.setPreserveWhitespace(false)
                xmlWriter.setNamespaceAware(true)
                xmlWriter.print(rootNode)
                } catch (FileNotFoundException e)
                {
                println('No AndroidManifest.xml file found. Skipping version update.')
                println('Probably not an Android project, but a library.')
                println('Skipping version update.')
                }
              </source>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

Profiles

This is the default profile I’ve created for building, signing and ziapligning the project. There are other options available but this is all you need to create a usable build.

  <profiles>
    <profile>
      <id>release</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
    </profile>
  </profiles>
</project>

Once you have configured your project all you need to do is type the following command and Maven will build a binary ready to run on your Android device. Look for the apk file under the target/ folder in your project.

mvn clean install -Prelease

or simply

mvn clean install

Files

pom.xml

Posted in Uncategorized | Tagged , , , | Leave a comment

How to setup TFS Check-in alerts for specific folders in Visual Studio 2008 and 2010

Overview

This walkthrough will explain how to setup email alerts in TFS when there is a check-in. Using this method, you can not only select a TFS Project, but you can also select an individual folder. This is useful if you are not interested in some folders in the project, but want alerts on others.

TFS Check-In Alerts in Visual Studio 2008

First, TFS Power Tools must be installed for Visual Studio 2008 (Link), and Team Explorer (Link).

First make sure you are connected to TFS.

Tools >> Connect to Team Foundation Server…

Open Source Control Explorer.

View >> Other Windows >> Source Control Explorer.

Navigate to the folder that you want notifications on.

Right click and select "Alert on Change…"

clip_image001

The following popup window will display. From here you can set the alert name and the email that you want to send it to. It will try to default itself to the folder name and your email.

clip_image002

After that, you can view and modify the alert from the "Alerts Editor"

Team >> Alerts Editor…

clip_image003

You can also access that menu from the Team Explorer:

clip_image004

Once you open that, the original alert definition is as follows:

clip_image005

I usually don’t mind getting an alert when I check-in, so I usually remove the second row from the grid. You can also specify this in the add dialog above, but I wanted to display it here as an example.

From here, you can modify the alert as necessary. If you have a nightly or weekly build you may not want notifications from that, so you can exclude those as shown below.

clip_image006

From the Alerts Editor, you can also specify other event types shown below.

Work Item Alerts

clip_image007

Check In Alerts

clip_image008

Build Alerts

clip_image009

TFS Check-In Alerts in Visual Studio 2010

This can also be done in Visual Studio 2010, but you will need the TFS 2010 Power Tools (Link)

The setup or modification of alerts is very similar to that in Visual Studio 2008. One difference shown below is how you access the Alerts Explorer from Team Explorer.

Instead of clicking on the "Alerts" button for a specific project, you have to right click on the TFS server, and select Alerts Explorer.

clip_image010

You can still access this menu from Team >> Alerts Explorer as in Visual Studio 2008.

You also still get the same "Alert on Change…" option from Source Control Explorer.

clip_image011

Hope this helps.

Resources

Visual Studio Power Tools: http://msdn.microsoft.com/en-us/vstudio/bb980963.aspx

TFS 2008 Power Tools: http://www.microsoft.com/download/en/details.aspx?DisplayLang=en&id=15836

Team System 2008 Team Explorer: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=16338

TFS 2010 Power Tools: http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f

Robert Lanzilli (robert.lanzilli@tallan.com)

Posted in Enterprise .NET | Tagged , , , , | Leave a comment

Book Announcement! Introducing “Programming Microsoft SQL Server 2012″

I’m very happy to announce that I am authoring Tallan’s new book on SQL Server 2012! The full title, “Programming Microsoft SQL Server 2012” will technically be published by O’Reilly, yet it will be branded as a Microsoft Press book, and will feature Tallan’s logo on the front cover. O’Reilly recently acquired MS Press, but retained the Microsoft logo and theme, which I’m really glad about. I much prefer the picture of a cool tool on a black and red cover over some some weird animal, don’t you?

This book is an update to the SQL Server 2008 edition I wrote three years ago, with many similarities but also some very notable differences. I’m extremely pleased to once again team together with Andrew Brust, who will be writing the chapters on SQL CLR, column stores, BI, and SQL Azure. Andrew was my co-author for the 2008 edition and lead author of the original 2005 edition, so this is actually his third time around on this book. Both previous editions literally burst at the seams in their zeal to cover the entire (end constantly growing) SQL Server stack. This time around, in consideration of the many readily available BI-focused books, the editors decided to distill the BI footprint of the new 2012 edition (which in the 1000+ page 2008 edition, accounted for roughly a whole third of the book) down to a single overview-style chapter. This simultaneously brings the page count down a bit, while actually opening more space for expanded coverage of the relational database engine. As a result, this new book is more narrowly (and uniquely) focused on programming SQL Server for transactional line-of-business applications built with .NET and Visual Studio.

So busy days lie ahead. Here are some of the new topics I’ll be covering in the 2012 edition:

  • SQL Server Data Tools
  • SQL Azure
  • Column store indexes and VertiPaq
  • Sequences
  • Windowing (OVER BY) improvements
  • Server-side paging
  • New conversion, date/time, logical, string, and analytic T-SQL functions
  • FileTable (FILESTREAM + hierarchyid = logical file system)
  • Metadata discovery
  • Spatial enhancements (curves, FULLGLOBE)
  • Contained Databases
  • Self-Service Reporting (Power View)
  • Conventional ADO.NET and LINQ
  • ADO.NET Entity Framework
  • WCF Data Services & WCF RIA Services

This list is by no means exhaustive (and remains subject to change), but it does give you a good idea of what to expect. In addition, I’ll be adding greatly expanded coverage to the previous edition, with broader treatment of topics such as table-valued parameters, FILESTREAM, and more. So I look forward to the journey ahead, and hope to produce the best piece of work I can. Along the way, I’ll be blogging more previews of what’s to come. So stay tuned!

Posted in Microsoft, SQL Server | Tagged | Leave a comment

CRM 4.0 Customization Synchronization Issue

Recently, I came across a very odd issue in CRM 4.0. This issue popped up because of an improper deploy/refresh in conjunction with the removal of an entity between test and production servers. It was very out of the ordinary, and I had not seen anything like it before.

The Issue at Hand

This issue was that we were unable to publish the Appointment entity. We were able to publish all of the other entities, but trying to publish the Appointment alone would fail. We could import previous versions of the entity, but all of them had the same effect. This is a critical issue because if  you are unable to publish an entity, then you can no longer modify that entity.

Research Time

So this is when I started to dig around. I first noticed that where was a blank lookup field on the Appointment form (create/new form).

image

After that I noticed the blank field was not on the customize entity form.

clip_image001[4]

After seeing this, I  understood why the problem was occurring. We had created an entity and later deleted it. Around that time we also did a restore to our dev server. In this process, we were able to delete the new entity while still keeping it on the form, something CRM usually prevents us from doing. This resulted in the blank field on the create form, and the issue above.

Solution

In order to remedy this, we re-created the Entity, giving it the same Entity name (eg: “tallan_example”). Once the entity was back in the system, we created the same 1:N relationship from “Example” to Appointment. When creating this relationship it was important to use the same relationship name that we did the first time the entity was created. Fortunately, we used the default naming convention, so we did not have a problem with this.

After the relationship was re-created, we were able the publish the Appointment entity! This caused the blank field to go away on the form.

image

Once this was done, going forward we could then remove the entity the proper way if necessary. I realize that this error could apply to any entity in CRM, and I hope it is of use to someone else.

Robert Lanzilli (robert.lanzilli@tallan.com)

Posted in Dynamics CRM | Tagged , , , , , , , , , , , , | Leave a comment

Using System vs. Custom Entities in CRM 2011

I wanted to write about the topic of whether to repurpose system entities in CRM 2011 or create new custom entities. I know that there have been some blog posts about this before, but I can also reflect on this from personal experience.

There are many different points to consider when repurposing entities:

1. The out of the box functionality of the entity may not be exactly what you need. In these cases it might take a higher effort to modify and customize it then it would to start from scratch with a custom entity.

2. If you repurpose a system entity in CRM 2011 and package it in a solution, there is always the chance that another solution contains this entity. If these two solutions are imported into the same organization, this may cause a conflict.

3. You cannot change the icons for system entities. If it were repurposed, then you would be stuck with the original icon. This may not be a big issue, but there may be a time when this is necessary. There may be an instance when the repurposed entity has a completely different business meaning, and it may be confusing to some users.

4.You are not able to remove some fields on system entities. For example, on Campaigns you cannot remove the fields in the “Scheduling” section:

image

Sure you can set their visibility to false, but how much would have have to customize it before you can start using it? This adds to the overhead of repurposing an entity.

5. If you repurpose it now, then you would not be able to use it in the future. It is not always possible to predict the future, so keeping your options open is usually a safe bet.

6. Some system entities are significantly different from others, and you would have to know certain things in advance before using them. For example, on the Invoice entity it has a relationship with Invoice Products. If you were to repurpose those, you may not realize afterward that you cannot display Invoice Products on the Site Map (CRM 4.0).

In CRM 4.0, Invoice Product didn’t have a default view, and you couldn’t create a custom view for it.

image

This specific consideration has been changed in CRM 2011 as you can now add Invoice Detail to the Site Map, but there does not appear to be a simple out of the box way to add a new public view.

Invoice:

image2

Invoice Detail:

image3

7. Another example is when systems are integrating together. A financial software system may have the concept of an Account, but it may not be the same as CRM’s out of the box Account entity. Something as simple as this may lead to a low acceptance rate of CRM because the users may have to deal with a conflict of interest.

8. The final thing you have to ask yourself is why you want to reuse the system entity. Is there a definite set of functionality that can not be repurposed, or would it take effort to remove functionality?

With all of  that in mind, I do realize that sometimes there may be reasons to reuse an entity. For example, Account and Contact when you are deploying CRM for a Sales Team. But also consider that those entities were designed for Sales Teams. Account was not specifically designed to be used for Financial software, so that should be taken into consideration when repurposing entities.

Most of these examples will apply to both CRM 4.0 and CRM 2011.

Resources

http://blogs.infinite-x.net/2009/06/11/the-dangers-of-repurposing-existing-crm-entities/

http://blog.customereffective.com/blog/2009/09/the-crm-configurators-dilemma-repurpose-or-create.html

https://community.dynamics.com/product/crm/crmtechnical/b/mycrmopus/archive/2011/01/20/why-retrofit-system-entities.aspx

 

Robert Lanzilli (robert.lanzilli@tallan.com)

Posted in Dynamics CRM | Tagged , , , , , , , , , | Leave a comment

Leonard Lobel Awarded Microsoft MVP for SQL Server!

This month, Microsoft awarded 143 exceptional technical community leaders with the Most Valuable Professional (MVP) title and re-awarded 764 MVPs worldwide. Tallan is thrilled to announce that Lenni Lobel has been recognized as an MVP in SQL Server!

According to the Microsoft MVP Award Program Blog, there are more than 100 million social and technical community members, but only a small portion are selected to be recognized as MVPs. Members of this highly select group of experts are not Microsoft employees; they voluntarily share their passion and real-world knowledge of Microsoft products with others.

In addition to his role as Principal Consultant, Lenni is currently working on the new edition of Tallan’s SQL Server book, “Programming Microsoft SQL Server 2012″ (O’Reilly Media) and speaks regularly at industry conferences and user groups around the country.

Thank you and congratulations to Lenni for his commitment and expertise.

Posted in SQL Server | Tagged , | Leave a comment

Build – The Developer’s Launch of Windows 8

The first keynote of Build was all about the launch of new Windows 8 for developers. As they said, Windows 8 is a reimaging of the way we interact with devices and use computers. With all this reimaging comes some major changes to the development paradigms that we are currently use to and it seems as though this conference is focusing on getting the developers up to speed with all the changes that affect how software will be created for the next version of Windows.

The keynote centered around 2 main topics. First is the changes in computing, including hardware, mobility, and the way in which we interact with multiple devices of all sizes. Second, is the new Metro UI , which is the way in which immersive Windows 8 applications are built and developed to provide rich experiences on the native operating system.

Computers have been changing for quite some time, devices are getting smaller, they are responding to touch input, and customers are using them on the go. This means applications need to be built in a way that allows customers to interact with content in a performant way no matter the screen size. Customers are also using computers in all aspects of their daily lives. They need applications that are mobile and that actively synchronize themselves across multiple devices, so that the experience is seamless.

Touch is an extremely important aspect to all this, with former GUI technologies there were some affordances to lags in performance when using a traditional mouse input. When using touch as a primary input it seriously impacts the user experience if the application doesn’t respond to a gesture. Microsoft has stated that they are committed to increasing performance and with reports of an 8 second boot time, quick resumes through Connected Standby, and a decrease in overall operating system memory consumption to 281 MB of core OS memory (down from 484MB), it is apparent that they are really squeezing every byte possible out of the operating system.

Microsoft also announced a brand new line of computing devices from the small tablet devices (which were given out to all attendees) to large multi-monitor desktops which support touch and hardware accelerated graphics. Power users will also benefit from the new Hyper-V support which is now included in Windows 8. Another important hardware feature that was announced is the ability to Refresh and Reset your desktop settings to a factory state.

The Metro UI is much broader, while reimaging the entire Windows 8 application experience, they have also reimagined the entire application model in the form of new API that sits on top of the Windows kernel call the Windows Runtime. This new Windows Runtime (WinRT) is a brand new application model that is completely different than the previous Win32 model. It offers a fresh new Windows start screen with Live Tiles and Notifications. Applications can now interact with the entire screen real estate without the need for window management complexities like chrome, minimizing, etc. WinRT has built in support for Charms, which allow developers to communication across applications. The only bit of screen real estate consumed by the runtime is a single pixel around the entire screen which is used to invoke both system and application commands via a concept called “first pixel sensitivity”.

There has been a lot of talk about Silverlight and WPF developers getting phased out of the new Windows 8 platform, first off, this is not true. Windows 8 has committed to offering full backwards compatibility with Windows 7 and all the Win32 applications and frameworks which are built on top of it. This doesn’t mean Silverlight or WPF will work on WinRT. However, (before you get too upset), your skills as a XAML developer are not lost. WinRT has rebranded their previous UI frameworks into a new set of components, which you will find very similar, under the distinction of XAML (the UI markup language) and the model/controller language of your choice (ie. C#, VB, C++). They’ve also added to the WinRT the ability to create applications with a view markup defined in HTML5 and CSS with controller logic written in javascript. A move that will hopefully attract designers who were previously constrained to web technologies to come on board and start creating native applications for the windows 8 platform.

Since this is a “Developer’s Preview Release” and since so many changes were made to the application development and deployment model, Microsoft also announced the release of new version of Visual Studio 11 and Expression Blend. The hope is that developers will download the bits and start looking as ways in which they can reimagine their own applications. Everything presented today will be provided for developers to download at http://dev.windows.com.

Posted in Uncategorized | Tagged | Leave a comment

UX Enhancements to Existing Products

UX Enhancements

Recently, I rolled off a client project where we implemented an e-commerce platform with lots of customization to meet client needs. This brought to light the delicate balance between using the platform’s existing features and customizing the user experience to more effectively accommodate your users. You want to think that every out-of-the-box solution is going to provide an optimal user experience, but we all know that’s just not the case. Every project needs tweaking.

Updating the Existing Front-End

Styles

There are some solutions and platforms that you can tell were built by developers with good coding skills but the UX is not ideal; that’s not their baileywick. The clues are in the existing CSS files. Maybe they are using points to define font-size for an online experience and setting your background-color property as “lightyellow" in your default CSS file; yup, you need some degree of damage control when you see this.

It would be nice to rewrite the entire stylesheet, but time and/or resource constraints will probably make that impossible. After all, the reason for using third-party technology is so you don’t need to spend time and resources building something from scratch, isn’t it?

I would recommend that you make as many quick changes as possible across the board, right off the bat. A simple “Find and Replace All” changing lightyellow, red, and mediumspringgreen to their appropriate hex values is a good start. From there, make similar changes to a handful of equally glaring issues that seem to be common throughout the file. These changes don’t take a lot of time, and allow you to become familiar with the base styles for future use. Do a quick “find” function to step through each instance and make sure the keywords don’t appear in any existing selector or attribute names, lest you find yourself wondering how your .featured class suddenly broke the page and became .featu#f00.

Layout

Another challenge is changing layouts of page templates that are used throughout the site, such as “Category” or “Product Detail” pages. This is where that initial review of the CSS file comes in handy. You should have some kind of idea as to how certain classes or elements are styled, or at least know where in the CSS file they can be found. From there, you can create new classes that suit your needs, if they can’t be met by existing styles. If you find yourself editing site-wide styles, don’t forget to test those styles across the whole site, and not just the page you’re working on. The same advice for updating images tied to a style.

Start Big, Finish Small

My strategy on this last project was to try and pinpoint site-wide issues from the start, and fix as many of those as time and resources allowed. Those I couldn’t fix I would note for future reference, or notify the client that there were potential issues that could come up down the road; don’t waste a lot of time arguing internally about the “best” solution: let the client make the decision about whether they want to have you spend time revamping it.

These issues don’t necessarily have to be related to how markup or styling are presented, but to the general flow and spatial relationships of elements within the design of the site. After this initial assessment, the general rule of thumb I came to live by was, if I saw a problem that could be quickly fixed, I’d fix it. For example, once I came across larger problems that I didn’t see in the first go-around, I had to pick my battles, but the strategy remained the same: make the client aware of the issue and its potential negative effects, and let them decide if they want to spend the time and resources fixing it. While some clients will heed your advice and warnings, others may not see the value in making any changes; that’s their prerogative. At the the end of the day all we can do as UX practitioners is to keep them informed, and document those decisions in email or other artifacts.

Adding New Custom Features

UX Considerations

Once you start going down the avenue of adding features and extending the platform with customizations, a development team needs to make UX considerations such as:

  • How is this new feature going to be implemented?
  • Where on the page, or in the system will it live?
  • How does it affect the information architecture, if at all?
  • Is that really going to fit in there?
  • Does it need to be a full page, or should it be a sidebar module or a lightbox?

These are only a few of the questions that need to be answered before you can take off your “UX Practitioner” hat and move forward with development.

Front-End Development Considerations

Once development begins, there are front-end considerations:

  • What styles will it inherit?
  • What JavaScript library are we using? (Standardize!)
  • Do we need to develop something custom to do that? Or does something already exist as a plug-in or extension?
  • How can we leverage existing code we wrote to implement this feature so we don’t have to start from scratch?

There may be some great solutions that developers will offer up, but which don’t fit in well with the site. This is where you need to be careful. They may work functionally, but they could also produce sloppy markup and a visual design that does not dovetail smoothly with the existing UX or workflow, thus impacting the user experience in a negative way. That’s why having UX involved from the beginning of the process of adding these features is so important.

Not Reinventing The Wheel

When it comes to adding these features, each one is a unique adventure. The trick lies in what’s come to be a theme here, for both new and existing features: The goal is always to balance client needs and existing platform structures with good UX and front-end development best practices. There are going to be a lot of compromises, and some of them are going to hurt, but that doesn’t mean you didn’t do your job. In fact, it means that you did it well.

Posted in CSS, User Experience, User Experience Design | Leave a comment