Sunday, August 15, 2010

iPhone Web Application


  • You can specify a custom icon for the home screen bookmark using a <link> element, like so:
    <link rel="apple-touch-icon" href="custom_icon.png" />

    If you don’t want iPhone to automatically apply the “shine” effect on your icon, use the following instead:


    <link rel="apple-touch-icon-precomposed" href="custom_icon.png" />

  • Since iPhone OS 3.0, offline web apps can have custom splash screens, as a native app! Simply add a link element to your web page:
    <link rel="apple-touch-startup-image" href="/splash.png" />

Wednesday, July 28, 2010

iPhone: Add bar button item and set action method programmatically

UIBarButtonItem *rButton =[[UIBarButtonItem alloc] init];

rButton.title= @"someText";
[rButton setTarget:self];
[rButton setAction:@selector(aMethod)]; //aMethod defined in the class
self.navigationItem.rightBarButtonItem=rButton;

Tested & working in my project!

Happy Coding :)

Tuesday, July 27, 2010

iPhone : Time interval with a given date

NSDate *now = [NSDate date];
//refDate is the date you select from picker
NSDate *refDate = [datePicker date];

NSTimeInterval difference = [now timeIntervalSinceDate:refDate];
NSString *strTimeDiff =[[NSString alloc] initWithFormat:@"%0.0f",difference];

Monday, July 26, 2010

iPhone : Protocols

Pointy protocol, curved category
In objective C, Pointed brackets are associated with protocols. Curved brackets are associated with categories.

Protocols are Objective C's version of what is known in .NET as "interfaces".

Defining the protocol

@protocol MyProtocolName
//Method declarations go here
@end

there are no curly brackets. That's because variables go in curly brackets, and protocols have no variables associated with them.

Notice 'NSObject'. This actually means that the current protocol is a derivative of the NSObject protocol. (There is both an NSObject class and an NSObject protocol...this is the protocol...)

The concept of protocols: Protocols are a strange & interesting cross between interfaces and event definitions. In the languages (C#, VB.NET, Java etc… ) when you define an interface, you’re defining a common set of methods that objects must implement if they want to be considered to “implement” a given interface. One of the requirements of implementing an interface is that you must implement every method in the interface, either directly or via a subclass by marking the method as abstract.
Interfaces are use frequently for implementing “event callbacks”.

We basically define a standard set of methods/events, called a protocol, that our class will call. Then, when instances of our class are created, a class implementing our protocol, called a ‘delegate’, can register itself as a handler. Take the following protocol definition below:

@protocol MyProtocolDefinition
@required
- (void) Save:(NSString*) stringToSave;
@optional
- (void) OptionalMethod:(NSString*) parameter;
@end

The above code indicates that the Save() method is a required method to implement in classes implementing this protocol. However, the OptionalMethod is optional, meaning classes wanting to use this protocol only need to implement the Save() method, but they could also implement the OptionalMethod.

Using the protocol

In Objective C, you use the pointy brackets in the interface declaration (and by "interface" here, I mean the part of the class in the header file, following the class you extend.
For example, suppose your class was normally declared like:
@interface myClass : UIView

To specify that it implements a protocol, simply change it to this:

@interface myClass : UIView


Protocols [As variables]

In Objective C, you declare a variable this way:

id myNewVariable;

So the new type is "id". "id" is the generic object.

You can also use this notation when defining a method...e.g.

- (void) doSomethingWithThisObject: (id) aObject

Enjoy Coding passionately :)

Thursday, July 1, 2010

iPhone : Change font and label size in UIPIckerView

while using picker view in iPhone ,I face the challenge how to re size the text appearing in Picker view components.

Just do it!
Instead of using-

- (NSString *) pickerView:(UIPickerView *) pickerView

titleForRow:(NSInteger) row

forComponent:(NSInteger) component

{

}



//USE



- (UIView *)pickerView:(UIPickerView *)pickerView

viewForRow:(NSInteger)row

forComponent:(NSInteger)component

reusingView:(UIView *)view {

UILabel *pickerLabel = (UILabel *)view;

if (pickerLabel == nil) {
//label size
CGRect frame = CGRectMake(0.0, 0.0, 70, 30);

pickerLabel = [[[UILabel alloc] initWithFrame:frame] autorelease];

[pickerLabel setTextAlignment:UITextAlignmentLeft];

[pickerLabel setBackgroundColor:[UIColor clearColor]];
//here you can play with fonts
[pickerLabel setFont:[UIFont fontWithName:@"Times New Roman" size:14.0]];

}
//picker view array is the datasource
[pickerLabel setText:[pickerViewArray objectAtIndex:row]];

return pickerLabel;

}

Garg Praveen

iPhone:Add done button to number pad in iphone

Here! We will be knowing how to add 'Done' button on number pad in iphone. this is bit tricky..
Problem specification:
In IB where we can select keyboard type I have changed it to number pad and this code doesn't seem to work for me.

- (BOOL)textFieldShouldReturn:(UITextField *)textBoxName {
[textBoxName resignFirstResponder];
return YES;
}
Type: Number Pad
Return Key: Done

And Auto-enable done key is checked.


But there is no done button appears on number pad!!!!
Hopes are alive ..................
I got the solution :)

when you will see the number pad on iphone ,there is a blank space on left bottom.This is the place which I will use to put Done Image,and use it to get this number pad disappear ...
First add these two images to your resorce folder.









-(void)keyboardWillShow:(NSNotification *)note {

// create custom button

UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
// exactly of image size
doneButton.frame = CGRectMake(0, 163, 106, 53);

doneButton.adjustsImageWhenHighlighted = NO;

[doneButton setImage:[UIImage imageNamed:@"DoneUp.png"] forState:UIControlStateNormal];

[doneButton setImage:[UIImage imageNamed:@"DoneDown.png"] forState:UIControlStateHighlighted];

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

// locate keyboard view

UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];

UIView* keyboard;

for(int i=0; i<[tempWindow.subviews count]; i++) {

keyboard = [tempWindow.subviews objectAtIndex:i];

// keyboard view found; add the custom button to it

if([[keyboard description] hasPrefix:@"
[keyboard addSubview:doneButton];

}

}



//// declare it in .h

-(IBAction) doneButton:(id) sender

{
//objNumberPad is the Keyboard
[objNumericPad resignFirstResponder];

}


//

- (void)viewDidLoad {

//Notification to add done buton on num pad

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];

}

- (void)viewDidUnload {

[[NSNotificationCenter defaultCenter] removeObserver:self];

}

I'm using it in live application,Hope this will resolve your problem.

Friday, May 28, 2010

C#.NET : Return XML Document using a DataSet?

here is the code snippet to return XML document from Dataset :


XmlDocument xd = new XmlDocument();

xd.LoadXml(ds.GetXml()); // ds is the data set

return xd;

Friday, May 14, 2010

Error when trying to do full text search with SQL Server 2008

This was the first time I gone with FULL TEXT SEARCH IN SQL server.and I got....

SQL Server encountered error 0x80070422 while communicating with full-text filter daemon host (FDHost) process. Make sure that the FDHost process is running. To re-start the FDHost process, run the sp_fulltext_service 'restart_all_fdhosts' command or restart the SQL Server instance.

anyways!I wasn't worried about it.After a deep R&D I found the solution :)
The problem was that the actual FTS service was disabled (but not just that.......)
So go into your services and make sure that this one is running:

SQL Full-text Filter Daemon Launcher (MSSQLSERVER)

But even after I set this up running things weren't working.More research led me to find out that there was an issue with the fact that we run our SQL Server under a domain account and the full text search was not running as that same user.

So I configured this service to run as the same user and restarted the service.

Then in SQL Server I ran this:

EXEC sp_fulltext_service 'restart_all_fdhosts'

to restart things.

Also right click on the FTS catalog (under databasename / Storage / Full Text Catalog), picked properties, and then selected the option to rebuild catalog.

OLE DB Connection String to an Excel File(.xls or .xlsx)

To Extract the extension:

string _connectionString= string.Empty;

// pathToFile is fully qualified file path

string Extension = Path.GetExtension(pathToFile);

// Pass the extension to Switch Module
switch (Extension)
{
case ".xls": //Excel 97-03
_connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + pathToFile + @";Extended Properties=""Excel 8.0;HDR=YES;IMEX=1;""";

// If there is no header set HDR to NO

break;

case ".xlsx": //Excel 07
_connectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + pathToFile + @";Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""";

break;

}

Thursday, May 13, 2010

Manually register ASP.NET if IIS is installed after the .NET Framework

Framework installation installs ASP.NET automatically only if IIS is already installed.if you install IIS after the Framework you need to manually register ASP.NET.

Go To C:\WINDOWS\Microsoft.NET\Framework\VERSION
[here C:\ is Windows installation drive on your machine.]
(e.g. VERSION is v2.0.50727)

You'll see there aspnet_regiis.exe.
Run that on command line with -i switch (e.g "aspnet_regiis -i"). That'll register ASP.NET to your machine as well as creates the ASPNET user.

Wednesday, May 12, 2010

Mobile applications development

In this era, there are huge business opportunities in mobile area. All solutions will include mobile capabilities.
The market is huge and fast-growing.
If you are interested or have already plans to create mobile apps , windows applications,office automation tools,web scrapping tools with HIGH QUALITY at LOW COSTS, we can be your best partner. Please take time to go through below text to learn how you can benefit from our resources and capabilities.
I’m now looking for opportunities of helping you to turn your great ideas and plans into wonderful products.
We are strong expertise and rich resources in developing mobile software(app & game) for iPhone etc. and have successfully delivered couple of mobile projects. We have been working with global customers. We are capable to develop complicated iPhone applications involving advanced UI effects . and windows application programming with database integration and office automation with high security & performance.

We have been always keeping pace with edge-cutting new technologies.As an integrated team ,We have established development processes involving R&D, architecture QA, performance testing, unit testing, code reviews. We adopt best practices such as iterative development, prototyping,agile, etc.

By working with us, you can get all you need – Quality in time at low cost.