Follow by Email

Friday, January 3, 2014

Sorting files according to their sizes and displaying the sorted values along with their names

q: (it, items 1 of items 1 of (it,(size of it, name of it) of (files of folder "d:/new folder")) whose (item 0 of it = item 0 of item 1 of it)) of elements of set of items 0 of  (size of it, name of it) of (files of folder "d:/new folder")

A: 0, abc.txt
A: 8, p.txt
A: 16, aaa.txt
A: 72, url debugger.txt
A: 99, url.txt
A: 163, x.txt
A: 251, k.txt
A: 251, n.txt
A: 1269, qna.exe - Shortcut.lnk
A: 1401, RelevanceDebugger.exe - Shortcut.lnk
A: 3030, relevancequr.qna
A: 3241, qqqq.txt
A: 3348, Restart Moex Branches Servers.bes
A: 4778, excel.txt
A: 13555, explanation of sum of plurals of tuple querry.docx
A: 14103, Training Campus Template.xlsx
A: 17382, Tivoli Endpoint Manager - BigFix Actions.htm
A: 33792, Dynamic downloads add the ability to use relevance clauses to specify downloads.doc
A: 42320, TEM vs SCCM TCO Analysis v7 20110505.xlsx
A: 43520, Training Campus Template.xls
A: 48640, actionscript.doc
A: 75776, 0771.doc
A: 119582, Registry Objects.htm
A: 204107, Relevance Queries.pdf
A: 441856, EXCEL2007.doc
A: 465550, In the park with god..pptx
A: 479956, actionscript.pdf
A: 720337, relevanceBuilder.zip
A: 727552, MS_Excel_-_Intermediate_Level.1.ppt
A: 864768, PracticalRelevanceGuide.ppt
A: 2497536, EXCEL_Formula(design).xls
A: 4518319, UC_Excel_2007_Module_1_-_Essentials.pdf
A: 8750053, 45778.mp4
A: 11083896, msexcel.pdf
A: 257780548, 19177.mp4
T: 253.721 ms


EXPLANATION

* 'elements of set of items 0 of  (size of it, name of it) of (files of folder "d:/new folder")' gives the sorted values of sizes of 'files of folder 'new folder''

*'(it, items 1 of items 1 of (it,(size of it, name of it) of (files of folder "d:/new folder"))whose (item 0 of it = item 0 of item 1 of it))'

-In this the first & the second 'it' refers to the sorted values of files of 'new folder'.

-'items 1 of items 1 of (it,(size of it, name of it) of (files of folder "d:/new folder"))', refers to the names of files of 'new folder'

-if we consider the whole statement, i.e, '(it, items 1 of items 1 of (it,(size of it, name of it) of (files of folder "d:/new folder"))whose (item 0 of it = item 0 of item 1 of it))', a whose statement  is added at the end in which the 'item 0 of it' is referring to the second 'it' of the statement, which in turn refers to the sorted values of sizes of files of 'new folder', and 'item 0 of item 1 of it' is referring to the unsorted values of files of folder 'new folder'.
on the whole the sizes are bieng compared and the names of those files are displayed, whose sizes matches the sorted order of sizes of files of 'new folder' along with their sizes.



Converting Date And Time

**conversion of date in ("mm/dd/yy, day of week" format & CST time zone)

q:((month of date (time zone "cst") of it) as two digits & "/" & day_of_month of date (time zone "cst") of it as two digits & "/" & year of date (time zone "cst") of it as string & "," & first 3 of (date(time zone("cst")) of it as string)) of now
A: 12/27/2013,Fri
T: 0.088 ms

**conversion of time in("hrs:mins am/pm" format & CST time zone)

q:((if(hour_of_day of it<12) then (hour_of_day of it as string & ":" & minute_of_hour of it as string & "am") else(((hour_of_day of it as integer)-12) as string)& ":" & minute_of_hour of it as string & "pm") of time(time zone "cst") of it) of now
A: 10:42am
T: 0.076 ms

**conversion of date & time in ("mm/dd/yy,day of week hrs:mins am/pm" format & CST time zone)

q:((month of date (time zone "cst") of it) as two digits & "/" & day_of_month of date (time zone "cst") of it as two digits & "/" & year of date (time zone "cst") of it as string & "," & first 3 of (date(time zone("cst")) of it as string)& " " & (if(hour_of_day of it<12) then (hour_of_day of it as string & ":" & minute_of_hour of it as string & "am") else(((hour_of_day of it as integer)-12) as string)& ":" & minute_of_hour of it as string & "pm") of time(time zone "cst") of it) of now
A: 12/27/2013,Fri 10:42am

T: 0.133 ms

Sunday, December 15, 2013

Sum of (item 1 & item 0) Seperately of Plurals Of Tuples


q:(sum of(substrings separated by "." of (concatenation of((substrings separated by " " of it) whose( it contains ".")))as integer),sum of(substrings separated by "," of (concatenation of((substrings separated by " " of it) whose( it contains ",")))as integer)) of (concatenation of ((item 0 of it as string) & ". " & (item 1 of it as string)& ", " ) of ((2,2);(22,226);(222,111)))
A: 246, 339
T: 0.249 ms
I: singular ( integer, integer )

Explanation

q: (concatenation of ((item 0 of it as string) & ". " & (item 1 of it as string)& ", " ) of ((2,2);(22,226);(222,111)))
A: 2. 2, 22. 226, 222. 111,
T: 0.112 ms
I: singular string

Source is prepared by separating the elements of tuples by adding ". " with items 0 and ", " with items 1 of the plural tuples(where " " serves as a level 1 separator and "." & "," serves as level 2 separators) and then concatenating them as a whole.
Using this source we can separate the item 1 and item 0 of plural tuples to perform operations.

q:(substrings separated by " " of it) of "2. 2, 22. 226, 222. 111,"
A: 2.
A: 2,
A: 22.
A: 226,
A: 222.
A: 111,
T: 0.076 ms
I: plural substring

" "(LEVEL 1 SEPARATOR) is used to get the various elements individually along with the level 2 separators attached to them.

q:(concatenation of(substrings separated by " " of it)whose( it contains ".")) of "2. 2, 22. 226, 222. 111,"
A: 2.22.222.
T: 0.099 ms
I: singular string

here, we have concatenated the elements which consists of a particular separator, i.e., "." so that we can again perform the substrings separation method for getting the separator free elements.

q: substrings separated by "." of (concatenation of(substrings separated by " " of it)whose( it contains ".")) of "2. 2, 22. 226, 222. 111,"
A: 2
A: 22
A: 222
A:
T: 0.111 ms
I: plural substring

now, we can easily convert the elements of item 0 of the plural tuples to integers and get the sum of them.

q: sum of ((substrings separated by "." of (concatenation of(substrings separated by " " of it)whose( it contains ".")) of "2. 2, 22. 226, 222. 111,") as integer)
A: 246
T: 0.290 ms
I: singular integer

 result..!!!