Intellicore Ltd

Hello and welcome

to Intellicore’s blog where we will give you info on relevant topics in relation to IT. We see the blog as a joint effort and would love to hear what you would like us to feature (there’s no point in us writing a blog that’s not of interest and we’d hate to bore you…)

Friday, 26 April 2013

Xcode Instruments Series: Part 1 - Automating Tests With UIRecorder


In this series of posts, we’re going to cover the basics of using Xcode's Instruments tool to test and debug code.

First of all, let’s explain what Xcode is:

Xcode Instruments is a performance, analysis, and testing tool for dynamically tracing and profiling OS X and iOS code. It is a flexible and powerful tool that lets you track one or more processes and examine the collected data.  Instruments helps you understand the behaviour of both user apps and the operating system.  It comes bundled with Xcode when you download it.

If you have ever experienced a bug in your code and have taken many steps to replicate it, then this first instalment is for you.  Testing and debugging code can be a very laborious process, requiring huge amounts of time, patience and dedication - especially in the realm of the iPhone.

For example, say you have an application that drills down 4 levels deep in the view hierarchy; now let’s say you have a bug in that fourth level.  Usually, you would perform the following steps to replicate that bug:



As you can see this is not an ideal situation and can be very wasteful of a developer’s time.  This is where Xcode's Instruments tool comes in; one of the most useful functions it provides is the ability to automate your testing:


  • Open up the applications project you wish to test/debug.
  • Launch the application in the simulator.
  • Open Instruments – This is located in /Developer/Applications/Instruments.
  • Select UIRecorder and click Choose.
  • Now attach this tool to the iPhone Simulator process. Click the drop-down above Default Target -> Attach to Process -> iPhone Simulator.
  • Now click Drive & Record and do all of the steps in the simulator to test your application. At this point, the UI Recorder is recording your every move. When you have finished press the Stop button. Note: After you have recorded your actions, don’t move the simulator as it will mess up the entire process.
  • Make any changes to your code.


  • Press the Drive & Record. The test is automatically done for you. You should see your mouse move over to the simulator and the system mimicking every action that you did before.


There we are – that’s how you automate testing using Instruments, it’s really as simple as that.

Even though this isn't a very long tutorial, it is incredibly useful and can save hundreds of man hours in development, as well as a lot of headaches!

Wednesday, 20 February 2013

How-to-integrate an SSRS report design

Best practice when designing a RDL report:
  • Always put controls of a section/sub-section in a rectangle, for correct alignment. This will save positioning and sizing of set of controls as a whole, especially when rendering to different formats or exporting to PDF.
  • While concatenating more than 1 field/values (e.g. complete address or Full name) use t/sql functions of STUFF & COALESCE.
For example, following is for column CustomerAddressLine consisting of multiple column/field values, with inclusion of line feed
STUFF( COALESCE(', ' + NULLIF(I.itg_customeraddress1, ''), '')  +  COALESCE(', ' + NULLIF(I.itg_customeraddress2, ''), '') , 1, 1, '') 
+ char(10) +
STUFF( COALESCE(', ' + NULLIF(I.itg_customeraddress3, ''), '')  +  COALESCE(', ' + NULLIF(I.itg_customercity, ''), '') , 1, 1, '') 
AS “CustomerAddressLine",


  • For landscape layout set width as 29cm and height as 14 cm, inclusive of Report Properties of Page margins. For Portrait style – the Default Page size should do.   This layout will ensure right rendering when exporting to PDF/Adobe file format.


  • Dashed/Dotted line can underlined for field/values using BorderStyle for Bottom part of the SSRS report.
  • For checks/ticks/tick marks use FONT Wingdings or webdings. 


  • Segregation of DataRows can be done using Row num and combining with proper logic around it. Refer dataset dsDetector & dsDetector2.
  • In VS2005, when there is need to show recurring sub-reports Table control can be used. Each of table body can refer to sub-report with its own set of parameters.


  • This covers most of the best practices to make sure report rendering is applied without surprises , although there are sure to be more.  Most people still learn something new every time they use it!


  • The key to a good use of SSRS Report is knowing your selection tools properly, and being able to choose the most appropriate one for the task will save lots of time. 


Note: Above rules are applicable when designing/creating with Visual Studio 2005.

Wednesday, 6 February 2013

How to make a good Photoshop selection


One of the key skills when using Photoshop is definitely knowing how to make good selections on your images. Have you ever seen the typical poor photo-montage where you can clearly see that one of the pictures has been 'cut-out' like if a child was learning how to use scissors for the first time? That's bad image selection, and it can often mean the difference between good and bad image-editing.

In Photoshop there is a huge range of selection tools and options you can choose from, ranging from very basic to quite complex, depending on what you're trying to do. Below are some of the ones available and a short description of what they do. (I have also aded the command in brackets, as these can become extremely useful to learn if you are wanting to cut down on time.)

From top to bottom on the tool bar:
  • Lasso Tool (L) - This tool has three variables:
    • Lasso Tool (basic) - allows you to draw your selection boundaries freely.
    • Polygonal Lasso Tool - allows you to draw in straight lines forming polygonal shapes.
    • Magnetic Lasso Tool - is used just like the previous tool, except that it automatically snaps to the edge of the shapes on your image. (This can prove to be a much quicker option for images that have clearly defined and contrasted shapes; however if not so, the magnetic tool can become very inaccurate.) 

  • Magic Wand (W) - This is one of the most popular selection tools, and also has two variables:
    • Magic Wand Tool - selects areas of a similar tone.
    • Quick Selection Tool - selects are of similar texture or appearance. 
    • The functionality of these tools can be modified on the menu that appears when selected, by adjusting the following:
      • Tolerance - this value determines how similar the tone or texture has to be from the area clicked on to be included in the selection. The larger the tolerance, the bigger the difference can be. (For example, selecting something red with a small tolerance, will select a very specific tone of red and nothing else; whereas selecting something red with a large tolerance could potentially also select light red, dark red, reddish orange and reddish pink.) 
      • Anti-alias - selecting this option will slightly soften the borders of your selection, giving it a less 'pixeled' appearance.
      • Contiguous - selecting this option will ensure that the tones or textures you are selecting are connected. (Un-ticking this option can allow a faster selection when a general tone is to be selected throughout the image.)
      • Sample all layers - selecting this option will allow your tool to select pixels from all layers at the same time.

  • Selecting using vector shapes - Pen Tool (P) & Custom Shape Tool (U):
    • These tools and their variables are not generally used as selection tools, however the more complex shapes or presets available can sometimes be very useful to convert into a selection. 
    • To do this, just draw your shape, and then in the 'Paths' menu, right-click on your shape and choose "Make selection". 

  • Modifying your selection - The options can be grouped into three main actions, and can be found in the 'Select' menu:
    • Adding:
      • Add - To add to your selection, simply hold down the Ctrl key whilst using any of the selection tools. 
      • Expand - Allows you to expand your selection by a determined number of pixels, whilst maintaining the original shape.
      • Grow - Will include all adjacent pixels falling within the tolerance range of your selection.
      • Similar - This option works a bit like un-ticking the 'Contiguous' option, as it will select similar tones / textures regardless of whether they are connected or not in the image.
      • Border - Will select a border of a determined number of pixels around your original selection.
    • Subtracting:
      • Subtract - To subtract from your selection, simply hold down the Alt key whilst using any of the selection tools. 
      • Contract - Allows you to contract your selection by a determined number of pixels, whilst maintaining the original shape.
    • Effects:
      • Feather - Softens the edges of your selection giving them a gradual transition to transparency. The feather value will determine how many pixels around the edge the feathering will affect. 
      • Smooth - Slightly simplifies and smoothes the selection line.
      • Invert - Selects the opposite pixels, all the ones that were unselected previously.
      • Transform selection - This option allows you to use the 'Free Transform' options (scale, perspective, distortion, etc) directly on the selection line, without affecting the image behind.

  • Saving your selection - Once you have managed to make your selection, you can save it into Photoshop, going to menu Select > Save Selection, and load it again with Load Selection. This way you won't have to go through the whole process more than once. 

This covers most of the options available, however I'm sure there could be more, as after using Photoshop for about 10 years I still learn something new each time!
I would definitely say that the key to a good use of Photoshop is knowing your selection tools properly, and being able to choose the most appropriate one for the task will save you a lot of time. 


Thursday, 31 January 2013

Compiling MonoTouch Application to Device Fails - Works on Simulator

This week I ran into a problem that prevented the application I had written in MonoTouch from com-piling successfully to the iPhone/iPad device.

I outlined the problem more thoroughly on StackOverflow:


As you can see my question received a couple of answers, none of which worked out for me (though entirely valid).

So after more problem solving I worked out the solution below:
I changed the lines that read:

fs = new FileStream(fileName, FileMode.Open);

to:

fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);

This fixed the problem because the default constructor asks for read/write access, which the applica-tions main bundle does not allow.  Therefore, by specifying read-only access, the file stream does not ask the main bundle for write access which allows the file stream to read in the data.  Simple when you know how, hope you found this helpful.

By Jack Nutkins,
Intellicore Junior Software Developer

Thursday, 10 January 2013

MonoTouch iOS Applications - Documents Directory & FileStream

We’re all about solutions at Intellicore – we’ve written the following article to address a very specific problem that took one of the team quite some time to figure out in regards to accessing the main bundle on an iPh-one/iPad device via MonoTouch (C# code).

The problem was that, as a developer to use the problem code mentioned in the article would have prevented the user from accessing certain files in the main bundle and using them within the application itself.   We’ve gone through extensive trial and error so you don’t have to - in order to find the solution to what is really quite a simple problem.

Recently, while developing an iPhone application in MonoTouch a bug presented itself meaning that access to certain files within the main bundle on the iPhone device was not available.  The directory existed in the main bundle because the following code returned 'got it':

if (Directory.Exists (NSBundle.MainBundle.BundlePath + "/TheDirectory")) {
    Console.WriteLine ("got it");
    } else {
      Console.WriteLine ("can't find it");
       }

Where "TheDirectory" is the directory our developer was trying to access within the main bundle.  Eventually we managed to figure out the problem, it was to do with the FileStream.  In the program, there were several occurrences of the line (or similar):

fs = new FileStream(fileName, FileMode.Open);

Now, if you’re a savvy iPhone developer, you'll know the main bundle is read-only.  This line caused a problem because unless you explicitly specify the type of FileAccess in the FileStream constructor, it will default to File-Access.ReadWrite.  This caused the following stack trace to be generated:

System.InvalidOperationException: Operation is not valid due to the current state of the object
  at System.Linq.Enumerable.Max[TileIndexRecord] (IEnumerable`1 source, System.Func`2 selector) [0x00000] in <filename unknown>:0
  at MyCompany.Data.Arcs.Loader.ExtractWriteableBitmap (MyCompany.Data.Arcs.Records.RGBPaletteRecord rgbPalette, Double dpi, MyCompany.Data.Arcs.Raschts.ChartIndexFile indexFile, MyCompany.Data.Arcs.Raschts.RasterChartFile chartFile) [0x00000] in /Users/me/Desktop/ARCSViewer/ARCSViewer/Loader.cs:571
  at MyCompany.Data.Arcs.Loader.GetHiResImage (MyCompany.Data.Arcs.Records.RGBPaletteRecord rgbPal-ette) [0x00000] in /Users/me/Desktop/ARCSViewer/ARCSViewer/Loader.cs:362
  at ARCSViewer.SecondViewController.generateChart (Int32 chartNumber, System.String palette) [0x0004e] in /Users/me/Desktop/ARCSViewer/ARCSViewer/SecondViewController.cs:118
  at ARCSViewer.SecondViewController.ViewDidAppear (Boolean animated) [0x00007] in /Users/me/Desktop/ARCSViewer/ARCSViewer/SecondViewController.cs:84
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at ARCSViewer.Application.Main (System.String[] args) [0x00000] in /Users/me/Desktop/ARCSViewer/ARCSViewer/Main.cs:17

This was preventing us from accessing the files in the main bundle.  In-order to circumvent this problem, all occurrences of the FileStream constructor mentioned above were changed to:

fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);

This forced the FileStream into a read-only state and allowed access the files in the main bundle.
At Intellicore, we specialise in mobile application development and would gladly take on projects that require solutions for multiple types of mobile platforms, from iPhone and iPads to Android-based devices.

Tuesday, 4 December 2012

The difference between Workflows and Dialogs in CRM 2011

A lot of Microsoft Dynamics CRM users get confused as to the difference between workflows and dialogs and so, being the helpful people we are – we’re going to try and cover some of the basics with this post.

The most frequently asked questions are:

  • When do I use a workflow, and when do I use a dialog? 
  • How are they different?

In short, dialogs execute synchronously (in real-time) whereas workflow execute asynchronously (in the background) - workflows don't require user interaction in order to complete whereas dialogs do.

Workflows and Dialogs are 2 separate kinds of processes in a Dynamics CRM 2011 system; they fall into this category because they are designed to support and automate particular processes within the system.

There are 5 distinct differences between workflows and dialogs which have been summed up in the following table:


Workflows Dialogs
InitialisationUser can start the process or the process can be automated.Must be started by user.
ParametersNeed to follow the configuration parameters for executionSynchronous process that requires user-interaction in-order to complete.
TriggersSupportedUnsupported
XAML CriteriaCreating and editing that happens outside of Microsoft Dynamics CRM in a XAML file for these processes are supported for workflows
Creating XAML (declarative) workflows doesn’t require you to write code either. You can import them right into Microsoft Dynamics CRM.
Creating and editing that happens outside of Microsoft Dynamics CRM in a XAML file for these processes is not supported for dialogs.


Bear in mind there are other slight differences between these processes, such as the entity that stores each running processes details (Workflow = AsyncOperatioin & Dialog = ProcessSession). 
Though these processes seem very similar, they are designed to benefit organisations in different ways:

Some examples of workflows:

▪ When a new contact record is created, send an email to the owner who is assigned to the contact.
▪ When an opportunity closes as won, update the account relationship type from prospect to customer.
▪ When the user fills in the last status field, copy that status to a note related to the record.
▪ Select a group of account records in a grid and run a manual workflow that creates an e-mail activity for those accounts.



Some examples of dialogs:


  • Customer service inbound call scripting, so your customer services representatives ask the correct questions. 
  • Prospecting for new clients. Create a dialog and have your outbound call specialists follow the script during their calls. Have the ability to create a new record based upon the inputs in the dialog. 
  • Ensure data integrity. If staff are forgetting to fill in certain fields when creating a new record, the process can be simplified through use of a dialog can guide your staff through the process of creating a new record. 
We hope that after reading this post you have a better understanding of the difference between workflows and dialogs, if you have any issues regarding your Microsoft Dynamics CRM 2011 system get in touch, don’t be shy!

Friday, 16 November 2012

How to Install BID

In this, our first blog we would like to impart some wisdom on an area that some of you have made enquiries about, we get a lot of questions at Intellicore and when we see one that crops up as often as this we think it useful to put together a little “How to” guide.

Please let us know how you get on with this, if you need more (or less) detail and if there’s anything we’re not doing that we should be, all comments welcomed! And now, without further ado:

In order to install BIDs, which allows for the modification of CRM 2011 reports in Visual studio, one needs to follow these steps (in the EXACT ORDER):

  1. Install Microsoft SQL Server 2008 R2 (with BIDs).
    • http://www.microsoft.com/en-us/download/search.aspx?q=sql+server+2008+r2
  2. Install Visual Studio 2008. 
    • http://www.microsoft.com/en-us/download/details.aspx?id=3713 
  3. Install any Visual Studio 2008 Service Packs.
    • Service Pack 1
      http://www.microsoft.com/en-gb/download/details.aspx?id=10986
These steps must be followed in the exact order for installation to work correctly.

From here, you can export any of your reports from Microsoft Dynamics CRM and import the files into BIDs in order to customise them to your exact specifications. Follow these steps to export a Dynamics CRM 2011 Report:
  • Navigate to the reports grid 
  • Highlight the report you want 
  • Click Edit report 
  • Click Actions-> Download Report 

This will give you the .rdl file.

This .rdl file can then be imported into BIDs and modified, after which you can import the modified report file back into CRM and use it in your solutions.

Posted by Jack Nutkins, Junior Software Developer at Intellicore