<cfscript> selectedList = "1,2,6"; currentList ="1,2,3,4,5"; selectedArray = ListToArray(selectedList); currentArray = ListToArray(currentList); deleteArray = currentArray.clone(); deleteArray.RemoveAll(selectedArray); insertArray = selectedArray.clone(); insertArray.RemoveAll(currentArray); WriteOutput("selected"); WriteDump(selectedArray); WriteOutput("Current"); WRiteDump(currentArray); WRiteOutput("Deleted"); WriteDump(deleteArray.ToList()); WriteOutPut("Inserted"); WriteDump(insertArray.ToList()); </cfscript>
Inside Out Outside In
A personal blog of Christopher Wigginton; a nerd by nature, programming polyglot, cooking enthusiast and fermentation practitioner.
Friday, November 17, 2023
ColdFusion: Comparing a selected list vs an existing list and determining which needs to be inserted and deleted.
I've seen implementations in code, where in a database update all the records are deleted and new ones are inserted. Here's a simple method in ColdFusion using underlying Java array methods for determining from a given selection list and current list, which items need to be deleted and inserted.
Wednesday, March 15, 2023
Wednesday, February 15, 2023
Wednesday, August 24, 2022
Wednesday, August 10, 2022
Crystal Reports Custom Report Function: Superscript Text generator.
A simple custom report function for Crystal Reports that will take a numeric value and generate a string of UTF8 superscripts of the digits.
//font must be Arial Unicode MS or other font with Unicode support //1 2 3 4 5 6 7 8 9 0 //Hex // 2071 00B2 00B3 2074 2075 2076 2077 2078 2079 2070 //Dec // 0185 0178 0179 8308 8309 8310 8311 8312 8313 8304 Function (numberVar SuperScriptNumber) //If 1 thru 9 and then zero since we're not a zero based array Local NumberVar Array subs := [0185,0178,0179,8308,8309,8310,8311,8312,8313,8304]; Local NumberVar x; Local NumberVar DecValue; Local StringVar NumString := ToText(SuperScriptNumber,0,"",""); Local StringVar SuperString := ""; For x:= 1 to Len(NumString) Do ( DecValue:= ToNumber(Mid(NumString,x,1)); if DecValue = 0 then SuperString := SuperString + chrw(subs[10]) else SuperString := SuperString + chrw(subs[decValue]); ); SuperString
Tuesday, May 24, 2022
Google Voice Chome Extension, React Development, and Incognito (Solved)
After trying to play around with the open package which is a dependency of react-dev-utils, I added the bopen package and changed the open call on line 131 in openBrowser.js to bopen and added incognito:true
This is currently hack status. but does solve the issue of using my chrome with all my extensions and launching the dev server in incognito mode.
try {
var options = { app: browser, wait: false, url: true , incognito: true};
bopen(url, options).catch(() => {}); // Prevent `unhandledRejection` error.
return true;
} catch (err) {
return false;
}
Google Voice Chome Extension and React Development
Google Voice is a fantastic free service for VOIP via the browser, however the extension isn't compatible with local React development and returns an "Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist".
Solutions are to use incognito sessions, disable the extension during development, or a different browser. I set Chrome as my default over other browsers for the various google app integrations. So for now, it's a minor annoyance to have to perform the manual switching or configuration each time I want to launch a development session.
There is one possibility of diving into the node packages such as react-dev-utils that's using html-webpack-plugin and trying to provide a method for launching the browser incognito when using the command npm start.
Subscribe to:
Posts (Atom)