String to the object?

I would like to achieve something underneath, in order to have a string value that I can convert to object. His reason is that I get the string from an external source values, I'm looking at an easy way to convert them into an object. It's probably pretty simple, but I can't figure out how to do this.

var s:String = "V1:30, V2:72, V3:86, V4:55;
var obj:Object = {s}; of course, this does not work, but you get the idea...

woutek wrote:
> I would like to achieve something underneath, in order to have a string value that I can
> convert to object. His reason is that I get the string values
> since an external source, so I'm looking for an easy way to convert them in a
> object. It's probably pretty simple, but I can't figure out how to do this.
>
> var s:String = "V1:30, V2:72, V3:86, V4:55;
> var obj:Object = {s}; of course, this does not work, but you get the idea...
>

If you mean you want obj to look like at {V1: 30, V2: 72, V3: 86, V4: 55},.
and you know the format of your channels, it would probably work:

function stringToObject(s:String):Object
{
var o: Object = {};
for each (var pair: String in s.split (","))
{
var a: Array = pair.split(':');
o [a [0]] = parseInt (a [1]);
}
Return to o;
}

Not necessarily efficient, but unless your strings are ridiculously long or
you do this in a tight loop, it should be OK.

-Adam

Tags: Flex

Similar Questions

  • How to get the property of the object by it's string name

    Hi all!

    There is a function that receiver of the string value = "propertyName", which is the name of the property.

    and I have an element object with the name property is equal to "propertyName".

    How can I get to the element ofvalue of this property?

    I know that

    ObjectUtil.getClassInfo (element) .properties

    Returns an array of the properties of the element, but it's an easier way to do instead to search the table ditch?

    Thank you, Alex.

    the mounting of the parent of the object:

    var yourObject:DisplayObject = getChildByName ("propertyName");

  • name of the object in a string

    I want to create an XML file I can change for different languages.  It contains the names of the fields that have the text and the text that they should be replaced by: for example. < name lang = "titleLabel" value = "This is the title of the app" / >.  I can read the XML rows in a table, but I can't understand how to use the name as object name:

    var labels: Array = new Array();
    var lblNumber:int = 0;
    for each (var lbl:XML of in langFile.children ())
    {
    Labels [lblNumber] = lbl.@name;

    How to use what is contained in the labels [1] under the name of the object? for example (labels[1].@name) .text = labels[1].@value

    }

    Use the scoreboard operator to force the flash to fix ropes to objects:

    This [[lblNumber] labels] .text =

  • HP50g: HP50g - hot to check if the object of the stack is a number?

    How to check if an object on the stack is a number or another type of data? There seems to be no any function to check on 50g.

    50 g advanced users to see, page 1-13:

    "The order TYPE ([left SHIFT] PRG-> TEST-> NXT-> TYPE) accepts any object as argument and returns the number that identifies the type of this object." For example, 'HELLO' TYPE returns 2, the value of a string object. See table of object types in Chapter 3, in the command TYPE, to find objects of calculator and corresponding type numbers.

    Generally want to DUP the object to the level of the stack 1 first of all, because likely you want to do something with it, after checking his type.  The following RPL program checks the type of the object in level 1 of the pile and adds a string to the stack indicating its type.  Only some of the possible types are checked and a generic "something else" translates to others:

    «
    TYPE OF DUP
    CASE
    DUP 0 == THEN DROP 'real number' END
    DUP 1 == THEN DROP "complex number" END
    DUP 2 == THEN DROP 'chain' END
    DUP 3 == THEN DROP "real array" END
    DUP 5 is THEN DROP 'list' END
    DROP "something else"
    END
    »

  • Linked clone failed: the operation is not supported on the object

    Hi all - I would appreciate help on a related clone operation that is a failure.

    I use Quest vWorkspace to create linked clone VM in my environment.  It integrates with virtual Center and creates from a VM snapshot parent according to normal related clones.  It has just stopped working and I am trying to track down the cause.  The task fails with the error message in the console of VMware vCenter: the operation is not supported on the object.

    The vCentre is 5.5 and esxi.  vWorkspace is v8.0 MR1.  The parent VM is located on an iSCSI datastore.  I tried to put the clones of destination on premises and warehouses of NFS data with the same result.  Unfortunately I can't (don't want really to) move the VM parent from the data store that I have of many VM related to this virtual machine.

    The failure message is a bit generic, so I looked on through the vmkernel.log and vpxa.log and it is an excerpt from the vpxa.log whereby it shows failed task 153.  Can someone please indicate something in the newspaper that had to be examined or another newspaper to look at?

    vWorkspace attached error and below:

    Linked clone has not CreateLinkedClone_Task of CloneVmLinked failed! Task of VMware CreateLinkedClone_Task status error - the operation is not supported on the object. -Call stacks-VmLinkedClone.VmLinkedCloneService.CloneVmLinked String vmInvPath, String strSnapshotMor, String strNewVmName, String strSysprep, ManagedObjectReference morFolder, ManagedObjectReference morResPool, ManagedObjectReference morHost, String strDatastoreName, Boolean bQuickPrep, String domainNameIP, String

    See attachments

    Thank you very much
    Wikus

    Additional accessories:

    Hello guys,.

    For those of you already on 5.5, I did a few tests these days. I did find a magic bullet yet as a single parameter that is sure to break but I came up with a workaround.

    I found that if my ESXi server was still on the 5.1, vWorkspace could deploy clones linked via vCenter 5.5 - it's only when the ESXi is also on 5.5 that you have a problem.

    If any of you have ESXi hosts still on 5.1, you can deploy there for now.

    In ESXi 5.x, it is easy to have an ESXi virtual machine. You might want to consider creating some virtual boxes ESXi to deploy on while the vworkspace dev team look at why it does not work.

    I know that this is not the best solution in the world, but it's better than no work around

    Thank you, Andrew.

  • Way to access compose the strings of the phone app?

    I'm developing on a device 7290 with software version 4.1 4.1/JDE.  I was wondering if there was a way to get the string that you entered in the phone app.  I'm doing this because I want to do a somewhat native mechanism for composition of phase two with a number stored in my application.  So when a user dials the number, they have the possibility of either compose regularly (already there, of course) or using my Dialer of two floors in the menu.

    The only thing I can think is to try recording an ApplicationMenuItem in the phone app.  I don't know if the object that is returned in the 'context' ApplicationMenuItem will contain the number you entered or if it would be just an entry PhoneLog for the prerequisites.  Runs tests on this one there would reveal the answer, the inspection of the object with getClass() calls and/or execution in the debugger for more details on the returned object.

  • Store the object in a persistent storage

    Hello

    I want to store the cusom object in the persistent store.here is my custom class:

    public class {UserData

    OrgName string;
    Time to string;
    String authTocken;
    Public UserData (orgName, String authTocken, String time, String)
    {
    this.orgName = orgName;
    This.Time = time;
    this.authTocken = authTocken;

    }
    public String getOrgName() {}
    return orgName;
    }
    {} public void setOrgName (String orgName)
    this.orgName = orgName;
    }
    public String getTime() {}
    back in time;
    }
    {} public void setTime (string time)
    This.Time = time;
    }
    public String getAuthTocken() {}
    Return authTocken;
    }
    {} public void setAuthTocken (String authTocken)
    this.authTocken = authTocken;
    }

    }

    and I use the following class of persistent storage to store the data.

    / public final class PersistentStoreContents implements {Persistable
    private CAMailMinderHashTable mElements = null;
    static private instance of PersistentStoreContents = null;
    Private static final long KEY = 0x67c5b66a2bcd1dfcL;
    private PersistentObject persistentObject = null;

    /**
    * Gets the single instance of the database.
    *
    * only @return of the database instance
    */
    public static getInstance() {} PersistentStoreContents
    try {}
    If (instance == null) {}
    Logger.out ("PersistentStoreInfo", "creation of the storage object");
    instance = new PersistentStoreContents();
    }
    } catch (Exception e) {}
    instance = null;
    }
    return instance;
    }

    private PersistentStoreContents() {}
    persistentObject = PersistentStore.getPersistentObject (KEY);
    synchronized (persistentObject) {}
    If (persistentObject.getContents () == null) {}
    persistentObject.setContents (new CAMailMinderHashTable());
    persistentObject.commit ();
    }
    }

    mElements = persistentObject.getContents ((CAMailMinderHashTable));
    If (mElements == null) {}
    Logger.out ("PersistentStoreInfo", "*" + (mElements is nothing));
    mElements = new CAMailMinderHashTable();
    }

    }

    public String getElement (String key) {}
    Logger.out ("PersistentStoreInfo", "getElement:" + key);
    Return (String) mElements.get (key);
    }

    ' Public Sub setElement (String key, String value) {}
    Logger.out ("PersistentStoreInfo", "setElement:" + key + value);
    mElements.put (key, value);
    persistentObject.setContents (mElements);
    persistentObject.commit ();
    }

    UserData public getElement2 (String key) {}
    Logger.out ("PersistentStoreInfo", "getElement:" + key);
    Return mElements.get (key) (UserData);
    }

    public void setElement2 (String key, UserData userData) {}
    Logger.out ("PersistentStoreInfo", "setElement:" + key);
    mElements.put (key, userData);
    Logger.out ("PersistentStoreInfo", "added");
    persistentObject.setContents (mElements);
    Logger.out ("PersistentStoreInfo", "game content");
    persistentObject.commit ();
    Logger.out ("PersistentStoreInfo", "Validate");
    }

    Public list getAllKeys() {}
    Logger.out ("PersistentStoreInfo", "getElement:" + key);
    Return mElements.keys ();
    }
    }

    I use the follwinng code to insert data :

    PersistentStoreContents ch = PersistentStoreContents.getInstance ();
    UserData = us new UserData("gmail.com","1111","aaaa");
    ps.setElement2 ("[email protected]", US);

    But it is not inserting data in the persistent store. App is struck to the persistent store setContent method... any idea on this?

    the object you put in the store has implemented persistable, not your utility class.

  • Label String to the data shared send event

    Well, I'm in trouble. I want to click a button (a label to be exact).

    So I have my label

    I've got and event listener for the label, click

    And now I want to take the text of the label string and use it in an event to send while sending a page change event (2 events shipping both to the 2nd page)

    On this second page that I need to know what the chain of the button pressed was so I can still process events.

    Basically, it's my event flow:

    • Click on the button
    • Send event (the signal to open second page)
    • Send event (shipment in the chain) (which I can't find out how)
    • See the second page
    • Dynamically load information based on the button pressed on the first page (which I know how to do, I just need to know how to get that String of the button that was pressed)

    I have all work perfect with the exception of the dilemma of channel button. There will be a lot of buttons (rather labels) involved.

    Each event has a 'target' attribute  The target is the object originally shipped from the event.  For example, a LabelButton dispatches a click event, you can cast the target to this object to know things about this target (assuming that the target is always in memory).

    private void ButtonClicked (event: Event): void

    {

    trace (LabelButton (event.target) .label + "button");

    }

    If you pass an intermediate event and you want to carry information at this event, you can create your own event class by extending the event base class and adding the attributes that you want to carry.  You can also watch the event meta class that allows you to attach some meta information with the event class that they prepare.

  • Recovery of the object in the Second Listner Action

    Hello

    I created a stack class using vectors (VectorStack2). Now, I want to set up this operation with the help of the buttons. I created a push button. His action Listener creates an object of class VectorStack2 that calls the push (...) method of the VectorStack2 class in the method actionPerformed (...) of Action1. Now I want to recover this object of class VectorStack2 in the second action listener for the key of Pop so that the floor to invoke the pop() method.

    I don't understand how to do it?

    Some body please guide me. I put "?" symbols on the line following the object I want to recover in the second actionlistener actionPerformed method.

    Javax.swing import. *;

    Import Java.util;

    import java.awt.*. *;

    java.awt.event import. *;

    Class VectorStack2 {}

    private String [] stArr = new String [5];

    Vector < number > elements around.

    private int tos;

    VectorStack2 () {}

    items = new Vector < integer > ();

    TOS = - 1;

    }

    empty() {Boolean}

    If (tos == - 1).

    Returns true;

    Returns false;

    }

    Object (pop) {}

    {if (Empty ())}

    JOptionPane.showMessageDialog (null, "Stack overflow");

    System.Exit (1);

    }

    Return items.remove (tos);

    }

    public void push (Integer x) {}

    Items.Add (++ PE, x);

    }

    }

    public class useVSButt {}

    Public Shared Sub main (String [] args) {}

    int i;

    int nLength = 0;

    int lLength = 0;

    NST string ="";

    String lStr ="";

    JFrame frame = new JFrame ("Test");

    frame.setVisible (true);

    frame.setSize (500,200);

    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);

    JPanel Panel = new JPanel();

    Frame.Add (Panel);

    JButton button = new JButton ("Push");

    Panel.Add (Button);

    button.addActionListener (new Action1());

    JButton button2 = new JButton ("Pop");

    Panel.Add (button2);

    button.addActionListener (new Action2());

    } //main

    } //useStack

    class Action1 implements ActionListener {

    VectorStack2 objVS;

    public void actionPerformed (ActionEvent e) {}

    int i;

    JFrame frame2 = new JFrame ("Clicked");

    frame2.setVisible (true);

    frame2. SetSize (200,200);

    JLabel label = new JLabel ("you clicked me");

    JPanel Panel = new JPanel();

    frame2. Add (Panel);

    Panel.Add (label);

    int [] int1 = {100, 200, 300, 400, 500};

    VectorStack2 obj = new VectorStack2 ();

    for (i = 0; i < 5; ++ I)

    obj.push (new Integer (int1 [i]));

    HOW TO OBTAIN THIS ITEM from VectorStack2 IN Action2 actionPerformed method?

    }

    }

    class Action2 implements ActionListener {

    public void actionPerformed (ActionEvent e) {}

    int i;

    JFrame image3 = new JFrame ("OKNO 3");

    frame3.setVisible (true);

    frame3. SetSize (200,200);

    JLabel label = new JLabel ("kliknales");

    JPanel Panel = new JPanel();

    frame3. Add (Panel);

    Panel.Add (label);

    VectorStack2 obj = new VectorStack2();

    for (i = 0; i < 5; ++ I)

    JOptionPane.showMessageDialog (null, "burst val is" + obj.pop ());

    }

    }

    Please watch carefully on these lines in your code:

         JButton button = new JButton("Push");
         panel.add(button);
         button.addActionListener (new Action1(objVStack));
    
         JButton button2 = new JButton("Pop");
         panel.add(button2);
         button.addActionListener (new Action2(objVStack));
    

    The lesson here is: always choose names of significant for login!

    Good bye

    DPT

  • URL of the object, with a post

    Hello

    I was wondering if anyone has tried to use the URL of the object?

    It seems pretty simple, but for some reason, the remote server always answer me as if my post was empty.

    I tried with a loop, and it works perfectly with my post.

    So the problem must be with my code, but I also noticed that the URL of the object in the API, the method Explorer postContent, it says that I should pass a string value.

    But if I take the workflow of post HTTP, its passage to a string value, so I'm confused.

    Also, I use vRO 7.0

    Here's the code I developed:

    var urlObject = new URL (url + user + "& _secret =" + password);

    If (os.toLowerCase () == 'sles') {}

    var folder_os = linux/unix/Assembly"."

    } ElseIf (os.toLowerCase () == "windows") {}

    var folder_os = "windows/windows 2012/Assembly."

    } else {}

    throw ("OS not supported");

    }

    var content = '{\"attributes\': {' +}

    '\"ipaddress\":\ '. "" "full domain name +"\"},\"hostname\":\." "" "" servername + "\" +. "

    ', \"folder\":\ '. "' + folder_os + ' \ '}"; "

    System.log ("URL:" + url + user + "& _secret =" + password);

    System.log ("PostContent:" + content);

    result = urlObject.postContent (content);

    System.log (result);

    Hello

    You must set the requestType ('POST') and the contentType (' application/json') properties of your URL object before calling the postContent() method.

  • Relationship between the objects in view with bind variable executed by program

    Hello

    I am trying to create a view link between two objects in view that are query based something like this:

    firstVO

    1. Select P1 in XXX_Table where P2 =: BindVariable1 and

    P3 =: BindVariable2;

    secondVO

    2. Select B1, B2, B3, B4, 1 m env in YYY_Table where B5 =: BindVariable1 and

    B6 =: BindVariable2 and

    B7 =: BindVariable3;

    concatenation of a string of the query above in AMImpl as 'and B8 in ('P1.a', 'P1.b', 'P3.c')' in the AMImpl

    I will execute queries above, based on the variable bind entered by the user in the AMImpl.

    I need to create a link to firstVO.P1 and secondVO.P1 with a 1-based view to * cardinality.

    the problem is when I try to drop the secondVO which is an accessor to the firstVO as a master-child relationship with master table form and as a child, I don't see the details of the child when I iterate the master shape.

    I got my problem solved, the problem was that the master and the children were not in the sink, we can define the child VO by substituting preparerowsetforquery... explained clearly in the post below.

    Thank you

    Jobinesh

    Binary: Defining the value of variable binding for the destination View object in the link display

  • Access to the objects in third-party systems

    Using the extract of code found in the section "to access objects in third-party systems" vSphere 5.5 documentation, I found a problem that I can't seem to overcome.

    Snippet (directly from the documentation):

    URI uri = URI.create ("https://orchestrator1:8283/vco/api");

    SessionFactory VcoSessionFactory = new DefaultVcoSessionFactory (uri);

    Enter the address of the server vCenter Single Sign-On

    SsoUri URI = URI.create ("https://vCenter1:7444/ims/STSService?") wsdl") ;

    define tokens to be valid for one hour

    long lifeTimeSeconds = 60 * 60;

    Create a vCenter factory chips Single Sign-On

    SSO SsoAuthenticator = new SsoAuthenticator (ssoUri, sessionFactory, lifeTimeSeconds);

    There is no class in vSphere or Orchestrator libraries that can be imported to manage the object 'SsoAuthenticator '.  My goal is to use this code to get the token for the REST API on Orchestrator calls to run workflows.  Any help in accomplishing my goal would be appreciated.

    Either way, another approach to get the token using a SOAP call works (I used the AcquireBearerTokenByUserCredentialSample found in the documentation with success); However, I thought I would ask the forum a glimpse on the fate of the class associated with SsoAuthenticator in case there is something that I am missing.

    Hi Scott,.

    Class of SsoAuthenticator lie in o11n-rest-client - sso.jar, part of the Java REST SDK vCO.

    There are some errors in your code:

    (1) the port number is vCO URI is not correct. It should be 8281, not 8283. 8283 is the Web Configurator vCO port, 8281 is the port of the server of vCO (and vCO REST API)

    (2) it seems that you SSO valid URI for the 5.1.x version 5.5.x not. For 5.5.x, the URI should be something like https://vCenter1:7444/sts/STSService/vsphere.local?wsdl. Note ims was changed to m


    In fact, you needn't get the UNIQUE authentication token. We support basic authentication with name of user and password in the SSO. Take a look at the following code sample who seeks stocks 'Rename Datacenter"workflow by ID:


                String user = "user123@domain";
                String pwd = "password123";
                URI vcoUri = new URI("https://10.23.20.30:8281/vco/api");  // replace with your vCO IP
                VcoSessionFactory sessionFactory = new DefaultVcoSessionFactory(vcoUri) {
                    @Override
                    protected HostnameVerifier newHostnameVerifier() {
                        return newUnsecureHostnameVerifier();
                    }
                    @Override
                    protected SSLContext newSSLContext() throws KeyManagementException, NoSuchAlgorithmException {
                        return newUnsecureSSLContext();
                    }
                };
                VcoSession session = sessionFactory.newSession(new UsernamePasswordAuthentication(user, pwd));
                WorkflowService wfService = new WorkflowService(session);
                Workflow workflow = wfService.getWorkflow("BD808080808080808080808080808080A3C380800122528313869552e41805bb1"); // ID of 'Rename datacenter' workflow
                if (workflow != null) {
                    System.out.println("Found workflow -> " + workflow.getName());
                }
    
  • Conversion of string in psobjects objects

    Hello everyone

    Can anyone help please?

    I have a small script that tries to read a text file and a list of "text strings" as output objects. I managed to get the relevant text strings, I want, but their output as objects seems to be the problem. If anyone can help that would be great. the script below

    $servers = (get-Content c:\servers.txt)

    {ForEach ($server in $servers)

    $Conn = (& racadm - u user_name password getsysinfo Pei $server r)

    $obj = New-Object psobject
    $obj | Add-Member Noteproperty-Hostname name-value (($conn | select-string "^ nom d'hôte" | foreach {$_.line}) - replace "hostname =" "")
    $obj | Add a member Noteproperty-SVCTag name-value (($conn | select-string "^ Service Tag" | foreach {$_.line}) - replace "Service Tag =" "")
    $obj | Add-Member Noteproperty-Date_Time name-value (($conn | select-string "^ RAC Date/heure" | foreach {$_.line}) - replace "RAC Date/Time =" "")

    Write-Host $obj

    }

    -The output I get is:

    @{Hostname = servername1; SVCTag = 532GY3J; {Date_Time = Thu Sep 20 09:51:56 2012}
    @{Hostname = servername2; SVCTag = 330GY2J; {Date_Time = Thu Sep 20 09:52:02 2012}
    @{Hostname = servername3; SVCTag = 230GY3J; {Date_Time = Thu Sep 20 09:52:10 2012}

    Thanks in advance

    Munster

    You may not use the Write-Host cmdlet. Change the line:

    Write-Host $obj

    in:

    $obj

  • Get the name of the object raising the event

    If I have a change event for a checkbox that is declared like this:

    topmostSubform.Page2.Competitions_CB.Checkbox::change - (JavaScript, client)

    How can I get the path of the object in a variable to process and extract the part "Competitions_CB"? Same route to the top of the tree of objects would be nice, but I can't seem to find the property that returns the object names.

    I went through all properties that seemed likely, xfa.event, events and this, but nothing seems to be what I'm after.

    Hello

    With the help of 'this.somExpression' will return a string of the trajectory of the entire article;

    XFA [0] form [0] .topmostSubform [0]. Page 2 [0]. Competitions_CB [0]. Box [0]

    You can also use 'xfa.context.somExpression' to return to the same thing, using xfa.context is very convenient when the code is in a script object and called many events of the object.

    In addition, "parent.name" would return the "Competitions_CB" part, so parent.somExpression would return

    XFA [0] form [0] .topmostSubform [0]. Page 2 [0]. Competitions_CB [0]

    Concerning

    Bruce

  • Pass the object as a parameter to a method by dragging to the user interface

    Hello

    I use datacontrol webservice to call "Webservice secure." A datacontrol method and he fell in the UI, it passes an object (for example, the SOAHeader object) as an input parameter and returns "String" as an output. So, here I created a passing and java class as an object to the method. When I deployed the application in the Android emulator, clicking on this method as a button, his throws me an error message * "" HTTPStatusCode 500: the server encountered an unexpected condition which prevented him from meeting demand "*." I tried to configure the debugger to get log for remote deployment, after that the application itself is not opening in the emulator. So how can I find the exact reason of this error message?

    Here, I had some doubts,
    (1) is the right way to pass the object as an input method parameter?
    (2) how can I call web service secured via 'Webservice datacontrol' in ADF Mobile. I searched in google and received a link by Sonia "http://andrejusb.blogspot.be/2012/11/adf-mobile-secured-web-service-access.html", but not understanding on "* adfCredentialStoreKey *", what is it? and how do I use it? I have defined strategies for security, as mentioned, is - it enough to call Web services secure without giving name of user and password? Bit confused, can someone please tell me more about access to the secure of webservice webservices datacontrol.
    (3) I tried to configure the option of debugging (as mentioned in the developer's guide) to get the log of remote deployment. I changed * "java.debug.enabled = true" * in cvm.properties. Once this configuration, can't open this mobile application through the emulator. What could be the reason?


    Concerning
    REDA

    Take a look at this:
    https://blogs.Oracle.com/Shay/entry/calling_web_service_with_complex

Maybe you are looking for