Joe Groff <arcata@...> writes: > > On Sat, Mar 10, 2012 at 4:44 AM, Robert Herman <rpjherman@...> wrote: > > I solved Windows-specific installation issues I had with Factor > > How did you end up solving these problems? > > > Any tips on other functions or structures would be most appreciated. I tried > > slice, joins, the CSV library,and some others, but mainly received errors > > asking for a string, when the Inspector showed that I had a string on the > > top of the stack. How can I index the string like: string[0] or string[2:4]? > > Or some other way of achieving the end results? > > How were you using the CSV library? I had no problem pasting your > example data and loading it as follows: > > ``` > IN: scratchpad "/Users/joe/testcsv.txt" utf8 file>csv . > { > { "Show Report" "" "" "" "" } > { "Show Name:" "TTTTT1 " "" "" "" } > { "Show Date:" "24/02/2012 (Fri)" "" "" "" } > { "Show Time:" "05:00:00 PM" "" "" "" } > { "Venue:" "DDDDDD WWWWW TTTTTTT" "" "" "" } > { > "Door Open:" > "04:30:00 PM" > "" > "Admission Time:" > "30 mins" > } > { "Announcement:" "05:00:00 PM" "" "" "" } > { > "Show Start:" > "05:02:00 PM" > "" > "Show End:" > "06:29:00 PM" > } > { > "Door Close:" > "06:37:00 PM" > "" > "Dismission Time" > "8 mins" > } > { "" " " "" "" "" } > { "Duration:" "87 mins" "" "" "" } > { "Ticket issued:" "1029" "" "Total Attendance" "998" } > { > "Remarks:" > "1. blah blah blah blah blah blah blah blah blah." > "" > "" > "" > } > { "Incidents:" "" "" "" "" } > } > ``` > > With the parsed CSV it should be easy to `find` the entry starting > with "Ticket" and extract the second element. > > > Thanks. I hope the post is not too long... > > Not a problem. Including code and data examples in-line is perfectly > fine around here. Any bugs and solutions you come up with would be > nice to have in our bug tracker at > https://github.com/slavapestov/factor/issues . > > -Joe > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ >
Thank you, Joe. NOTE: I changed my settings to not receive the digest, since I cannot for the life of me figure out how to reply to a single email in the digest in gmail. This is a reply through gmane.org. Now on to business. The Windows errors I had were mainly due to user error by creating my own .factor-rc file using the 'copy con' in the command shell on Win 7 to be able to create a 'dot' file. Plus I placed it in the 'c:\Users\login_name\factor' directory instead of 'c:\Users\login_name'. Now it works, and the .factor-rc file properly sets my name as the default author when using scaffold. I still have issues with missing vocabulary references ( cannot find 'csv', etc..) when I copy/paste from my text editor to the Listener, frustrating me with the USE: / USING: usage. I am still not clear on the use of USE: or USING: when I am coding in SciTE and copying and pasting to the Listener. Also, now that I have a working bunch of code lines, I would like to be able to execute it, but when I type '"filename" run' or '"filename" load' it faults. I know I need t define a MAIN entry point, and possibly turn my code into one big word (starting with ":" and ending with ";", or vocabulary, but I am not sure how yet. Here is the code I finally wound up with today: > USE: io.encodings.utf8 csv > >"c:\\Users\\login_name\\factor\\work\\TTTTT\\TTTTT1.csv" utf8 file>csv >dup dup >11 swap nth 4 swap nth >[ 11 swap nth second "," append ] dip >[ 2 swap nth second 10 cut swap "," append ] 2dip >3append dup string>csv >"c:\\Users\\login_name\\factor\\work\\TTTTT\\parsed.csv" utf8 csv>file ...which gives me exactly what I want: "24/02/2012,1029,998" in the output for putting back into a spreadsheet. I had used file>csv before, but I had had all sorts of type mismatches in getting it to work between all of the operations I was carrying out in my old attempts - like how I had to finally resort to 'string>csv' above before outputting the file because the array of strings when cut up and appended became plain strings not a one member array of one string. To continue with this task, I now need to figure out how to process a directory of csv files, extract the same bits as above and append them in one big csv file like so: 24/02/2012,1029,998 22/02/2012,1803,1799 and so on... The big directory of csv files was created by running a Windows shell command, and then a Python OpenOffice-to-csv script from original Excel xls files. I would love to re-create that part by using only Factor. After I complete the task, I really want to go back over the code above and see if I can make it more 'elegant' or 'Factorish'. I am very enthusiastic about Factor and the help from the community! Rob ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk