BLOG main image
Category (326)
News (16)
All about me (1)
Diary (1)
Projects (8)
Programming (95)
Ideas (8)
Treasures (28)
Study (59)
Bookmark (19)
iPhone (77)
만들어보자!! Game Engine fo.. (0)
Android (0)
The matter of a single trade c..
17:23 - Ken Griffey Jr Shoes
The matter of a single trade c..
17:23 - Ken Griffey Jr Shoes
The matter of a single trade c..
17:22 - Ken Griffey Jr Shoes
Concentration and perseverance..
17:19 - Ken Griffey Jr Shoes
http://www.replicaoakleysungla..
05/18 - hgfhg
thanks for sharing
05/16 - replica watches
For Coach handbags alone, eBay..
05/10 - Coach outlet
thanks for sharing
05/10 - Coach outlet
좋은 게시물, 공유를위한 감사합..
05/10 - china wholesale
All of us need to preserve up..
05/07 - replica watches
free microsoft office 2010
free microsoft office 2010
特殊網站設計
特殊網站設計
特殊網站設計
特殊網站設計
Business Idea
Business Idea
surf lessons newport beach
surf lessons newport beach
295,709 Visitors up to today!
Today 2 hit, Yesterday 192 hit
daisy rss
tistory 티스토리 가입하기!
'iPhone/Reference'에 해당되는 글 8건
2009/12/28 13:16

Original : http://www.turkeysheartrhinos.com/?p=8

Exending Xcode - File & Project Templates, TextMate Style Macros

Introduction

I gave a presentation a few weeks ago at the local CocoaHeads MN meeting on extending Xcode. It was pretty well received and at some point I promised to deliver this content online in some form; this post is the result. The techniques here are all available in some form or another elsewhere on the web, but it took some digging to get them together in one place and working in Xcode 3.1. Hopefully this post will save some of you from having to do similar work, which while fascinating, may not be the best use of your time.

It should be noted that I am far from the most proficient Xcode user on the planet. There may be better ways to approach the following; if I’ve made a mistake somewhere please leave a comment to that effect and I’ll correct it.

I will be covering three ways to extend Xcode. First custom project and file templates, then the really useful custom text macros with placeholders.

Requirements

All of this work was done in Xcode 3.1. It was not tested with earlier versions and may not work there.

Custom Project Templates

Xcode comes with some great templates to get you up and running quickly with a variety of common application types. Early on in my iPhone development work when I was churning through a bunch of project ideas I found myself making the same modifications for code signing and basic setup again and again. Exactly the kind of work that I would normally automate with a build tool. I wanted to build Xcode project templates that had a number of these things baked in. It turned out to be pretty simple, once I got the directory structure worked out.

I’m going to walk through the following steps.

  • Create an override directory for Xcode
  • Copy and modifying an existing Project Template

Creating a User Override Directory

When Xcode boots it scans through a few different directories to put together its runtime environment. One of the last directories that it scans is ~/Library/Application Support/Developer/Shared/Xcode. This directory contains user specific Xcode extensions. If this directory does not exist, you will have to create it. This is where you will place project templates, file templates, and macro specifications.

Copying and Modifying an Existing Template

Xcode has a few different directories where it keeps overrideable runtime settings. For our purposes the most useful of these directories are /Developer/Library/Xcode/ (standard Xcode templates, plugins, etc) and /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode (iPhone specific extensions). I’ll use the iPhone directory for my examples. It should look like this:

iPhone Directory Screenshot

The directory we’re interested in for now is the Project Templates directory. If you open up that directory you will see ‘Application’. Underneath that directory you will find the actual project template directories. These are just standard Xcode projects with a few small differences. Copy one of those folders, for example ‘iPhone Navigation-Based Application’.

Now create a Project Templates directory in your user overrides folder. Create a subfolder named whatever you like; I used Ideaswarm. Paste the project directory into this subfolder. Your directory should look like ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/YourGroupingName/iPhone Navigation-Based Application. Now  go to Xcode and choose file -> New Project.

Notice the ‘User Templates’ section with the ‘YourGroupingName‘ grouping. This grouping will be named after the grouping directory under Project Templates. The template itself will be named after the Xcode project directory; renaming this folder from iPhone Navigation-Based Application will change the name of the template.

This project can now be opened like any Xcode project. Any changes you make will be reflected in the final project. Just remember to delete the build directory that Xcode will create when you open the project; that probably isn’t something you want to include in your template.

One other thing to note is the replacement of certain character sequences when a project is created from a template. The most important of these is  ___PROJECTNAMEASIDENTIFIER___ which will be replaced with the new project name wherever it is found, including in file names.

Custom File Templates

Custom file templates are basically the same. You can copy an existing file template from /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/File Templates/Cocoa Touch Classes. For this example I am using NSObject subclass.pbfiletemplate. Create a directory called File Templates under your user overrides directory. Create another grouping directory inside this directory, named whatever you’d like, and paste the file template into this directory. You’ll end up with something like ~/Library/Application Support/Developer/Shared/Xcode/File Templates/YourGroupingName/NSObject subclass.pbfiletemplate. The ‘.pbfiletemplate’ is required.

Inside of this directory you will find three files:

  • class.h
  • class.m
  • TemplateInfo.plist

If you open up TemplateInfo.plist you will find the following three key value pairs:

{
	MainTemplateFile = "class.m";
	CounterpartTemplateFile = "class.h";
	Description = "my test template";
}

MainTemplateFile is the main file to create. CounterpartTemplateFileis an optional second file. Description is the description that will appear in the new file window. So if you change description to ‘my test template’ and open the new file dialog you will see a User Templates section with a grouping named YourGroupingName. Selecting this will show your file template.

Again, the name of the template directory (before the .pbfiletemplate part) will become the name of your file template.

If you read some of the existing file templates you can find some constants that will be replaced when the file is created. These will allow you to insert the new file name into the generated text (<<FILEBASENAMEASIDENTIFIER>>), for instance.

Custom TextMate - Like Macros

One of the things I missed most about TextMate was the easy tab based macro completion with placeholders. It turns out that Xcode actually has something similar, but it is relatively painful to learn how to add your own macros. I’ll be covering how to do this in this section.

The first thing you’ll want to do is take note of the code completion keys that you have set up in the Xcode preferences. These can be found under Xcode preferences -> Key Bindings -> Edit -> Next Completion, Completion List, and Select Next Placeholder. I remapped these to be on my home row because I use them so much.

To follow the pattern of the rest of this post, I will be taking some existing Xcode macros and bending them to my evil will. First create a Specifications directory in your user override directory: ~/Library/Application Support/Developer/Shared/Xcode/Specifications. Then you’ll need to find the xcode macro specifications. These are in /Developer/Applications/Xcode.app/Contents/PlugIns/TextMacros.xctxtmacro/Contents/Resources/. Copy the ObjectiveC.xctxtmacro file into your new Specifications directory. Any changes in this file will override the previous macro definitions; you are free to change existing macros or add more to your hearts content.

If you open your copy of  ObjectiveC.xctxtmacro you will see a long list of declarations similar to this:

 {
            Identifier = objc.try;
            BasedOn = objc;
            IsMenuItem = YES;
            Name = "Try / Catch Block";
            TextString = "gibberish";
            CompletionPrefix = "@try";
            IncludeContexts = ( "xcode.lang.objc.block" );
 }

Identifier - unique id for the macro. Doesn’t matter what this is, as long as it is unique.

BasedOn - This is a simple inheritance scheme. You can base one macro on another and any keys that are not declared will be pulled from the parent. Usually you will leave this as objc.

IsMenuItem - Determines whether or not this macro will show up in the Edit -> Insert Text Macro menu. Most of the time I set this to NO.

Name - This is the name the macro will appear under in the Edit -> Insert Text Macro menu if IsMenuItem is yet. Usually I put something descriptive in here regardless of whether it is a menu item, to make it easier to determine the purpose of the entry.

TextString - This is the string that your macro will expand to. You can ignore the funky syntax for now, I will explain it shortly. I’ve replaced it with ‘gibberish’ here, for clarity.

CompletionPrefix - this is the basic macro. If you type @try and then hit Next Completion, Xcode will replace this text with the TextString.

IncludeContexts/ExcludeContexts - these allow you to determine where your completion is valid. These are not necessary; if excluded your completion will work anywhere in an objective c file. In the above case, @try will only expand inside of a block.

Ok, lets create a very simple macro. Scroll to the bottom of this file and insert the following (make sure there is a comma after the previous entry):

{
           Identifier = objc.asimplemacro;
           BasedOn = objc;
           IsMenuItem = NO;
           Name = "My first Simple Macro";
           TextString = "NSString *something = @\"Simple\"";
           CompletionPrefix = simple;
}

Notice that the double quotes must be escaped. As simple as this is, it is what I get tripped up on the most. If Xcode encounters a parsing error like an unescaped double quote it will either 1) not load your file, using the original macros or 2) not load the macros after the error, resulting in some working and others not. It can be a bit frustrating to track down.

Now restart Xcode (every macro edit requires a restart), open an objective c file, and type ’simple’. Then use your ‘Next Completion’ key. It should replace the text with your NSString. In some cases you may have to go through a few completions to see your macro; this list includes function and variable name completions as well. If you keep your macros fairly unique, you won’t have this problem.

Now we will insert a custom placeholder. Replace the TextString line above with:

TextString = "NSString *<#varname#>= @\"<#text#>\"";

Restart Xcode and try your macro again. This time it should have two placeholders, varname and text. You should be able to jump between them using the Next Placeholder key.

And that’s it! Not quite as nice as TextMate, but a lot better than not having this functionality at all.

More Advanced Macro Techniques

Two other things I wanted to mention briefly.

First, if you use the same CompletionPrefix for two macros then Next Completion will cycle through them. This can be useful for defining two similar expansions with the same keyset. For Example, I use the obscure ‘df’ to first declare a CGFloat, then a float.

Second, IncludeContext and ExcludeContext. These allow you to define the same macro key and have it do different things in different places, for example the body of a function vs the function name, or the header vs the implementation. Some contexts I find useful:

"xcode.lang.objc.block"
"xcode.lang.objc.bracketexpr"
"xcode.lang.objc.parenexpr"
"xcode.lang.objc.interface"
"xcode.lang.objc.implementation",
"xcode.lang.objc.protocol.declaration",
"xcode.lang.objc.protocol",
"xcode.lang.objc.function.declaration",
"xcode.lang.objc.function.definition",
"xcode.lang.objc.typedef",
"xcode.lang.objc.initializer"

‘initializer’ is after an equals expression. The others are fairly self explanatory. Or seem so to me, after looking at them for so long.

Conclusion

That concludes our Xcode fun for the day. Let me know if you have any questions or need clarification on some points. Hopefully this helps some of you have a more enjoyable Xcode experience.

Trackback Address :: http://joyholic.kr/trackback/384 관련글 쓰기
Name
Password
Homepage
Secret
2009/03/10 11:09
Trackback Address :: http://joyholic.kr/trackback/348 관련글 쓰기
Name
Password
Homepage
Secret
2009/03/10 10:30

Scott Nichols

Dec 2, 2008 11:53 pm

I guess it was really just a matter of time until it happened, but thanks to PlanetBeing, an industrious member of the iPhone Dev Team, Linux is running on an iPhone.

")//]]>
iPhone Linux Demonstration Video from planetbeing on Vimeo

The port is of the Linux 2.6 kernel and can run on first and second generation iPhones as well as the first generation iPod touch. PlanetBeing details his Linux port on his blog, making sure to note that the Linux project is separate from the iPhone Dev Team project.

Currently the Linux port is fairly incomplete. The framebuffer driver, serial driver, serial over USB driver, and drivers for interrupts and other miscellaneous components have been successfully ported over. Read-only support for the NAND memory is coming along also, but there are a number of components still not running, including write-support for NAND memory, baseband chip support, and support for many iPhone features such as the touch screen, accelerometer, sound, and wireless networking.

Currently the port is possible through the iPhone attached to a computer with USB keyboard so it isn't a fully portable Linux port yet. Hopefully future updates will find a way to use a touch pad keyboard. But even in an incomplete state, it is very promising to see a version of Linux running on iPhone, and an indication that a more complete port will be coming in the future.

But it looks like PlanetBeing isn't just thinking of running Linux on iPhones. On his blog he also says that he is interested in working with people experienced with Google's Android OS. Might this be an indication that we could have the Android OS running on our iPhones in the future? It sure looks that way. Though I doubt Google will do this, maybe it should get working on an official Android port before some very skilled hackers beat them to it.


Trackback Address :: http://joyholic.kr/trackback/337 관련글 쓰기
Name
Password
Homepage
Secret
2009/03/06 21:56

http://code.google.com/p/cookbooksamples/downloads/list
Trackback Address :: http://joyholic.kr/trackback/325 관련글 쓰기
Name
Password
Homepage
Secret
2009/03/05 16:49
original : http://www.electronicpulp.net/2009/03/02/mac-os-7-system-7-installed-and-running-on-the-iphone/

Mac OS 7 (System 7) on the iPhone
While it was fun to see Windows 3.1 running on Nokia’s N95, it probably didn’t sit well with some Apple fans. “What about our iPhone? Isn’t there anything that can be done to install a Mac OS on it besides the mobile OS X that it’s already got?” I don’t really know why anyone would want that, but a group that has been working on what is called the “MacOS iPhone Project” for a few weeks now have released photos showing the iPhone running Apple’s System 7. System 7 was first introduced in 1991 and was where QuickTime made its first appearance.

Some photos from the MacOS iPhone project show that it is possible to run applications like MacPaint, Calculator, and MacDraw on the iPhone. This is apparently done using QEMU, the same processor emulator that made running Windows 3.1 on the N95 possible. Mac OS 7 can be launched via an application launcher that resides on the iPhone’s home screen. I’m not sure where this will all lead (running old, outdated operating systems on new hardware), but at least the people working on projects like these have things to spend their time on. And that’s a good thing, I guess.

[SOURCE | VIA]



21 Comments on “Mac OS 7 (System 7) installed and running on the iPhone”

You can track this conversation through its atom feed.

  1. brian herman says:

    It has cut and paste!

    [Reply to this comment]

  2. Jeremy says:

    I wonder if you could play ‘Beyond Dark Castle’ and some of the old Mac OS9 classic games with this setup? Shuffle Puck cafe maybe? How the heck would you get keyboard entry to it though? Keycaps? :)

    [Reply to this comment]

    David Gonzales Reply:

    Yeah, Shufflepuck Cafe would be great. Let’s hope the team behind this releases the code so we can all try this on our iPhones/iPod touches.

    [Reply to this comment]

    Raphael Reply:

    @Jeremy, good questions ! Dark Castle is still in my heart and I would love to share some good times with my son on it.

    [Reply to this comment]

    joey Reply:

    @Raphael, yes dark castle ruled, as did crystal quest, and there were some stellar 3d games back in the day. I am trying to remember this great game that had a hoverboard that you controlled in a 1/2 globed skateboard like 1/2 pipe.

    but at least someone has to get the original talking moose running on the iphone..

    [Reply to this comment]

    Raphael Reply:

    @joey, aah crystal quest !!

    [Reply to this comment]

    joey Reply:

    @Raphael, they did an updated version for the 360 but it just didn’t cut it. many hours were spent on dark castle and crystal quest on my mac plus with CMS 30mb SCSI drive…

    [Reply to this comment]

  3. Raphael says:

  4. Name says:

    Point?

    What’s next, DOS 2.0?

    The OS is dead for a reason.

    [Reply to this comment]

  5. opl says:

    ‘coz it’s fun, ‘coz it’s possible.

    If you need a point, than there isn’t any.

    [Reply to this comment]

Trackbacks

  1. Yes Virginia, you can run System 7 on your iPhone
  2. Mashups on IM.ESHED.UP » Blog Archive » iPhone running Mac OS System 7
  3. Laptops Press Latest Laptops News - Reviews - Deals » Mac OS 7 (System 7) installed and running on the iPhone at …
  4. Ink and Virtue » System 7 Kind Of, Sort Of Running On An iPhone [Emulation]
  5. 5Words for March 2nd, 2009 | Technologizer
  6. thecolor » iPhone running Mac OS System 7
  7. thecolor » iPhone running Mac OS System 7
  8. That N95 running Windows 3.1? Pft! Check out the iPhone running Mac System 7
  9. Le copier coller sous iPhone marche en fait depuis 1991 | The Tech Guy
  10. » Mac OS 7, Yes 7, On An iPhone » Gadget Review
  11. Mac System 7 gets installed on the iPhone | iPhonefreak
Trackback Address :: http://joyholic.kr/trackback/319 관련글 쓰기
Name
Password
Homepage
Secret
2009/02/25 12:02

Review: iFitness for iPhone

App offers a handy and surprisingly thorough exercise guide and log

Starting a workout routine, especially at a gym or health club that probably includes sophisticated weight and resistance machines, can be an intimidating prospect. Deciding what exercises to do and then figuring out how to do them can be difficult, especially if you don’t have a personal trainer and the club is understaffed or overcrowded.


Pumping Iron: When you tap on an exercise in iFitness (in this case the decline close-grip bench press), you are first presented with two images displaying its setup and sequence of motions.

But using iFitness for the iPhone and iPod touch can be a great help to newbie gym-goers. The app from Medical Productions includes simple graphics and instructions for more than 150 exercises, and sports an elegant interface that can be easily tapped (no pun intended) between sweaty sets. For those with a passing familiarity with weight machines and free weight techniques, iFitness’s breadth of exercises, descriptions of what muscles are being worked, and logging capabilities may be appealing.

iFitness packs a lot of capabilities into a $2 app squeezed onto the 3.5-inch diagonal display of Apple’s mobile devices. When considered simply as a reference, iFitness is impressive. Each of its exercises can be accessed via three list views: by muscle group (abdominals, arms, back, and so on); by muscle (tap a body part, and the name of the muscle comes up; the second tap brings you to exercises for that muscle); and alphabetical by exercise name (starting with “ab crunch on a ball,” and ending with “Zercher squat”).

When you tap on the exercise, you’re presented with a graphic including two images of a person performing the exercise. These images are often sufficient to provide a basic understanding of how to complete the exercise. But if you want more information, you tap a quote mark icon at the top of the screen, which brings you to the flip side of the graphic, and a text description. The text is in a medium-sized black font on a white background, which makes it easy to read.


Exercise Regime: iFitness includes nine programs or routines, designed for beginners, travelers without access to weight machines, and goals such as weight loss and abdominal defining.

After you’ve finished the exercise, you can then tap on a pencil icon at the top of the screen and enter in the weight lifted (when appropriate), the number of reps, and notes. These are then added to your log, which you can view by date or by exercise. You can also edit your log and, to get a “big picture” view of your progress, view a graph of your progress and e-mail your log data to yourself. The data is sent quickly and arrives as a CSV-formatted attachment, which you can then view with a desktop spreadsheet application. The desktop display is simple and elegant.

iFitness includes nine routines (with more to come, according to the developer). These include routines for the beginner, abdominal defining, weight loss, muscle building, strength building, and more. There’s a “business” routine that includes only exercises you can do without gym equipment. (Many of the exercises require you to use free weights or weight or resistance machines). Each routine includes not only a list of exercises, but also a suggested number of sets and repetitions.

The program also includes the ability to add your own custom exercises, with the two-sided card format as the program—you can import images, include details about the target region, the target muscle, and the difficulty, and provide a name for the exercise and a text description. This capability might make iFitness especially appealing to physical therapists who would like to add exercises and create custom workouts for their patients, and to sports coaches as well. When you add your own exercises, they’re seamlessly integrated into iFitness’s list of all exercises in alphabetical order and by muscle group.

The app does have a few shortcomings. Some of the exercises simply don’t lend themselves to a two-photo graphic depiction, and could benefit from a four- or five-photo sequence or a short video. In addition, many people begin fitness programs with weight loss as a primary goal, yet the app doesn’t yet provide even simple weight tracking capabilities.

“Doesn’t yet” is the key phrase here: these are minor criticisms of an outstanding app supported by a developer who frequently updates with new features and capabilities. For both beginning and intermediate fitness enthusiasts, iFitness is a compact, handy, and surprisingly thorough exercise guide and log, and is especially attractive when you consider its price tag.

iFitness is compatible with any iPhone and iPod touch running the iPhone 2.x software update.

[Jeff Merron is a freelance writer and editor living in North Carolina.]

Trackback Address :: http://joyholic.kr/trackback/306 관련글 쓰기
Name
Password
Homepage
Secret
2009/02/23 17:08
 

My previous company's game...... It also really cool.....
Trackback Address :: http://joyholic.kr/trackback/303 관련글 쓰기
Name
Password
Homepage
Secret
2009/02/23 16:56

 
It's so great game. I really want to make like this.
Trackback Address :: http://joyholic.kr/trackback/302 관련글 쓰기
Name
Password
Homepage
Secret
prev"" #1 next