How to retrieve data by using nested loops?
The problem seems to be that he never gets inside the loop in line 13. I don't know if this line of code is correct, because it gives me error in module custom script before it happens inside the loop. I put a plain text inside the loop and it is never executed.
<cfoutput> <cfset cfData = DeserializeJSON(artDetails)> <cfif structKeyExists(cfData, 'data')> <cfif not ArrayIsEmpty(cfData.data) > <cfloop index="i" from="1" to="#arrayLen(cfData.data)#"> <!---<cfdump var="#cfData.data[i].faqChildren.categories#" >---> <cfdump var="#cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45#" > <!---<cfdump var="#cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45.object#" >---> <h2>#cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45.object.name.en#(#cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45.subCount#)</h2> <p>url_hash: #cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45.object.url_hash#</p> <cfdump var="#cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45.subcontent#" > <ul> <cfloop index="p" from="1" to="#arrayLen(cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45.subcontent)#" > <li>#cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45.subcontent[p].object.name#</li> </cfloop> </ul> </cfloop> <cfelse> <p>No data found for <b>#hash#</b>. <p> </cfif> </cfif> </cfoutput>
My dump subcontent on line 11 indicates the following, and I want to get the name. Any help is very appreciated.
Well, I found the answer to my question. Replace line 13-15 with the following, and now it gives me the name I need.
Cell Name: #cfData.data[i].faqChildren.categories.5798bea791121cc46fd77a45.subcontent[id].object.name#
Tags: ColdFusion
Similar Questions
-
Send with blackBerry Smartphones, how to retrieve data from blackberry?
Hi, I need to send an email to blackberry and on the user's response, I need to store this data in the database. Can u please help me in this regard. How to send email from web browser, and then retrieve the data in a database.
khushi289 wrote:
OK ya... We use Tomact 6. How do you after thatIt is a forum oriented BlackBerry technology, you have questions about web development. I think it's best for you is to find some tutorials on the internet on "how to create a web application on tomcat with a database" or try a forum oriented Tomcat directly.
-
How to retrieve data from the database after the removal of the lines of the VO?
Hello
I use Jdeveloper 11.1.2.1.0
I have a master's degree and a child.
So according to my use case when a value in the master t changes the corresponding child should be removed.
but when I change it to any other value I want to cancel the delete operation and retrieve values in children.
Is it possible to do?
Kind regards
Nigel.
Edited by: Nigel Thomas March 29, 2012 05:07
Edited by: Nigel Thomas March 29, 2012 05:09Check [url http://mjabr.wordpress.com/2011/05/20/perform-deleteundo-delete-without-using-rollback/] recover deleted lines without using rollback
-
How to: Retrieve data on a hard disk of laptop after screen went kaput
Original title: my computer screen dell laptop went kaput can I connect my laptop it to my office to recover files etc my computer laptop OS is vista and my office windows 7?
I have a dell laptop where the screen is dead? I connected to an external display of phillips, who worked for awhile, but which has now gone empty as well.
How can I transfer files etc. to my desktop from the laptop? the operating system vista laptop and the pc is windows 7.
Any help would be appreciated.
Hello frechjohn,
Your best bet to solve this will probably be in getting a USB drive cage to put laptop hard drive. Once this is done, you can plug the USB cable into your desktop computer and browse the structure of folders and files on the drive of the laptop.
You can find these stores to the hardware of the computer.
Best regards
Matthew_Ha
-
to retrieve data from xml data type
Hello...
I have a doubt in the oracle database... Here's how to retrieve data from xml data type?Like this...
SQL> ed Wrote file afiedt.buf 1 with t as (select xmltype(' 2
3') as xml from dual) 12 -- 13 -- end of sample XMLDATA, use below query on your own table etc. as required 14 -- 15 select x.* 16 from t 17 ,xmltable('/DETAILS/FIELDS_VALUES/FIELD' 18 passing t.xml 19 columns name varchar2(30) path './NAME' 20 ,val varchar2(10) path './VALUE' 21* ) x SQL> / NAME VAL ------------------------------ ---------- toMonth 5 ctTestPan 1 costType 2 toYear 2012 fromMonth 12 fromYear 2011 6 rows selected.4 11 5toMonth 5 6ctTestPan 1 7costType 2 8toYear 2012 9fromMonth 12 10fromYear 2011 -
Accidentally deleted "Recycle icon '.» How to retrieve it? Windows Vista
I accidentally deleted "icon of Recycle" on my desktop. How to retrieve it?
Using Windows Vista on a Dell Inspiron 530 home.Hello
http://support.Microsoft.com/kb/810869
There is also an automatic fix - it on the link above of microsoft
To resolve this problem in Windows Vista, follow these steps:
- Click Startand then click Control Panel.
- Click appearance and personalization, click personalization, and then click onChange desktop icons.
- Click to select the Recycle Bin check box, and then click OK.
Or try this way:
http://ITsVISTA.com/2007/01/ITsVISTA-tip-19-restore-your-Vista-Recycle-Bin-icon/
1. right click on your desktop and choose personalize
2. click on the Change Desktop Icons link in the upper left corner
3. in the desktop icons settings window, check the Recycle Bin box, and clickOKand see if you are interested in these items accidentally does you new in the future
http://www.howtogeek.com/HOWTO/Windows-Vista/disable-deletion-of-the-Recycle-Bin-in-Windows-Vista/
How to display the "Delete" command of the context menu Recycle Bin in Windows Vista
-
How to transfer data from an old laptop (broken screen) to a new laptop
How to retrieve data from an old laptop, to transfer to the new laptop. the problem is that the screen is broken on the old portable th.
From Internet Explorer
Original title: data transfer
The easiest way would be to put his HARD drive in a box that connects to the computer by USB.
This is just an example - http://www.amazon.co.uk/Hard-Drive-Caddy-Case-Enclosure/dp/B003MVW2SM
You probably have a 2.5 HDD "because I know that all laptops do. If you need to buy an enclosure for a 2.5 drive "[not a disk 3.5" that could come from a desktop computer].
Almost all cases derive the power to drive the HARD drive to the USB itself [rather than an external power]. If you see one that needs an external power supply, then you are probably looking to the wrong thing.
You need to know if the HARD drive is IDE or SATA. It depends on the age of the computer. Your computer's manual should tell you or you can whip the HARD drive just to have a look.
- Here is an illustration of an IDE - http://www.amazon.co.uk/Generic-Toshiba-Fujitsu-Samsung-Hitachi/dp/B0042WZZD4/ref=pd_sim_147_4?ie=UTF8&dpID=21bYEH0CONL&dpSrc=sims&preST=_AC_UL160_SR160%2C160_&refRID=125C3XKTAFS54XACCCZ8 - connection if you look at the diagrams that you will see that there are long rows of pine trees coming from the HARD disk - what is FDI.
- Here are illustrations of a connection SATA - http://www.amazon.co.uk/Screw-drive-Enclosure-laptop-Laptop/dp/B003RIL0EM/ref=pd_sim_147_2?ie=UTF8&dpID=419CrJiBX9L&dpSrc=sims&preST=_AC_UL160_SR160%2C160_&refRID=125C3XKTAFS54XACCCZ8 and http://www.amazon.co.uk/drive-Enclosure-laptop-Caddy-Laptop/dp/B00926NM8K/ref=pd_sim_147_9?ie=UTF8&dpID=31sO4aOkykL&dpSrc=sims&preST=_AC_UL160_SR160%2C160_&refRID=125C3XKTAFS54XACCCZ8 - the diagrams show the link inside that connects the HARD drive on [if it's a reflection of what sticks out from HARD drive]-you can see that the connection is a long slot in two sections to the HDD has a long protruding into two sections - which is SATA.
-
How to insert data into tables using sql loops
Oracle 10.2 g
using Oracle sql * more
Table amounts is
nowcreate table student(id) as select distinct student_id from students_table;
Now create a sequencedesc student; will retrieve student ====== Name Null? Type =========================== ID VARCHAR2(10)
create sequence st_seq;
alter table student add column no;
This is the main partselect * from student no id ========= 234 298 ..........
There are 100 student in the table
now, I want to fill the table with sequences using seq.next_val
How to use a loop to insert 100 auto generated numbers in the table.
Thank you.
Expected result
Why I'm doing this instead ofSelect * from student no id ========= 1 234 2 298 .........
This will cause the duplication of the upncreate table student(no,id) as select st_se.nextval,student_id from students;
using separate throws an error.
Thank you.create table student(st_id,id) as select distinct st_seq.nextval,academicyear from student as select distinct st_seq.nextval,academicyear * ERROR at line 2: ORA-02287: sequence number not allowed here
Hello
As you discovered, you cannot use SELECT DISTINCT and sequence. NEXTVAL in the same query.
You can SELECT DISTINCT in a subquery, like this:
CREATE TABLE student AS WITH distinct_ids AS ( SELECT DISTINCT student_id AS id FROM students_table ) SELECT st_seq.NEXTVAL AS st_id , id FROM distinct_ids;
-
use OPT_ESTIMATE or CARDINALITY tip for correct estimation of nested loops
I'm using Oracle 11.2.0.3. Below the execution below plan, how can I use tip OPT_ESTIMATE or CARDINALITY to teach optimization E-lines for ID 9 (Nested Loop) 30553 instead of 6.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | 1 | | | 4604 (100)| | 30553 |00:00:02.56 | 208K| | | | | 1 | SORT ORDER BY | | 1 | 6 | 7044 | 4604 (1)| 00:01:05 | 30553 |00:00:02.56 | 208K| 41M| 2086K| 36M (0)| |* 2 | HASH JOIN OUTER | | 1 | 6 | 7044 | 4603 (1)| 00:01:05 | 30553 |00:00:02.10 | 208K| 38M| 3120K| 39M (0)| |* 3 | HASH JOIN OUTER | | 1 | 6 | 6870 | 4599 (1)| 00:01:05 | 30553 |00:00:01.97 | 208K| 38M| 3120K| 39M (0)| |* 4 | HASH JOIN OUTER | | 1 | 6 | 6744 | 4591 (1)| 00:01:05 | 30553 |00:00:01.85 | 208K| 37M| 3121K| 39M (0)| |* 5 | HASH JOIN OUTER | | 1 | 6 | 6570 | 4584 (1)| 00:01:05 | 30553 |00:00:01.74 | 208K| 37M| 3121K| 38M (0)| |* 6 | HASH JOIN OUTER | | 1 | 6 | 6414 | 4576 (1)| 00:01:05 | 30553 |00:00:01.60 | 208K| 37M| 3121K| 38M (0)| | 7 | NESTED LOOPS | | 1 | | | | | 30553 |00:00:01.44 | 208K| | | | | 8 | NESTED LOOPS | | 1 | 6 | 6318 | 4572 (1)| 00:01:05 | 30553 |00:00:01.31 | 182K| | | | | 9 | NESTED LOOPS | | 1 | 6 | 1830 | 4568 (1)| 00:01:04 | 30553 |00:00:01.11 | 124K| | | | |* 10 | HASH JOIN | | 1 | 2069 | 270K| 2499 (1)| 00:00:35 | 30646 |00:00:00.46 | 23738 | 6539K| 2033K| 7965K (0)| |* 11 | TABLE ACCESS BY INDEX ROWID | DSCLR | 1 | 5079 | 158K| 533 (1)| 00:00:08 | 91395 |00:00:00.28 | 6460 | | | | | 12 | BITMAP CONVERSION TO ROWIDS | | 1 | | | | | 197K|00:00:00.16 | 615 | | | | | 13 | BITMAP AND | | 1 | | | | | 4 |00:00:00.14 | 615 | | | | | 14 | BITMAP OR | | 1 | | | | | 4 |00:00:00.07 | 276 | | | | | 15 | BITMAP CONVERSION FROM ROWIDS| | 1 | | | | | 2 |00:00:00.02 | 69 | | | | |* 16 | INDEX RANGE SCAN | XIF913DSCLR | 1 | 274K| | 14 (0)| 00:00:01 | 68407 |00:00:00.01 | 69 | | | | | 17 | BITMAP CONVERSION FROM ROWIDS| | 1 | | | | | 4 |00:00:00.05 | 207 | | | | |* 18 | INDEX RANGE SCAN | XIF913DSCLR | 1 | 274K| | 42 (0)| 00:00:01 | 209K|00:00:00.03 | 207 | | | | | 19 | BITMAP CONVERSION FROM ROWIDS | | 1 | | | | | 5 |00:00:00.06 | 339 | | | | |* 20 | INDEX RANGE SCAN | XIF910DSCLR | 1 | 274K| | 67 (0)| 00:00:01 | 239K|00:00:00.04 | 339 | | | | | 21 | NESTED LOOPS | | 1 | | | | | 21749 |00:00:00.10 | 17278 | | | | | 22 | NESTED LOOPS | | 1 | 3404 | 339K| 1965 (1)| 00:00:28 | 22772 |00:00:00.03 | 1246 | | | | | 23 | TABLE ACCESS FULL | TMP_RPT_BD_STATE_DATA_DWNLD | 1 | 3255 | 257K| 11 (0)| 00:00:01 | 3255 |00:00:00.01 | 27 | | | | |* 24 | INDEX RANGE SCAN | XIE2OCRN | 3255 | 7 | | 1 (0)| 00:00:01 | 22772 |00:00:00.03 | 1219 | | | | |* 25 | TABLE ACCESS BY INDEX ROWID | OCRN | 22772 | 1 | 21 | 1 (0)| 00:00:01 | 21749 |00:00:00.06 | 16032 | | | | |* 26 | VIEW PUSHED PREDICATE | | 30646 | 1 | 171 | 1 (0)| 00:00:01 | 30553 |00:00:00.63 | 101K| | | | | 27 | WINDOW BUFFER | | 30646 | 1 | 21 | 1 (0)| 00:00:01 | 46946 |00:00:00.59 | 101K| 2048 | 2048 | 2048 (0)| |* 28 | TABLE ACCESS BY INDEX ROWID | DSCLR_FLNG | 30646 | 1 | 21 | 1 (0)| 00:00:01 | 46946 |00:00:00.32 | 101K| | | | |* 29 | INDEX RANGE SCAN | XIE1DSCLR_FLNG | 30646 | 2 | | 1 (0)| 00:00:01 | 46946 |00:00:00.21 | 59862 | | | | |* 30 | INDEX RANGE SCAN | XPKH760_RGLTY_ACTN_DSCLR | 30553 | 1 | | 1 (0)| 00:00:01 | 30553 |00:00:00.18 | 57541 | | | | | 31 | TABLE ACCESS BY INDEX ROWID | H760_RGLTY_ACTN_DSCLR | 30553 | 1 | 748 | 1 (0)| 00:00:01 | 30553 |00:00:00.11 | 26218 | | | | | 32 | TABLE ACCESS FULL | DSCLR_ST_TYPE_TBL | 1 | 4 | 64 | 4 (0)| 00:00:01 | 4 |00:00:00.01 | 5 | | | | | 33 | TABLE ACCESS FULL | RGLTY_RSLTN_TYPE_TBL | 1 | 12 | 312 | 7 (0)| 00:00:01 | 12 |00:00:00.01 | 10 | | | | | 34 | TABLE ACCESS FULL | INTTR_TYPE_TBL | 1 | 14 | 406 | 7 (0)| 00:00:01 | 14 |00:00:00.01 | 10 | | | | | 35 | TABLE ACCESS FULL | SNCTN_TYPE_TBL | 1 | 15 | 315 | 7 (0)| 00:00:01 | 15 |00:00:00.01 | 10 | | | | | 36 | TABLE ACCESS FULL | PRDCT_TYPE_TBL | 1 | 25 | 725 | 4 (0)| 00:00:01 | 25 |00:00:00.01 | 5 | | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Query Block Name / Object Alias (identified by operation id): ------------------------------------------------------------- 1 - SEL$A8B7A3F4 11 - SEL$A8B7A3F4 / D@SEL$13 23 - SEL$A8B7A3F4 / OH@SEL$1 24 - SEL$A8B7A3F4 / O@SEL$13 25 - SEL$A8B7A3F4 / O@SEL$13 26 - SEL$13512960 / DF@SEL$13 27 - SEL$13512960 28 - SEL$13512960 / DF1@SEL$14 29 - SEL$13512960 / DF1@SEL$14 30 - SEL$A8B7A3F4 / H7@SEL$2 31 - SEL$A8B7A3F4 / H7@SEL$2 32 - SEL$A8B7A3F4 / DS@SEL$9 33 - SEL$A8B7A3F4 / RST@SEL$11 34 - SEL$A8B7A3F4 / ITT@SEL$3 35 - SEL$A8B7A3F4 / ST@SEL$5 36 - SEL$A8B7A3F4 / PT@SEL$7 Outline Data ------------- /*+ BEGIN_OUTLINE_DATA IGNORE_OPTIM_EMBEDDED_HINTS OPTIMIZER_FEATURES_ENABLE('11.2.0.3') DB_VERSION('11.2.0.3') OPT_PARAM('optimizer_index_cost_adj' 20) ALL_ROWS OUTLINE_LEAF(@"SEL$13512960") PUSH_PRED(@"SEL$A8B7A3F4" "DF"@"SEL$13" 11) OUTLINE_LEAF(@"SEL$A8B7A3F4") ELIMINATE_JOIN(@"SEL$2D47CDEA" "DTT"@"SEL$13") OUTLINE(@"SEL$14") OUTLINE(@"SEL$A8B7A3F4") ELIMINATE_JOIN(@"SEL$2D47CDEA" "DTT"@"SEL$13") OUTLINE(@"SEL$2D47CDEA") MERGE(@"SEL$3FAACB6D") OUTLINE(@"SEL$15") OUTLINE(@"SEL$3FAACB6D") MERGE(@"SEL$11") MERGE(@"SEL$A1A6E401") OUTLINE(@"SEL$12") OUTLINE(@"SEL$11") OUTLINE(@"SEL$A1A6E401") MERGE(@"SEL$9") MERGE(@"SEL$BFB1842A") OUTLINE(@"SEL$10") OUTLINE(@"SEL$9") OUTLINE(@"SEL$BFB1842A") MERGE(@"SEL$7") MERGE(@"SEL$EEDE2B8C") OUTLINE(@"SEL$8") OUTLINE(@"SEL$7") OUTLINE(@"SEL$EEDE2B8C") MERGE(@"SEL$5") MERGE(@"SEL$A6B38458") OUTLINE(@"SEL$6") OUTLINE(@"SEL$5") OUTLINE(@"SEL$A6B38458") MERGE(@"SEL$171BE69E") MERGE(@"SEL$3") OUTLINE(@"SEL$4") OUTLINE(@"SEL$171BE69E") MERGE(@"SEL$AF02BF1E") OUTLINE(@"SEL$3") OUTLINE(@"SEL$2") OUTLINE(@"SEL$AF02BF1E") MERGE(@"SEL$13") OUTLINE(@"SEL$1") OUTLINE(@"SEL$13") FULL(@"SEL$A8B7A3F4" "OH"@"SEL$1") INDEX(@"SEL$A8B7A3F4" "O"@"SEL$13" ("OCRN"."ORG_PK" "OCRN"."DSCLR_DSCLB_FL" "OCRN"."DSCLR_RPTBL_FL")) BITMAP_TREE(@"SEL$A8B7A3F4" "D"@"SEL$13" AND(OR(1 1 ("DSCLR"."FORM_TYPE_CD") 2 ("DSCLR"."FORM_TYPE_CD")) ("DSCLR"."DSCLR_TYPE_CD"))) NO_ACCESS(@"SEL$A8B7A3F4" "DF"@"SEL$13") INDEX(@"SEL$A8B7A3F4" "H7"@"SEL$2" ("H760_RGLTY_ACTN_DSCLR"."FLNG_PK" "H760_RGLTY_ACTN_DSCLR"."DSCLR_PK" "H760_RGLTY_ACTN_DSCLR"."REC_SEQ_NB")) FULL(@"SEL$A8B7A3F4" "DS"@"SEL$9") FULL(@"SEL$A8B7A3F4" "RST"@"SEL$11") FULL(@"SEL$A8B7A3F4" "ITT"@"SEL$3") FULL(@"SEL$A8B7A3F4" "ST"@"SEL$5") FULL(@"SEL$A8B7A3F4" "PT"@"SEL$7") LEADING(@"SEL$A8B7A3F4" "OH"@"SEL$1" "O"@"SEL$13" "D"@"SEL$13" "DF"@"SEL$13" "H7"@"SEL$2" "DS"@"SEL$9" "RST"@"SEL$11" "ITT"@"SEL$3" "ST"@"SEL$5" "PT"@"SEL$7") USE_NL(@"SEL$A8B7A3F4" "O"@"SEL$13") NLJ_BATCHING(@"SEL$A8B7A3F4" "O"@"SEL$13") USE_HASH(@"SEL$A8B7A3F4" "D"@"SEL$13") USE_NL(@"SEL$A8B7A3F4" "DF"@"SEL$13") USE_NL(@"SEL$A8B7A3F4" "H7"@"SEL$2") NLJ_BATCHING(@"SEL$A8B7A3F4" "H7"@"SEL$2") USE_HASH(@"SEL$A8B7A3F4" "DS"@"SEL$9") USE_HASH(@"SEL$A8B7A3F4" "RST"@"SEL$11") USE_HASH(@"SEL$A8B7A3F4" "ITT"@"SEL$3") USE_HASH(@"SEL$A8B7A3F4" "ST"@"SEL$5") USE_HASH(@"SEL$A8B7A3F4" "PT"@"SEL$7") SWAP_JOIN_INPUTS(@"SEL$A8B7A3F4" "D"@"SEL$13") INDEX_RS_ASC(@"SEL$13512960" "DF1"@"SEL$14" ("DSCLR_FLNG"."DSCLR_PK" "DSCLR_FLNG"."BLLBL_FL")) END_OUTLINE_DATA */
This plan gives you an idea of why your initial synchronization has been long - most of your readings are one-piece readings and you have read 53 724 blocks. If you estimate 1 centisecond by read (which could be on a reasonable charge system) then it is 537 seconds. to 5 milliseconds per read, it's still 268 seconds or 4 minutes and 30 seconds.
A quick break down of some (the worst case) potential time - only you can say whether or not some of these readings will be always/often/never being cached in the file or at the SAN level.
Line 11 - physical reads 6 400 done - it's a tree bitmap then the readings are in the order of physical table with no. rereads. Call 5ms by read-online 32 seconds. L
| * 11 | TABLE ACCESS BY INDEX ROWID | DSCLR | 1. 5079. 158K | 533 (1) | 00:00:08 | 91395 | 00:00:01.27 | 6460. 6400 | | | |
The hash join takes us from 6 400 to 11 788 because it joins, lines 21 to 25 (nested loop) in which most of the work is the random access table with some automatic caching: 26 seconds. Do a search here rather than indexed 22 000 access? Which would be faster, which would charge less.
| * 25. TABLE ACCESS BY INDEX ROWID | OCRN | 22050. 1. 21. 1 (0) | 00:00:01 | 21059 | 00:01:04.74 | 15634 | 5280. | | |
Three nested loops that introduce more readings:
11788 9-> 26386:14 600 of the predicate view pushed which some lies but a very large index and a table of random access 73 seconds
8 26386-> 33783:7 400 index line 30 - big clue about 37 seconds Access hides
33783 7-> 53691:19 900 31 table access - large table line, not much caching, 100 seconds.
In each case, you can ask if an analysis would take less time than all of these random reads.
NOTE - all I'm pointing our here where you potentially use a lot of time so that you can ask whether or not you should do little of the query in this way, or if there is an alternative, or if the work you're doing is absolutely necessary. If you want to optimize the query you should consider the intent of the query and think your way through a reasonable join order to see if you can imagine an effective way to get the same data. I have written a few articles and presentation on an approach that begins by drawing - here is a link to an article I wrote for a group of SQL Server: https://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/
and a video I did with Kyle Hailey, while he was working for Embarcadero:Tune in for the ultimate SQL Tune-off | Landing pages
Concerning
Jonathan Lewis
-
Need help for the conversion of the nested loops to use the stream
I'm trying to teach me how to effectively use the java stream, but finds it difficult to find the correct syntax for a problem of nested loop. I would like to convert the following code to use the Java 8 stream instead of nested loops. Can anyone provide an example or a solution?
/** * Return all members of stringListOne that begin with any of the strings in * stringListTwo * * @return all members of stringListOne that begin with any of the strings in * stringListTwo */ Set<String> getFilteredStrings(Set<String> stringListOne, Set<String> stringListTwo) { Set<String> stringListOneFiltered = new HashSet<String>(); for (String next : stringListOne) { for (String nextPrefix : stringListTwo) { if (next.startsWith(nextPrefix)) { stringListOneFiltered.add(next); } } } return stringListOneFiltered; }
Here's a test case for the above code:
/** * Test method for {@link scratchpad.MyClass#getFilteredStrings(java.util.Set, java.util.Set)}. */ @Test public final void testGetFilteredStrings() { MyClass uut = new MyClass(); Set<String> stringListOne = new HashSet<String>(); stringListOne.add("until"); stringListOne.add("unite"); stringListOne.add("under"); stringListOne.add("prepare"); stringListOne.add("pretend"); stringListOne.add("prefix"); stringListOne.add("prepend"); stringListOne.add("post"); stringListOne.add("positive"); stringListOne.add("postgame"); stringListOne.add("postpone"); Set<String> stringListTwo = new HashSet<String>(); stringListTwo.add("post"); stringListTwo.add("pre"); stringListTwo.add("und"); Set<String> result= uut.getFilteredStrings(stringListOne, stringListTwo); System.out.println(result); assertEquals(8, result.size()); }
Thanks for any help you can provide! I get the hang of using the course of water, but this particular code was difficult.
tmbc
I found the following solution to my question:
GetFilteredStrings (Set stringListOne, the value {Set
stringListTwo) Predicate startsWith
= p-> stringListTwo.stream () .anyMatch (prefix-> p.startsWith (prefix)); Return stringListOne.stream () .filter (startsWith) .collect (Collectors.toSet ());
}
-
How to use the loop in BPEL process
Hi friends
I did a bpel process that picks up the XMl file using the File adapter and imports the data from the XMl file into db oracle table using the DB adapter...
But here the XML in the file that have only one line... If I want to insert the XML code in the file that have two or more lines I want to use a loop in my process BPEL how to use loop in my bpel process?
In my BPEL process, that I have que j' ai utilise used receive, process and call activity where I can use in my BPEL process
Thanks in advance
ATHere is a basic example of while activity in BPEL
http://blogs.Oracle.com/ajaysharma/
Thank you
AJ -
I have a nested loop
loop1 start
...
loop2 start
...
end loop2
...
end loop1
I want to know how can I come out the two loops of the inner loop.Hello
Out of the inner loop in the use of nested loops labelsSQL> BEGIN 2 <
> 3 FOR i IN 1..2 LOOP 4 < > 5 FOR j IN 1..4 LOOP 6 DBMS_OUTPUT.PUT_LINE('I am in Inner Loop'); 7 END LOOP inner; 8 DBMS_OUTPUT.PUT_LINE('I am in outer Loop'); 9 END LOOP outer; 10 END; 11 / I am in Inner Loop I am in Inner Loop I am in Inner Loop I am in Inner Loop I am in outer Loop I am in Inner Loop I am in Inner Loop I am in Inner Loop I am in Inner Loop I am in outer Loop PL/SQL procedure successfully completed. SQL> BEGIN 2 < > 3 FOR i IN 1..2 LOOP 4 < > 5 FOR j IN 1..4 LOOP 6 DBMS_OUTPUT.PUT_LINE('I am in Inner Loop'); 7 exit inner; 8 END LOOP inner; 9 DBMS_OUTPUT.PUT_LINE('I am in outer Loop'); 10 END LOOP outer; 11 END; 12 / I am in Inner Loop I am in outer Loop I am in Inner Loop I am in outer Loop PL/SQL procedure successfully completed. SQL> SQL> BEGIN 2 < > 3 FOR i IN 1..2 LOOP 4 < > 5 FOR j IN 1..4 LOOP 6 DBMS_OUTPUT.PUT_LINE('I am in Inner Loop'); 7 exit outer; 8 END LOOP inner; 9 DBMS_OUTPUT.PUT_LINE('I am in outer Loop'); 10 END LOOP outer; 11 END; 12 / I am in Inner Loop PL/SQL procedure successfully completed. Twinkle
-
How to create a chart using two independent loops while?
Hello world
I'm currently developing a program for the acquisition of data. In this program, I have two independent, while loops that each output a number of type double with each iteration of the loop. I am able to successfully create two independent waveform graphs (data / time) for each of the loops when placed inside. However, I now want to create a live data xy chart (the output of a loop is x and the output of the other is there).
I have a problem, that the distinct nature of loops... When I try to extract data outside of the loop (naturally), it is not refresh with each iteration of the loop causing the graph xy does not work in the way I intend. Is there an easy way to solve this problem? If more clarification is needed, please let me know!
David
If the two loops are not synchronized, exactly how do you do the xy graph, where each point, by definition, must have a value of each loop.
- updated when updates or the other value and combine with the last value from the other loop?
- updated on a constant basis with the current value of each loop?
- ... There are many other possibilities.
#2 is the easiest. Simply create a third loop with a reasonable time and graph the two values via local variables. You probably also should limit the history of ranking somehow.
-
How to make the exchange of data between 2 whole loop real-time
Hello
I have 2 while loop
the 1st loop includes data acquisition program
the 2nd loop includes control program
--------------------------------------------------------------------------------------------------------------
My question is how do the exchange of data between 2 whole loop real-time--------------------------------------------------------------------------------------------------------------
I tried with the variable and direct wiring between the 2 local while loop
It does not work (there is a delay)
-
Hi, I tried to figure out how to extract data from my SQL Server databases and reading messages and to do some tests with examples, I can get data connection type in my SQL server, but so far nothing helps. Is it possible to get data from a SQL Server database without using the database connectivity Toolkit? and if so, how? are there whitepapers and/or examples of this? So far, I can't find something that works. Thank you.
Jesse - what is your reason for not using the database connectivity Toolkit? It is by far the best way to recover the data.
Maybe you are looking for
-
How to make icons and text in the largest Navigation toolbar? Not bigger but smaller.
I see that in view/Toolbars/Customize tools to 'Use small icons' defined. But could not find any place where I can make it bigger. Is it still possible?
-
How to force boot from the CDROM on Satellite M40 183
I have error in the MBR on the drive in my laptop, it doesent from disk, before I had put into hibernation system (Windows XP). Now, I can't force boot from the CDROMin the bios, CDROM is selected as first boot-> nothingon bootking, I am pressing end
-
DeskJet 2540: Cannot print from my devices mobile apple
You just bought a deskjet 2540 yesterday to print wireless from my laptop and apple iphone 6 + and an air of ipad. Setting up went well and I can print wireless from laptop but when I search for the printer on my apple devices, it happens with the m
-
Greetings! I am looking for the chipset to the FireWire on my Pavilion dv7-3079wm laptop, and I'm not. I was wondering what the chipset was for an audio interface problems. I looked in Device Manager and all that I can find the driver isn't... the ch
-
How can I synchronize my cc of photoshop with another computer?
Hey guys! I just got another computer and wanted to use my cc photoshop and lightroom on the new computer as well. I loaded the CC on the new computer, but I notice that photoshop is different from the one I'm currently using on my old computer. It i