How to record a little complex data in json?

Hi all

I want to use json to store complex data a bit. I checked the sample application code. It's too simple.

The data are as follows:

{

'day': 'ddd ',.

'type': 'xxx ',.

'name': "qqq"

"amandine":]

{'name': 'sss', 'set': 'ddd', 'time': 'ddd'},

{'name': 'eee', 'set': 'fff', 'time': 'fff'},

{'name': 'qqq', 'set': 'ggg', 'time': 'ggg'},

{'name': 'aaa', 'set': 'vvv', 'time': 'vvv'},

{'name': 'zzz', 'set': 'ccc', 'time': "ccc"}

]

}

I am confused with QVaraintMap, QVariantList and QVariant and don't know how to use them properly.

PS: I'm new to json. I used to use MySQL in my work.

Thank you.

brad_qqq

The simplest approach is the following:

JSON object (something wrapped in {}) will be a QVariantMap

List of JSON (something wrapped in []) will be a QVariantList

Everything else (numbers, strings, boolean, etc.) will be a QVariant

Everything will be a QVariant when initially mapped out, and you must check the types with canConvert (Type) and use the methods toXXXX, that all return values (http://qt-project.org/doc/qt-4.8/qvariant.html) to get the respective types and use the data.

Tags: BlackBerry Developers

Similar Questions

  • How to record measured analog data on the PC?

    Hello

    I am a beginner in the real-time hardware. I have the cRIO-9024 controller and the cRIO-9112 chassis. I have a few questions:

    (1) I can't see the examples because Labview 2009 shows that The NI Service Locator is not running. I just installed Labview 2009. How can I solve it?

    (2) what is the best way to filter the measured analog data? There are hardware module filtering or I have to use Labview tools as filters pint? I would like to read data to the time step 1 Ms.

    (3) how can I save measured analog data on the PC? I tried to use 'write to file measured', but he did my program slower and I couldn't get my 1 mS of a cycle. Can I use cRIO-9024 memory somehow and after when the programme is complete to save the files to the hard drive? Maybe it would be faster?

    Thanks for any help and examples, whether it would be possible.

    Hello Rodzynek,

    If you do not have the FPGA module (or just for now) the solution you gave with the filter would be OK. Place a second loop for file IO (and possible your communication to the user Windows interface) would be a good idea. Do not forget that you are using on the function of file create the file path represents the drive of the controller cRIO (which is mostly a c drive). You can send via FTP to the RIO DC (using the IP address) and have a look at the files.

    A suggestion to get this file programattically is that the cRIO controller sends the file name of the Windows user interface (after the closing of the record), with the Windows user interface, you can use the FTP functions in Labview to get the measures file.

    Best regards

  • How to record data using a while loop?

    Hello

    I created a .vi I try to use to record several channels of data. I have implemented the user must be able to record data until the "STOP" button is pressed, then the data is saved in a spreadsheet file.

    Question No. 1: How to allow the user to store an indefinite amount of data?

    If you run the .vi as is, you will see that you are only able to collect 100 points, and registration takes place during Ms. I want to collect about 5 minutes worth of data and have a sampling frequency of 1 kHz.                 Any suggestions?

    Question 2: How can I change the worksheet file extension? Let's say I want than to save it as a .csv file?

    Thanks in advance for any pointers or suggestions!

    I have not looked at your code, but only based on your description I would implement a producer/consumer to save your data.  You must acquire your data in a loop (the producer) and send to your loop of logging (the consumer) using a queue.  Yes, you must save the data, then that is acquired.  In this way, you do not have to worry about storage who knows how much data in RAM.  It's just the disk as soon as he can.

    You can save the file with whatever the desired extension.  If you want it to be a CSV file, then do the extension a .csv.

  • For the complex data type, how to generate the Dll with compatible interface to C/C++

    Hello

    I used the Labview FPGA module to develop test equipment. Now, I need to write a driver that is to be a Dll with compatible interface to C/C++ for this equipment. So that my client who is familiar with C/C++ can call the driver without any study on labview. But I had a few problem on how to convert labview for C/C++ data complex data type. To clearly explain to my question, I have attached a simple example. (see attachment) I try to generate a Dll for the attached example VI and get the the function prototype at the head of the files as below:

    ' void OpenFpgaReference (LStrHandle * RIODevice, TD1 * errorIn, LVRefNum * FPGAVIReferenceOut, TD1 * errorOut).

    As you have known, the type of data "LStrHandle * RIODevice" and "LVRefNum * FPGAVIReferenceOut" Labview data format are. C/C++ do not have this kind of data type and can not reconige it. As a result, I can't call the Dll of C/C++ programming language. How to convert these two data type of labview for the C/C++ compatible data format, and then build the Dll? Anyone know about this?

    The answer is really apprecaited! Thank you in advanced.

    Ivan.Chen wrote:

    As I found in the following article:

    http://digital.NI.com/public.nsf/WebSearch/FB001AA027C8998386256AAD006C142D?OpenDocument

    LVRefNum is the name of resource of LabVIEW VISA or refnum, and "it is impossible to convert LabVIEW VISA name of resource or refnum VISession valid ID."
    This means that external code modules can not access & control the session VISA which is open by labview. But for my purposes, I will not attempt to access this VISA extenal code(C/C++) session. I just hope that save this session VISA in the external code once I opened it in Labview dll; and pass it to the labview dll when needed. While I have not need to login again when I need to control the device. Is it possible to do?

    A LVRefNum is really just a single int32 value. Its meaning is useless for other environments than those who created it so that you Michael not any what in C/C++ caller but pass it back to other functions in your DLL, but this often isn't a problem at all.

    You can take the following statement of the LabVIEW extcode.h headers and add them to your delabviewed header files to make it work in such a way.

    #define Private (T) typedef struct T # _t {void * p ;} * T}

    Private (LVRefNum);

    The LStrHandle you must set a standard C string instead in your export DLL and document what is the size of the string buffer should have if it is an output parameter.

    TD1 error clusters should also be divided into their parameters (C compatible) separate for all items or just to the left of suite entirely.

    Rolf Kalbermatter

  • How can I "RECORD each piece of data (and I mean everything!)" contained in the hard disk of the laptop? »

    How can I "RECORD each piece of data (and I mean everything!)" contained in the hard disk of the laptop? »

    I know PC never fade completely everything, so if there is a way to get personally, I'd really like the head upward on the how to do?  I would be better for me to download all this information on a PHDD, rather than handing the portable real in question so that its content of forensics experts, because current 'Communications Network serious security' we have been subjected to.

    Here you go:

    1. Use an imaging program to create a clone of your hard drive.
    2. Delete the original from your PC hard drive and keep it somewhere safe.
    3. Put the clone in the PC.
    It is the only way to really keep all while still able to use the PC.
  • How to record data block details without validation data?

    Hi all.
    I have a form - forms 6i - contains three blocks of data DB1 h1 ^(form/master) ^ <-DB2 ^ (in the form of table/main/detail) ^ <-DB3 ^(tabular/detail) ^

    There are certain mandatory elements in DB1, which must be entered.
    user first enter data DB1 then go to DB2 - master DB1, DB2 in detail.
    in normal when insert us a new record in the detail data block and move the cursor to the next element form will ask for validation. I solve this problem by engaging if the status in new or modified data block, that is the problem because there are certain elements is required in DB1, so if the user leave them empty and fill the tabular data block DB3 form will commit and the requested item will be stored as null in the database.

    so, how can I save the data in DB2 and DB3 temporally to the form so that the form won't ask for validation when the cursor will move to the other element?
    If Yes, then I can do a procedure which ensure that all the necessary filed came before committing.
    Thank you

    To be very honest, I'm still confused what you want to do. But the thing in the last post asked you then read on the POST in the help of forms...

    Integrated POST

    Writes data into the form in the database, but does not perform data validation. Oracle Forms valid first form. If there are changes to publish on the database, for each block in the form of what oracle Forms written deletions, insertions and updates the database. All the data that you send to the database is committed to the database of the next COMMIT_FORM that runs when the session Runform. In addition, these data can be restored by the next CLEAR_FORM.

    -Clément

  • Creation of complex data signals

    Hello

    I have 2-channel audio that contains the parts real and complex of an I / Q wave. I'm trying this demodulation using block MSK modulation toolkit, but I have trouble accessing the i / Q stream in the right type. The MSK block requires a complex waveform input, but after the construction of this waveform complex, I discovered that he really had to a 'Waveform.ctl of complex data.

    How can I get my data in the right format? I can't find a block which generates this 'Waveform.ctl complex data.

    I have attached a picture of the situation.

    Best regards

    Jan

    Try this

    Right-click on the entry of complex waveform of this Subvi node MT demodulate MSK. Click on 'Create' > 'Constant '. Now remove the wire between the newly created constant and the Subvi. Adds a set of cluster name. Wire the constant in the top of the boot of cluster name. Left click and pull on the bottom of the boot of cluster name until 3 entries appear. Click with the right button on each entry and use the item select to get the entries you need.

  • I backed up the files on a DVD of a XP OS to put on a 7 OS but the record shows that the data on the DVD is corrupted

    I backed up the files on a DVD of a XP OS to put on a 7 BONE, but the record shows that the data on the DVD is corrupted. I have run some recovery on the DVD programs and even if she shows that 2.3 GB have been used they are unable to find the data

    * original title - I need fast help please *.

    How is not have you backed up the files?  You just burn it to a CD or did you use the 'NT backup' program of Windows XP?  I don't think that the Windows XP Backup program is compatible with the Windows 7 backup program.  The following link contains an article that explains this condition:

    "Windows 7 backup XP restore"

    If you simply copied the files on the CD/DVD, then it is possible the program that copied the DVD not to "finalize" the DVD.  If you can play the DVD on the computer that created it, but cannot on another computer, then this is probably the case.  If this is the case, then put the disk into the computer that created and put in place the program that burned and look under the 'Tools' menu for an option "Finalize"... and do it.

    HTH,
    JW

  • How to record and play Audio

    Hello

    I want a code example to learn how to record audio and play audio recorded

    Can anyone help me regarding this?

    Thank you

    Pounet

    Try this code, it works for me.

    To record the audio. Note that this code records audio in the device memory. Just change the url to save the code in the sd card.

    try {}
    Reader = Manager.createPlayer ("capture://audio?encoding=amr");
    Player.Realize ();
                
    RC = (RecordControl) player.getControl ("RecordControl");
    BT = new ByteArrayOutputStream();
    rc.setRecordStream (bt);
    FC = (FileConnection)Connector.open("file:///store/home/user/RecordedFiles/audio1.amr");
    {if (!) FC. Exists())}
    FC. Create();
    }
    OT = fc.openDataOutputStream ();
    rc.setRecordStream (ot);
    rc.startRecord ();
    Player.Start ();

    } catch (Exception e) {}
    e.printStackTrace ();
    }

    To stop and play the audio. Copy the following code,

    try {}
    RC.Commit ();
                
    data = bt.toByteArray ();
    BT. Close();
    Player.Close ();
              
                
    BI = new ByteArrayInputStream (data);
                
                
    Player = Manager.createPlayer (bi, "audio/amr");

    Player.Realize ();

    Player.Start ();

    } catch (Exception e) {}
    e.printStackTrace ();
    }

  • How to fill a field of date with today's date when the signature field is signed?

    How to fill a field of date with today's date when the signature field is signed? In the LCD, I insert a signature field and a date field, what parameters in these two fields are necessary to make this work? Is the date field, the value calculated? I tried different JS suggestions I found, but none work. In the form, I named the signature ClaimSignature field and the date in the ClaimSigDate field.

    The thought of her with a little help. In the script editor window, I selected the postSign event and added the following JS:

    Form1.Page1.ClaimSignature::postSign - (JavaScript, client)

    var date = new Date();

    var day = date.getDate ();

    var month = date.getMonth () + 1;

    var monthstring = (month, 10?) ('0' + month: month)

    year var = date.getFullYear ();

    var = year DateString + '-' + monthString + '-' + (day< 10="" "0"="" +="" day="" :="">

    ClsimSigDate.rawValue = dateString;

    I hope this helps someone else save time.

  • How to record down version Cloud Creative InDesign CS5? Exported as a file .idml but still the messages that plug-ins are missing, although CS5 confirms it is fully updated.

    How to record down version Cloud Creative InDesign CS5? Exported as a file .idml but still the messages that plug-ins are missing, although CS5 confirms it is fully updated.

    Yes. Thank you. I based on another post misled. Successfully done this by selecting 'File', 'save a copy... ". "then choosing"for CS4 or later (IDML).

    He had little patience and several tests, but I think it was because of hardware (memory) overloaded version CC cloud or something. It was a 50 MB, file of 500 pages and took 17 minutes to convert/save,

    Recap: dnuee to CS5, do not use "Export" (IDML); use ' Save as ' or 'Save a copy' and select "for CS4 or later (IDML).

    Advice much appreciated.

  • How to record 1920 x 1080 video without quality loss? Do not use blu ray.

    How to record 1920 x 1080 video without quality loss? Do not use blu ray.

    It is physically IMPOSSIBLE to use HD on a DVD material and to play in a DVD player... the data rate is different, it is BluRay invented

    Link to DVD Demystified FAQ http://forums.adobe.com/thread/544206

  • How to record draws lines?

    Hello

    My goal is to make a flash application that can do these things:

    -drawing application database (I can handle this part)

    -Save the user features

    -save data that record each moves in a single file, let's call my-design-data file

    -load my-design-data file into the flash application

    -reading my-design-data file in order to watch a kind of movie that shows the drawing who 'draw' itself

    A good example of this application can be found on drawingnow.com. So I know it's possible but how...?

    Any ideas how they do?

    Hello

    Here is a very rough idea on how to record and playback of drawing.

    Capture the drawing:

    -drawing points are stored in a table "_pointArray".

    -the "_pointArray" coded JSON is published on the server.

    -Next - server, save the string in a file or a database.

              private function mouseDownHandler(e:MouseEvent):void{
    
                   //start new segment
                   moveTo(stage.mouseX,stage.mouseY);
    
                   //mark the point as starting point , "newline=true"
                   _pointArray.push({x:stage.mouseX, y:stage.mouseY, time:getTimer(), newline:true});
    
              }
    
              private function mouseMoveHandler(e:MouseEvent):void{
                   if(e.buttonDown){
    
                        //draw line
                        drawLine(stage.mouseX, stage.mouseY);
    
                        //record the points
                        _pointArray.push({x:stage.mouseX, y:stage.mouseY, time:getTimer()});
    
                   }
              }
    
              private function moveTo(x:Number, y:Number):void{
                   this.graphics.moveTo(x,y);
              }
    
              private function drawLine(x:Number, y:Number):void{
                   this.graphics.lineTo(x,y);
              }
    
              private function saveData():void{
                   var json:JSONEncoder = new JSONEncoder(_pointArray);
                   var urlVariable:URLVariables = new URLVariables();
                   var urlRequest:URLRequest = new URLRequest('{URL_TO_POST_AND_SAVE_POINTS}');
    
                   urlVariable.points = json.getString();
                   urlRequest.method = URLRequestMethod.POST;
                   urlRequest.data = urlVariable;
    
                   var urlLoader:URLLoader = new URLLoader();
    
                   urlLoader.load(urlRequest);
                   urlLoader.addEventListener(Event.COMPLETE, saveCompleteHandler);
    
              }
    
              private function saveCompleteHandler(e:Event):void{
                   trace("Saved the animation");
              }
    

    Load and replay the animation:

    -load the json string

    -Decode the json string to array

    -Playback of the animation

                             private function loadData():void{
                        var urlRequest:URLRequest = new URLRequest('{REQUEST_URL_TO_LOAD_POINTS}');
                        var urlLoader:URLLoader = new URLLoader();
                        urlLoader.addEventListener(Event.COMPLETE,loadCompleteHandler);
                        urlLoader.load(urlRequest);
                   }
    
                   private function loadCompleteHandler(e:Event):void{
                        var loader:URLLoader = e.target as URLLoader;
                        var json:JSONDecoder = new JSONDecoder(loader.data as String);
                        _pointArray = json.getValue() as Array;
    
                        //start the animation
                        playAnimation();
                   }
    
                   //Playback the drawing on an EnterFrame/Timer event
                   private function playBackHandler(e:Event):void{
                        var nextPoint:Object = _pointArray[_currentIndex];
                        var nextMilliSec:Number =  nextPoint.time;
                        var timeLapsed:Number = getTimer() - _startTime;
    
                        while(timeLapsed >= nextMilliSec){
                             if(nextPoint.newline){
                                  //stating point
                                  moveTo(nextPoint.x, nextPoint.y);
                             }else{
                                  //draw line
                                  drawLine(nextPoint.x, nextPoint.y);
                             }
    
                             //next array index
                             _currentIndex++;
    
                             //reached the end?
                             if(_currentIndex >= _pointArray.length){
                                  stopPlayBack();
                                  break;
                             }else{
                                  nextPoint = _pointArray[_currentIndex];
                                  nextMilliSec =  nextPoint.time;
                             }
    
                        }
                   }
    

    Kadiatou

  • Consume a web service from ASP which responds with complex data types...

    Here's my problem - I'm trying to consume a web service from a provider that uses complex data types.

    The starting of the WSDL part looks like this (I have not included all) - named have been changed to protect the innocent:

    " < wsdl:definitions targetNamespace = ' http://domain_name ">
    WSDL: < types >
    " < s:schema elementFormDefault ="qualified"targetNamespace =" http://domain_name ">
    < s:element name = "Authentication" >
    < s:complexType >
    < s:sequence >
    < s:element minOccurs = "0" maxOccurs = "1" name = "User name" type = "s:string" / >
    < s:element minOccurs = "0" maxOccurs = "1" name = "Password" type = "s:string" / >
    < s:element minOccurs = "0" maxOccurs = "1" name = "Token" / >
    < / s:sequence >
    < / s:complexType >
    < / s:element >
    < s:element name = "AuthenticateResponse" >
    < s:complexType >
    < s:sequence >
    < s:element minOccurs = "1" maxOccurs = "1" name = "AuthOK" type = "s:int" / >
    < s:element minOccurs = "0" maxOccurs = "1" name = "Token" / >
    < / s:sequence >
    < / s:complexType >
    < / s:element >

    Since it is a return, with a sequence of complexType, I expect an array or a structure returned, but instead I just get the value of "AuthOK" and no way to get something else.

    Here are the ways I tried to call it:

    < cfscript >

    WS = createObject ("WebService", "https://WSDL_URL");

    WS_ret = WS. Authentication (name of user = "username", password = "password", token = "");

    < / cfscript >

    < cfdump var = "" #WS_ret # "/ >"

    < cfinvoke webservice = "WSDL_URL" method = "Authentication" returnVariable = "WS_ret" >

    < name cfinvokeargument = "userID" value = "7253320" / >
    < cfinvokeargument name = "password" value = "ctpjxs3" / >
    < name cfinvokeargument = "SecurityToken" value = "" / > "

    < / cfinvoke >

    < cfdump var = "" #WS_ret # "/ >"

    Any ideas how I can get the other variables in the sequence? I have other calls after that have a greater amount of variables, and as such I can't use without being about to get more than the

    You can try using the function GetSOAPResponse to review the XML code you receive.

    'GetSOAPResponse '.

    http://livedocs.Adobe.com/ColdFusion/8/htmldocs/help.HTML?content=functions_e-g_59.html#50 54378

    "Troubleshooting SOAP requests and responses.

    http://livedocs.Adobe.com/ColdFusion/8/htmldocs/help.HTML?content=webservices_27.html#1222 070

    As for the question of docs, I suspect mediocre edition is at fault.  I assume that the web service is supposed to have an echoStruct method but this is unclear.

  • How to find the last update date, time and user of the file field peoplecode

    How to find the last updated date time fields of peoplecode records?

    Thank you.

    We can check the update date-time using the following query

    SELECT LASTUPDDTTM IN THE PSPCMPROG WHERE OBJECTVALUE1 LIKE "RECNAME" AND OBJECTVALUE2 AS "FIELDNAME".

Maybe you are looking for