An essential resource for troubleshooting problems with MSDTC: MSDN documentation
Thursday, January 13, 2011
Wednesday, January 12, 2011
Event Logs, Enterprise Logging and Asp.Net
Here are the basic steps in getting this working:
1. Setup logging configuration
2. Create the event source before running your app.
1a. You need to add the Event log listener under the listeners node:
<listeners>
<add name="Event Log Listener"
formatter="Text Formatter"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"
source="SourceNameCustomize" machineName="." log="Application"/>
1b. Next under categorySources node, add a reference to the Event Log Listener defined above, like so:
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Event Log Listener"/>
</listeners>
</add>
Now your app is ready to publish events to the Events log.
2. But before you actually do, you need to create the EventSource and as this needs elevated privileges, you should do it using a special tool or do it as part of the setup/deployment process.
Here is the code I typically use to create the eventSource. (I build it into a command line utility that can be run on the machine).
using System;
public class EventSourceCreatorUtility
{
public static void RunSnippet(string logName, string eventSource)
{
if (!EventLog.SourceExists(eventSource))
{
System.Diagnostics.EventLog.CreateEventSource(eventSource, logName);
Console.WriteLine("Event Log and Source: {0},{1} were created successfully.",logName, eventSource);
}
else
{
Console.WriteLine("Event log/source: {0}/{1} already exists",logName, eventSource);
}
Console.WriteLine("Done");
}
public static void Main(string[] args)
{
try
{
if (args != null && args.Length == 2)
{
RunSnippet(args[0], args[1]);
}
else
{
Console.WriteLine("Parameters: logName, eventSource [eg: Application, AppName]");
}
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.ToString());
}
finally
{
Console.Write("Press any key to continue...");
Console.ReadKey();
}
}
}
Tuesday, January 11, 2011
WCF – MaxItemsInObjectGraph Error
If you get the following error:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameterhttp://tempuri.org/:xxxxx. The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. '. Please see InnerException for more details.
There are 2 parts to fixing this error:
On the server:
Add the following to the server's config file
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior0">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
And reference it in your service using the following code:
<services>
<service behaviorConfiguration="ServiceBehavior0" name="serviceName">……
On the client:
Add the following:
<behaviors>
<endpointBehaviors>
<behavior name="behavior0">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
And reference it in your end-point using the following code:
<endpoint address="serviceAddress"
behaviorConfiguration="behavior0"
The 2147483647 is just a sample value. You should adjust it to something that makes sense for your application.
Note: The above works only if you are not using a custom serializer/deserializer.
Monday, January 10, 2011
Undeleting a file/folder from TFS
Undeleting a file/folder that has been deleted and committed to TFS previously is easy.
First, under Visual Studio options, turn on the feature that allows you to view deleted file in the TFS source explorer:
Now go to the folder/file that you wish to undelete, right click on the item and select Undelete.
Sunday, January 09, 2011
WP7–Application Quotas for Developers
A developer account on WP7 app hub allows you to publish 5 free apps for free, after which you need to pay for every new free app you publish. Here is some additional information regarding the quota.
- You can publish unlimited paid apps to the marketplace.
- You get to publish 5 free apps to the marketplace, after which you pay $20 per app.
- When it comes to updates to your published app:
- They are always free and never ever count towards your free quota of applications.
- Even an update that fails certification does not count towards your free quota.
To me, the above is an extremely reasonable cost of publishing apps to the market-place because if you think about it, this is what you get for $100 from Microsoft:
- An excellent app-store via the Zune.
- Management and reporting of downloads of your apps
- Free QA team that makes sure that your app performs to a minimum set of requirements (performance, appearance and behavior).
- Publicity via Bing’s Visual Search tool.
- Free development IDE – that is better than any other IDE out there.
The processor is an expression of human potential
Another of Hugh MacLeod’s creation, this time for Intel
Full sized image: http://scoop.intel.com/wp-content/uploads/2011/01/visibly-smart-3.jpg
Saturday, January 08, 2011
Windows Phone 7–Design Guidelines–Cheat Sheet
An excellent resource put together by the Silverlight SDK team, if you are developing a WP7 app, print it and paste it on a wall. Many of the guidelines will help you through the certification process and maybe even get your app through on its first submission.
Windows Phone 7 – Design Guidelines – Cheat Sheet
The tips are copied from the post here:
Navigation, frames and pages
- Mockup the pages and navigational map of your application and walk through them several times before coding. This will minimize or eliminate the need to add pages or change the map later, when it will be much harder.
- Make sure to consider the back button and user interactions with the application bar when creating your navigation map.
Application Bar
- Use the application bar button for common application tasks.
- You are limited to four application bar buttons.
- Place less frequently performed actions in the application bar menu.
- If the action is difficult to clearly convey with an icon, place it in the application bar menu instead of as a button.
- You are limited to five application bar menu items to prevent scrolling.
- Standard application bar icons are installed as part of the Windows Phone Developer tools. Find them at C:\Program Files\Microsoft SDKs\Windows Phone\v7.0\Icons
- Custom application bar icons should be 48 x 48 pixels and use a white foreground on a transparent background. You do not need the circle in the icon, as this is drawn by the application bar.
Back button
- Pressing the back button from the first screen of an application must exit the application.
- Pressing the back button must return the application to the previous page.
- If the current page displays a context menu or a dialog, the pressing the Back button must close the menu or dialog and cancel the backward navigation to the previous page.
- You should only implement back button behaviors that navigate back or dismiss context menus or modal dialog boxes. All other implementations are prohibited.
Screen orientations
- Portrait is the default application view-you must add code to support landscape view
- If an application supports landscape it cannot specify only left or only right landscape views – both views must be supported.
Application icon
- Application icon should be 62 x 62 pixels and PNG format.
Tiles and tile notification
- Tile images should PNG format and measure 173 pixels by 173 pixels at 256 dpi
- Make sure to change Build Action for images to Content when you add them to Visual Studio.
Themes
- Avoid using too much white in applications, such as white backgrounds, as this may have an impact on battery life for devices that have organic LED displays.
- If the foreground or background color of a control is explicitly set, verify that the content is visible in both dark and light themes. If the set color is not visible, also explicitly set the background or foreground color to maintain contrast or choose a more appropriate color.
Application settings
- Application actions that overwrite or delete data, or are irreversible must have a “Cancel” button.
- When using additional screens with commit and cancel buttons, clicking those buttons should perform the associated action and return the user to the main settings screen.
Touch input
- All basic or common tasks should be completed using a single finger.
- Touch controls should respond to touch immediately. A touch control that lags or that seems slow when transitioning will have a negative impact on the user experience.
- For time consuming processes, developers should provide feedback to indicate that something is happening by using content to indicate progress, or consider using a progress bar or raw notification as a last resort. For example, show more and more of the content as it is being downloaded.
- The touch and hold gesture should generally be used to display a context menu or options page for an item.
On-screen keyboard
- You should set the InputScope property for a text box or other edit controls to define the keyboard type and enable the appropriate typing aides. For example, if you choose the URL input scope, a keyboard layout will be shown featuring a .com key.
Canvas/Grid for layout
- Canvas uses a pixel-based layout and can provide better layout performance than the grid control for deeply embedded or nested controls in for applications that do not change orientations.
- Grid control is the best choice when the application frame needs to grow, shrink, or rotate.
Panorama control/pivot considerations
- Both panorama and pivot controls provide horizontal navigation through phone content, enabling the user to flick and pan as necessary.
- Use panorama elements as the starting point for more detailed experiences.
- Use a pivot control to filter large data sets, providing a view of multiple data sets, or to provide a way to switch between different views of the same data.
- Do not use the pivot control for task-based navigation, like in a wizard application.
- Use for vertical scrolling through a list or grid in panorama sections is acceptable as long as it is within the confines of the section and is not in parallel with a horizontal scroll.
- Never place a pivot control inside of another pivot control.
- Never place a pivot control inside of a panorama control.
- Applications should minimize the number of pivot pages.
- The Pivot control should only be used to display items or data of similar type.
Text guidelines
- Use fonts other than Segoe sparingly
- Avoid using font sizes that are smaller than 15 points in size.
- Maintain consistent capitalization practices to prevent a disjointed or jagged reading experience.
- The title bar application title should be all capitals.
- User all lower case letters for most other application text including page titles, list titles, etc.
Wednesday, January 05, 2011
Accounting for software costs
An interesting question when it comes to accounting and software development is, whether a particular activity that is involved in the creation of a software can be categorized as a “Capital Cost” or an “Expense”. Below are links to some of the accounting standards that I found online.
I am no accountant, but it looks like typically all activities surrounding the creation of a software are typically recorded as capital costs (as long as the software has a useful life of 2 years or more) and all activities surrounding its maintenance are recorded as expenses.
According to an article in CFO.com: (link below)
Current Financial Accounting Standards Board guidelines require that all costs incurred before a product reaches "technological feasibility" — the point at which it can actually be produced — must be treated as R&D expenses. After that, companies can capitalize costs associated with software development until the product is released. Once that happens, the capital expenses are amortized.
An interesting thing about the above statement is, how do you account for software that is being produced using an Agile methodology? Software applications that are developed using an Agile methodology can be in continuous development through-out its life and also at the same time be in production (achieving technological feasibility early in its life).
Links:
Accounting for Internal Use Software (Federal Financial Accounting Standards): http://www.fasab.gov/pdffiles/fasab10.pdf
Accounting for Software Costs, Computer Systems and Business Process Reengineering (Yale University): http://www.yale.edu/ppdev/policy/4203/4203.pdf
Accounting for the development costs of internal-use software: http://www.allbusiness.com/accounting-reporting/assets/196287-1.html
Software Expensing Grows, Study finds (CFO.com, an interesting article that was released recently): http://www.cfo.com/article.cfm/14545408
Definition:
Capital costs: Costs that have an estimable future benefit which are included on the Statement of Financial Position as assets,
and amortized or depreciated over their estimated useful lives.
Expenses: Costs that do not provide future benefit and are recorded directly on the Statement of Activities in the period in
which the costs are incurred.
Saturday, January 01, 2011
WP7 - "Manual rotation cannot be used in automatic rotation mode"
If you ever get the less than information exception message: "Manual rotation cannot be used in automatic rotation mode", then it is most probably because you are using Microsoft’s AdControl for Windows Phone 7 and you created your AdControl instance with rotation enabled and you also requested the control to display a new ad.
Here is what you need to know:
When you specify that rotation is enabled in the AdControl constructor, then the AdControl will automatically display new ads and you don’t have to do anything. But if you do enable rotation of ads, then you cannot call “RequestNewAd”, else you will get the exception shown above.
Thoughts:
The error is basically stating that you cannot manually rotate Ads when the Ad control was instantiated to automatically rotate the ads. The reason I don’t like the exception message is that just by looking at the message its hard to figure what it means or what caused it. In addition, the fact that the message was being caused on the Windows Phone, it led me on a wild goose chase looking for issues with the code that handled orientation changes of the phone. (Though, I must admit that if I had groked the AdControl docs, I would have known what the rotation argument actual stood for, instead of assuming that it meant the control supports orientation changes).
More Info:
RequestNextAd: http://msdn.microsoft.com/en-us/library/ff973787(v=msads.10).aspx
AdControl class: http://msdn.microsoft.com/en-us/library/ff973756(v=msads.10).aspx