New Mocking Capabilities in JustMock Q3 2011 SP
Telerik JustMock received many new features in the service pack for the Q3 2011 release, enhancing the mocking framework’s impressive ability to mock almost everything. Let’s take a look at a few highlights of JustMock Q3 2011 SP.
Mock Inside a ThreadpoolMock objects can be accessed inside of another thread and work as expected.
var mockable = Mock.Create<Mockable>();
Mock.Arrange(() => mockable.IsMocked).Returns(true);
bool mocked = false;
var latch = new WaitLatch();
ThreadPool.QueueUserWorkItem(cookie =>
{
try
{
mocked = mockable.IsMocked;
}
finally
{
latch.Signal();
}
});
latch.Wait();
Assert.IsTrue(mocked); The callback for ThreadPool.QueueUserWorkItem accesses the mock object, and the expected value is returned.
Asserting Occurrence in Extension Method
You can now ensure occurrences for extension methods to your mocked objects.
var sequence = Mock.Create<IEnumerable<int>>(); Mock.Arrange(() => sequence.First()).Returns(1).OccursOnce(); int result = sequence.First(); Assert.AreEqual(1, result); Mock.Assert(sequence);
In this example, sequence.First() is only called once, passing the test.
IgnoreInstance in Fluent ExtensionsMehfuz Hossain’s article on Future Mocking with IgnoreInstance describes this feature added in JustMock Q3 2011, but you may have noticed he didn’t use the Fluent API. It is now present in these extensions, so the example in the original blog post can be written as follows:
var fakeUsed = Mock.Create<UsedClass>();
fakeUsed.Arrange(mock => mock.ReturnFive()).Returns(7).IgnoreInstance();
Assert.AreEqual(7, fakeUsed.ReturnFive());
Assert.AreEqual(7, new UsedClass().ReturnFive()); Whichever style you prefer, mocking tightly coupled class is simple with JustMock.
Invoke Call with Expression Argument with Dynamic ValueThis feature gives you granular control over an arrangement utilizing a lambda expression.
var repository = Mock.Create<IBookRepository>();
var service = new BookService(repository);
var expected = new Book { Title = "Adventures" };
Mock.Arrange(() => repository.GetWhere(book => book.Id == 1))
.Returns(expected)
.MustBeCalled();
var actual = service.GetSingleBook(1);
Assert.AreEqual(actual.Title, expected.Title); In this example, service.GetSingleBook(1) is calling its dependent repository with the expression: book => book.Id == id. The parameter ‘id’ is a dynamic value.
public class BookService
{
private IBookRepository repository;
public BookService(IBookRepository repository)
{
this.repository = repository;
}
public Book GetSingleBook(int id)
{
return repository.GetWhere(book => book.Id == id);
}
} JustMock will now match book.Id == 1 to book.Id == id when id is equal to one. The expression must match value types. For example, book.Id > 0 will never be called by service.GetSingleBook(1).
Better Access to Documentation
The Getting Started Guide and example projects are now found in the start menu under Telerik | JustMock.
These resources can help you find the solution to nearly any mocking scenario. The Getting Started Guide is the bulk of the English documentation. However, we view tests as documentation as well. That’s why the example projects provide a hands-on approach, unit testing JustMock itself.
The documentation is also available in Help3 for download in a separate ZIP file.
What’s Coming?Our Q1 2012 Webinars are just around the corner. If you attend the What’s New in Tools for Better Code webinar, you can see live demos of the features mentioned in this blog post and much, much, more. One lucky winner from the Just* webinar will receive a Telerik Ultimate Collection worth $1999. More importantly, you will sharpen your ninja skills to write better code!
The week in qooxdoo (2012-02-03)
Just referencing the list of bugfixes, as most team members were absent this week or busy with unresolved tasks:
BugfixesFor a complete list of tasks accomplished during the last working week, use this bugzilla query.
Have a nice weekend.
Telerik OpenAccess SDK – MVC 3, RAD data binding and more
As a response to your constant requests for sample projects demonstrating the best practices of using OpenAccess ORM in web projects, we have released some of the new and updated samples before Q1 2012 so that you can benefit from them immediately.
MVC developers will be happy to know that along with the MVC 2 example “MVC Forum”, we are now offering two solutions demonstrating MVC 3 usage with Fluent API or an .rlinq Domain Model – whichever approach you prefer. In addition, you can see an implementation using the Razor view engine as an alternative of the default one. Find the samples in our new ASP.NET MVC category.
We have revised the best practice examples for ASP.NET applications and they are now merged into one sample solution, called Managing OpenAccess Context. There you can see three different approaches for managing your context – storing it in the Master page, in the HttpContext or implementing an HttpModule for it. We appreciate your feedback – which approach do you like the most and why?
To provide the RAD developers among you some insight on LINQ-based data binding with OpenAccess ORM, we have updated most of the old OQL-based OpenAccessDataSource samples to use the new OpenAccessLinqDataSource instead. Check out the Hierarchical RadGrid, Self-Referencing with RadTreeView, Cascading Delete and CRUD Operation samples, all under the ASP.NET category.
Get the latest build (2011.3.1320) of the OpenAccess SDK from the download page now and speed up the integration of OpenAccess in your solution! Feel free to provide any feedback or to request new samples according to your needs.
Introducing RadDiagnostics for Windows Phone
As part of the Telerik “Q1.2012 Beta” package for Windows Phone we are releasing a new set of "Application Building Blocks" components. You can find more info on the idea of Application Building Blocks here. Among these components is RadDiagnostics.
OverviewRadDiagnostcs component will enable you to receive crash reports, get specific debug and run-time information from your end users when an issue (ApplicationUnhandledException) in your application is encountered. When an exception occurs, a MessageBox dialog is displayed and users are asked to report the diagnostics data. The collected data contains rich information about the exception, device and runtime info. Optionally a screenshot of the current application state can be provided. Developers can also add custom data when an exception has occurred and to collect runtime logs.
We are already using this component in Telerik “Tasks” application for WindowsPhone and it has proved to be a very valuable helper in debugging and resolving application issues. I strongly recommend you to add such an error reporting component to all of your applications.
Here is how the default user experience for the end users looks like:
When users click on the “Yes” button they will be able to send an email message pre-filled with all the data collected from RadDiagnostics.
This is the default user experience. Developers can customize the displayed message and also have an option to skip the message, to get the data and to send it automatically to their own web service for analyzing (this requires additional development and is not provided out of the box).
The usage of the control is quite simple and intuitive:
RadDiagnostics diagnostics = new RadDiagnostics(); diagnostics.EmailTo = “myemail@mail.com”; diagnostics.Init();This initialization code should be added in the App constructor.
To create a custom action and to get notified when an exception has occurred, you can subscribe to the ExceptionOccured event:
radDiagnostics.ExceptionOccurred += new EventHandler<ExceptionOccurredEventArgs>(RadDiagnostics_ExceptionOccurred); private void RadDiagnostics_ExceptionOccurred(object sender, ExceptionOccurredEventArgs e) { //e.Cancel = true; setting Cancel to true will prevent the message box from displaying. // add any custom code here, like reporting to a custom web service //SendDiagnosticsToWebService((sender as RadDiagnostics).DiagnosticInfo); } Diagnostic DataYou are maybe now curious to see what data you will receive when an error is encountered. Here is a sample error report:
[StackTrace]:[
Navigation is not allowed when the task is not in the foreground. Error: -2147220990
at Microsoft.Phone.Scheduler.SystemNotificationInterop.CheckHr(Int32 hr)
at Microsoft.Phone.Scheduler.SystemNotificationInterop.CreateNotification(ScheduledAction action)
at Microsoft.Phone.Scheduler.ScheduledActionService.Add(ScheduledAction action)
at Telerik.WindowsPhone.Tasks.ApplicationHelpers.ScheduleMasterTileUpdateAgent()
at Telerik.WindowsPhone.Tasks.App.Application_Launching(Object sender, LaunchingEventArgs e)
at Microsoft.Phone.Shell.PhoneApplicationService.FireLaunching()
at Microsoft.Phone.Execution.NativeEmInterop.FireOnLaunching()
]
[OccurrenceDate]:[Tue, 31 Jan 2012 12:41:48 GMT]
[AppInstallDate]:[Sun, 29 Jan 2012 19:00:42 GMT]
[AppTotalRuns]:[4]
[AppRunsAfterLastUpdate]:[4]
[AppPreviousRunDate]:[1/29/2012 2:01:54 PM]
[AppVersion]:[1.33]
[Culture]:[en-US]
[CurrentPageSource]:[/Views/SyncProvidersList.xaml?SyncProviderId=1]
[NavigationStack]:[/Views/MainPage.xaml]
[DeviceManufacturer]:[HTC]
[DeviceModel]:[mwp6985]
[DeviceHardwareVersion]:[0003]
[DeviceFirmwareVersion]:[2305.13.20104.605]
[OSVersion]:[Microsoft Windows CE 7.10.7720]
[CLRVersion]:[3.7.11140.0]
[DeviceType]:[Device]
[NetworkType]:[Wireless80211]
[DeviceTotalMemory(Mb)]:[475.375]
[AppPeakMemoryUsage(Mb)]:[4.828125]
[AppCurrentMemoryUsage(Mb)]:[4.828125]
[IsoStorageAvailableSpace(Mb)]:[2909]
As you can see we are collecting a lot of data which will be useful for you when debugging the problem. If this is not sufficient enough RadDiagnostics can be used as a simple logger to collect any runtime info you are providing. Here is a simple usage of the logging feature:
radDiagnostics.AddDebugInfo(String.Format("filterData = {0}", filterDate));In order to keep the performance of your application high logs will contain only the last 1Mb of data. Please keep this in mind when using this feature.
Another cool feature (and my favorite one I must admit :)) of RadDiagnostics is how the mail Subject is composed. Apart from the obvious info – ApplicationName and ApplicationVersion – it contains the Hashcode of the Stack Trace!!! This allows you to group the mails you receive and see which error is occurring most often – thus seeing the top priority issues.
Here is how my inbox looks like for the Tasks application crash reports:
I hope that this component will be very useful for you as it is for us in Tasks application. Please give it a try during the beta period and let us know if you have suggestions for enhancements.
You can also find me on twitter @valiostoychev – I’ll be happy to discuss any feedback you have!
Winding road of open-source webOS
HP continues to divulge bits and pieces of a road map for the ill-starred and nearly-orphaned webOS. The company has followed up its December plan to release webOS mobile platform and development tools with a proposed timeline, with a full release set before year’s end. Some people see a life for the associated Enyo JavaScript framework aside from any success or failure webOS ultimately achieves.
Naming Conventions in JustCode
Choosing appropriate identifiers for the constructs in your code provides better readability and maintainability. With the latest build of Telerik JustCode you can now easily set naming conventions for all your code elements.
Configuration and Supported languagesThese rules can be set for C# and VB.NET and are part of the Code Style section of the JustCode options dialog:
These options are part of the shared settings so you can share them per solution as well.
Naming RulesThere are seven types of rules that a user can choose from:
- camelCase
- PascalCase
- UPPER_UNDERSCORE
- lower_underscore
- Sentence_underscore
- PascalCase_Underscore
- camelCase_Underscore
You can also disable the naming convention for a specific construct. Just choose “Disabled” from the rules combo box.
WarningsJustCode will analyze every identifier in your solution and will show a warning if the name of the construct does not match the specified naming rule:
An appropriate fix will be available:
There are some cases, in which you would like to set two rules for a construct, so that JustCode will accept either one of them when analyzing the name of the construct.
Consider the following case, where you want to have constants that are Pascal Case as well as constants that are UPPER_UNDERSCORE_CASE:
JustCode is showing a warning that the second constant does not match the naming conventions, because the naming rule for constants is set to “PascalCase”. You can, however, specify a secondary rule. To do so, click on the “Add” button in the Naming Conventions section or choose from the available context menu “Add Secondary Rule”. Save the chosen setting and the analysis will be refreshed automatically. The warning will not be shown anymore:
JustCode does not only show warning if the identifier of a construct does not match the chosen rule, but also uses the Naming Conventions when generation new constructs:
The Naming Conventions are also used in the quick-fixes that JustCode suggests:
That’s it for today. If you are eager to put your hands on these new functionalities, you can give Telerik JustCode a try! We hope you like what you see, much more to come. Your feedback is welcome and appreciated. Write to us in forum or support.
What's Coming?Our Q1 2012 Webinars are just around the corner. If you attend the What’s New in Tools for Better Code webinar, you can see live demos of the features mentioned in this blog post and much, much, more. One lucky winner from the Just* webinar will receive a Telerik Ultimate Collection worth $1999. More importantly, you will sharpen your ninja skills to write better code!
Happy Coding!
The JustCode team
The Q1 2012 MVC Beta is here with new Area chart and galore of charting features
I am happy to announce the immediate availability of the Telerik MVC Extensions Q1 2012 Beta release! With it comes the longed-for Area chart type as well as a bunch of new features for the majority of the existing chart types supported by our MVC charting. We are also shipping a plethora of small and medium-sized features across all the Telerik MVC extensions, as well as formal support for the Chrome 16 and FireFox 10 browser versions.
I won't go into much detail about each and every new functionality delivered with the Beta and, consecutively, the upcoming official major release (due in a couple of weeks time), but I will surely underline the most important features from which the majority of the ASP.NET MVC developers will benefit.
New Area Chart TypeThis chart type accounts for one additional means to visualize your data by means of area shape. The area chart shores up all applicable features of the rest chart types.
Now the developers have the option to scale the charting series presentation against more than one value axis. You are free to choose two, three or more value axes - there is virtually no limit, it all depends on how and versus what measurements you would like to visualize the data.
This feature is supported for bar, line and area charts for now, and will be braced for scatter charts with the official Q1'12 release.
Plot Bands
Allow you to define visual lines that highlight an important section of the charting graph - oftentimes min/max threshold or range that is aimed to be achieved for a given period. This feature has actually been included since the Q3 2011 SP1 commercial release of the extensions, but the Q1'12 Beta marks its prime time in the Open Source MVC distribution.
Common for all ExtensionsTwo things are worthy to be mentioned here - improved support for MVC authorization scenarios and combined js file for all MVC extensions client features.
And here are the links that will direct you to all the available information concerning the Q1 2012 MVC Beta release:
Trial Files | Commercial Files | OS Files | Demos | Documentation | Release Notes
As always, do not cringe and tell us what you think about the Beta in the public MVC Beta forum. We are only days away from the next major Telerik DevTools release, and your opinion matters!
Also do not miss our Q1'12 webinar week, starting Feb 20th and book your seat now!
About the authorStefan Rahnev is the Unit Manager of the ASP.NET MVC Telerik Division. He has been working for the company since 2005, when he started out as a regular support officer. His next steps at Telerik took him through the positions of Technical Support Director, co-team leader in one of the ASP.NET AJAX teams and ASP.NET AJAX Unit Manager. Stefan’s main interests are web development, agile processes planning and management, client services and psychology.
Are you into ASP.NET MVC development? Download our MVC components now to cut back development time and boost your productivity!
Horizontal Scrolling in RadDataBoundListBox now available
RadDataBoundListBox has been continuously developed and extended with new features like Item Animations, CheckBoxes support, Data Virtualization support etc. We have also fine-tuned its performance so that it perfectly fits in an environment of limited memory and CPU resources what a mobile phone is. You can see here a real-world scenario based comparison between RadDataBoundListBox and a standard ListBox control putting both UI Virtualization approaches head to head.
With Q1 2012 Beta we are introducing an entirely new feature which also paves the way for a more complex and performance-optimized Wrap Virtualization Layout: Horizontal Scrolling. A nice example is available in our Demos app (source code in) that showcases this feature:
You may now ask what’s the common thing between Horizontal Scrolling and support for Wrap Layout? Well, with this Beta release we are introducing some major architectural changes in RadDataBoundListBox’ engine which give us more freedom to implement different UI virtualization approaches and layouts. These changes include an extraction of the whole UI virtualization mechanism into a so called Strategy class which is simply plugged into the control. In this way we can easily develop a Wrap Layout Virtualization strategy and also make it available as an option in the feature set of the control.
Following is a quick code-snippet enriched demonstration of how activating horizontal scrolling in RadDataBoundListBox is done. There is a new property called VirtualizationStrategyDefinition which basically represents a definition for a given UI strategy and also a set of properties for this strategy. Currently only instances of the StackVirtualizationStrategyDefinition class can be used in this context:
<telerikPrimitives:RadDataBoundListBox x:Name="radDataBoundListBox"> <telerikPrimitives:RadDataBoundListBox.VirtualizationStrategyDefinition> <telerikPrimitives:StackVirtualizationStrategyDefinition Orientation="Horizontal"/> </telerikPrimitives:RadDataBoundListBox.VirtualizationStrategyDefinition> </telerikPrimitives:RadDataBoundListBox>
As you can see, the StackVirtualizationStrategyDefinition exposes an Orientation property which is used to define whether RadDataBoundListBox will scroll vertically or horizontally.
In near future, you will also be able to define a WrapVirtualizationStrategyDefinition by using the same approach and have your DataBoundListBox position its visual items in a wrap mode.
You can find this new functionality in the RadControls for Windows Phone 7 Q1 2012 Beta package available for download from the Downloads section of your accounts.
XAMLflix continues with RadBarCode for Silverlight and WPF
Hello everyone and welcome back to XAMLflix with RadBarCode for Silverlight and WPF. What is XAMLflix you might ask? Well, it is Telerik’s way of teaching you how to use both new and existing controls from Telerik’s XAML suite. Each and every Thursday, we will provide a fresh batch of videos and sample projects highlighting a different control. Since our Silverlight and WPF share a common codebase and API, you only have to learn how to use these controls once! You can simply copy and paste the code between frameworks. If you are eager to get started then go ahead and download a trial of RadControls for Silverlight and WPF right now and follow along with the videos real-time.
Meet RadBarCode
The RadBarcode control can be used for automatic Barcode generation directly from a numeric or character data without the need of any Barcode font being installed in the end user’s PC. It can also generate many different types of Barcodes including those commonly used in point-of-sales industries.
- Getting Started with RadBarCode – In this video, we will dive into Visual Studio 2010 and begin with File -> New Project and use the RadBarCode Control. We will discuss adding references, to getting your Toolbox setup to finally adding a RadBarCode to our Silverlight Application. We will also discuss several properties that you can use to assist in developing highly flexible barcode applications. If you are brand new to RadBarCode then watch this video first! (source code)
- RadBarCode – Additional Formats In this video, we will discuss the various formats supported by RadBarCode out of the box and begin using several more popular Barcodes such as Code 128, PostNet, EAN-13 and UPC-A. If you want to become familiar with what barcodes we support and get a glimpse at using each one then this video is for you. (source code)
- RadBarCode – Sample Application In this video, we will create a sample application that demonstrates using the RadBarCode in an electronic catalog by using the RadBook control. Your user can flip pages easily in this real world simulation. I also discuss how easily you can print barcodes using RadBarCode and Silverlight 4’s built in PrintDocument class. (source code)
Wrap-Up
Thanks for reading and if you have any questions or comments then please let me know.
Also, keep watching the Telerik blogs as we are planning on releasing new videos for XAMLflix each and every week. You can download a trial of RadControls for Silverlight and WPF right now.
Find me on Twitter at : @mbcrump
Dojo 1.7 Tutorial Update
Hot on the heels of the Dojo 1.7.1 release, we are excited to officially publish SitePen’s 1.7-specific updates to not one, not two but ALL 55 Dojo 1.6 tutorials. As you can guess, this was no small feat given that Dojo 1.7 is loaded with significant changes that encompass best practices on the road to 2.0. We’ve revamped the full Dojo 1.6 tutorial series to cover, not only how to do the things you already knew, but to prepare your team and your web app for what’s to come.
Oh and of course, the tutorials are rewritten to take full advantage of the new Dojo loader’s support for AMD, and they lay a groundwork for preparing your application to be lighter and more modular than ever!
So raise your glass and toast with us to the completion and release of the Dojo 1.7 Tutorials and to the best JavaScript toolkit available for scalable web apps!
Ready to upgrade to 1.7?
We stand ready to bring your code current to the latest release or kick off your project right out of the gate with Dojo 1.7! In addition to our dedication to Dojo documentation and tutorials we offer a comprehensive set of services to make your project a success!
Dojo Workshops – Learn Dojo 1.7 from the experts. We’ve posted a nationwide, 2012 workshop schedule that will exceed the expectations of developers and engineering budgets alike! If these dates and locations don’t work for you and your team, reach out to us about our private Dojo workshops.
Dojo Support – SitePen offers 5 different plans, all of which are provided to you by Dojo experts who will provide your team with the knowledge and experience necessary to support your web development efforts. Get pro-active and purchase a plan that will support your team with Dojo 1.0 through 1.7 and eliminate potential schedule-busting roadblocks on your path to success!
Development – Upgrading to Dojo 1.7 will improve your web application. If you know this to be true but don’t have the resources to make it happen, engage our development team to work for you and let us do what we do best – Make you look good. Contact us for a custom quote for your Dojo 1.7 upgrade.
Related posts:
SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications. Sign up today!
Try the Hot Stuff – Telerik’s AJAX Q1 2012 Beta is Out!
Quick links: Play with the Beta Demos | Download the Beta | Check the full Release notes
Client-side binding for RadListView – RadListView now supports client-side binding with client-side HTML templates. The HTML templates are defined through the markup similarly to the server templates. jQuery is used for DOM operations.
Expand/Collapse and Drag-and-drop for RadOrgChart – Added with the previous version of RadControls for ASP.NET AJAX, we continue with the important functionalities of the RadOrgChart. Now your users will have the ability to collapse and expand the hierarchical tree, and this is achieved with a single property. Or if you need to re-organize the current structure, you can just drag a single item, or a whole tree of items, and drop it wherever you like.
Thumbnail Explorer Mode for RadFileExplorer – This feature offers a new way to display the files list in the selected folder resembling the Windows Explorer view. To enable the thumbnail explorer mode you need to set a single property. This mode is also the default one for the RadEditor Image Manager.
Export to Excel and Column Resizing and Show/Hide for RadTreeList – RadTreeList already provides the ability to export it to Pdf and from now on you will be able to export its data to Excel as well. And to make it more flexible and for better user experience, columns resizing and show/hide client-side functionalities are added to the RadTreeList features set. See Demos
New Format Sets drop down for RadEditor – These sets are used to apply formatting to elements and sections in the content of the editor. The format sets dropdown provided different groups. And you can add a custom format set directly through your markup. See Demos
To be getting regular updates on what’s new, subscribe to the ASP.NET AJAX Team blog feed, or keep an eye on it frequently. In the upcoming days the AJAX developers will blog about each of the new features in details and share interesting tips with you.
And last but not least, don’t forget to share your feedback with us on the Beta forum!
About the authorIana Tsolova is Unit Manager of Telerik’s ASP.NET AJAX division. She joined the company back in 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of theASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web developing, reading articles related to geography, wild nature and latest renewable energy technologies.
Announcing Application Building Blocks for Metro applications
With Telerik WindowsPhone Q1.2012 Beta release we are shipping the first parts of the new line of Telerik components – Application Building Blocks for Metro mobile applications. These components are created to target mobile Metro applications for Windows Phone 7 and for Windows 8/Rt at a later stage.
The tricky part in mobile development is that you have to think about development and promotion simultaneously.
The Marketplace is the primary distribution channel for your app and it has its logic and app’s success metrics. What’s cool is that there are a number of in-app tricks that you can do yourself that will influence the app’s overall success. What’s even cooler is that we have thought about these composite parts of your app instead of you.
With our experience in building professional Mobile applications we identified that there are a lot of mobile specific features that can be reusable and are essential parts of every professional application that will be distributed throughout mobile marketplaces. For every application we’ve been working on we needed to implement a set of common features like trial experience, rate the application reminders (for better marketplace rankings), error diagnostics, dynamic live tiles etc.. This is how we came to the decision to develop the following application building blocks which you can get out of the box and reuse in your applications:
- Error diagnostics – with this component you can receive crash reports, add specific debug information and get run-time information from your users when an issue in your application is encountered.
Read more about Rad Diagnostics
- Trial functionality– with this component you can adjust the trial functionality of your application. You can add application wide trial notifications, or feature specific trial functionality with a lot of configurable options for Trial Period or Trial Usages of the application or the paid feature.
Read more about RadTrialReminder
- Rate Application Reminder – with this component you can add a very important feature for reminding your users to rate your application thus increasing your marketplace presence.
Read more about RadRateApplicationReminder
- Live Tiles – live tiles in WP7 and WinRt are a great way expose application functionality onto user’s desktop. With this component you can easily create context specific dynamic tiles.
Read more about RadLiveTileHelper
Please give these components a try, while they are still in Beta, and let us know if you have any other feedback or ideas for other building blocks that will be useful for you.
You can also find me on twitter @valiostoychev – I’ll be happy to discuss any feedback you have!
RadControls for Windows Phone Q1 2012 Beta is here
Two weeks before the official Q1 2012 release we have prepared a Beta package containing all the new stuff that we have been working on the previous months for you to check out. There are some brand new components, as well as cool new features in RadSlideView, RadDataBoundListBox and RadBusyIndicator.
Let's start with the newborn components available in RadControls for Windows Phone Q1 2012 Beta:
- RadToolTip - this is a control that allows you to display a popup associated with a given visual element on your page. This popup may contain any type of information, like additional details or some hints. We have a pretty slick example of this new component in our Demos App with source code available
- RadRating - this one implements one of the most common scenarios: providing the end-user with the ability to evaluate something by choosing from a range of rating items associated with a given value
- Application Building Blocks - here we are taking a new direction by shipping a set of classes that will help you bring some essential scenarios to your own app without having to write so much code. The building blocks are inspired by the marketplace environment and requisite for the promotional stage of your app development cycle. RadDiagnostics, RadTrialReminder, LiveTileHelper and RadRateApplicationReminder are tools that easily integrate withing your app and help you gather feedback from your users, track application crashes, create secondary application tiles and implement trial-only available functionality.
Furthermore, we have prepared some upgrades for a couple of our existing controls that were both highly demanded by many of you and also greatly contribute to the big picture of a fully fledged control suite:
- RadDataBoundListBox now gets horizontal scrolling and a green light for Virtualized Wrap Layout (!) support (which we hope we will ship officially with Q1 2012)
- RadSlideView has been completely redesigned and revamped to provide greater performance, extended functionality like per-item Busy Indicator and optimized UI virtualization logic
- RadBusyIndicator has now an extended out-of-the-box animation set containing the standard WP7 OS dot-style animation
As you can see there is a lot of new stuff to play with. Since this is a Beta we are expecting your extensive feedback so go download the package from your account and check it out!
We have also left some new cool stuff as a surprise for the release. If you’d like to see all the new bits, make sure to sign-up for the Release Webinar Week, February 20-22. This 3-day event is packed with hour-long webinar sessions on the coolest new features shipping with the Q1 2012 release. One lucky winner from each webinar will leave with a Telerik Ultimate Collection license worth $1999. To enter the drawing and participate in the Q&A session, you must attend the live webinar.
Register at: http://www.telerik.com/support/webinars.aspx
Sencha Touch 2 Beta—Raising The Bar
Two years ago, we set out on a journey to make the web mobile. Today, we’re raising the bar with the release of Sencha Touch 2 Beta.
Thank you to our community for your feedback during our sneak peaks with our Preview Releases. Your contributions in the forums, reporting bugs, adding feature requests, and your inspirational teamwork in the Q&A threads have kept us focused on what’s really important to you—delivering quality. We’ve taken all your feedback and we’re proud to deliver a release that we hope will exceed your expectations.
Download Sencha Touch 2 Beta View Release Notes
What’s New?With every major release, we strive to bake in the latest innovate approaches to help you create impressive applications. And learning how to use these techniques is now easier than ever.
API Documentation, Guides, and ExamplesWe’re investing a great deal of time in creating comprehensive documentation for Sencha Touch 2. Every major class now has a full introduction complete with code samples and how it fits into the wider context of your app. As well as class docs, we’re adding over 20 brand new guides covering everything from getting started through to building and deploying your applications.
On top of this, our documentation center now allows you to experiment with inline code editing.
Touch 2 Docs feature 20 new guides, code samples, and editable examples.Visit the Touch 2 Docs
We’re continuing to lead the way when it comes to innovation in our learning materials. We’re also proud to continue sharing all of the hard work we put into our documentation tools under the open source JSDuck project, a part of Sencha Labs.
New Facebook Integration ExampleWe’re adding an example showcasing Sencha Touch’s seamless integration with the Facebook Graph API. Jog With Friends combines the Facebook JavaScript SDK on the client side with a 200 line node.js script backed with MongoDB on the server side. For a live demo, check out http://ju.mp/senchajwf on a WebKit browser.
Foundational ImprovementsEach major new version of Sencha Touch brings with it an opportunity to advance the state of what can be done with the mobile web. Here are just a few of the improvements we’ve made in Sencha Touch 2.
A New Class SystemSencha Touch 2 benefits from the supercharged class system that powers Ext JS 4. The upgraded system enables powerful new capabilities like dynamic loading, custom builds and new features like mixins. This makes developing your app easier from the first line of code all the way through to creating a minimal custom build that contains only the classes your app actually uses.
As a developer though, the biggest improvement you’ll probably notice is the use of the new config system. Sencha Touch components have always been very configurable, but for version 2 we’ve made a big improvement to the consistency of the API.
Every single configuration can now be set and updated in a very predictable way through the use of generated getter and setter functions. These functions always follow the same format and can be called at any time so once you know the config name you automatically know what function to call to update it:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; }var panel = Ext.create('Ext.Panel', {
html: 'Sencha Touch 2 rocks'
});
alert(panel.getHtml()); // alerts the current value of the html config
panel.setHtml('It sure does'); // changes your panel html to a new value
These functions always follow the same format, which makes learning the framework really easy. As well as the getter and setter functions we provide hook functions which makes it easy to create your own configs—check out the new class system guide to find out more.
MVC with History SupportOne of the most frequently asked questions about web frameworks is how to structure your apps to make them easy and fun to create and maintain. With Sencha Touch 2, we’re bringing significant improvements in our MVC architecture, providing new functionality and a cleaner, leaner API.
History support is baked right into Controllers in this new release, making it easy to add back button and deep linking support into your application. We have a full guide on history support and you can see it in action on your device by checking out the upgraded Kitchen Sink example.
Setting up routes is easier than ever—just define the urls your app needs to react to inside your controller along with a function to call when that url is detected. For example here’s how we can easily create an ecommerce application that shows product details when the user navigates to urls like http://myapp.com/#products/123:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; }Ext.define('MyApp.controller.Products', {
extend: 'Ext.app.Controller',
config: {
routes: {
'products/:id': 'showProduct' // It’s that easy
}
},
showProduct: function(id) {
console.log('showing product ' + id);
}
});
Check out the full guide on History Support to find out how to add this to your app.
Multi Device ProfilesOne of the challenges of a multi-device world is building an application that runs seamlessly across operating systems and screen sizes. With Sencha Touch 2 we provide a simple mechanism that enables you to write your app once then customize it for each device it runs on.
This is achieved by configuring Device Profiles, which usually split your app into Phone and Tablet modes. Define all of the models, views, controllers and store that you want to reuse in your Ext.application and anything profile-specific inside the configuration for each Profile.
For example, let’s say we’re creating a Facebook app and want to show a simple feed view on Phones and a detailed one on Tablets. We can start by telling our Application that it has two profiles:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; }Ext.application({
name: 'FB',
profiles: ['Phone', 'Tablet'],
controllers: []
});
Now we set up a Tablet Profile that’s activated when we detect that we’re running on a Tablet device:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; }Ext.define('FB.profile.Tablet', {
config: {
controllers: ['Feed'],
views: ['DetailedFeed', 'Timeline']
},
isActive: function() {
return Ext.os.is.Tablet;
}
});
And one for Phones:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; }Ext.define('FB.profile.Phone', {
config: {
controllers: ['Feed'],
views: ['SimpleFeed', 'Timeline']
},
isActive: function() {
return Ext.os.is.Phone;
}
});
When the app boots up, it will automatically figure out which Profile to activate and use its specialized models, views and controllers. Check out the Device Profiles guide to find out how to use them in your app.
New Components—Component Data View and Navigation ViewIn addition to using the new XTemplates in your dataviews, we’re adding one of the most asked for features—using components in your data views. You can now add buttons, or any components, to items.
The KivaTouch demo app uses a Component DataView to show funding progress.
Giving your users the proper visual cues helps your applications flow more naturally. With Sencha Touch 2, wiring up view transitions are now simpler than ever when using a Navigation view. If you choose to use a navigation view, navigational controls such as back buttons will be handled for you. As an added bonus, we’re adding sexy animations when switching between cards.
Sencha Touch 2 Navigation View. View video on Vimeo Dive InNow that we’re in beta, we encourage you to dive right in. We have a stable API, and we have more guides to help get you going quickly. If you’re looking to port your Sencha Touch 1.0 app we have a backwards-compatibility build that helps you through the migration process. We also have an upgrade guide to help you out.
Note: those of you who have been using the Sencha Touch 2 Preview releases, be aware that we have cleaned up the builds we generate and as a result you may need to change which build of Sencha Touch you use. Most people should now be using sencha-touch-debug.js while developing, but for a complete list of the builds we generate see the builds guide.
Features We’re Still Working On: Android ICS PerformanceSencha Touch 2 has significantly faster performance on Android 2.x browsers – with fast list scrolling being a particular point of pride. We’ve always treated the browser in Android 3.x as fundamentally broken, and do not plan to officially support it in Touch 2. We are currently working on improving performance in Android 4.0 – the Ice Cream Sandwich release. So far, we have found no acceptable mechanism to achieve fast and flicker-free animations. We have filed a bug with a simplified test case showing poor performance on a variety of mechanisms with the Android bug list. If you’d like to help prioritize this bug, please go to the bug page for Android bug number 24833, and “star” the bug by clicking on the star icon just before the headline. Solving this bug will help, not just Sencha Touch 2, but the entire web community developing content for the Android 4 browser. Feel free to add your own test cases as well!
SummaryWe hope you enjoy playing around with the examples, and diving in to building your next great app. It’s been a lot of hard work getting to this point, and we thank you for all the feedback. Please keep sharing your ideas.
.right, .alignright { float: right; margin: 0 0 10px 10px; } .left, .alignleft { float: left; margin: 0 10px 10px 0; }Assert the order of expected calls over instances
How you assert through unit test that an user is authenticated before doing withdraw operation? You can surely verify a method is invoked as expected but if you want to ensure the order right then you might require a little more. JustMock lets you specify the order in which your setups should be executed. This helps you identify the exact way in which a particular logic is implemented.
To begin, lets consider the following context:
User wants to withdraw money from his account. Withdraw operation should validate the following goals:
- It should check if the user is authenticated
- It should get the balance for the authenticated user and check if the amount to be withdrawn is less than or equals to what is specified.
- Do the withdraw operation and return the remaining balance.
Now we have one IUserService interface
- public interface IUserSerivce
- {
- bool IsAuthenticated { get; }
- IUser GetUser();
- }
One IAccountService interface to process the accounts operation:
- public interface IAccountService
- {
- double Withdraw(double amount);
- double GetBalance(IUser user);
- }
The basic AccountRepository class with minimal implementation covering the above context looks like:
- public class AccountRepsotory
- {
- public AccountRepsotory(IUserSerivce userService, IAccountService accountService)
- {
- this.userService = userService;
- this.accountService = accountService;
- }
- public virtual double Withdraw(double amount)
- {
- if (userService.IsAuthenticated)
- {
- if (accountService.GetBalance(userService.GetUser()) >= amount)
- {
- return accountService.Withdraw(amount);
- }
- }
- throw new ArgumentException("TODO");
- }
- private readonly IUserSerivce userService;
- private readonly IAccountService accountService;
- }
Ensuring every step to be executed in an orderly manner , we just need to specify an extra InOrder option in Mock.Arrange that will otherwise fail the test during assert for any change of the expected execution order.
- [TestMethod]
- public void ShouldCheckUserAndBalanceInOrderWhenSpecificAmountIsWithdrawn()
- {
- var userService = Mock.Create<IUserSerivce>();
- var accountService = Mock.Create<IAccountService>();
- var user = Mock.Create<IUser>();
- Mock.Arrange(() => userService.IsAuthenticated).Returns(true).InOrder();
- Mock.Arrange(() => userService.GetUser()).Returns(user).InOrder();
- Mock.Arrange(() => accountService.GetBalance(user)).Returns(1000).InOrder();
- Mock.Arrange(() => accountService.Withdraw(Arg.AnyDouble)).Returns((amount) => 1000 - amount).InOrder();
- var repository = new AccountRepsotory(userService, accountService);
- Assert.AreEqual(990, repository.Withdraw(10));
- Mock.Assert(userService);
- Mock.Assert(accountService);
- }
Let’s remove the line# 13 from AccountRepository.Withdraw that yields:
- public virtual double Withdraw(double amount)
- {
- if (userService.IsAuthenticated)
- {
- return accountService.Withdraw(amount);
- }
- throw new ArgumentException("TODO");
- }
Since we broke the order, the test will fail with the following message:
Here one thing to notice that InOrder is applied to different mock instances within the test method scope that makes it effective in most practical and wide variety of scenarios. I have used Q3 SP build for the purpose (Also available via NuGet).
Hope that helps
An update on Network and color values in CSS
Lots of changes in the Network inspector have now made it into an experimental build. The main purpose of the makeover is to give more insight on what happens on the Network side of Opera, with powerful new filtering and search functionality.
The type filter now lets you narrow down the view to certain types of Resources. In addition, you can also look only at the Resources that were requested via XMLHttpRequest. Also you can use CTRL/CMD + click, to combine multiple filters.

We have added an inline search, which works consistently over the URL list, table view, and in the details.

The graph view now uses specific colors to represents the different phases of resource retrieval as segments within each row. A new tooltip lets you see a sequence of internal events in Opera that occur during the retrieval and how much time was spent on each. Note that the values represent the time elapsed between two events.

Although the standard graph view is useful for visualizing the loading flow, sometimes developers may be more interested in picking out specific data about their requests. You can now switch from flow view to a table view, which can be sorted and further customized via the context menu.

Selecting each line will provide the specifics of each request in the Details view, which shows the actual request and response of each network activity, including headers and body. This view has been streamlined: headers are split into key/value pairs, and the response body is shown inline.

Most of these UI changes are still work in progress, but they should give you an indication of where we're heading. A few known issues:
- The line-height of tables can get out of sync with the list of URLs on the left-hand side
- Content tracking is not enabled by default, but available as a toggle in the Network options tab. Without tracking, the response body will sometimes not be shown in the Details view
- The search may sometimes match parts of the UI itself
- The layout in the details view sometimes breaks due to long headers or body
- Timing information in the Network view is not accurate, as it can be affected by other debugging activities in Opera. In general, the loading flow will be slower when Opera Dragonfly is running. We plan to address this issue with a special network-profiler mode, which is on the roadmap for later this year.
But wait, there's more! As a bonus, this build also includes some new features in our Style inspector. We now show color swatches next to all color values. And – as hotly requested by many of our users – it's now possible to use your preferred color format: Hex, RGB or HSL (which can be changed in Settings → Documents → Styles). Other changes include clickable links (which open in the Resources tab) and a streamlined view in the Computed Style panel.

jQuery 1.7.2 Beta 1 Released
Hey there Internets, it’s the jQuery Core team! We haven’t talked in a while, but over the holidays we were busy fixing the bugs you reported. The result of that hard work is jQuery 1.7.2 Beta 1. We decided to get a beta out by Groundhog Day so you wouldn’t be in the shadow of six more weeks of unfixed bugs.
You can get the code from the jQuery CDN:
Oh, we know what you’re thinking: “Cool, a new version of jQuery; I’ll wait until the final release has been out a few weeks and then I’ll give it a try.” Right, and then you’ll find some bug that keeps you from upgrading. Nothing makes us sadder than finishing up a release and only then seeing a report of a serious bug that could have been fixed earlier.
So please, come out of your burrow and try this beta with your code. Did we miss an old bug? Did we create a new bug that makes you feel like Bill Murray waking up to “I Got You Babe?” We want to know. You can use the bug tracker to report bugs; be sure to create a test case on jsFiddle so we can figure it out easily. If you’re not sure it’s a bug, ask on our forum or on StackOverflow.
jQuery 1.7.2b1 Change LogThe current change log of the 1.7.2b1 release.
Ajax- #10978: jQuery.param() should allow non-native constructed objects as property values
- #5571: Allow chaining when passing undefined to any setter in jQuery
- #10692: Configure the jshint options to more accurately match the style guide
- #10902: ability to test a built version of jQuery in unit tests
- #10931: Unit tests shouldn’t require internet access
- #10466: jQuery.param() mistakes wrapped primitives for deep objects
- #10639: outerWidth(true) and css(‘margin’) returning % instead of px in Webkit
- #10754: have jQuery.swap return the return of the callback instead of just executing it
- #10782: Incorrect calculating width
- #10796: Bug in IE7 with $(‘#el’).css.(‘background-position’)
- #10858: css.js regular expressions are incomplete
- #11119: The curCSS function only need 2 arguments
- #8498: Animate Hooks
- #10006: method show is not working as expected in all browsers when called for document fragment
- #10848: Animation toggling loses state tracking in certain atomic edge cases
- #8165: .live(‘click’, handler) fires on disabled buttons with child elements in Chrome
- #10819: Eliminate “this.on.call(this, “
- #10878: $(“select”).live(“change”, function(){ …broken in IE8 in jQuery 1.7
- #10961: Error in XRegExp using jQuery 1.7.1 in IE6-9
- #10970: The .on() selector parameter doesn’t work with :not(:first) selector
- #10984: Cannot off() custom events ($.event.special)
- #11021: Hover hack mangles a namespace named “hover”
- #11076: .clone(true) loses delegation filters
- #11130: jQuery.fn.on: binding map with null selector ignores data
- #11145: $(document).on() not working with name=”disabled”
- #9427: Passing undefined to .text() does not trigger setter
- #10753: inline the evalScript function in manipulation.js as it’s only used once
- #10864: text() method on a document fragment always returns the empty string
- #11055: Update HTML5 Shim elements list to support latest html5shiv
- #10952: .fired() doesn’t work on Callbacks object when it is flagged with “once”
- #11257: Wrong path to source files in test suite if PHP missing
- #11048: Support Tests affect layout for positioned elements in IE6-9
YUI: Open Hours Thurs Feb 2nd
We deployed the second 3.5.0 preview release right on time, celebrated for a couple minutes, then went back to work on PR3, which will be the gating preview before 3.5.0 GA in mid-March.
But we’ll stop to take a breath and highlight some of the changes in PR2. You’ve read the short list on the release blog post, so join us for a little more detail and probably some live tinkering.
As is the case with all preview releases, we’re eager to get your feedback and any bugs you find. Or if you’re note yet convinced to give it a try before the GA, maybe we can convince you.
Time & Details
We’ll be online on Thursday from 10am to 11am PST.
RecordingThe recording is available in the YUILibrary YouTube channel.
Firefox 10 is now available
Firefox 10 is now available as a free download for Windows, Mac, Linux, and Android. As always, we recommend that users keep up to date with the newest version of Firefox for the latest features and fixes. The release notes for Firefox 10 are available here.
Creating custom drag arrow in Silverlight
Since Q3 2011 we have changed the default drag API used. It allows creating more complex scenario as well as building MVVM friendly drag behaviors. However, it does not support drag arrow which, although not very popular feature is still used. Thus, when arrow was required, we have suggesting using legacy execution mechanism.
In this blog I will write how to create your own drag arrow using DragDropManager events. So, basically we will use AddDragInitialize, GiveFeedback and DragDropCompleted to create and control the arrow. We also use Popup to display it on the screen.
The arrow itself is located in Arrow class which derives from Content control and has its own template defined. Thus you can create custom arrow by simply adding new style to this control.
So, in order to use it you can just add the following lines in your code:
- Initialize ArrowService:
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
ArrowService.Initialize(this.RootVisual);
}
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
- Enable Arrow on drag:
ArrowService.DisplayDragArrow = true;
That way you have full control of arrow appearance and behavior. I hope you’ll like it.
Download Silverlight project
