• Skip to main content
  • Skip to primary sidebar

Ravi Shankar

Tweaking Apps

  • Swift
  • Tech Tips

How to hide header/footer while typing in Excel 2010

February 7, 2012 By Ravi Shankar Leave a Comment

This is in response to question asked by a reader of this blog related with header and footer in Excel 2010.

how do I make the header / footer not visible on the page while typing?

When you click on the insert header and footer option in Excel 2010, excel would immediately change the view to Page Layout. Hence you would see the newly added header and footer in your worksheet.

image

After typing the required header and footer details and do not want to see header and footer while typing you excel sheet in the data section then you can change the view to Normal by selecting Normal under the Workbook Views section.

image

This would temporarily hide the inserted header and footer in the Worksheet and you can always get it back by changing the Workbook view to Page Layout.

del.icio.us Tags: Excel 2010,Header,Footer,Hide,Workbook,Worksheet,Views,Normal,Page Layout

Filed Under: Excel, Excel 2010, Office 2010 Tagged With: Excel 2010, Footer, Header, hide, Normal, Page Layout, Views, Workbook, Worksheet

How to disable code completion suggestion in Xcode

February 4, 2012 By Ravi Shankar Leave a Comment

Xcode is one of the powerful IDE for IOS development and by default it supports code completion suggestion. Code completion feature suggests users with possible code substitution when you start typing first few letters of code in Xcode editor.

201202040829.jpg

For example, if you have UILabel reference variable and start typing “t” after the dot then the above code completion popup will be displayed. Now you can quickly pick up your desired attribute from the list.

In case if you do not prefer the code suggestion and find it more annoying then you can disable this option using the Xcode Preferences.

Click the Xcode menu and select Preferences from the menu list.

201202040832.jpg

In the Preferences window, navigate to Text Editing Preferences then Code Completion under the Editing section.

201202040834.jpg

Unmark the check box with caption as “Suggest completion while typing“. This should turn off the code completion feature in Xcode.

Filed Under: Xcode Tagged With: Apple, code completion, Disable, Suggestion, Xcode

How to set Organization name for Xcode Project

February 3, 2012 By Ravi Shankar Leave a Comment

When ever a new project is created in Xcode, the projects files like header and implementation files will have auto generated comment section at the top of the file. This comment section will have information such as file name, Project name, Author and Organization name.

//

// ViewController.h

// Welcome

//

// Created by Ravi Shankar on 02/02/12.

// Copyright (c) 2012 __MyCompanyName__. All rights reserved.

//

If you have not set the organization name then the default value substituted will be _MyCompanyName_. You can set the Organization name by the following ways.

  • Setting Organization name under File Inspector
  • Updating Company name for the user in Mac Address book

File Inspector

Select the Project in the Project Navigator, then navigate to Utilities section and click the File Inspector icon. Now navigate to Project Document section and enter the company name in field with caption as Organization.

201202031600.jpg

Now if you add any new file to this project then the auto generated comment will have the company name as “rshankar.com”.

Address Book

If you want to retain this organization name for all the future projects then update the company name for the user in Mac Address Book. Launch Address Book, then select the user and update the company name as shown below.

201202031613.jpg

Now when ever a new project or new file is added in Xcode, the Organization name will be set the value provided for company name in address book.

//

// ViewController.h

// OrganizationName

//

// Created by Ravi Shankar on 03/02/12.

// Copyright (c) 2012 rshankar.com. All rights reserved.

//

Please note that any files created before this change will not get affected and you will have to manually update company name.

Filed Under: Xcode Tagged With: Apple, Organization, Xcode

iPad App that prints Welcome Message

February 2, 2012 By Ravi Shankar Leave a Comment

Here is an example of writing an iPad app that prints a Welcome message.

Launch Xcode, click File -> New -> New Project.

New Project

Now select the template for the project as Single View Application.

Project Template

Provide the details for your project, like Product Name, Company Name then choose the device for which you are writing the App. Also mark the check box with label as Use Automatic Reference Counting and click the Next button.

Options for New IPad Project

And finally click the Create button to complete the project creation. Now Open the ViewController.xib file and using the Interface Builder designed add two label controls , TextField and Button as shown below.

UI Interface Builder

Label 1 is used for displaying the caption “Enter your Name”, TextField is used for accepting user input, Display button is used for printing the Welcome message in the second label.

Now edit ViewController.h file and add two IBOutlet elements for UITextField and UILabel and IBAction element for button as shown below.

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

{

IBOutlet UITextField *txtName;

IBOutlet UILabel *lblMessage;

}

-(IBAction) btnDisplay;

@end

Then edit ViewController.m file and implement the IBAction function as shown below

– (IBAction)btnDisplay {

lblMessage.text = [@”Welcome “ stringByAppendingString: [txtName text]];

}

This function creates local string by adding “Welcome ” and suffixing it with the name entered in the Textfield.
After completing the coding part, it is time to connect the UI Interface elements with the Object References in code. Select ViewController.xib in the Project Navigator section then click the File’s Owner under Place Holder section. Drag and drop the respective object references to the UI element and connect map the btnDisplay with the Button Touch Down event. The completing mapping of UI Interface elements with Object References is shown below.
UI Elements and Object Reference Mapping

Now the Run the App in iPad simulator by clicking the Run option on the menu bar or by pressing Control + R on the Keyboard.
iPad Simulator
Now entering the name and clicking the Display button will print the Welcome message as shown below.
Welcome App in iPad Simulator

Filed Under: Apple, Develop, ios, iPad Tagged With: App, Apple, iPad, Welcome

How to set Keynote as default application for PPT file

January 27, 2012 By Ravi Shankar Leave a Comment

Mac OS X Lion is pre-installed with OpenOffice software and this is set as the default application for opening any PowerPoint presentation file. Mentioned below are the steps required to set Apple Keynote as the default application for opening PPT file.

  • Launch Finder application on Mac and locate the PPT file.
  • Right click on the PPT file, navigate to Open With and Select Other option.

201201271605.jpg  

  • This would display the following Choose Application window.

201201271607.jpg

  • Scroll down the application list and pick Keynote. Then mark the check box with label as “Always Open With” and click the Open button.

201201271609.jpg

  • This would launch the Keynote application with the selected PowerPoint Presentation file.

Now when ever a PPT file is opened, it will be automatically opened in Apple Keynote.

Filed Under: Apple, Keynote, PowerPoint 2010 Tagged With: Apple, Default, Keynote, Mac OS X Lion, Powerpoint 2010, presentation

Dissecting Objective-C program

January 14, 2012 By Ravi Shankar Leave a Comment

Fotolia_29238788_XS.jpg

We have already seen couple of examples in Objective-C like writing your first program in Objective-C and adding Objective-C classes. Now let us try and analyze the code to learn basic coding on Objective-C program.

Adding Comments

The very basic thing to learn is any programming language is “how to add comments”. In Objective-C you can add comments by adding two consecutive slashes “//” before the text entries. And if you want to add block of comments (more than one line) then you start with /* and end the comment with */

Including Header files

In Objective-C, users can include header files by adding “#import <header filename>”. This would include functions and classes from the header files in to the current program. The examples that has been discussed includes “Foundation” and “Calci” header files.

#import <Foundation/Foundation.h>

#import “Calci.h”

main keyword

int main (int argc, const char * argv[])

“main” is the keyword that marks the beginning line for execution of the program.

Reserving memory

  @autoreleasepool {

The execution code is provided within autoreleasepool and this allocates memory for the program. Now you do not have to explicitly drain the pool, the latest release will automatically drain the allocated memory.

Printing Message

 

  NSLog(@”My First Objective C Program using Xcode!”);

 

NSLog routine is used for printing text messages to the console. The text that needs to be printed is preceded with “@” character. And if you want to print value from a variable then you can use “%i” along with text.

 

NSLog(@”Addition of two numbers %i”, [calculator addition]);

 

Method definition

 

In Objective-C, you can define methods as shown below

 

-(void) setNumber1:(int) n1

-(int) addition

  • “-” refers to the access specifier.
  • void and int specifies the return type for the method.
  • setNumber1 and addition refers to the method name.
  • (int) n1 specifies the type of argument and argument that will be passed to the method.
  • return number1+number2; – “return” keyword is used returning the value from the method.

Filed Under: Apple, Develop, ios Tagged With: Apple, Objective C, Program

Basic tutorial – Adding Objective-C Class using Xcode

January 13, 2012 By Ravi Shankar 1 Comment

Let us see how to add a class in Objective-C by looking at an example that provides basic functionality of adding two numbers. In this example we will be using Xcode for development similar to the earlier post on first program in Objective C using Xcode.

This program is going to have to three main section.

  • Defining Interfaces.
  • Implementing Class methods.
  • Using Objective C class in the program.

Xcode users can add a new class to an existing project by clicking File -> New

201201131923.jpg

This would display the following “Choose a template for your new file” window. Now select Objective-C class from the templates and click Next button.

201201131930.jpg

Then provide a name for the Class some thing like Calci. Also select the Subclass for the class as NSObject and click Next button.

201201131931.jpg

Now this would add two files with extension .h and .m, “Calci.h” and “Calci.m”.

Defining Interfaces

You can define the interface required for adding two numbers in header file (Calci.h). When you add the class file using Xcode, it will be pre-populated with the following code in “Cacl.h” header file.

//

// Calci.h

// Exercise2

//

// Created by Ravi Shankar on 13/01/12.

// Copyright (c) 2012 __MyCompanyName__. All rights reserved.

//

#import <Foundation/Foundation.h>

@interface Calci : NSObject

Write two interfaces for setting the two numbers and another interface for adding the two numbers.

#import <Foundation/Foundation.h>

@interface Calci : NSObject

{

int number1;

int number2;

}

-(void) setNumber1: (int) n1;

-(void) setNumber2: (int) n2;

-(int) addition;

@end

Implementing Methods

After defining the interfaces, implement those interfaces in .m file (Calci.m). When a new class is added, Xcode will pre-populate the .m file with the following code.

//

// Calci.m

// Exercise2

//

// Created by Ravi Shankar on 13/01/12.

// Copyright (c) 2012 __MyCompanyName__. All rights reserved.

//

#import “Calci.h”

@implementation Calci

Now add the following piece of code to add the functionality for settings the two numbers and a method that adds these numbers.

#import “Calci.h”

@implementation Calci

-(void) setNumber1:(int) n1

{

number1 = n1;

}

-(void) setNumber2:(int) n2

{

number2 = n2;

}

-(int) addition

{

return number1+number2;

}

@end

Using Objective C class in the program

After defining and implementing the interfaces in the .h and .m file, now it is time to use the functionality in the program.

  @autoreleasepool {

  

Calci *calculator;

calculator = [Calci alloc];

calculator = [calculator init];

[calculator setNumber1: 35];

[calculator setNumber2: 65];

  

// insert code here…

NSLog(@”Addition of two numbers %i”, [calculator addition]);

  

}

The above code creates an instance of the “Calci” class, then passes the two numbers that needs to be added. Finally [calculator addition] does the addition and the result is printed using NSLog routine.

Filed Under: Apple, ios Tagged With: Apple, Classes, Objective C, Xcode

My fiirst program in Objective C using Xcode

January 11, 2012 By Ravi Shankar Leave a Comment

This tutorial is about writing a basic and simple program in Objective C using Xcode. Let us see an example program that prints “My First Program” in the Console Window.

Xcode new project window

Click the File menu on Xcode, then navigate to New -> New Project. This would display the following Choose a template window. Now select Application under Mac OS X then the Command Line Tool option.

Xcode Command Line Tool

In the Choose options for your new project, enter the name of Product Name and select the Type as Foundation and leave the rest of the option as it is. Click Next to continue with the project creation.

Xcode Choose Project Options

Now specify the location where you want to create the project folder and click Next to continue with the setup.

Xcode Project Creation Folder

This would create a new project window as shown below.

Xcode Project Window

Navigate to Project Navigator and edit main.m file. The Xcode would have already pre-populated code as shown below

//

// main.m

// Exercise1

//

// Created by Ravi Shankar on 11/01/12.

// Copyright (c) 2012 __MyCompanyName__. All rights reserved.

//

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])

{

@autoreleasepool {

// insert code here…

NSLog(@”Hello, World!”);

}

return 0;

}

Change the “Hello World” text to “My First Objective C Program using Xcode” and save the changes (Command + S).

@autoreleasepool {

// insert code here…

NSLog(@”My First Objective C Program using Xcode!”);

}

You can Run the project in Xcode by clicking Product menu and select Run from the menu list.

Xcode Project Build

You can Run Once the build is complete and successful, the output window in the bottom of Xcode will print the message as “My First Objective C Program using Xcode”.

Xcode Console Output Window

Filed Under: Apple, Develop, ios Tagged With: Apple, Objective C, Program, Xcode

  1. Pages:
  2. «
  3. 1
  4. ...
  5. 35
  6. 36
  7. 37
  8. 38
  9. 39
  10. 40
  11. 41
  12. 42
  13. 43
  14. 44
  15. »
« Previous Page
Next Page »

Primary Sidebar

TwitterLinkedin

Recent Posts

  • How to block keywords in Jio broadband
  • How to disable opening an app automatically at login in Mac
  • How to set preferred Wifi network on Mac
  • Attribute Unavailable: Estimated section warning before iOS 11.0
  • How to recover Firefox password from Time Machine backup

Pages

  • About
  • Privacy Policy
  • Terms and Conditions

Copyright 2022 © rshankar.com

Terms and Conditions - Privacy Policy