Question for all programmers who use Xcode

Hi,
What style of indenting do you use?
1)<pre>
int myFunc(int num){
//some code
}</pre>
2)<pre>
int myFunc(int num)
//some code
}</pre>
I uses style 2, but I cannot get Xcode 2.4 to properly indent nested braces. Here is an example:
<pre>
class Test
public:
Test()
int x = 0;
while(x < 10)
{ <font color="2200cc"><------- should be moved to the left</font></pre>
Can anyone get that to indent properly in Xcode?

So, for instance, the
character sequence 'f' can be used to insert a for
loop in your code. It's amazing how fast it is to
write code with that feature.
Textmate has that. Make sure you have the proper language selected at the bottom of the file window. If you have "C" selected, all you have to do is type "for", then hit the tab key and you'll get a "for" loop. And you can even tab from bit to bit to fill in the parameters you want. I've poked around with adding my own completions, too. It's a little non-obvious to me, but it might not be to someone else.
Also, Xcode has something similar, just look at "Insert Text Macro" in the "Edit" menu. You can assign key bindings to any of those. So, for example, I bound "option"-"f" to the "for" loop. If you haven't already discovered it, there's an easy way to move from parameter to parameter, just use the "control"-"/" key combo.
Also, just tonight, I discovered the free Completion Dictionary plugin. It's really easy to define your own text macros. One thing I found puzzling was the key binding to expand the macro. Completion Dictionary comes with a key bindings file, but I couldn't make it work, so I just added a key binding to the "Expand Macro" submenu. Works a charm.
Finally, as to your original question, about the indenting. Did you want the "{" to line up directly below the "while"? If so, Textmate does that for me:
<pre class="command">class Test
public:
Test()
int x=0;
while (x<10)
// something.
}</pre>But that's a language I never use (Java or C++?), so I'm not real sure about that.
Finally, I should put in a word for BBEdit. It's what I actually use most of the time for work, since I work on a web site all day long and I've been using it forever. It has a slick feature where you can build various kinds of macros using Perl or other scripting languages, which is great for creating really complex (or tedious) bits of code. But it doesn't have the same kind of autocompletion as Textmate or Xcode does.
charlie

Similar Messages

  • A Few Serious Questions for ALL Programmers

    I am fairly new to programming ,and ,so far, have only finished 2 programming classes at the college I attend.
    One class was a mix of Program Logic and C++.
    The other was Visual Basic.
    Right now I am in Java 1.
    I absolutely LOVED C++ and Visual Basic, especially the latter.
    I know a lot of people bash VB but I really liked it and I don't know why so many people "Pick on" it.
    Anyway, I finished TOP in my class for VB and am well on my way to finishing top in the Java class.Not because I am a genius, but because I really put alot into it and even the smallest things sometimes takes me hours.
    I sit at my computer and when I get an idea, I usually do not stop until I have it figured out.
    I find the answers most of the time but IT COMES REALLY HARD TO ME!
    The problem I am having is this: When I come here and see some of the sample codes and sample codes that I see elsewhere, like for a " 3D Molecule viewer" I get VERY frustrated because I feel like, to get anywhwere, I will have to be a genius like the people who write such code.
    My fear is that I will only get to be mediocre at best and there will be no place for me in the Programming world...
    I guess what I am really asking is this:If you are a great programmer, like somone who can whip out code for ANYTHING, did you always "Get It" or did it seem like you never would and eventually had an epiphany and "Got It".?...
    Also, how much of programming is about using existing classes and how much is totally writing your own Classes and Methods.
    I know the phrase, "Why re-invent the wheel?" but how much good does it do for me if I parse code all the time?--what are your thoughts on this?

    Not because I am a genius, but because I really put alot into it and even the smallest things sometimes takes me hours. I sit at my computer and when I get an idea, I usually do not stop until I have it figured out. I find the answers most of the time but IT COMES REALLY HARD TO ME!You have hit on a key component here. Your willingness to sit there for hours on end trying and trying and trying. Even then, when it still won't run properly, you get back at it tommorrow and try some more. Many people do not have this patience, and get distracted by the TV, or by their friends, or by their friends and TV ...and they walk away after an hour.
    I too received the highest marks in nearly every class I took at school. Classmates used to say "Ya, but this stuff comes easy to you." No it didn't, I just spend more time with the labs than they did ...thats why I always received the better grades. I appeared to know more, but really I had just made more mistakes than most of my classmates. When it came to the exams, I was like "Oh, I made that mistake last week". My peers, however, had not made these mistakes yet and got tricked into choosing wrong answers on their exams.
    I think programming experience creeps into our brain subconciously while we do it. One day, certain things that once boggled your mind will seem second nature. This comes from just doing it. I think you sound like you are on the right track. And don't worry, even though I know about a few things in Java ...I am constantly in awe of most of the good people I see throughout this forum. Everyone has something to teach, and everyone can always learn something new. What is important is that you don't get discouraged and give up. Now enough of the pep talk, where's my coffee and my compiler. Ah, there they are.
    Good luck and I wish you all the best.

  • How can I deploy EFS using Group Policy and automatically encrypt computers for ALL users who login?

    How can I deploy EFS using Group Policy and Active Directory with a goal to automatically encrypt computers for ALL users who login? (NOT an option for me to use BitLocker)
    I was asked to deploy EFS to encrypt the user my documents folder and profile on all of the users laptops. The laptops are in common areas (board meeting rooms, etc) and security of files is a must.
    I successfully created a recovery certificate in AD. I created an OU and setup an EFS policy and users can now login and select to encrypt their own files. The issue is that management would like to have automaticy Encrypt ALL users my documents AUTOMATICALLY
    when a user login.
    Can this be done?
    Please help

    Hi,
    Any update?
    Just checking in to see if the suggestions were helpful. Please let us know if you would like further assistance.
    Best Regards,
    Andy Qi
    TechNet Subscriber Support
    If you are
    TechNet Subscription user and have any feedback on our support quality, please send your feedback
    here.
    Andy Qi
    TechNet Community Support

  • Got a question for all you peeps dos anyone know about i phones i have a i phone 3gs which i got unlocked i did a master reset or summin and just had a pic of apple so i plugged it in i tunes downloaded and it now says no service at the top of phone and i

    got a question for all you peeps
    dos anyone know about i phones i have a i phone 3gs which i got unlocked i did a master reset or summin and just had a pic of apple so i plugged it in i tunes downloaded and it now says no service at the top of phone and i tunes says invalid sim i put the correct sim in it used to be locked too and still says same pls any one with ideas?

    hi sorry what happoned is that ages ago i brought a i phone 3gs on 02 network i went to a sml phone shop and payed for them to unlock it. it has been fine till yesterday when i went to reset it from the phone it then turned off and came back on just just an image of a apple for about an hour so i connected to i tunes and it said downloading software after another hr it had finished but then i tunes said in had to insert a sim so i had to un plug the phone from laptop while i did this i put my orange sim in and the i phone said where do i live and had to connect to a internet connection but all the time saying no service where the signal bar is and then says activating i phone it took a few min and said couldnt finish it bec of the signal and to connect it to i tunes to do it so i connected it to itunes and i tunes just keeps saying invalid sim so i took my orange sim out and put a 02 sim in and is still saying invalid sim on itunes?

  • SOME SIMPLE QUESTIONS FOR ALL OF YOU

    hi,
    I have some questions for all of you.
    1. Oracle uses cgi (even asp!!! I've seen an asp page somewhere on an Oracle's site but this moment I don't remember where perhaps it is asp->cgi). Why ?
    Oracle doesn't support their techologies
    (Pl/SQL, Jsevlets,XML) ?
    2. Oracle says that has just released a
    new product for mobiles called "Portal2Go".
    I tried to install this product on NT with OAS 4.8.1.
    I had many problems during the installation and after many tries finally I did it(thanks God). but the problems continue...
    many Jsp errors (from the "tested" supplied apps). My question is:
    a. This product is in an early stage (many installation errors.. just a baby) and I think is stable for Sun Solaris but not on NT.
    b. You Oracle "experts" (i.e. oracle staff, NOT YOU guys) tell me ONE advantage to use you product (I'm an oracle developer for 6 years now):
    You say that I can PORT my existing app in any device and Web (through XML). This is a joke. Mobiles,PalmPCs,Web etc. have different requirements (content,display etc).The scope is different.. so this is absolutely FALSE (to use a boolean).
    This release is user unfrienlty. Why.. tell me WHY to pay for a product and for extra hardware (read the product technical reqs!!) to do the SAME THINK
    I do NOW with existing sources.
    I've developed an app for my company's employees using existing version of DB (8.0.5),pure pl/sql and a WAP GATEWAY.NOTHING LESS NOTHING MORE.
    please answer. Any comment welcomed...
    maybe I'm wrong maybe I'm not.
    PS.WHERE THE WAP GATEWAY/SERVER IS. I searced the cd and..nothing :-) ?
    thanks
    thanasis j.a.
    B.A. in Informatics
    M.Sc. in IS

    Portal-to-Go is a wireless portal server, the first version was released November 1999.
    The problems you describe that mobiles, Palm devices, etc all have different characteristics is one of the key reasons for Portal-to-Go. It allows any service to be displayed on any device by generating content in an appropriate format for specific devices. This way you can take into consideration the size of the screen, the display characteristics, etc.
    It is 'stable' on Solaris and NT, though it is true that the installation procedure of the CD is for Solaris only. The product is not currently available on OTN, so the installer restrictions should have been explained to you when you obtained the CD.
    Why Portal-to-Go? Here's three reasons:
    1. Inherent problems of the User Interface for a wireless device, so we provide a way personalise the UI to improve navigation and allow commonly used parameters to be saved as stored preferences through the portal.
    2. Differences in the characteristics between wireless devices make it hard to support all type without re-creating content and applications for each specific case. With Portal-to-Go, the same service can be accessed from any device.
    3. Lack of content available for WAP and other wireless devices. We have tools to quickly create wireless services from existing Web sites as well as an application platform for creating new Java or database applications for wireless devices.
    You are correct that the product does not have a WAP gateway.
    I'm not sure where you are located, but feel free to contact me offline. I can answer any specific questions, or get you contact with a local Oracle representative.
    At the moment, if anyone wants to obtain a copy of Portal-to-Go, you should contact your local Oracle representatives.
    Paul

  • How to develop a simple plugin for adobe illustrator cs2 using xcode on mac os

    I would like to know the steps to develop a simple plug-in for adobe illustrator cs2 using xcode on mac OS...anything like a dialog box displaying "hello World"... I m new to MAC OS...Please help...
    Thanks in advance

    Get the SDK and start playing with the sample plug-ins. Asking for something as general as "how do I get started" is asking a little much from this forum :) Try your hand at the SDK and come back to ask more specific questions as you run into them.
    Bear in mind that this isn't an Xcode forum either, though I'm sure there are places to get good help on that!

  • HI i am user for InDesincc TrialVersion now. i have serious question for all guys in here. at first i installed Indesigncc as korean language but now i need to indesigncc english language installation. and then now i cant translate and changing korean lan

    Daniel SterchiHI i am user for InDesincc TrialVersion now. i have serious question for all guys in here. at first i installed Indesigncc as korean language but now i need to indesigncc english language installation. and then now i cant translate and changing korean language interface to english language interface at indesigncc download. so i wonder How i can do that?...i am very seriuos for now....i want indesigncc version for Eng.Language interface. but now i cant do that .i dont konw how i can presented kor. interfacing transite to eng. interface..
    forumnotifierHI i am user for InDesincc TrialVersion now. i have serious question for all guys in here. at first i installed Indesigncc as korean language but now i need to indesigncc english language installation. and then now i cant translate and changing korean language interface to english language interface at indesigncc download. so i wonder How i can do that?...i am very seriuos for now....i want indesigncc version for Eng.Language interface. but now i cant do that .i dont konw how i can presented kor. interfacing transite to eng. interface..

    First of all, uninstall it with the uninstaller.
    Then:
    Install the ENGLISH version.
    Change the language in the CC app to Korean.
    Install the Korean version. (DON't uninstall the English version)
    Change back the langauge in the CC app to English.
    When your OS is running in English, InDesign will run in English with Korean functionality added, if your OS is running in Korean it will take the Korean User Interface, so let your OS run in English.
    Every installer language will add needed plugins for the work with that language. E.g. If I install Hebrew, I get RTL functionality in German version, only if I would change the OS language it would change the language of InDesign, InDesign takes always as UI language the language of the OS if available, if not (in your case you have uninstalled English before), it takes any version which is available in the order of languages specified in the OS.
    If you need to run your program in a different language than the OS but you have installed it in the language of the OS it becomes more difficult. You would have to use some system tools which are able to force a program to open with a different language. Most of those tools are freeware.

  • Getting numerous calls for the people who used to live here

    At least 2 -3 times a day, i getphone calls for the people who used to live in my house. They are all debt collectors and i have told them that they do not live here but it doesnt matter. Short of looking up their new number and giving that to the debt colllectors, what can i do?

    Your problem has nothing to do with Verizon and everything to do with debt collectors...
    When these individuals call, take down the number (from the caller ID), time and date and tell them the following:
    a) That the party that they're looking for does not reside there anymore.
    b) That you are recording the calls (and indeed do so) and that you'll be forwarding the tape to your attorney who will sue them for violation of Fair Debt Collection Practices Act.
    c) If they don't stop, sue them. You can recover up to $1,000 for every violation that is proven in court.
    Happy hunting.

  • Okay. Question for all those IT wirzards (

    Okay. Question for all those IT wirzards (& iTunes) experts out there. Anyone know why a playlist (Purchased) keeps dropping off my playlists in iTunes??l This has happened at least 15-20 times to me in the past couipe of years. Fofrtunately for me, I saved these songs to an external hard drive, so retrieval won't be so painful. Guess I just want to know how to avoid this going forward.

    Just that one playlist goes missing and no other content? No idea. But it is clear you ought to have a backup so you can restore the database should it happen again.
    tt2

  • Creating SYNONYM for all tables who don't have one at once!

    Hello to all,
    I'm trying to create synonyms for every table who's missing one at the moment. I'm trying this code:
    declare
    cursor cur_objects is
    select obj.object_name , obj.owner
    from all_objects obj
    where owner = '&&SCHEMA_OWNER'
    AND NOT EXISTS (SELECT *
    FROM all_synonyms syn
    WHERE obj.object_name = syn.table_name)
    AND obj.object_type = 'TABLE'
    AND obj.object_name LIKE 'CI_%';
    begin
    for rec_objects in cur_objects loop
    begin
    dbms_output.put_line(rec_objects.object_name);
    execute immediate('create public synonym ' || rec_objects.object_name || ' for '
    || rec_objects.owner ||'.'||rec_objects.object_name )
    exception when others then
    null;
    end;
    end loop;
    end;
    I'm getting this error:
    ORA-06550: line 10, column 37:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    begin function package pragma procedure subtype type use
    <een ID>
    <een scheidingsteken-ID tussen dubbele aanhalingstekens> form
    current cursor
    I'm still pretty new at PL/SQL and can't get it to work. Does anyone got any tips ?
    Thnx already

    Ok now I got this error:
    RA-06550: line 17, column 1:
    PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:
    * & = - + ; < / > at in is mod remainder not rem return
    returning <een exponent (**)> <> or != or ~= >= <= <> and or
    like LIKE2_ LIKE4_ LIKEC_ between into overlaps using ||
    multiset bulk year DAY_ member SUBMULTISET_
    The symbol ";" was substituted for "EXCEPTION" to continue.

  • So what do you do when you import - a questions for all??

    So far I have not had them time to dive into LR 1.1 as I would like to.
    Although lately that time has been free'ing up. While I currently do use LR
    to import and tag my photos, I have not tried much else except the album
    part, but even that has been minimal. I shot mostly in jpeg, but some raw as
    well. So my questions to you all, other than just importing as I do, what
    else do you do? I mean, do you do auto adjustments as you import? Sometimes,
    when I import, I will have 200-600 photos. I know I do not want all of them
    and will delete some. And then some, I think I will want to eventually move
    into collections to create a digital portfolio of sorts. I know LR is just
    in it's beginning stages, but still presents a lot of power.
    Secondly to this, do many of you use LR in conjunction with Bridge and PS
    CS3 and if so, how do you bring it all together?
    I know this could warrant some exhaustive answers, but I think it could be
    fun to see what all we do and whatnot and maybe get some ideas from one
    another. So let's hear from you!?!?

    I don't use any develop preset. I do apply a metadata preset with basic contact and copyright. It also applies a purple label (the only label with no shortcut) which means Rate and Add Metadata. I apply the same keywords as Robert and any others that apply to all photos. I apply the lens and camera tags because folks on flickr appreciate it. Different cameras write lens identity differently so a lens tag is actually easier to use than the MB. After import I'll apply a metadata template for location.
    Further use of labels:
    none - keep but don't work on further
    Red - process
    Green - Raw/DNG done
    Yellow - full size derivative
    Blue - reduced size for web
    CR2/CRW files that I process are also flagged as Pick. I export/import a DNG of these to serve as a local backup. The DNG's are not flagged. This allows me see just what I want very easily. I have CR2/CRW files and DNG of the keepers so that I have the native files in case I decide to develop with something that doesn't handle DNG and the DNG's for the possibility that the native Canon files will become obsolete.

  • Is the 'C' language acting differently for all the SDK(VisualStudio,xCode...)?

    Hi guys~!
    I've been in a dazed since i started writing this piece of code as an example since i'm still learning 'C' programming in the Poly's. Is the 'C' language acting differently while is on another platform?
    When i wrote this using VS, it works, but when it comes to Xcode, it's not going to provide me the right output.
    #include <stdio.h>
    #include <ctype.h>
    int main(int argc, const char * argv[])
        int x, num = 0;
        char choice;
        printf("Number\n");
        for (choice = 'Y'; choice == 'Y'; num++)
            for (x = 1; x <= 4; num++)
                printf("%6d\n", x);
                x++;
            } // end for
            printf("\nWould you like to continue the loop? Y/N?: ");    < - - It ignored the user key and skipped out of the loop, and proceed with the final output.
            fflush(stdin);
            scanf("%c", &choice);
            choice = toupper(choice);
        } // end for
        printf("Thank you for your participation~! Have a nice day & See you!");
    } // end main

    Code the scanf like this:
    scanf(" %c", &choice);
    Note the leading white space.
    c
    Matches a sequence of width count characters (default 1); the next pointer must
    be a pointer to char, and there must be enough room for all the characters (no
    terminating NUL is added).  The usual skip of leading white space is sup-
    pressed.  To skip white space first, use an explicit space in the format.

  • Is the Cloud right for an individual who uses only PS?

    There is a lot of buzz with speculation that Adobe is moving toward forcing all users to use the Creative Cloud subscription approach. As an individual free lancer with no corporate support and no needs except for PS and LR, the pricing of Creative Cloud today appears prohibitive for me. I have tried to locate appropriate links on the Adobe site but am led only to Chat or Telephone or here. Seems this is a question for Adobe personnel but I see no other way to present the question than the forum.
    I am looking at my experience with CS5 as an example. I have upgraded to the newest major versions as soon as possible. So, if you look at my record in Adobe's database, you'll confirm I installed CS5 on 7/11/2010. That site also shows I purchased CS6 on 5/14/2012. That means I used CS5 for a hair over 22 mos. If I was paying the "buy it now" price of $29 per month, I would have paid $638 for the upgrade to CS5 for which I paid $199.
    If future major versions will come at a pace of one every seven months, paying $29 per month would break even with the single license upgrade purchase cost. Have not seen any buzz suggesting such a torrential product cycle is under consideration.
    Is this a legitimate assessment?
    Should I be expecting an increase of over 300% if I am forced into the Cloud? Until now, I have purchased the upgrades eagerly for the new capabilities they have brought.
    I have also search for other threads in the discussion that might raise this question without success.
    I recognize Creative Cloud may not yet be fully defined. My primary purpose here is to register the question and hope Adobe is giving consideration to users like me.
    Doug

    No. It is not right or you.
    Nor do you need the latest versions. Photoshop is thankfully backward compatible, and most new functions do not alter the core capabilities that much.

  • Programming for the mac without using xcode

    Hi
    I'm very new to programming for Apple platform. I wanted to clear some doubts which is currently standing as a barrier in getting started.
    Can I use a text editor (preferably TextMate), Interface Builder, and the Terminal (without using xcode to write & compile) to develop software for the Mac. I have installed the xcode package (~900 mb image).
    Can you point me to some resources on terminal commands for compile, debug codes for the mac. (Obj-C, Cocoa api)
    Thank You.
    Message was edited by: jase21

    You can use anything you want to develop software for the Mac. In fact, I always encourage people to start out with tutorials and examples using standard UNIX command line tools like vi and gcc. There are plenty of such getting started tutorials for UNIX and Linux.
    At some point, however, the command line is going to get cumbersome. You may want go start writing true Mac applications instead if command line tools. Then it will be time to start with Xcode.

  • Can i design for all android tablets using one size folio?

    I want to minimize my production workflow. Of course. Will a one size design folio work for all android tablets including kendal fire?
    thanks

    Yes, you can use one folio size for all Android devices. A 16x9 aspect ratio usually works nicely if you are only interested in Android devices and don't already have an iPad design.
    Note that we do not support in-app purchase on Kindle devices.
    Neil

Maybe you are looking for

  • Problem in Sample application LifeCycle Dataservice

    Hi.. I run a sample application in Lifesycle dataservce. Sample is lcds-samples/testdrive-remoteobject. its working fine. main.swf file execute and show data. i compiled the main.mxml source file and overide the existing swf file but it doesnt work..

  • Changing a user's username programatically

    Hi, I'm currently working on a java method to update a user's information on portal. I've been pretty successful using wwsec_oid.update_user_profile, but that doesn't (as far as i can tell) allow you to change a users' username. Is there a better way

  • Oracle BI EE Answers Defaults for Tables etc

    Hi Together, I'd like to know how to configure the defaults for the following parameters. The most importent parameters for me are the default size for the tables with fixed headers and fixed rows (fixed headers and scrolling content). I'm able to se

  • My lightroom 4 will not open

    My lightroom 4 will not open. It says being used by another application. how do i access files to unlock, If that is the problem?

  • All Magenta after switching to 4.4

    Hi, I just installed Camera Raw 4.4. Now photos I open in CR from Bridge are tinted Magenta. Went back to 4.3.1, all fine. Can't be the monitor. When I open photos from Photoshop CS3 they look OK. No issues with Lightroom 1.4 either. The files I am l