Quiz App - What is the Best Way to Represent Data?

I'm creating a quiz app, kind of like flash cards.
The text for the questions and answers might contain HTML code, double and single quotes, etc..
The text for a question or answer might also extend across multiple lines, with some lines indented.
Should I store the question and answer text in an XML file, or in text files?
I ask because I know sometimes when you store data in XML files you have to jump through hoops to have Flex not mess up the data if it contains <, >, ", ', and lots of whitespace.
If I store the data in an XML file, I guess I need to escape < > " ' and unescape after reading in the data?

If I enter this text and send it using JSON to PHP:
What does this code do?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    <![CDATA[
      private function testFunc(testArg:String):int{
        var myVar:String = "#000000";
        var myVar2:int = 0xFFFFFF;
        return 1;
    ]]>
  </mx:Script>
</mx:Application>
This is the raw, escaped data received by my PHP script:
%7B%22questionData%22%3A%7B%22answerDescription%22%3A%22test%20question%20description%22%2 C%22questionAnswers%22%3A%5B%7B%22answer%22%3A%22test%20answer1%22%2C%22correct%22%3A1%7D% 2C%7B%22answer%22%3A%22test%20answer2%22%2C%22correct%22%3A0%7D%5D%2C%22questionMetadata%2 2%3A%5B%7B%22metadata%22%3A%22test%22%7D%5D%2C%22questionText%22%3A%22What%20does%20this%2 0code%20do%3F%5Cr%5Cr%3C%3Fxml%20version%3D%5C%221.0%5C%22%20encoding%3D%5C%22utf-8%5C%22% 3F%3E%5Cr%3Cmx%3AApplication%20xmlns%3Amx%3D%5C%22http%3A//www.adobe.com/2006/mxml%5C%22%3 E%5Cr%20%20%3Cmx%3AScript%3E%5Cr%20%20%20%20%3C%21%5BCDATA%5B%5Cr%20%20%20%20%20%20private %20function%20testFunc%28testArg%3AString%29%3Aint%7B%5Cr%20%20%20%20%20%20%20%20var%20myV ar%3AString%20%3D%20%5C%22%23000000%5C%22%3B%5Cr%20%20%20%20%20%20%20%20var%20myVar2%3Aint %20%3D%200xFFFFFF%3B%5Cr%20%20%20%20%20%20%20%20return%201%3B%5Cr%20%20%20%20%20%20%7D%5Cr %20%20%20%20%5D%5D%3E%5Cr%20%20%3C/mx%3AScript%3E%5Cr%3C/mx%3AApplication%3E%22%2C%22quest ionType%22%3A%22Multiple%20Choice%22%7D%7D
And this is the data after urldecode(), str_replace(), and utf8_encode():
{"questionData":{"answerDescription":"test question description","questionAnswers":[{"answer":"test answer1","correct":1},{"answer":"test answer2","correct":0}],"questionMetadata":[{"metadata":"test"}],"questionText":"What does this code do?rr<?xml version="1.0" encoding="utf-8"?>r<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">r  <mx:Script>r    <![CDATA[r      private function testFunc(testArg:String):int{r        var myVar:String = "#000000";r        var myVar2:int = 0xFFFFFF;r        return 1;r      }r    ]]>r  </mx:Script>r</mx:Application>","questionType":"Multiple Choice"}}
My PHP script is not able to parse this and get data from these objects:
$questionData = $dataRaw["questionData"];
$questionType = $dataRaw["questionData"]["questionType"];
$questionText = $dataRaw["questionData"]["questionText"];
The actual problem is that $questionData does not contain anything.
However, if I enter this text and send it using JSON to PHP:
What does this code do?
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml"><mx:Script><![CDATA[private function testFunc(testArg:String):int{var myVar:String = &quot;#000000&quot;;var myVar2:int = 0xFFFFFF;return 1;}]]&gt;&lt;/mx:Script&gt;&lt;/mx:Application&gt;
This is the raw, escaped data received by my PHP script:
%7B%22questionData%22%3A%7B%22answerDescription%22%3A%22test%20question%20description%22%2 C%22questionAnswers%22%3A%5B%7B%22answer%22%3A%22test%20answer1%22%2C%22correct%22%3A1%7D% 2C%7B%22answer%22%3A%22test%20answer2%22%2C%22correct%22%3A0%7D%5D%2C%22questionMetadata%2 2%3A%5B%7B%22metadata%22%3A%22test%22%7D%5D%2C%22questionText%22%3A%22What%20does%20this%2 0code%20do%3F%5Cr%5Cr%26lt%3B%3Fxml%20version%3D%26quot%3B1.0%26quot%3B%20encoding%3D%26qu ot%3Butf-8%26quot%3B%3F%26gt%3B%26lt%3Bmx%3AApplication%20xmlns%3Amx%3D%26quot%3Bhttp%3A// www.adobe.com/2006/mxml%26quot%3B%26gt%3B%26lt%3Bmx%3AScript%26gt%3B%26lt%3B%21%5BCDATA%5B private%20function%20testFunc%28testArg%3AString%29%3Aint%7Bvar%20myVar%3AString%20%3D%20% 26quot%3B%23000000%26quot%3B%3Bvar%20myVar2%3Aint%20%3D%200xFFFFFF%3Breturn%201%3B%7D%5D%5 D%26gt%3B%26lt%3B/mx%3AScript%26gt%3B%26lt%3B/mx%3AApplication%26gt%3B%22%2C%22questionTyp e%22%3A%22Multiple%20Choice%22%7D%7D
And this is the data after urldecode(), str_replace(), and utf8_encode():
{"questionData":{"answerDescription":"test question description","questionAnswers":[{"answer":"test answer1","correct":1},{"answer":"test answer2","correct":0}],"questionMetadata":[{"metadata":"test"}],"questionText":"What does this code do?rr&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml"><mx:Script><![CDATA[private function testFunc(testArg:String):int{var myVar:String = &quot;#000000&quot;;var myVar2:int = 0xFFFFFF;return 1;}]]&gt;&lt;/mx:Script&gt;&lt;/mx:Application&gt;","questionType":"Multiple Choice"}}
And my PHP script processes the data successfully. In this case $questionData correctly contains the data.
I've diffed the raw data and JSON data received in my PHP script, and the &quot; and &lt; and &gt; are there, but if I do not escape them manually as we have seen it does not work.
On the Flex side this is how I process the data:
private function saveQuestion(saveOrUpdate:String):void{
  var questionObj:Object = {    questionData: {
      questionType: quesType.selectedItem,
      questionText: questionTxt.text,
      answerDescription: answerDescTxt.text,
      questionAnswers: getAnswers(),
      questionMetadata: getMetadata()
  var requestSend:Object = new Object();
  var dataString:String = JSON.encode(questionObj);
  dataString = escape(dataString);
  requestSend.questionDataString = dataString;
  requestSend.addQuestion =
"true";  addQuestionRequest.send(requestSend);

Similar Messages

  • What is the best way to transfer data from a PC to an iMac?

    What is the best way to transfer data from a PC to an iMac?

    If you know how to set up a computer-to-computer Ethernet network, then you can give that a try, but a hard drive will be faster than Ethernet unless you don't have a lot to transfer.
    Mac OS X 10.6 Help- Creating a computer-to-computer network

  • What is the best way to get data to a user interface?

    Hi,
    I'm using labview 6i. I have an application with a handful of "core" vi's that actually run my application, doing the data acquisition, analysis, and control. I am currently using these same vi's for my user interface. I also have a number of vi's that contain menu's for configuring the "core" vi's. My questions is, what is the best way to seperate the "core" vi's from the user interface vi's. Global's, data socket, control references, others?
    Thanks for the help.

    Hi Sal,
    I have been a strong advocate of control refnums ever since LV 6i hit the streets. I recomend you look into using them to provide this conectivity.
    You could accomplish this by using a variation on the following.
    In your UI, create refnums for each of the controls or indicators that must be monitored or updated. Pass the appropriate refnums to each of the "core.i's" at program init time. Inside each of the core.vi's, use property nodes to read the control's values when appropriate and similarly for display purposes. (Note: Not all boolean mechanical actions are compatible with this technique. In those case you will have to explicitly write false values after find the control to be true or vise versa).
    By using this technique, you can keep the UI diagrams clea
    n. Depending on your app. the UI diagram could consist of the init's I mentioned above, and a while loop that watches if it's time to exit.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Replacing MacBook Pro's optical drive with SSD. What is the best way to migrate data?

    I have a time machine backup on external drive.
    I would like to:
    1. clean install Lion on the new SSD (120 GB)
    2. restore apps from my backup on the SSD
    3. keep only data on the existing HDD
    My questions:
    What is the best way to make it?
    Can I just keep the existing system on my non-SSD HDD, and after having Lion on SSD keep just data and delete the system libraries? Or is it better to format the whole disk and restore data from time machine backup (so it is not fragmented...).
    Thanks for any tips in advance!
    Antonin

    OK, thanks a lot.
    And after reformatting the old HDD can I - can I tell Time Machine where to recover my folders (apps --> SSD, data --> old HDD)?
    I mean when Time Machine starts recovering my 450 GB of files onto 120 GB SSD will it ask me to decide what put where?

  • What is the best way to save data from GPIB Device in a file?

    HI!
    I have a Keithley SourceMeter and want to save readings in a File along with settings on the front panel and timestamps plus several other infos. What is the best way to do this? Which file type? Any recommendations or hints could help me?
    Thanks

    Hi Andy,
    There are 3 main file formats that you can consider writing your data out to in LabVIEW:
    ASCII
    Binary
    Datalog
    ASCII
    ASCII files are useful because every operating system and almost every application can read/write ASCII format files. Use ASCII files when:
    Other users or applications will need to access the data file.
    You will not need to perform random access file I/O
    File I/O speed is not crucial
    Disk space is not crucial
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write to Text File.vi and Read from Text File.vi
    Binary
    Binary byte stream files are more specific to data storage and retrieval. Use b
    inary files when:
    File I/O will remain in LabVIEW only -- no other applications will be needing to write/read that file. There is no standard formatting for binary files and thus other applications or operating systems may be unable to read the file.
    Files are smaller than ASCII files
    Easier and faster random access to data
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write Binary File.vi and Read Binary File.vi
    Datalog
    When to use datalog:
    If you need to record data with a mixture of types, it can be cumbersome to convert everything to ASCII or to keep track of the binary formatting.
    Datalog format is binary and internal to LabVIEW, so again only use this format if no other applications or operating systems will be needing to perform file I/O on the file.
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write Datalog File
    Example.vi and Read Datalog File Example.vi
    Good luck!
    Kileen C.
    Applications Engineer
    National Instruments

  • What is the best way to retrive data from a Global Variable?

    Here is what I want to do,
    I have several PC's that run different types of tests. I want to use a global variable, running on a single PC, that acts like a sever that can be accessed by the other PC's in my lab. This Global variable will store the hostnames of the different PC's that are currently running each test, along with a description of the test.  Then, a user can access this Global variable to read the different values and select the PC and connect to it's desktop using Remote Desktop in Windows.
    Is it possible to write data to the Global variable that is running on the single PC?
    What is the best way to do this? Does anyone have a sample VI?
    What is the best way to then read the data from the Global variable?
    (I will probably use an array\cluster to store the hostnames.) 

    Another pre-LV8 idea...
    A functional global can be accessed using VI-Server and called using "call by reference".
    This approach harnesses the TCP functionality built into the VI-Server to manage the conncetion.
    This can be pretty quick and (if the functional global is written correctly) will support buffered- mixed data types. (Try to do that with the Shared Variable  ).
    Just another idea,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • What is the best way to audit data

    What is the best way to audit actual changes in the data, that is, to be able to see each insert, update, delete on a given row, when it happened, who did it, and what the row looked like before and after the change?
    Currently, we have implemented our own auditing infrastructure where we generate standard triggers and an audit table to store OLD (values at the beginning of the Before Row timing point) and NEW (values at the beginning of the After Row timing point) values for every change.
    I'm questioning this strategy because of the performance impact it has (significant, to say the least) and because it's something that a developer (confession, I'm the developer) came up with, rather than something a database administrator came up with. I've looked into Oracle Auditing, but this doesn't seem like we'd be able to go back and see what a row looked like at a given point in time. I've also looked at Flashbacks, but this seems like it would require a monumental amount of storage just to be able to go back a week, much less the years we currently keep this data.
    Thanks,
    Matt Knowles
    Edited by: mattknowles on Jan 10, 2011 8:40 AM

    mattknowles wrote:
    What is the best way to audit actual changes in the data, that is, to be able to see each insert, update, delete on a given row, when it happened, who did it, and what the row looked like before and after the change?
    Currently, we have implemented our own auditing infrastructure where we generate standard triggers and an audit table to store OLD (values at the beginning of the Before Row timing point) and NEW (values at the beginning of the After Row timing point) values for every change.You can either:
    1. Implement your own custom auditing (as you currently do)
    2. Flashback Data Archive (11g). Requires license.
    3. Version enable your tables with Workspace Manager.
    >
    I'm questioning this strategy because of the performance impact it has (significant, to say the least) and because it's something that a developer (confession, I'm the developer) came up with, rather than something a database administrator came up with. I've looked into Oracle Auditing, but this doesn't seem like we'd be able to go back and see what a row looked like at a given point in time. I've also looked at Flashbacks, but this seems like it would require a monumental amount of storage just to be able to go back a week, much less the years we currently keep this data.
    Unfortunately, auditing data always takes lots of space. You must also consider performance, as custom triggers and Workspace Manager will perform much slower than FDA if there is heavy DML on the table.

  • What is the best way to move data from one array to another

    I'm going to be moving data from one array to a larger array on the same RAID but different controller. (I have some extra extra drives I'm also going to be installing Retrospect so I can't just restore from a backup.)
    The RAID has 450GB of production files, fonts etc.
    What is the best way to move the data over?
    I saw that someone had suggested using ditto. Would that be better than MacMV?
    I also own Bru LE so I could use that.
    Any advice would be appreciated.
    Thanks,
    Paul

    Ditto is a great option -- probably the best.
    ditto -rsrc src_folder /Volumes/targetvolume/targetfolder

  • What is the best way to consolidate data on two Macs?

    Hi All,
    About to embark on a small project to move all my data on to my MacBook before finally saying goodbye to my trusty iMac.  In order to do this I'll be upgrading the HDD on the MacBook to a large one and using Time Machine to restore all the original data onto the new drive.  This bit I'm good with as I did it before when I upgraded the drive on my old iMac. 
    The main problem I have is that the majority of my photos, music, videos and documents are on my old iMac and I'd like to discuss the best way to merge these with a smaller amount of data that the MacBook has on it.  Both machines are running Snow Leopard and I'm not aware of any tools that are currently available to do something like this although I am aware that Lion is supposed to have features that would consolidate everything to the cloud and might make things quite easy.  This is something I would be willing to spend the £30 or so doing so if anyone has any experience of using Lion to merge everything across Macs to the cloud please let me know if you feel this would be a suitable approach.
    Just to summarise the state my data is in currently and the approach I currently intend to take. 
    Have the Mobile Me service so Mail, Address Book, Calendars and all that stuff are all synced across both machines anyway. 
    Applications - Some stuff on the old Mac that I no longer user but nothing here that I really want to migrate.  Some specific application stuff is mentioned below. 
    Movies - This is the bit that I'm most concerned about.  Have a lot of legacy iMovie stuff on the old iMac which I'd like to keep.  iDVD as well.  Not sure of the best way to get this across and maybe it even warrants a separate discussion. Aside from that most of my older video stuff and projects are on the iMac with the newer stuff on the MacBook.  I'm unaware of any function to export and import this but I have a large HDD which I can use to copy stuff over and am going to look into this a bit further.  There will be a small amount of duplication here but this is manageable. 
    Documents - Will just copy these across and organise them as and when I need them.  Again, a small amount of duplication but this is manageable. 
    Music - Pretty much all my stuff the old iMac.  Can just export this and copy it onto the MacBook. 
    Pictures - Bit complicated this.  Most of my stuff on the old iMac but some newer albums on the new MacBook.  No duplication so presuming I can just export the library off the old iMac and import it on to the new MacBook. 
    No websites or anything like that. 
    iPhone currently syncs with iMac but once I have all the stuff over it should not be too hard to change this. 
    Just my user account on each machine that I really want to keep.  Shared documents and other users accounts all contain temporary stuff that I'm happy to lose or archive. 
    Given this is anyone able to offer advice as to 1) Whether this is the best approach? 2) Have I considered everything? 3) Are there any tools that might help me?
    Many thanks,
    Tom

    OK, seeing as no-one replied (presumably because a lot of this information is on the forums in bits elsewhere) here's how I've got on so far.
    Applications - just went through them.  About the only one I needed was my media server app.  Just downloaded and re-installed, had a quick look back though my email to find the license key and it all went on fine.  Installation never seemed quite right on my old machine so solved that problem too. 
    Movies - New iMovies just copied across the clips and projects into their respective folders.  Seems to have worked but haven't checked it all that thoroughly.  Some duplicate footage here but I can trim this out at some point when I get a chance to go through here. 
    Documents - Just copied these across. 
    Photos - used an app called iPhoto Library Manager.  You can download for free but have to pay to use the part that consolidates your libraries.  Possibly if I was willing to spend a bit more time I could have got away without using this but given I didn't know the state of my different libraries and just how many duplicates I had this was too much of a convenience to ignore.  Also got my library into a state where I can now spend a few hours organising it a bit better with Faces / Events etc. 
    Not attempted Music or iPhone sync yet as been stuck trying to solve a problem with my power adapter. 

  • What is the best way to append data from one field to another?

    I have the following table, table1:
    Name Null? Type
    MAIL_ID NOT NULL NUMBER(10)
    LAST_NAME VARCHAR2(45)
    FIRST_NAME VARCHAR2(45)
    MIDDLE_INITIAL VARCHAR2(1)
    ADDRESS_1 VARCHAR2(45)
    CITY VARCHAR2(35)
    STATE VARCHAR2(2)
    ZIP VARCHAR2(10)
    REMARKS VARCHAR2(200)
    The table has duplicate entries that need to be removed. The records that will be removed need the
    data in the Remarks column appended to the Remarks data of the record that is not deleted.
    For example, the following listing shows a sample of the duplicate records.
    Mail ID Last Name First Name M Address City St ZIP Remarks
    189 BROWN STEPHEN 6706 MOESER LN EL CERRITO CA 94530-2909 Sf7#s124,f16#d7996(NML)[Cl#117][Ml#1649][NMf1#d288][NCf9#d319][SNl#e62]
    211023 BROWN STEPHEN B 6706 MOESER LN EL CERRITO CA 94530 RLl#a12047[IDl#i398]
    287796 BROWN STEPHEN B 6706 MOESER LN EL CERRITO CA 94530 SNl#e1163
    The following listing shows how the kept record should appear after the duplicate records are deleted.
    Mail ID Last Name First Name M Address City St ZIP Remarks
    189 BROWN STEPHEN 6706 MOESER LN EL CERRITO CA 94530-2909 Sf7#s124,f16#d7996(NML)[Cl#117][Ml#1649][NMf1#d288][NCf9#d319][SNl#e62]RLl#a12047[IDl#i398]SNl#e1163
    I have the process of deleting duplicates working but have yet to determine the best way to move
    the Remarks data from the deleted records to the preserved record.
    I know there are probably various ways to approach this.
    Any suggestions will be greatly appreciated!
    Here is the sql for deleting duplicates.
    DELETE FROM table1
    WHERE mail_id in (SELECT mail_id FROM table1
              where not first_name = 'Null' and
    not last_name = 'Null' and
              not city = 'Null' and
              not state = 'Null'and
    not last_name = 'Anon'
              minus
              select min(mail_id) from table1
              group by first_name, last_name, city, state, address_1, organization, title);
    THANKS in advance!!!!

    Here's quick and dirty example probably a better way to do it, but this is what I came up with quickly.
    My table looks like this:
    MAIL_ID LAST FIRST PHONE REMARKS
    123 Ruff Shawn 555-555-5555 Called 10-10-04
    135 Ruff Shawn 555-555-5555 Called 10-12-04
    201 Ruff Shawn 555-555-5555 Called 10-19-04
    The code below will concatenate the remarks column from the rows, and delete the 135 and 201 rows, then update the 123 row with the concatenated remarks.
    declare
    l_remarks varchar2(500);
    l_min_mail_id number;
    begin
    select min(mail_id) into l_min_mail_id
    from test
    group by last, first, phone;
    select remarks into l_remarks from test where mail_id = l_min_mail_id;
    for i in (select mail_id, remarks from test
         where last = 'Ruff'
              and first = 'Shawn'
              and phone = '555-555-5555'
              and mail_id <> l_min_mail_id)
    loop
    l_remarks := l_remarks||','||i.remarks;
    delete from test where mail_id = i.mail_id;
    end loop;
    update test set remarks = l_remarks where mail_id = l_min_mail_id;
    commit;
    end;
    Hope this helps.

  • What is the best way to store data for this project?

    hey everyone,
    I have been subscribed to this for a while, not sure if I have ever actually asked anything though.
    I have a project on the go for myself/portfolio
    It is a booking sheet, where by I have a GUI that has a diary system of a day followed by time slots. This also has a date picker that can change the date of the booking sheet
    I want to be able to store mainly strings and ints,
    I need to be able to store, retrieve and on occasion change some data.
    I was looking at using something called JExcelAPI but I cant get that to work at all, I asked for assistance but was refered to here.
    what would be the best way to implement this data storage?
    davyk

    Hey everyone,
    Back again,
    I got this this little snippet of code working but want to ask you guys for a little bit of help on it. if thats ok?
    try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         String dataSourceName = "mdbTEST";
         String dbURL = "jdbc:odbc:" + dataSourceName;
         Connection con = DriverManager.getConnection(dbURL, "","");
         // try and create a java.sql.Statement so we can run queries
         Statement s = con.createStatement();
         s.execute("create table TEST1234567 ( column_1 char(27), column_2 char(150), column_3 char(150), column_4 char(150), column_5 char(150), column_6 char(150))"); // create a table
         s.execute("insert into TEST1234567 values('"+date+"','"+a+"','"+b+"','"+c+"','"+d+"','"+e+"',)"); // insert some data into the table
         s.execute("select column_7 from TEST1234567"); // select the data from the table
         ResultSet rs = s.getResultSet(); // get any ResultSet that came from our query
         if (rs != null) // if rs == null, then there is no ResultSet to view
                    while ( rs.next() ) // this will step through our data row-by-row
              /* the next line will get the first column in our current row's ResultSet
              as a String ( getString( columnNumber) ) and output it to the screen */
                   System.out.println("Data from column_2: " + rs.getString(1) );
         s.execute("drop table TEST1234567");
         s.close(); // close the Statement to let the database know we're done with it
         con.close(); // close the Connection to let the database know we're done with it
    catch (Exception err)
         System.out.println("ERROR: " + err);
         err.printStackTrace();
    }there are more columns, but i cut this code down.
    my question is:
    I think I want a method with an if statement to see whether the table is created or not, if not create it, but how do I go about this? I have searched the API and google, but my brain is fried.
    Also do I always have to do the try/catch and have the code of Class.forname to Statement s in all methods that want to deal with the table?
    davy

  • What is the best way to copy data....

    Hello friends,
    What could you think is the best way to copy this data ? :
    - I have two identical databases (Oracle 9i)
    - I want to migrate the data of 90 tables (all tables begin with the same string, i.e. 'TAB') from Database1 to database2.
    - There are integrity constraints, referentials, etc.
    I'd like to generate a script to automate/accelerate the process.
    So, I'm thinking on the following:
    - Disable all the constraints in Database2.
    - Connect to Database 1 and generate a script with the 'inserts' using TOAD (or another similar application)
    - In a Database 2 session, execute the script...
    Of course if I use TOAD I can't generate an unique script to do this process in one step so...
    Any better idea? (Using export/import, ... or some script you have...)
    Thanks.
    Jose.

    Use exp and imp. It works... seriously! And you don't need to drop the user/schema. But don't take my word, run an example...
    On Database 1
    First let's create a couple of tables with referential integrity to each other to make sure exp/imp can handle it...
    SQL> create table t1 (t1_id number constraint pk_t1 primary key, t2_id number);
    Table created.
    SQL> create table t2 (t2_id number constraint pk_t2 primary key, t1_id number);
    Table created.
    SQL> alter table t1 add constraint fk_t1_t2 foreign key (t2_id) references t2 (t2_id);
    Table altered.
    SQL> alter table t2 add constraint fk_t2_t1 foreign key (t1_id) references t1 (t1_id);
    Table altered.
    SQL> insert into t1 (t1_id, t2_id) values (1, null);
    1 row created.
    SQL> insert into t2 (t2_id, t1_id) values (2, 1);
    1 row created.
    SQL> update t1 set t2_id = 2 where t2_id is null;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select * from t1;
         T1_ID      T2_ID
             1          2
    SQL> select * from t2;
         T2_ID      T1_ID
             2          1
    SQL> select table_name, constraint_name, constraint_type, r_constraint_name from user_constraints
      2  where table_name in ('T1','T2');
    TABLE_NAME                     CONSTRAINT_NAME                C R_CONSTRAINT_NAME
    T1                             PK_T1                          P
    T1                             FK_T1_T2                       R PK_T2
    T2                             PK_T2                          P
    T2                             FK_T2_T1                       R PK_T1
    SQL>
    Now let's export those tables. You can build a parfile manually or even spool it from a sql script with the names of all tables you need to export...
    $ cat parfile.txt
    tables=(\
    t1,\
    t2
    $ exp rc/pwd parfile=parfile.txt file=db1.dmp log=db1.log
    Export: Release 10.1.0.3.0 - Production on Mon Jan 9 20:49:17 2006
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in UTF8 character set and UTF8 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table                             T1          1 rows exported
    . . exporting table                             T2          1 rows exported
    Export terminated successfully without warnings.
    On Database 2
    Copy your .dmp file to Database 2
    Import
    $ imp rc/pwd full=y file=db1.dmp log=db1_imp.log
    Import: Release 10.1.0.3.0 - Production on Mon Jan 9 20:51:15 2006
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export file created by EXPORT:V10.01.00 via conventional path
    import done in UTF8 character set and UTF8 NCHAR character set
    . importing RC's objects into RC
    . . importing table                           "T1"          1 rows imported
    . . importing table                           "T2"          1 rows imported
    About to enable constraints...
    Import terminated successfully without warnings.
    All data is there...
    SQL> select * from t1;
         T1_ID      T2_ID
             1          2
    SQL> select * from t2;
         T2_ID      T1_ID
             2          1 All constraints are there...
    SQL> select table_name, constraint_name, constraint_type, r_constraint_name from user_constraints
      2  where table_name in ('T1','T2');
    TABLE_NAME                     CONSTRAINT_NAME                C R_CONSTRAINT_NAME
    T1                             PK_T1                          P
    T1                             FK_T1_T2                       R PK_T2
    T2                             PK_T2                          P
    T2                             FK_T2_T1                       R PK_T1It does work!

  • Moving from 13" MBP to 15" MBP...  What is the best way to get data moved over?

    I have a 13" MBP Mid-2009 model, upgrading to a 15" MBP Late-2011 model.  Both are on Lion OS 10.7.3.  I use Time Machine to back up the old machine.  If I use Migration Assistant, is a recovery from the Time Machine Backup taken on the 13" MBP over to the 15" MBP the best way to bring over all of the Apps and Data?  I know that the 13" has different HW drivers, so am unsure if the recovery will overwrite these drivers on the new 15" MBP.  Just trying to make sure that I do not mess up the new system, but have not been able to find out if Time Machine will preserve the critical OS files during the recovery.
    Thanks all!

    Some suggest you use Setup Assistant when you first turn the new MBP on.
    I have never used it to transfer any data from one computer to another, from Mac or PC to new Mac.
    I simply don't trust it, never had on any platform.
    I find it easier for me to just network computers together and copy data over. That way only the data I want is copied to the new computer. I can make all the interface changes myself.
    Oh as eww says do NOT use a TM backup from the older Mac to move data over to the new one. You could possibly be looking at reinstalling the OS on the new unit.

  • What is the best way to get data from a spreadsheet into an HTML table?

    I am using libreoffice, and I have it set to collate all the information I enter and output it to a simple table within the program like this:
    http://imageshack.us/a/img717/5144/spreadsheeta.jpg
    I want to get this information after sorting it and put it into the following html table within dreamweaver:
    http://imageshack.us/a/img28/8872/htmls.jpg
    what is the best method for getting the info from A to B?

    before:
    <table id="tbl-m">
              <tr class="tbl-hd">
                <td class="tbl-pos-width">pos</td>
                <td class="tbl-team-width">team</td>
                <td class="tbl-p-w-d-l-p">pld</td>
                <td class="tbl-p-w-d-l-p">won</td>
                <td class="tbl-p-w-d-l-p">drwn</td>
                <td class="tbl-p-w-d-l-p">lost</td>
                <td class="tbl-p-w-d-l-p">pts</td>
              </tr>
              <tr class="tbl-row-b">
                <td class="tbl-pos-width">1</td>
                <td class="tbl-team-width">Team Name 1</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-a">
                <td class="tbl-pos-width">2</td>
                <td class="tbl-team-width">Team Name 2</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-b">
                <td class="tbl-pos-width">3</td>
                <td class="tbl-team-width">Team Name 3</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-a">
                <td class="tbl-pos-width">4</td>
                <td class="tbl-team-width">Team Name 4</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-b">
                <td class="tbl-pos-width">5</td>
                <td class="tbl-team-width">Team Name 5</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-a">
                <td class="tbl-pos-width">6</td>
                <td class="tbl-team-width">Team Name 6</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-b">
                <td class="tbl-pos-width">7</td>
                <td class="tbl-team-width">Team Name 7</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-a">
                <td class="tbl-pos-width">8</td>
                <td class="tbl-team-width">Team Name 8</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-b">
                <td class="tbl-pos-width">9</td>
                <td class="tbl-team-width">Team Name 9</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-a">
                <td class="tbl-pos-width">10</td>
                <td class="tbl-team-width">Team Name 10</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-b">
                <td class="tbl-pos-width">11</td>
                <td class="tbl-team-width">Team Name 11</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-a">
                <td class="tbl-pos-width">12</td>
                <td class="tbl-team-width">Team Name 12</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-b">
                <td class="tbl-pos-width">13</td>
                <td class="tbl-team-width">Team Name 13</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-a">
                <td class="tbl-pos-width">14</td>
                <td class="tbl-team-width">Team Name 14</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-b">
                <td class="tbl-pos-width">15</td>
                <td class="tbl-team-width">Team Name 15</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
              <tr class="tbl-row-a">
                <td class="tbl-pos-width">16</td>
                <td class="tbl-team-width">Team Name 16</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
                <td class="tbl-p-w-d-l-p">0</td>
              </tr>
            </table>
    after:
    <table>
              <tr>
                <td>Pos</td>
                <td>Team</td>
                <td>Pld</td>
                <td>Won</td>
                <td>Drwn</td>
                <td>Lost</td>
                <td>Pts</td>
              </tr>
              <tr>
                <td>1</td>
                <td>Team 1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>2</td>
                <td>Team 2</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>3</td>
                <td>Team 3</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>4</td>
                <td>Team 4</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>5</td>
                <td>Team 5</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>6</td>
                <td>Team 6</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>7</td>
                <td>Team 7</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>8</td>
                <td>Team 8</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>9</td>
                <td>Team 9</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>10</td>
                <td>Team 10</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>11</td>
                <td>Team 11</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>12</td>
                <td>Team 12</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>13</td>
                <td>Team 13</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>14</td>
                <td>Team 14</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>15</td>
                <td>Team 15</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
              <tr>
                <td>16</td>
                <td>Team 16</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
              </tr>
            </table>

  • What's the best way to extract data (a substring) from a string?

    Hi,
    I have a field being returned from a function call and the data looks like this:
    sfaqwe4|89uuuroeoi0|kjg3j90493  (It's data...pipe...data...pipe...data)
    What is the best technique to use to extract the middle set of data between the two pipes?
    Is the any prewritten method to separate the data, or do I have to loop thru the field looking for the pipes, etc.?
    Thanks for your help,
    Andy

    <<Copy paste from http://careerabap.blogspot.com/2009_08_01_archive.html - user notified, points removed>>
    Hi,
    The WRITE statement is what we use to substring a field. The syntax is as follows:
    WRITE fieldname+starting_position(field_length) to variable
    The fieldname is the source (or input). The plus sign precedes the starting position of the substring.  The first position in the string is 0. Immediately after (no space) comes the length of the substring you are going to use. You can also substring the variable that you are writing the string to (the target).
    You can also use function module 'STRING_SPLIT_AT_POSITION'.
    Best Regards,
    Edited by: nihad omerbegovic on Dec 14, 2009 3:03 PM
    Edited by: Matt on Dec 20, 2009 4:13 PM

Maybe you are looking for