Wednesday, November 9, 2011

Xcode 4 : Select and Edit All Variables in Scope


The Jump Bar is the navigation area at the top of the source editor pane, which is highlighted in red in the figure below:


There is a popup menu available by clicking on each separate section of the Jump Bar. For example, clicking on the title SandboxAppDelegate.m will bring up a list of all the other files stored at the same location in the project hierarchy. Notice in the screenshot below that the file list shown in the popup is the same as shown in the project navigator.


Jump Bar Tip #1 – Sorting
You can sort the entries in the popup list by Command-clicking the Jump Bar. In the screenshot below is the same popup shown above, however, all the entries are now sorted.


Jump Bar Tip #2 – Type Ahead
Once a popup is displayed, you can type ahead to narrow the list of entries. This is really handy if you have a long list of files or methods and are looking for a specific entry.
The screenshot below shows the popup for the file list:

As I type characters, the list of the entries narrows based on my search:


Jump Bar Tip #3 – Open in Assistant Editor
To open a file in the assistant editor, from within the popup showing the file list, Option-click the desired file. If you are viewing a popup of the methods in a file, if you Option-click, the file containing the method will be opened in the assistant editor, and the selected method will be highlighted:

Xcode 4 : Select and Edit All Variables in Scope


Xcode offers a nice way to highlight all references of a variable within the current scope. First, make sure you have the setting shown below enabled within the Text Editing tab in the Xcode Preferences:


Now, select a variable within your code, and notice that all references within the current scope will be highlighted. For example, below I selected (double tapped) username and all references are now underlined.

In the above figure notice the drop down arrow next to the first instance that I referenced. Tapping this arrow brings up an dialog, given the configuration of my system, the dialog looks as follows:

The values in your dialog may be different based on your system configuration.
If you choose the Edit All in Scope, Xcode will highlight all references and allow you to change the name of the selected variable. Changes will cascade through to each reference of the variable.

Using this tip you can quickly change all references to a variable in the current scope, watching the changes take place as you type.

Get Started Guide for iOS using Phonegap


  • 1. Requirements

    • Intel-based computer with Mac OS X Snow Leopard (10.6)
    Necessary for Installing on Device:
    • An Apple iOS device (iPhone, iPad, iPod Touch)
    • iOS developer certification
  • 2. Install SDK + PhoneGap

    Download and install Xcode from Apple Developer Portal (Membership required)

    Download the latest copy of PhoneGap and extract its contents. Navigate to the iOS directory and run the installer until completion.
  • 3. Setup New Project

    • Launch Xcode, then under the File menu select New and then New Project...
    • Select PhoneGap-based Application from the list of templates
    • Select the Next button, Fill in the "Product Name" & "Company Identifier" for your app
    • Choose a directory to store your app
    • You should see your project in Xcode 4 now. Press the Run button in the top left corner. Your build should succeed and launch in the simulator
    • You should see a error in your simulator informing you index.html was not found
    • To fix this, we need to copy the www directory into the project. Right click on the project in the left navigation window and click show in finder
    • In Finder, you should see the www directory beside your project
    • Next step is IMPORTANT! Drag the www folder into Xcode 4. You can't just drag the www folder into your app's folder. It needs to be dragged into Xcode 4!! In my case I would drag it and drop it on HiWorld shown below.
    • After you drag, you should see a prompt with a few options. Make sure to select Create folder references for any added folders. Click Finish
  • 4. Hello World

    Open the folder named www and type <h1>Hello World</h1> after the <body> tag in index.html. You can also add any associated Javascript and CSS files there as well.
  • 5A. Deploy to Simulator

    • Make sure to change the Active SDK in the top left menu to Simulator+version#.
    • Hit Run in your project window header.
  • 5B. Deploy to Device

    • Open [AppName]-Info.plist and change BundleIdentifier to the identifier provided by Apple. If you have a developer license, you can access and run the Assistant at here and register your App.
    • Make sure to change the Active SDK in the top left menu to Device+version#.
    • Hit Run in your project window header.
  • Thursday, November 3, 2011

    Read some interesting data from your iDevice with iOS 4.3



    Ever tried to read some interesting data like the Serial Number, IMEI, Phone Number… from your iPhone (or an other iDevice) ? Some data is easy to access, some other uses not supported API calls. I have written a simple App which can read the above mentioned data. You can download it here (click)

    Reading common data is very easy, this is the Code for the UniqueIdentifier, iDevice Name, System Name, System Version and Model:
    1. // Stores the complete Text Output 
    2. NSMutableString *data = [[NSMutableString alloc] init];  
    3. // Reading Legal Apple Data 
    4. [data appendString:[NSString stringWithFormat: @"%@: %@nn",
      @"phoneUniqueIdentifier", [[UIDevice currentDevice] uniqueIdentifier]]]; 
    5. [data appendString:[NSString stringWithFormat: @"%@: %@nn",
      @"name", [[UIDevice currentDevice] name]]]; 
    6. [data appendString:[NSString stringWithFormat: @"%@: %@nn",
      @"systemName", [[UIDevice currentDevice] systemName]]]; 
    7. [data appendString:[NSString stringWithFormat: @"%@: %@nn",
      @"systemVersion", [[UIDevice currentDevice] systemVersion]]]; 
    8. [data appendString:[NSString stringWithFormat: @"%@: %@nn",
      @"model", [[UIDevice currentDevice] model]]]; 
    9. [data appendString:[NSString stringWithFormat: @"%@: %@nn",
      @"localizedModel", [[UIDevice currentDevice] localizedModel]]]; 
    To access the IMEI and Serial Number you have to use the (semi)public IOKit framework. Erica Sadun has managed this and released the overwritten IOKit-Extension. I have included these files in my App and used it this way:
    1. #import "UIDevice-IOKitExtensions.h" 
    2.  
    3. // Reading not by the Appstore supported Data 
    4. [data appendString:[NSString stringWithFormat: @"%@: %@nn",
      @"IMEI", [[UIDevice currentDevice] imei]]]; 
    5. [data appendString:[NSString stringWithFormat: @"%@: %@nn",
      @"SerialNr", [[UIDevice currentDevice] serialnumber]]]; 

    Be aware that you cannot submit an App with this IOKit-Extension into the Appstore!

    Sunday, October 16, 2011

    iPhone: Locating the serial number, IMEI, ICCID, or MEID


    Getting the information using your iPhone

    If you have access to your iPhone, here are some quick ways to obtain your iPhone serial number, International Mobile Equipment Identity (IMEI), ICCID, or Mobile Equipment Identfier (MEID).

    iPhone About screen

    You can find your iPhone serial number, IMEI, ICCID, or MEID in the About screen on your iPhone. From the Home screen, tap Settings > General > About and scroll down.
    iPhone About screen
    If you are unable to access the About screen on your iPhone, please use one of the following options  to access the Serial Number and IMEI on iPhone models with SIM cards. If you have an iPhone 4 with Verizon, and are not able to access the information using the About screen, please see the section below to get the information from your computer.

    iPhone 3G, iPhone 3GS, iPhone 4 (GSM model), and iPhone 4S

    Please see this article for information on how to remove and re-insert the SIM tray. Once you have removed the SIM tray, the Serial Number and IMEI will be printed on the SIM tray as shown below.
    Serial number and IMEI number printed on an iPhone SIM tray.
    The SIM tray on an iPhone 4S activated on CDMA carrier displays both the MEID and IMEI number as 15 digits. The MEID number uses the first 14 digits, disregarding the last digit, and the IMEI number uses all 15 digits.

    Original iPhone

    Your original iPhone serial number and IMEI are engraved on the back metal case as shown:

    Getting the information from your computer

    If you are able to connect your iPhone to your computer

    If you have access to your computer and prefer to get the information using it, or if you are unable to use the iPhone itself, the following includes ways of accessing your iPhone serial number, International Mobile Equipment Identity (IMEI), ICCID, or Mobile Equipment Identfier (MEID).
    1. Connect your iPhone to your computer and open iTunes.
    2. Select the iPhone when it appears in the left-hand column.
    3. Click the Summary tab. Your iPhone's serial number and phone number will display as shown:
    4. If you click the words Phone Number in this tab, iTunes will also display the IMEI or MEID of your iPhone as shown below. If you click IMEI, iTunes will display the ICCID:

    Notes:
    • Some GSM carriers may not store the phone number on the SIM card, so the data may not be available in iTunes. If that is the case, you will want to access the information using one of the aforementioned ways. See HT2232 for more information.
    • You can choose Edit > Copy to put the serial number on the Clipboard. You can then paste the serial number into an email or webpage (for service or registration for example).

    If you have access to your computer, but not your iPhone

    Open iTunes and mouse over a device backup:
    1. Open Preferences in iTunes. (In Mac OS X, choose iTunes > Preferences. In Windows, choose Edit > Preferences.)
    2. Click the Devices tab.
    3. Position the mouse over a backup to display the phone number, serial number, and IMEI or MEID of the backed-up iPhone.
    About Screen tips
    • Hold down the Option key (Shift key in Windows) to reverse the scrolling.
    • Press the Space bar to pause the scrolling.
    • You can copy this information onto the Clipboard and and paste it into a document:
      • In Mac OS X, choose Edit > Copy (or Command-C).
      • In Windows, press Control-C.

    Getting the information from the iPhone packaging

    If you still have the device's original packaging, you can find your iPhone serial number and IMEI or MEID printed on the barcode label that's affixed to the packaging.

    Apple support and service


    Contacting Apple for support and service

    International Technical Support Numbers

    To expedite your call, please have your hardware serial number ready. Learn how to find your serial number.

    Country Phone Website
    Australia (61) 1-300-321-456* www.apple.com/au/support/
    Austria  Use Express Lane for fast, personalized service.
    (43) 0810 300 427*
    www.apple.com/at/support/
    Belgium Flemish: (32) 070 700 772
    French: (32) 070 700 773
    www.apple.com/benl/support/
    www.apple.com/befr/support/
    Brazil 0800-761-0880 www.apple.com/br/suporte/
    Brunei Dial 800-1111 first, then dial 800-708-5413 www.apple.com/asia/support/
    Bulgaria 00800 6002 7753 www.apple.com/bg/support/
    Canada


    Use Express Lane for fast, personalized service.
    English: 1-800-263-3394
    French: 1-800-263-3394
    www.apple.com/ca/support/
    www.apple.com/ca/fr/support/
    China (86) 4006-272273 www.apple.com.cn/support/
    Cyprus 800 92433 www.apple.com/cy/support/
    Czech Republic 800 700527 www.apple.com/cz/support/
    Denmark (45) 70 10 20 07 www.apple.com/dk/support/
    Estonia 8000 044333 www.apple.com/ee/support/
    Finland (358) 0800 96162 www.apple.com/fi/support/
    Fiji (61) 1-300-321-456* www.apple.com/asia/support/
    France Use Express Lane for fast, personalized service.
    Metropolitain: (33) 0805 540 003
    DOM-TOM: (33) 0825 77 00 35*
    www.apple.com/fr/support/
    Germany Use Express Lane for fast, personalized service.
    (49) 01805 009 433**
    www.apple.com/de/support/
    Greece 00800 44145417 www.apple.com/gr/support/
    Guam 1-800-865-0853 www.apple.com/asia/support/
    Hong Kong (852) 2112-0099* www.apple.com/hk/support/
    www.apple.com/hk/en/support/
    Hungary 06 80 983 435 www.apple.com/hu/support/
    India (91) 1800 4250 744 or (91) 80-4140-9000 www.apple.com/in/support/
    Indonesia 0018 03061 2009 www.apple.com/id/support/
    Ireland Use Express Lane for fast, personalized service.
    (353) 1850 946 191
    www.apple.com/ie/support/
    Italy Use Express Lane for fast, personalized service.
    (39) 199 120 800*
    www.apple.com/it/support/
    Japan Within Japan: 0120-27753-5
    Outside Japan: (81) 3-5334-2096
    www.apple.com/jp/support/
    Latvia 800 03251 www.apple.com/lv/support/
    Lithuania (8-800) 30772 www.apple.com/lt/support/
    Luxembourg (352) 800 24550 www.apple.com/lu/support/
    Macau Dial 0800-111 first, then dial 800-708-5413 www.apple.com/mo/support/
    Malaysia 1-800 803-638 www.apple.com/my/support/
    Malta 800 62072*** www.apple.com/mt/support/
    Mexico 001-866-676-5682
    iPhone: 001-800-692-7753
    www.apple.com/mx/support/
    Netherlands (31) 0900 7777 703 www.apple.com/nl/support/
    New Zealand 00800-7666-7666 www.apple.com/nz/support/
    Norway (47) 815 00 158 www.apple.com/no/support/
    Pakistan Dial 00800 01001 first, then dial 800 361 0479 www.apple.com/asia/support/
    Papua New Guinea (61) 1-300-321-456* www.apple.com/asia/support/
    Philippines 1-800-1441-0234 www.apple.com/ph/support/
    Poland 00800 4411875 (universal free phone) www.apple.com/pl/support/
    Portugal (00351) 0707 200 826 (national rate) www.apple.com/pt/support/
    Romania 0800 894847 www.apple.com/ro/support/
    Russia 495 5809557
    (PSTN local rate for Moscow, national rates for others)
    www.apple.com/ru/support/
    Singapore 800-186-1087 or (65) 6835-1812* www.apple.com/sg/support/
    Slovakia 0800 004640 www.apple.com/sk/support/
    Slovenia 0800 80321 www.apple.com/si/support/
    South Korea (82) 1544-2662* www.apple.com/kr/support/
    Spain Use Express Lane for fast, personalized service.
    (34) 902 151 992
    www.apple.com/es/support/
    Sweden (46) 0771 199 519 www.apple.com/se/support/
    Switzerland Use Express Lane for fast, personalized service.
    French: (41) 0848 000 132
    German: (41) 0848 000 132
    www.apple.com/chfr/support/
    www.apple.com/chde/support/
    Tonga (61) 1-300-321-456* www.apple.com/asia/support/
    Taiwan (886) 0800-095-988 www.apple.com/tw/support/
    Thailand 001800 4412904 www.apple.com/th/support/
    United Arab Emirates 8000 444 0407 www.apple.com/ae/support/
    United States


    Use Express Lane for fast, personalized service.
    1-800-275-2273
    iPhone: 1-800-MY-IPHONE (1-800-694-7466)
    Apple Rebates: 1-877-4-APL-PROMO (1-877-427-5776)
    Education Customers: 1-800-800-2775 (support), 1-800-780-5009 (sales)
    Enterprise: 1-866-752-7753
    www.apple.com/support/
    United Kingdom Use Express Lane for fast, personalized service.
    (44) 0844 209 0611****
    www.apple.com/uk/support/
    Vanuatu (61) 1-300-321-456* www.apple.com/asia/support/
    Vietnam Dial 1-201-0288, then dial 800-708-5413 www.apple.com/vn/support/

    Telephone numbers and hours of operation are subject to change.

    * Local and national telephone rates apply.
    ** 0,14 € pro Minute aus dem deutschen Festnetz. Maximal 0,42 € pro Minute aus dem Mobilfunknetz.
    *** Free phone technical support number is not accessible by mobile phone.
    **** £0.05p per minute when dialed from a landline within the UK. Call charges may vary when calling from a mobile phone.

    Monday, October 10, 2011

    60 QUOTES BY STEVE JOBS

    60 QUOTES BY STEVE JOBS



    “Sometimes when you innovate, you make mistakes. It is best to admit them quickly, and get on with improving your other innovations.”

    “Being the richest man in the cemetery doesn’t matter to me … Going to bed at night saying we’ve done something wonderful… that’s what matters to me.”

    “We’ve gone through the operating system and looked at everything and asked how can we simplify this and make it more powerful at the same time.”

    “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”

    “I want to put a ding in the universe.”

    “I was worth over $1,000,000 when I was 23, and over $10,000,000 when I was 24, and over $100,000,000 when I was 25, and it wasn’t that important because I never did it for the money.”
    “The Japanese have hit the shores like dead fish. They’re just like dead fish washing up on the shores.”
    “Unfortunately, people are not rebelling against Microsoft. They don’t know any better.”

    “Bill Gates‘d be a broader guy if he had dropped acid once or gone off to an ashram when he was younger.”

    “The only problem with Microsoft is they just have no taste. They have absolutely no taste. And I don’t mean that in a small way, I mean that in a big way, in the sense that they don’t think of original ideas, and they don’t bring much culture into their products.”

    “My job is to not be easy on people. My job is to make them better.”

    “We made the buttons on the screen look so good you’ll want to lick them.”

    “Click. Boom. Amazing!”

    “You can’t just ask customers what they want and then try to give that to them. By the time you get it built, they’ll want something new.”

    “Design is not just what it looks like and feels like. Design is how it works.”

    “Why join the navy if you can be a pirate?”

    “A lot of companies have chosen to downsize, and maybe that was the right thing for them. We chose a different path. Our belief was that if we kept putting great products in front of customers, they would continue to open their wallets.”

    “Innovation distinguishes between a leader and a follower.”

    “Recruiting is hard. It’s just finding the needles in the haystack. You can’t know enough in a one-hour interview.
    So, in the end, it’s ultimately based on your gut. How do I feel about this person? What are they like when they’re challenged? I ask everybody that: ‘Why are you here?’ The answers themselves are not what you’re looking for. It’s the meta-data.”

    “We’ve had one of these before, when the dot-com bubble burst. What I told our company was that we were just going to invest our way through the downturn, that we weren’t going to lay off people, that we’d taken a tremendous amount of effort to get them into Apple in the first place – the last thing we were going to do is lay them off.”

    “I mean, some people say, ‘Oh, God, if [Jobs] got run over by a bus, Apple would be in trouble.’ And, you know, I think it wouldn’t be a party, but there are really capable people at Apple.
    My job is to make the whole executive team good enough to be successors, so that’s what I try to do.”

    “It’s not about pop culture, and it’s not about fooling people, and it’s not about convincing people that they want something they don’t. We figure out what we want. And I think we’re pretty good at having the right discipline to think through whether a lot of other people are going to want it, too. That’s what we get paid to do.
    We just want to make great products. (I think he means “insanely great products!“)”

    “So when a good idea comes, you know, part of my job is to move it around, just see what different people think, get people talking about it, argue with people about it, get ideas moving among that group of 100 people, get different people together to explore different aspects of it quietly, and, you know – just explore things.”

    “When I hire somebody really senior, competence is the ante. They have to be really smart. But the real issue for me is, Are they going to fall in love with Apple? Because if they fall in love with Apple, everything else will take care of itself.
    They’ll want to do what’s best for Apple, not what’s best for them, what’s best for Steve, or anybody else. (this actually reiterates my oft-repeated mantra of “ubiquitous evangelism” in companies)”

    “People think focus means saying yes to the thing you’ve got to focus on. But that’s not what it means at all. It means saying no to the hundred other good ideas that there are. You have to pick carefully.”

    “Our DNA is as a consumer company – for that inpidual customer who’s voting thumbs up or thumbs down. That’s who we think about. And we think that our job is to take responsibility for the complete user experience. And if it’s not up to par, it’s our fault, plain and simply.”

    “That happens more than you think, because this is not just engineering and science. There is art, too. Sometimes when you’re in the middle of one of these crises, you’re not sure you’re going to make it to the other end. But we’ve always made it, and so we have a certain degree of confidence, although sometimes you wonder.

    I think the key thing is that we’re not all terrified at the same time. I mean, we do put our heart and soul into these things.”

    “We don’t get a chance to do that many things, and every one should be really excellent. Because this is our life.

    Life is brief, and then you die, you know?

    And we’ve all chosen to do this with our lives. So it better be damn good. It better be worth it.”

    “Almost everything–all external expectations, all pride, all fear of embarrassment or failure–these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.”

    “Here’s to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes… the ones who see things differently — they’re not fond of rules… You can quote them, disagree with them, glorify or vilify them, but the only thing you can’t do is ignore them because they change things… they push the human race forward, and while some may see them as the crazy ones, we see genius, because the ones who are crazy enough to think that they can change the world, are the ones who do.”

    “In most people’s vocabularies, design means veneer. It’s interior decorating. It’s the fabric of the curtains of the sofa. But to me, nothing could be further from the meaning of design. Design is the fundamental soul of a human-made creation that ends up expressing itself in successive outer layers of the product or service.”

    “So we went to Atari and said, ‘Hey, we’ve got this amazing thing, even built with some of your parts, and what do you think about funding us? Or we’ll give it to you. We just want to do it. Pay our salary, we’ll come work for you.’ And they said, ‘No.’ So then we went to Hewlett-Packard, and they said, ‘Hey, we don’t need you. You haven’t got through college yet.”

    “The people who are doing the work are the moving force behind the Macintosh. My job is to create a space for them, to clear out the rest of the organization and keep it at bay.”

    “Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma – which is living with the results of other people’s thinking. Don’t let the noise of other’s opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.”

    “I’m the only person I know that’s lost a quarter of a billion dollars in one year…. It’s very character-building.”

    “I’m as proud of what we don’t do as I am of what we do.”

    “Quality is more important than quantity. One home run is much better than two doubles.”

    “I’ve always wanted to own and control the primary technology in everything we do.”

    “It comes from saying no to 1,000 things to make sure we don’t get on the wrong track or try to do too much.”

    “It’s really hard to design products by focus groups. A lot of times, people don’t know what they want until you show it to them.”

    “Innovation has nothing to do with how many R&D dollars you have. When Apple came up with the Mac, IBM was spending at least 100 times more on R&D. It’s not about money. It’s about the people you have, how you’re led, and how much you get it.”

    “Insanely Great!”

    “I’m convinced that about half of what separates the successful entrepreneurs from the non-successful ones is pure perseverance.”

    “It’s rare that you see an artist in his 30s or 40s able to really contribute something amazing.”

    “I feel like somebody just punched me in the stomach and knocked all my wind out. I’m only 30 years old and I want to have a chance to continue creating things. I know I’ve got at least one more great computer in me. And Apple is not going to give me a chance to do that.”

    “I didn’t see it then, but it turned out that getting fired from Apple was the best thing that could have ever happened to me. The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life.”

    “Do you want to spend the rest of your life selling sugared water or do you want a chance to change the world?”

    “The products suck! There’s no sex in them anymore!”

    “The cure for Apple is not cost-cutting. The cure for Apple is to innovate its way out of its current predicament.”

    “If I were running Apple, I would milk the Macintosh for all it’s worth — and get busy on the next great thing. The PC wars are over. Done. Microsoft won a long time ago.”

    “You know, I’ve got a plan that could rescue Apple. I can’t say any more than that it’s the perfect product and the perfect strategy for Apple. But nobody there will listen to me.”

    “Apple has some tremendous assets, but I believe without some attention, the company could, could, could — I’m searching for the right word — could, could die.”