Wednesday, August 6, 2008

Little Import Utility

Me and a friend were talking about setting up Remote Viewing tasks as an experiment, using a number, words, etc. to see if we would get symbol, or be able to dowse for numbers / letters, etc. It turns out the utility I wrote for that last night will server as a lovely improvement to the existing "bulk self-tasking" upload option in Taskerbot.

Basically, in the new utility, you have a 'settings' page where you can write your own 'psychic intent' as a default, and set the visual style you want your feedback in. (So you can make big red letters on yellow background in Impact font, for more effect.) Then you put whatever you want to 'view' -- numbers, words, phrases, whole specific tasker intents, reference to other existing task numbers, whatever! -- in a single column in a spreadsheet (simple) and click to import. It will create up to 250 new tasks on the fly. The system would let you have 3000 chars but spreadsheets will limit it to 250.

The existing 'bulk self-tasking' is a simple form that lets you type in "task number references". But (a) it's all online and (b) it only allows 25 characters. Because that is tying into the 'my task reference# field', whereas the new utility is actually using the text feedback field. And so in this one you could even use html or an img ref or brief EMBED code if you wanted so it could be pretty robust.

***

The "style" thing is a quick-and-dirty HTML that I made with as much find/replace in Textpad (my beloved Textpad...) as possible:



***

The combo CFLAYOUT-CFGRID I've been working on for the RV Galleries has not only fried my brain but is at the point of making me cry. The same queries that work just fine on the live site cause a timeout when I try to run them for the grid on my local... I have no idea why. Every time I get something working, nearly every thing I do after that breaks it (and breaks each thing I accomplished before them) and it needs re-re-re-fixing. Some of it's because the middleware just needs more/better development... there are 'quirks' especially in multiple things working together and often stuff just flat out doesn't work, or works fine alone but even though they are supposed to be wholly separate pages, when combined into the tab layout, changing a stylesheet on one screws up another for example. It's never ending. I have to take a brief break from that before I burn out entirely, and do something else that's constructive. So last night it was "Strings" (Numbers-Words-Phrases or NWP) bulk import utility.

***

Back to the utility: So basically it is using the groovy CF to Excel custom tag that my server company makes available. It's ridiculously easy. Basically you spec the tag, and it saves the content of the spreadsheet as a query set. Then you do a "query of query" for the data. And in my case, then loop it out so you can put a variety of unique/other info into the insert.


<cfx_excel2query r_qResults="importthis" file="#form.importxls#" startRow="1" maxRows="250">


That creates the query set of all the values in the spreadsheet.


<cfquery name="importit" dbtype="query">>
select COLUMN1 as myfeedbackraw
from importthis
</cfquery>


This goes and gets just the first column of values, in this case.

Then I loop through. Weird thing, I have scripts used in a dozen forms for generating random task numbers and so on, and they cracked in the loop, giving me all kinds of bizarre results. I couldn't figure out why, but decided not to deal with it, and instead just used a couple generated randoms for both the random task number and the unique 'task reference' number.


<cfset thenow = "#TimeFormat(Now(),'LL')#">
<cfset therand = "#RandRange(32,999)#">
<cfset therand2 = "#RandRange(32,999)#">
<cfset vwrtn = '#therand2#-' & '#variables.thenow#' & '-#variables.therand#'>

<cfset theTN1 = "#RandRange(2001,9999)#">
<cfset theTN2 = "#RandRange(3111,8999)#">
<cfset tasknum = '#theTN1# - #theTN2#'>


That used two randoms and "milliseconds" of a time for insert, to create a 3-3-3 digit 'task reference number' which really means nothing to the viewer but the system needs something unique there. It creates a 4x4 task number for actual assignment (the system task number).

Meanwhile, I use CFDUMP all over the place for quick outputs when nothing needs to be clicked on in that output. But the one on the import page has like a 5 point font. Go figure. I haven't figured out why it's so tiny yet.

No comments: