Thursday, November 25, 2010

UINavigationController back button custom text

To Change the back button text we need to give in viewDidApper. If you give in viewDidLoad it not work.

- (void)viewDidAppear:(BOOL)animated {
self.navigationController.navigationBar.backItem.title=@"Back";
}


Tuesday, October 5, 2010

To enable remote connections on SQL Server 2005

To enable remote connections on the instance of SQL Server 2005 and to turn on the SQL Server Browser service, use the SQL Server 2005 Surface Area Configuration tool. The Surface Area Configuration tool is installed when you install SQL Server 2005.


  • Click Start, point to Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Surface Area Configuration





  • Click Surface Area Configuration for Services and Connections. It gives the following screen.





On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Remote Connections, click Local and remote connections, click the appropriate protocol to enable for your environment, and then click Apply.


On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Service, click Stop, wait until the MSSQLSERVER service stops, and then click Start to restart the MSSQLSERVER service.

Enable the SQL Server Browser service

If you are running SQL Server 2005 by using an instance name and you are not using a specific TCP/IP port number in your connection string, you must enable the SQL Server Browser service to allow for remote connections. For example, SQL Server 2005 Express is installed with a default instance name of Computer Name\SQLEXPRESS. You are only required to enable the SQL Server Browser service one time, regardless of how many instances of SQL Server 2005 you are running. To enable the SQL Server Browser service, follow these steps.



On the Surface Area Configuration for Services and Connections page, click SQL Server Browser, click Automatic for Startup type, and then click Apply.











Check the firewall if you are enabled the sqlservr.exe and sqlbrowser.exe.
You may need to create an exception on the firewall for the SQL Server instance and port you are using

  • Start > Run > Firewall.cpl

  • Click on exceptions tab

  • Add the sqlservr.exe (typically located in C:\Program Files (x86)\Microsoft SQLServer\MSSQL.x\MSSQL\Binn),

  • Add the sqlbrowser.exe(typically located in C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe)

Monday, September 20, 2010

Error:The model used to open the store is incompatible with the one used to create the store(in iphone/iPad)

When i was working with coredata first it runs perfect after i change the the data model,my program got crashed.

To solve this problem:
  • Delete your previous builds completely.
  • Delete the app in simulator also
Now build the application and run it its work fine now.

Wednesday, September 1, 2010

Border and Rounded corners the UIImage

To border the UImage is Simple way

Bofore adding the Code import QuartzCore  (#import <QuartzCore/QuartzCore.h>)

UIImage *MyImage=[UIImage imageNamed: @"baby.jpg"];

MyImage.layer.borderColor = [UIColor lightGrayColor].CGColor;


MyImage.layer.borderWidth = 2.0;
To add Corner radius for the same image just add below two lines

MyImage.layer.cornerRadius = 10.0;

MyImage.layer.masksToBounds = YES;

Sunday, August 29, 2010

Remove the Duplicate Rows in DataTable

Removing the Duplicate Rows in DataTable in C# is simple.

Best way is use DISTINCT Keyword in Database Query, but some times we may fill the data manually.

We can remove by using two type

First One is very simple and it is used when we need to compare all columns in the rows.
DataTable _NewTable=_Table.DefaultView.ToTable(true);
Second, Suppose we need to remove the rows for specific columns only means then we can go for the following Method
List<string> keyColumns = new List<string>();
keyColumns.Add("Column1");
keyColumns.Add("Column2");
RemoveDuplicatesFromDataTable(ref _Table, keyColumns);

public void RemoveDuplicatesFromDataTable(ref DataTable table, List<string> keyColumns)

{
Dictionary<string, string> uniquenessDict = new Dictionary<string, string>(table.Rows.Count);
StringBuilder stringBuilder = null;
int rowIndex = 0;
DataRow row;
DataRowCollection rows = table.Rows;
while (rowIndex < rows.Count - 1)
{
row = rows[rowIndex];
stringBuilder = new StringBuilder();
foreach (string colname in keyColumns)
{
stringBuilder.Append(((string)row[colname]));
}
if (uniquenessDict.ContainsKey(stringBuilder.ToString()))
{
rows.Remove(row);
}
else
{
uniquenessDict.Add(stringBuilder.ToString(), string.Empty);
rowIndex++;
}
}
}