Global alloc init declaration

Is there anyway to do a global alloc init so all functions in a class can see it?
any help is appreciated
pheonixfire

okay, here it is:
-(void) connectAction:(id)sender
    sshServer *server = [[sshServer alloc] init];
    sshConnector *connection = [[sshConnector alloc] init];
    address *destination = [[address alloc] init];
    if ([[connect stringValue] isEqualToString:@"Connect"])
        [addressOutput setStringValue:[destination destinationAddress]]; //to check the destination address
        NSMutableString *address;
        address = [destination destinationAddress];
        [server setSSHHost:address port:22 user:[username stringValue] key:@"" keypub:@"" password:[password stringValue]];
        [connection connect:server];
-(IBAction)PlaySongAction:(id)sender
    [sshOperator execCommand:@"nightingale -play" sshServer:server];
the ssh stuff comes from here:
http://thebsdbox.co.uk/?p=257
any help is appreciaed
pheonixfire

Similar Messages

  • New versus alloc-init

    Is there any semantic difference between, for example,
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    and
    NSAutoreleasePool * pool = [NSAutoreleasePool new];
    Why would alloc and init be used in Apple's documentation examples and code templates rather than the more concise new where there are no init arguments? I happened upon new while browsing the class methods of NSObject.

    alloc-init and new are the same as far as I know. I try to use new when I can. The only plausible explanation I've heard is that Apple wants people to use the concept of "resource acquisition is initialization". That is, they prefer you get in the habit of using one of the other init* functions instead. I have seen people get into the habit of creating lots of objects and then having to create a whole separate initialization phase.
    I try to create and use init* functions whenever I can. But if I just want alloc-init, I use new.

  • -Alloc [[]Init] vs.  New

    I'm not sure I'm getting this correctly, but is there a difference between a initializing a receiver with alloc/Init vs. using +(id)new 
    Where does the class name argument fit into the +(id)new method?
    In either case, once a new instance is returned, does that mean that during runtime the instance of the object will be where the command pointer goes next? And then that instance continues to be available during run until deallocated?
    What if you want to have more than one instance of the class available during runtime? Is it better just to initialize one, use it, destroy it, and initialize another, etc, in rapid succession, or better to initialize a quantity of instances, if needed during runtime (if possible)?

    There shouldn't be any difference. "[MyClass new]" and "[[MyClass alloc] new]" should be interchangeable. The last time I really tried, I got complaints from either the static analysis and/or leak checker tools when I used "new". I haven't done this test for a long time. I have noticed that in Apple's recent sample code, they are starting to use "new". I hadn't noticed that before. I need to check on this because I think "new" is cleaner and I would prefer to use it if the tools don't complain.
    For the record, only autoreleased values get cleaned up. When you do either "alloc, init" or "new", you must release. One alternative is to use a default autorelased initializer. Instead of doing "[[NSMutableArray alloc] init]" and then releasing, you can just do "[NSMutableArray array]". There are similar autoreleased initializers for other classes.

  • Duplicate global type definition/declaration

    I'm getting an error while compiling that says that one of my xml types is declared in more than 1 location and that the type is different in both locations. It is declared in the schema file on my hard drive, and then somewhere on my server. The potential fix says
    [Potential fix]: If your site has a proxy server, then you may need to configure your BPEL Server, designer and browser with your proxy server configuration settings (see tech note on http://otn.oracle.com/bpel for instructions).
    but I do not have a proxy server.
    How do update the instance on my server so that it isn't different from the file on my hard drive?
    Is that even the way to go about fixing the compiler error?

    It looks like your local orsmds store and your server's oramds store are out of sync.
    To be sure, check the differences in WorkflowTask.xsd file at the following locations
    Local machine -->  "jdeveloper\integration\seed\soa\shared\workflow"
    URL --> http://qaipm.atfoods.com:8001/soa-infra/services/default/ReportData//soa/shared/workflow/WorkflowTask.xsd
    I am sure there must be a difference at the location mentioned in your original post.
    Regards,
    Vikrant Korde.

  • What for? (2nd part global declaration in transformation)

    Hi Experts,
    does anybody know, what for is the 2nd part global declaration in a routine of a transformation?
    Myself I'm a developer, so I can differ between global and local declaration in a class-definition. But the second possibility to declare variables is outside of class-definition and class-implementation.
    I checked start routine, end routine and character/ keyfigure routine. I can see both of the declaration. Does it makes any sence to use this declaration?
    $$ begin of global - insert your declaration only below this line  -
        ... "insert your code here
    $$ end of global - insert your declaration only before this line   -
    $$ begin of 2nd part global - insert your code only below this line  *
    ... "insert your code here
    $$ end of 2nd part global - insert your code only before this line   *
    Thanks in advance.
    Greets Nico

    Hi Lijo,
    first, thank you for you answer.
    I'm not sure if I got it.
    If you want to use a global variable for all packages that will be processed, I have to declare a CLASS-DATA. That means the instance of the class won't be deleted the whole data package.
    If I want to use a global variable that will be used in character/ keyfigure routine it's sufficient to declare DATA in 1st or 2nd part of declaration.
    I understand it in a way, that the second declaration part is redundant. Is it right?
    Thanks in advance.
    Greets Nico

  • Global Declaration

    Good day everyone!
    Is it possible to declare a variable Globally in Oracle 8?
    What will be the syntax? I am really new at this stuff so please bear with me.
    Thanks!
    Regards

    hi,
    It's the Same
    ex: varibalename type;
    unlike local variables Global variables are declared in the header Part of the Package.
    Which makes it public and accessible from other packages.

  • How to use a variable global?

    Oracle 10g Enterprise edition
    Is there a way to retain a text in a global variable session specific?
    The global variable is declared in a package specification. But i am losing the values as the session changes.
    Can any one suggest me an approach to go with this?
    Thanks
    R

    No you didn't do anything wrong.
    Web applications are inherently stateless, so create a new session for each database request. Oracle's Application Express, which is a web based application, implements a form of state persistency through it's own means of storing values. It does this by allocating a session ID to the user as they start up their connection to the application and then that session ID is passed as part of the URL to each page call, which allows the Application Express "engine" on the database to identify the session and pull back any variables that require persistency.
    Sounds like you need to implement something similar.

  • Allocation in a transformation

    Hi guys,
    I need some help programming a transformation routine with the following requirements:
    in a data flow from a DSO to an InfoCube I want to fill an InfoObject in the InfoCube by allocating it from a Z-table:
    data record from DSO:
    COMPANY;AMOUNT
    ABC;100
    Z-table:
    COMPANY;PARTNER COMPANY
    ABC;DEF
    data record in InfoCube:
    COMPANY;PARTNER COMPANY;AMOUNT
    ABC;DEF;100
    The partner company should be filled, when I load the data from DSO to InfoCube, but I need some support to do this in BI 7.0.
    Thanks in advance + kind regards!
    Clemens

    Hi Clemens,
    Make changes to the INFO Objects Tech names and the Z Table as per requirement.
    Paste in the Start Routine
    Declarations
    $$ begin of global - insert your declaration only below this line  -
      TYPES : BEGIN OF TY_COMPANY,
                   /BIC/COMPANY TYPE /BIC/COMPANY-/BIC/COMPANY,
                   /BIC/PARTNER COMPANY  TYPE /BIC/COMPANY-/BIC/PARTNER COMPANY,
                END OF TY_COMPANY.
       DATA  :   IT_TEST    TYPE STANDARD TABLE OF TY_COMPANY,
                 WA_TEST    TYPE TY_COMPANY.
    $$ begin of routine - insert your code only below this line        *-
    Start Routines
        IF SOURCE_PACKAGE[] IS NOT INITIAL.
          SELECT     /BIC/PARTNER COMPANY
                     INTO CORRESPONDING FIELDS OF TABLE IT_TEST
                      FROM u201CZ Tableu201D
                      FOR ALL ENTRIES IN SOURCE_PACKAGE
                      WHERE /BIC/COMPANY = SOURCE_PACKAGE-/BIC/COMPANY AND
                      OBJVERS  = C_A.
        ENDIF.
        IF NOT IT_TEST IS INITIAL.
          SORT IT_TEST BY /BIC/COMPANY.
        ENDIF.
    Paste this in the Transfer Routine
    Transfer ROutine
    Source Field = COMPANY
    Target Field = PARTNER COMPANY
        READ TABLE IT_TEST INTO WA_TEST WITH KEY /BIC/COMPANY(Field) =
        SOURCE_FIELDS-/BIC/COMPANY
        BINARY SEARCH.
        IF SY-SUBRC = 0.
          RESULT = WA_TEST-/BIC/PARTNER COMPANY.
        ENDIF.
    Rgds
    SVU123

  • Declaring  NSNumberFormatter for use in different methods

    Hello all,
    I'm trying to use an NSNumberFormatter to display numbers in textfields in this format : xxx xxx xxx
    I got it to work like so :
    NSNumber *formattedResult;
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    [formatter setGroupingSeparator:@" "];
    [formatter setFormat:@"###,###"];
    result = number1 + number2; // (all these are declared int...)
    formattedResult = [NSNumber numberWithInt:result];
    resultField.text = [formatter stringForObjectValue:formattedResult];
    [formatter release];
    But I need to write similar code everywhere I display a number in a TextField.
    I tried to declare it in an initialize method, in viewDidLoad in order to "globalize" it, with no success...
    Anyone know where I should write it to ?
    Thanks

    Yeah, I did try that ! no luck...
    There is absolutely no mention of even the word "formatter" in either the "UITextField Class Reference" or the "UITextFieldDelegate Protocol Reference"... which is not a good sign !
    I feel lucky that :
    NSNumber *resultBy3;
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    [formatter setGroupingSeparator:@" "];
    [formatter setFormat:@"###,###"];
    resultBy3 = [NSNumber numberWithInt:result];
    resultField.text = [formatter stringForObjectValue:resultBy3];
    invoked everytime I need a number displayed, works !!!
    If you find anything more efficient/elegant, I'm interested !
    Thanks
    Message was edited by: Ostrowsky S
    Message was edited by: Ostrowsky S

  • Warning: (Insert object here) may not respond to '+alloc' ?

    I'm just getting started with Objective C development, and the following example that I am working with results in the following error:
    fraction.m:6: warning: ‘Fraction’ may not respond to ‘+alloc’
    fraction.m:6: warning: (Messages without a matching method signature
    fraction.m:6: warning: will be assumed to return ‘id’ and accept
    fraction.m:6: warning: ‘...’ as arguments.)
    fraction.m:6: warning: no ‘-init’ method found
    fraction.m:8: warning: ‘Fraction’ may not respond to ‘-free’
    I am running Snow Leopard, and I have downloaded the most recent XCode and iPhone dev libraries.
    I would very much appreciate your input. Thank you.
    ==========
    #import <stdio.h>
    #import <objc/Object.h>
    /* Interface */
    @interface Fraction: Object
    int numerator;
    int denominator;
    -(void) print;
    -(void) setNumerator: (int) n;
    -(void) setDenominator: (int) d;
    -(int) numerator;
    -(int) denominator;
    @end
    /* Implementation */
    @implementation Fraction;
    -(void) print
    printf ("%i,%i", numerator, denominator);
    -(void) setNumerator: (int) n {
    numerator = n;
    -(void) setDenominator: (int) d {
    denominator = d;
    -(int) numerator {
    return numerator;
    -(int) denominator {
    return denominator;
    @end
    int main (int argc, char *argv[])
    Fraction* myFraction = [[Fraction alloc] init];
    [myFraction free];
    return 0;
    }

    tkambler wrote:
    I've determined that this script compiles just fine on my iMac running 10.5.8. My other iMac, which I just installed Snow Leopard on, is the one that is giving me the errors. Any thoughts?
    Fraction.m compiled and ran under Xcode without any problems on my OS X 10.5.5 system. I don't have a Snow Leopard system, so can't reproduce the errors you reported.
    My first guess would be that the difference in your two systems is a difference in the included Object.h file. On my system the included file lives in /Developer/SDKs/MacOSX10.5.sdk/usr/include/objc. That @interface does indeed declare alloc, init, free, etc.
    From the compiler warnings you posted (which don't include "Can't find Object.h"), I would assume that either the Object.h file at the above path has changed, or that the wrong Object.h file is being included. The latter needs to be ruled out because (at least on my system) there are several Object.h files intended for different purposes. So for example, if your Snow Leopard Xcode isn't searching in the same folders, or if the correct Object.h has been relocated, it's entirely possible the wrong file is being included during the build.
    Determining which possibility applies in your case may require some familiarity with OS X and Xcode, and I don't know if +just getting started with Objective C+ means just that, or whether OS X and all of the developer tools are also new for you. If the code you posted is part of an isolated exercise and you won't be using Object.h much in the future (since it's not used in Cocoa), my advice would be to stay on the system that works until you're done with the current exercise.
    If you have a requirement to program in Obj-C without using Cocoa for an extended period of time, I'm sure someone here can help you find out what happened to Object.h on your Snow Leopard system. Of course things will be a lot easier if that help comes from someone who already has Snow Leopard.
    You can get started by looking at the Object.h file Xcode is including. You can do this by selecting Object.h in a text editor window, then selecting File->Open Quickly from the top menu (see Opening Files by Filename or Symbol Name in the Xcode Workspace Guide). Is your Active SDK set to 10.6? If your Snow Leopard Xcode has the option to set the Active SDK to 10.5, see which Object.h file gets included in that case.
    Hope that helps!
    \- Ray

  • Receiving the warning of class forward declaration

    I am trying to build the Clustering Plug in project on my Leopard. I have following 2 queries -
    In that project an interface class is defined as
    @interface ClusteringController : NSWindowController { ....... ..... .... } @end.
    And this class is used in implementation class using forward declaration as follows
    @class ClusteringController;
    then in one fuction it is used as follows
    (long) filterImage:(NSString*) menuName {
    ClusteringController *cluster = [[ClusteringController alloc] init]; [cluster showWindow:self]; return 0; }
    When i try to build this project it showing a warning as follows
    warning: receiver 'ClusteringController' is a forward class and corresponding @interface may not exist
    Also there is 1 more warning is coming
    warning: no '-updateProxyWhenReconnect' method found
    This warning is coming for the following line of code
    if(delegate) [delegate updateProxyWhenReconnect];
    Can anybody help me to overcome these warnings?

    shaktirsg wrote:
    And this class is used in implementation class using forward declaration as follows
    @class ClusteringController;
    An implementation requires an #import of the entire interface file for any class used in the code. As a rule:
    Use @class when a class is used in an @interface
    Use #import when a class is used in an @implementation
    if(delegate) \[delegate updateProxyWhenReconnect\];
    warning: no '- updateProxyWhenReconnect' method found
    It looks like the compiler doesn't know the class of 'delegate'. Can we see the code that sets the 'delegate' variable? Also please let us know where updateProxyWhenReconnect is declared. Is it declared in the interface for the class to which 'delegate' belongs? If so, it might be good for us to also see that @interface file.
    \- Ray

  • Declaration in start routine in transformations

    Hi guru's
    What is the difference between first and second global declaration in the start routine of a transformation?
    First: $$ begin of global - insert your declaration only below this line  -
    Second: $$ begin of 2nd part global - insert your code only below this line  *
    Kind regards
    Erik

    Hi Shambhu
    We usually write out code in the section:
    $$ begin of routine - insert your code only below this line        -
    What is the difference between writing the code in
    $$ begin of 2nd part global - insert your code only below this line  *
    and
    $$ begin of routine - insert your code only below this line        - ?
    Kind regards
    Erik

  • Global variable in XSLT

    Hi,
    I have a requirement in XSLT mapping where i sum up all the data related to amount field and then want to display total that i have added in the another node
    eg.
    <Detail>
    <xsl:variable name="<b>etotal</b>" select="sum(ns0:pay/ns0:checkList/ns0:check/ns0:deductionList/ns0:adjustment/ns0:amount/ns0:amount)"/>
    </Detail>
    <Trailer>
    <TotalDeductionAmount><xsl:value-of select="<b>$etotal</b>"/>
    </TotalDeductionAmount>
    </Trailer>
    how to do ?
    since the above example the scope of the variable is local and cannot be accessed globally. how to declare a global variable and then assign value to the variable
    or is there any other method to do this in XSLT
    Thanks in advance
    With Regards
    Pradeep N

    Hi,
    Please see below sample code is solving your problem. Global variable can not solve the problem, you need to use templates and call then appropriately.
    -Kavita
    Sample Input
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <Test>23</Test>
    <Test>34</Test>
    <Test>90</Test>
    </root>
    Sample Output
    <?xml version="1.0" encoding="UTF-8"?>
    <Mt_test>
         <Header>"create the header data according to req"</Header>
         <Details>
              <DetailsCol>23</DetailsCol>
         </Details>
         <Details>
              <DetailsCol>34</DetailsCol>
         </Details>
         <Details>
              <DetailsCol>90</DetailsCol>
         </Details>
         <Trailer>
              <TotalSum>147</TotalSum>
         </Trailer>
    </Mt_test>
    XLST:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template match="/">
    <xsl:element name="Mt_test">
    <xsl:element name="Header">"create the header data according to req"</xsl:element>
              <xsl:variable name="checkNext" select="//Test[1]"/>
    <xsl:call-template name="GenerateTest">
    <xsl:with-param name="currNode" select="//Test[1]"></xsl:with-param>
    <xsl:with-param name="Sum" select="0"></xsl:with-param>
    </xsl:call-template>
    </xsl:element>
    </xsl:template>
    <xsl:template name="GenerateTest">
    <xsl:param name="currNode"></xsl:param>
    <xsl:param name="Sum"></xsl:param>
    <xsl:element name="Details">
    <xsl:element name="DetailsCol"><xsl:value-of select="$currNode"></xsl:value-of></xsl:element>
    </xsl:element>
    <xsl:variable name="Sum1" select="$Sum + $currNode"></xsl:variable>
    <xsl:variable name="checkNext" select="$currNode/following-sibling::*[1]"/>
    <xsl:choose>
         <xsl:when test="$checkNext">
    <xsl:call-template name="GenerateTest">
    <xsl:with-param name="currNode" select="$checkNext"></xsl:with-param>
    <xsl:with-param name="Sum" select="$Sum1"></xsl:with-param>
    </xsl:call-template>     
         </xsl:when>
         <xsl:otherwise>
         <xsl:call-template name="GenerateTrailer">
    <xsl:with-param name="currNode" select="chkeckNext"></xsl:with-param>
    <xsl:with-param name="Sum" select="$Sum1 "></xsl:with-param>
    </xsl:call-template>
         </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    <xsl:template name="GenerateTrailer">
    <xsl:param name="currNode"></xsl:param>
    <xsl:param name="Sum"></xsl:param>
    <xsl:element name="Trailer">
    <xsl:element name="TotalSum"><xsl:value-of select="$Sum"></xsl:value-of></xsl:element>
    </xsl:element>
    </xsl:template>
    </xsl:stylesheet>

  • How to refer global simple types in another schema?

    Hello All,
    Any help would be greatly appreciated. My problem is , I have a global.xsd schema which declare simple types such as
    <xsd:simpleType name="DecimalMin1Max14Places2Type">
    <xsd:restriction base="xsd:decimal">
    <xsd:totalDigits value="14"/>
    <xsd:fractionDigits value="2"/>
    </xsd:restriction>
    </xsd:simpleType>
    I am referring to this type in my another schema forms.xsd. It is used as an attribute to an element. for example an element in forms.xsd is
    <xsd:element name="BudgetFourthYearAmount" type="glob:DecimalMin1Max14Places2Type"/>
    where glob is the prefix associated with global.xsd
    I am sucessfully able to register global.xsd in xdb, but when i try to register forms.xsd, i get sql mapping error. Oracle is able to resolve all the global elements from global.xsd , but it cannot resolve the global simple types i declared.
    My question is how i can refer global simple types declared in one xsd and use them in another xsd?
    Thank you,
    Maninder

    Using an include statement in forms.xsd to import in the global.xsd
    <xs:include schemaLocation="Global.xsd"/>
    If Global.xsd was the shcema_url that you registered the first xsd to.
    Regards
    Coby

  • How to determine the RDT name generated by sdo_geor.init()?

    I've done the following in a stored procedure:
    insert into ... values(sdo_geor.init()) returning newcol into gr;
    Now, before I do anything with gr, I have to create the rdt whose name was generated by sdo_geor.init. How do I get that name? There doesn't seem to be a sdo_geor.get* procedure or function for returning this.
    What I'm trying to do is implement this example of using sdo_geor.copy, but without specifying an rdt in sdo_geor.init():
    DECLARE
    gr1 sdo_georaster;
    gr2 sdo_georaster;
    BEGIN
    INSERT INTO georaster_table VALUES (11, sdo_geor.init('RDT_11', 1))
    RETURNING georaster INTO gr2;
    SELECT georaster INTO gr1 from georaster_table WHERE georid=1;
    sdo_geor.copy(gr1, gr2);
    UPDATE georaster_table SET georaster=gr2 WHERE georid=11;
    COMMIT;
    END;
    Alternatively, is there a way to generate a unique RDT name myself so that I can specify it in the call to sdo_geor.init?
    Many thanks,
    Mike

    Mike,
    the RDT table name is in the georaster object (gr) you just created. It's an attribute of sdo_georaster object, i.e., gr.RASTERDATATABLE in your case.
    generally, automatically generating the RDT name thru sdo_geor.init is not recommended because that would generate an RDT for each GeoRaster object. An RDT table should be used to contain the raster blocks of many smaller GeoRaster objects while you devote a single RDT table for a huge GeoRaster object (an image with a size over tens of GB to many terabytes for example). Even though the RDT tables are internal to GeoRaster, the creation of the RDT table is done by users, which is intentional, so that you can fully leverage the configuration and tuning power of oracle database (for example, if ASM is not used, RDT tables may be created on different tablespaces so that the raster blocks are distributed to different disks to improve performance).
    to generate unique RDT names, you can leverage the SEQUENCE object to create sequence numbers and then attach them to a special table name you picked up.
    Regards,
    Jeffrey

Maybe you are looking for

  • Re:How can we delete the concurrent node entry from the FND_NODE table

    HI , 11.5.10.2 on Oracle Solaris on SPARC (64-bit) . How can we delete the concurrent node entry from the FND_NODES table without running Autoconfig. Currently we are having 3 nodes RAC and we are deciding to remove one node from the RAC and all 3 no

  • Collision Detection with Tiled Map

    I have a 32*32 tile map size and also 32*32 size image character. I am having difficulty in having the character avoiding walking through the wall. It keeps moving through the wall. Has anyone ever done any similar things as I am? Just need a simple

  • Microphone for G4

    I would like to use Skype but need a microphone. Would also like to ad webcam. What is compatible?

  • Activity Texts: not able to define Text Typee

    Hi guys    I am created the new <b>Text Object ZCRM_ORDER</b> and new Text Determination Procedure <b>ZACT0001</b>, but when I am trying to create the Definition of procedure with  <b>new TEXT TYPE</b> say Z001 I am getting the Error Pls help where t

  • Error when running Application Manager

    I keep getting this error " Extension Manager 6.0.5 Update Installation failed. Error Code: U44M1P7 "