20. Handling big, multiline data using the cross-cellset cursor

 

19. Password strength-related analysis

In the big data file MulLineData.csv, data of each person covers two lines, which includes information of ID, NAME, GENDER, BIRTHDAY, CITY and STATE. List information of people who were born on May 5. To do this, we suggest using the cross-cellset cursor to first combine every two lines of data to generate a cursor.

**Expected result: **

SPL code:

A B C
1 =file(“MulLineData.csv”).cursor@c()
2 for A1,1000 =A2. step(2,1) =A2. step(2,2)
3 =join@p(B2:Row1; C2:Row2) =B3.new(Row1.#1:ID, Row1.#2:Name, Row1.#3:Gender, Row2.#1:Birthday, Row2.#2:City, Row2.#3:State)
4 return C3

In order to make the code easier to understand and simpler, we use the above mulLineCursor.splx to first combine every two rows to generate a cursor. The cursor invoked and data is retrieved from it by loop – 1000 rows each time to generate and return 500 records. It is in this way that the traversal is implemented. Then it is simple to call the cross-cellset cursor in the main program:

A
1 =cursor(“mulLineCursor.splx”)
2 =A1.select(month(Birthday)==5&& day(Birthday)==5)
3 =A2.fetch()

21. Computing PI to 10000 decimal places
Contents and Exercise Data