MSDTC Issue : Duplicated CID

Recently while overseas at work, I was setting up a distributed environment for a client of mine.

Everything was working fine till I started configuration for the MSDTC (Distributed Transaction Coordinator) on 2 of the Virtual Machines. Both machines just refused to pass data or communicate with each other.

Upon viewing on the Event Viewer, I notice this error.

Duplicate CID.

We found out that the infra guys just copy this VM and change the computer name for it.

Solution:

1. Start Command Prompt as Administrator

2. Enter and Run the following : MSDTC -uninstall

3. Restart your OS.

4. Again Start the Command Prompt as Administrator

5. Enter and Run the following : MSDTC -install

K2 Blackpearl Sharepoint XML not updating

Just the other day, I was working with the K2 Blackpearl 4.6.

It’s a great product but as with all great product, you need a consultant or a product specialist to help you out with various aspect of it.

I will write an article on this product at a later stage for today, I am just jotting down the technical challenge I faced.

K2 Blackpearl have this great feature that pulls the columns for Microsoft Sharepoint Document Library or LIst into its own Object Browser and format it in XML for your usage with the workflow design.

ISSUE:

I was trying to get it to refresh so that the Object Browser updates with the latest columns that I have created in the Sharepoint Document Library.

SOLUTION:

The easiest way is to rerun the Sharepoint Process Integration Wizard that we ran the first time. This will refresh the Object Browser and allow us access to the latest set of the Sharepoint column.

For more information on K2, I found this site extremely useful as the lack of information on the internet was really a show stopper.

www.k2underground.com

Adding Storyboard in your project

So I have worked with Xcode’s Storyboard for awhile now, most of the work are done with a design template that have Storyboard already in.

Just the other night, I tried creating a Single View Application and try to implement a push via segue on it and was thrown with the following:

Error:

Terminating app due to uncaught exception ‘NSGenericException’, reason: ‘Push segues can only be used when the source controller is managed by an instance of UINavigationController.’

Bear in mind that with the various option available on Storyboard, modal will work fine but not push.

For push to work, you will need a UINavigationController. In doing so you can just drag a UINavigationController onto the Storyboard and make sure that you set it as the start of the application.

NavigationController with Start

UITableView Prototype Cell with UIButton

With the introduction of iOS 5, UITableview now comes with Prototype Cell.

For those who work with anything before this, you will know that creating a customized tableview cell take alot of effort.

Today, I am going to show 2 method of getting the instance of the button that is clicked.

Method 1 is the “downright dirty” way of doing things. Method 2 is much “cleaner”.

Method 1:

In the

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

We add the uibutton to the cell and add the indexpath.row to the tag of the UIButton.

UIButton *newButton = [[UIButton alloc ] initWithFrame:CGRectMake(0, 0, 100, 50)];

newButton.tag = indexPath.row;

[newButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];

[cell.contentView addSubview:newButton];

By adding the indexPath.row to the tag of the button allow us to determine which row in the UITableview the user selected.

Therefore in the ButtonPressed Method we can do the following.

-(void) buttonPressed:(id) sender{

//We load the data from a NSArray name array_data

[array_data objectAtIndex:[sender tag]];

….}

As you can see from the above we can therefore know which data is selected and the application can progress forward.

Method 2:

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *CellIdentifier = @”Cell”;

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    }    

    UIButton *btn = (UIButton *)[cell viewWithTag:1];

    [btn addTarget:self action:@selector(onClicked:) forControlEvents:UIControlEventTouchUpInside];

}

The above is similar to the first method. Do note that the cell viewWithTag this have been already added to the Prototype cell in the Storyboard.

The tag can be set via the Storyboard, on the right of the Xcode, 3 tag from the right. The Tag Field.

Now in the onClicked Method.

-(void) onClicked: (id) sender{

    UITableViewCell *clickedCell = (UITableViewCell *)[[sender superview] superview];

    NSIndexPath *clickedButtonPath = [self.tableview indexPathForCell:clickedCell];

  }

In the clickedButtonPath, this allow us to find out the row that was selected by the user.

Summary

The 2 method above shows the different way of doing things, each have its pro and con.

In method 1, by setting the tag of the uibutton we remove certain customising ability should we want to change the color of the uibutton programmatically at a later stage.

In method 2, we have to know the view to cast it as a UITableViewCell and the wrong view will cause us to hit EXE_BAD ACCESS error.

Thanks for the read