[WebDNA] Useful (to me) [function]s
This WebDNA talk-list message is from 2013
It keeps the original formatting.
numero = 110342
interpreted = N
texte = Feel free to use if they will come in handy. They do for me.-Dan[!]-- "danFunction_timestamp" (ex: "735110.41805" - usage: "[danFunction_timestamp]" --[/!] [function name=danFunction_timestamp][text]theTimestamp=[math]{[date]}[/math].[math]{[time]}[/math][/text] [return][theTimestamp][/return] [/function][!]-- "danFunction_reverseTimestamp" -- ex: "735110.41805" becomes "12/12/2012 at 12:12:12" - usage: "[danFunction_reverseTimestamp theTimestamp=735110.41805]" --[/!] [function name=danFunction_reverseTimestamp] [listwords words=[theTimestamp]&delimiters=.] [text]word[index]=[word][/text] [/listwords] [text]reversedDate=[Format Days_To_Date %m/%d/%Y][word1][/format][/text] [text]reversedTime=[format Seconds_To_Time %I:%M:%S %p][word2][/format][/text] [return][reversedDate] at [reversedTime][/return] [/function][!]-- "danFunction_randomString" -- ex: "s$RD*63#@sbh54^" - usage: "[danFunction_randomString length=16]" --[/!] [function name=danFunction_randomString] [text]tPasswordLength=[length][/text][text]tChars=abcdefghijkmprstuvwxyz23456789~@#$%^*ABCDEFGHJKLMNPQRSTUVWXYZ[/text] [text]tMax=[countchars][tChars][/countchars][/text] [text]tPass=[/text] [loop start=1&end=[tPasswordLength]] [text]tX=[math]ceil([random format=float]*[tMax])[/math][/text] [text]tPass=[tPass][getchars start=[tX]&end=[tX]][tChars][/getchars][/text] [/loop] [return][tPass][/return] [/function][!]-- "danFunction_sessionID" -- ex: "7352384344505013201522545" (from end: last 12 are IP, next 5 are time, remaining are date) - usage: "[danFunction_sessionID]" --[/!] [function name=danFunction_sessionID][text]thisSession=[math]{[date]}[/math][math]{[time]}[/math][grep search=[.]&replace=][ipaddress][/grep][/text] [return][thisSession][/return] [/function][!]-- "danFunction_reverseSessionID" -- ex: "063.249.017.164|1/3/2013" (see danfunction_SessionID): usage: "[danFunction_reverseSessionID session=7352384344505013201522545]" --[/!] [function name=danFunction_reverseSessionID] [text]getIP=[getchars start=1&end=12&from=end][session][/getchars][/text] [loop start=1&end=12&advance=3] [text]IP[index]=[getchars start=[index]&end=[math][index]+2[/math]][getIP][/getchars][/text] [/loop] [text]sessionDate=[Format Days_To_Date %m/%d/%Y][getchars start=18&end=&from=end][session][/getchars][/format][/text] [return][IP1].[IP4].[IP7].[IP10]|[sessionDate][/return] [/function][!]-- "danFunction_randomNumber" -- (1 thru [max]) - usage: "[danFunction_randomNumber max=256]" --[/!] [function name=danFunction_randomNumber] [text]randomNumber=[math]ceil([random format=float]*[max])[/math][/text] [return][randomNumber][/return] [/function][!]-- "danFunction_IPnormalize" -- (converts 063.249.017.164 to 63.249.17.164) - usage: "[danFunction_IPnormalize]" --[/!] [function name=danFunction_IPnormalize] [text]normalizedIP=[listWords words=[ipaddress]&delimiters=.][math][word][/math][hideif [index]>3].[/hideif][/listWords][/text] [return][normalizedIP][/return] [/function]
Associated Messages, from the most recent to the oldest:
|
- [WebDNA] Useful (to me) [function]s (Dan Strong 2013)
|
Feel free to use if they will come in handy. They do for me.-Dan
[!]-- "danFunction_timestamp" (ex: "735110.41805" - usage: "[danFunction_timestamp]" --[/!] [function name=danFunction_timestamp]
[text]theTimestamp=
[math]{
[date]}[/math].
[math]{
[time]}[/math][/text]
[return][theTimestamp][/return] [/function]
[!]-- "danFunction_reverseTimestamp" -- ex: "735110.41805" becomes "12/12/2012 at 12:12:12" - usage: "[danFunction_reverseTimestamp theTimestamp=735110.41805]" --[/!] [function name=danFunction_reverseTimestamp] [listwords words=[theTimestamp]&delimiters=.]
[text]word[index]=[word][/text] [/listwords]
[text]reversedDate=[Format Days_To_Date %m/%d/%Y][word1][/format][/text]
[text]reversedTime=[format Seconds_To_Time %I:%M:%S %p][word2][/format][/text]
[return][reversedDate] at [reversedTime][/return] [/function]
[!]-- "danFunction_randomString" -- ex: "s$RD*63#@sbh54^" - usage: "[danFunction_randomString length=16]" --[/!] [function name=danFunction_randomString]
[text]tPasswordLength=[length][/text]
[text]tChars=abcdefghijkmprstuvwxyz23456789~@#$%^*ABCDEFGHJKLMNPQRSTUVWXYZ[/text]
[text]tMax=
[countchars][tChars][/countchars][/text]
[text]tPass=[/text] [loop start=1&end=[tPasswordLength]]
[text]tX=
[math]ceil([random format=float]*[tMax])[/math][/text]
[text]tPass=[tPass][getchars start=[tX]&end=[tX]][tChars][/getchars][/text] [/loop]
[return][tPass][/return] [/function]
[!]-- "danFunction_sessionID" -- ex: "7352384344505013201522545" (from end: last 12 are IP, next 5 are time, remaining are date) - usage: "[danFunction_sessionID]" --[/!] [function name=danFunction_sessionID]
[text]thisSession=
[math]{
[date]}[/math]
[math]{
[time]}[/math][grep search=[.]&replace=]
[ipaddress][/grep][/text]
[return][thisSession][/return] [/function]
[!]-- "danFunction_reverseSessionID" -- ex: "063.249.017.164|1/3/2013" (see danfunction_SessionID): usage: "[danFunction_reverseSessionID session=7352384344505013201522545]" --[/!] [function name=danFunction_reverseSessionID]
[text]getIP=[getchars start=1&end=12&from=end]
[session][/getchars][/text] [loop start=1&end=12&advance=3]
[text]IP[index]=[getchars start=[index]&end=
[math][index]+2[/math]][getIP][/getchars][/text] [/loop]
[text]sessionDate=[Format Days_To_Date %m/%d/%Y][getchars start=18&end=&from=end]
[session][/getchars][/format][/text]
[return][IP1].[IP4].[IP7].[IP10]|[sessionDate][/return] [/function]
[!]-- "danFunction_randomNumber" -- (1 thru [max]) - usage: "[danFunction_randomNumber max=256]" --[/!] [function name=danFunction_randomNumber]
[text]randomNumber=
[math]ceil([random format=float]*[max])[/math][/text]
[return][randomNumber][/return] [/function]
[!]-- "danFunction_IPnormalize" -- (converts 063.249.017.164 to 63.249.17.164) - usage: "[danFunction_IPnormalize]" --[/!] [function name=danFunction_IPnormalize]
[text]normalizedIP=[listWords words=
[ipaddress]&delimiters=.]
[math][word][/math][hideif [index]>3].[/hideif][/listWords][/text]
[return][normalizedIP][/return] [/function]
Dan Strong
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Nested [tags] (2001)
[OT] Search Engine Tips (2003)
Has this happened to you? (was:Emailer Chokes on bad address) (1997)
Text variables do not show (1999)
[WebDNA] Ubuntu 18.04 & Apache2 & WebDNA fcgi - File upload error (2019)
Problems getting parameters passed into email. (1997)
Looking For WebCatalog Migration Assistance (2003)
Separate SSL Server (1997)
service stop and restart (1997)
encrypt/decrypt (2001)
ThisURL and getting domain/server address (2005)
WebCatalog Hosting (1996)
problems with 2 tags (1997)
Any WebCatalog Server providers in Seattle? (1998)
javascript for dynamic pulldowns? (1998)
2.0 Info (1997)
Graphs & diagrams (2003)
WC2b15 - [HTMLx]...[/HTMLx] problems (1997)
Music in background (2000)
searching multiple databases in single search (1997)