惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
C
Cybersecurity and Infrastructure Security Agency CISA
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Know Your Adversary
Know Your Adversary
S
Securelist
I
Intezer
AWS News Blog
AWS News Blog
L
LINUX DO - 热门话题
P
Privacy International News Feed
Recent Announcements
Recent Announcements
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 聂微东
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Attack and Defense Labs
Attack and Defense Labs
N
News and Events Feed by Topic
The GitHub Blog
The GitHub Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Schneier on Security
Schneier on Security
N
Netflix TechBlog - Medium
爱范儿
爱范儿
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
Blog — PlanetScale
Blog — PlanetScale
WordPress大学
WordPress大学
S
Secure Thoughts
K
Kaspersky official blog
N
News | PayPal Newsroom
O
OpenAI News
Last Week in AI
Last Week in AI
C
Check Point Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Tor Project blog
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
D
Docker
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
博客园 - 司徒正美
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
P
Palo Alto Networks Blog

szhshp 的第三边境研究所

假设, AI 把我代替的那一刻真的到来 | szhshp 的第三边境研究所 小傻瓜都能懂的 AstrBot QQ 机器人集成 MCP 功能实战指南 | szhshp 的第三边境研究所 《智人之上: 从石器时代到 AI 时代的信息网络简史》阅读笔记 | szhshp 的第三边境研究所 iPadOS 26 无法设置空间场景图片壁纸的解决方法 | szhshp 的第三边境研究所 《一路云海》(终) | szhshp 的第三边境研究所 《一路云海》(四): 如何不按套路旅行 | szhshp 的第三边境研究所 《一路云海》(三): In Ya Mellow Tone | szhshp 的第三边境研究所 《一路云海》(二): 关西世博参观纪实 | szhshp 的第三边境研究所 《一路云海》(一): 新的征程 | szhshp 的第三边境研究所 2025 大阪世博会 [ 3 天前-先到先得 ] 阶段 场馆预约必中独家攻略 | szhshp 的第三边境研究所 Hackathon 随想 | szhshp 的第三边境研究所 一杯双皮奶 | szhshp 的第三边境研究所 Armbian + CasaOS + NAS 配置指南 | szhshp 的第三边境研究所 Docker 构建镜像报错: error getting credentials - err: exit status 1, out: `` | szhshp 的第三边境研究所 Disqus RIP! 论过高的维护成本如何治疗固执的坏习惯 | szhshp 的第三边境研究所 炸弹猫桌游变体规则 | szhshp 的第三边境研究所 《小岛经济学》阅读笔记 | szhshp 的第三边境研究所 《金钱心理学》阅读笔记 | szhshp 的第三边境研究所 为知笔记 RIP: 迁移剩余的笔记 | szhshp 的第三边境研究所 2025 博客第十年展望 - 再见我的过去 | szhshp 的第三边境研究所 我在独立游戏里面致敬的作品 | szhshp 的第三边境研究所 《How to make thing faster》阅读笔记 | szhshp 的第三边境研究所 《The Art of Clean Code》阅读笔记 | szhshp 的第三边境研究所 《Clean Architecture: A Craftsman Guide to Software Structure and Design》阅读笔记 | szhshp 的第三边境研究所 《How AI Works》阅读笔记 | szhshp 的第三边境研究所 游戏策划废案 - Project Uranus | szhshp 的第三边境研究所 游戏策划废案 - Project X | szhshp 的第三边境研究所 人生第一款独立游戏开发复盘 | szhshp 的第三边境研究所 Trap of Life | szhshp 的第三边境研究所 如果我用手搓了个暗物质雏形 | szhshp 的第三边境研究所 《Rust Programming Language》- EX - Cheatsheet | szhshp 的第三边境研究所 新的播放器上线了 | szhshp 的第三边境研究所 Cypress - End-to-End Testing: OKTA Authentication with MFA | szhshp 的第三边境研究所 VSC x VIM - 反正多学几个快捷键没有坏处 | szhshp 的第三边境研究所 两小时 Docker 速成 - Getting Started | szhshp 的第三边境研究所 《The Joy of Javascript》- 5 - Data | szhshp 的第三边境研究所 《The Joy of Javascript》- 4 - Meta Programming | szhshp 的第三边境研究所 《The Joy of Javascript》- 3 - ADT(Algebraic Data Type) | szhshp 的第三边境研究所 Web-Automation Testing | szhshp 的第三边境研究所 《The Joy of Javascript》- 2 - Functor/Monad | szhshp 的第三边境研究所 《The Joy of Javascript》- 1 - Object/Function | szhshp 的第三边境研究所 EvalError: Possible side-effect in debug-evaluate | szhshp 的第三边境研究所 前端 QA 工具链指南 - husky,commitlint,commitizen,eslint,typescript,express | szhshp 的第三边境研究所 效率工具 & 软件推荐 | szhshp 的第三边境研究所 站点开源 Project Titan | szhshp 的第三边境研究所 cmd/powershell-命令速查-Cheatsheet | szhshp 的第三边境研究所 Git-命令速查与相关问题解决-Cheatsheet & Troubleshooting | szhshp 的第三边境研究所 Tailwind.css not included in NextJS Production | szhshp 的第三边境研究所 Github GraphQL API - Data Integration | szhshp 的第三边境研究所 尝试 Windows Terminal + z.lua | szhshp 的第三边境研究所 StrokePlus.net - Powerful Hotkey Boost | szhshp 的第三边境研究所 优雅地 Hack 一台黑苹果 | szhshp 的第三边境研究所 一杯关东煮 | szhshp 的第三边境研究所 Gitee x PicGo 管理图床 | szhshp 的第三边境研究所 Create Your Own Redux (Typescript) | szhshp 的第三边境研究所 Getting Started: Ionic + Capacitor + React + Typescript + Android | szhshp 的第三边境研究所 GraphQL: File Upload & Troubleshooting | szhshp 的第三边境研究所 吉祥航空随心飞刷票工具循环查票工具 | szhshp 的第三边境研究所 NVM Windows Portable Installation | szhshp 的第三边境研究所 NextJS x Typescript - Integration & Troubleshooting | szhshp 的第三边境研究所 全站点升级 - Project Titan | szhshp 的第三边境研究所 AWS-EC2-常见问题解决-Troubleshooting | szhshp 的第三边境研究所 Workbox-Getting Started | szhshp 的第三边境研究所 《时间简史》阅读笔记 | szhshp 的第三边境研究所 《时间的秩序》阅读笔记 | szhshp 的第三边境研究所 ESLint-常见问题解决-Troubleshooting | szhshp 的第三边境研究所 站点索引 | szhshp 的第三边境研究所 个人知识库搭建 - Hexo 实现 Github/Coding 持续集成 | szhshp 的第三边境研究所 BMOB-常见问题解决-Troubleshooting | szhshp 的第三边境研究所 React + Typescript: 开启 HMR/Hot Loader | szhshp 的第三边境研究所 Yarn & NPM | szhshp 的第三边境研究所 ESLint: Typescript + React + TSX 集成 | szhshp 的第三边境研究所 《10101》EP15:过年 2020 | szhshp 的第三边境研究所 Cmder-Usage | szhshp 的第三边境研究所 Redux-DOM not refreshed | szhshp 的第三边境研究所 React Semantic UI-CheatSheet | szhshp 的第三边境研究所 Typescript: Getting Started | szhshp 的第三边境研究所 Flutter-Getting Started | szhshp 的第三边境研究所 Typescript: Access window object with type check | szhshp 的第三边境研究所 VSC Extension Development-Create A Code Formatter Extension | szhshp 的第三边境研究所 OneNote Extension-Main API | szhshp 的第三边境研究所 TortoiseGit Win10 Icon not showing correctly | szhshp 的第三边境研究所 Mongoose: aggregate() 方法实现聚合函数 | szhshp 的第三边境研究所 React In Depth - React 源码解析 - render() & Fiber | szhshp 的第三边境研究所 MongoDB x Mongoose: 实现类似 Join 的功能 | szhshp 的第三边境研究所 Disqus 评论框改造工程-实现 Disqus 代理的 Serverless 服务 | szhshp 的第三边境研究所 GUI, CLI, Terminal, Shell, TTY, Console, Bash | szhshp 的第三边境研究所 Jest Async Best Practise: No Nested Async | szhshp 的第三边境研究所 关系型数据库与非关系型数据库优缺点分析 | szhshp 的第三边境研究所 New Edge & Chromium Error - Package is invalid: 'CRX_VERSION_NUMBER_INVALID' | szhshp 的第三边境研究所 选择 GraphQL 的 N 个理由 | szhshp 的第三边境研究所 StrokePlus - 鼠标手势神器的代码编写技巧 | szhshp 的第三边境研究所 嗨,好久不见 | szhshp 的第三边境研究所 Vue + ElementUI 集成 Vue Router | szhshp 的第三边境研究所 IE8 - Unknown Runtime Error Using innerHTML & Ajax | szhshp 的第三边境研究所 React: Handling Events | szhshp 的第三边境研究所 React-Navigation Integration with Redux | szhshp 的第三边境研究所 React: States is tricky | szhshp 的第三边境研究所 《10101》EP14:小剧场 | szhshp 的第三边境研究所 ColdFusion - Basic - arguments in cffunction | szhshp 的第三边境研究所
ColdFusion-命令速查与日常使用-CheatSheet Pt 2 | szhshp 的第三边境研究所
2019-01-01 · via szhshp 的第三边境研究所

Meta

目录

CFScript Example

<cfscript>
data = {    "FirstMetricGoal"=6.283185307179586476925286766559,
    "FirstMetricRate"=3.1415926535897932384626433832795,
    "SecondMetricGoal"=5.4365636569180904707205749427053,
    "SecondMetricRate"=2.7182818284590452353602874713527
};

// Data for round Charts
data.roundChartAttributes = arrayNew(1);
for(i=1; i<=5 ; i=i+1)
{
    data.roundChartAttributes[i] = structNew();
    data.roundChartAttributes[i].currentValue = 0.5;
    data.roundChartAttributes[i].yellowThreshold = 0.3;
    data.roundChartAttributes[i].greenThreshold = 0.5;
    data.roundChartAttributes[i].topScale = 1.0;
    data.roundChartAttributes[i].allTransparent = "true";
    data.roundChartAttributes[i].meterTitle = "Chart 1";
    data.roundChartAttributes[i].boxHeight = "120";
    data.roundChartAttributes[i].boxWidth = "120";
    data.roundChartAttributes[i].radius = "50";
}

// Data for TriangleChart
data.arrTriangleChart = arrayNew(1);
// Format: Title | Position in Triangle (1 is the top) | Value to display | Color to display (Hex or string if available) | Text to display on helptext
data.arrTriangleChart[1] = "test1|1|1111|ffffff|test.";
data.arrTriangleChart[2] = "test2|2|222|ffffff|test22.";
data.arrTriangleChart[3] = "test3|3|333|ffffff|test33.";
data.arrTriangleChart[4] = "test3|4|333|ffffff|test33.";
data.arrTriangleChart[5] = "test3|5|333|ffffff|test33.";

// Data for Regulatory Training Completion
data.TrainCompletion_YTDElapsed="0.5";
data.TrainCompletion_YTD2014="0.8";

// Data for First Aid/NM/Concerns Rate
data.FA_NM_Concern_Rate="0.5";

// Data for Calendar Closure Rate
data.Calendar_Closure_Rate="0.8";

// Data for Incurred Costs
data.IncurredCosts_3YrAvg="2000";
data.IncurredCosts_2014="3000";

// Data for Finding Closure Rate
data.FindingClosureRate_PrioA="0.9";
data.FindingClosureRate_PrioB="0.9";
data.FindingClosureRate_PrioC="0.9";
data.FindingClosureRate_PrioD="0.9";

// Data for Finding Ratio
data.FindingRatio_Site="250";
data.FindingRatio_Crop="750";

</cfscript>

SerializeJSON

<cfparam name="IncludeSubOrgs" default="">
  <!--- <cfheader name="Content-Type" value="application/json"> --->
  <cfquery name="getSites" datasource="">
    ……
  </cfquery>

  <cfcontent reset="true" />
  <cfoutput>
    #SerializeJSON(getSites,true)#
  </cfoutput>

Query of Query

<cfset subCategoryIDs=valueList(getsubcategories.subCategoryID)>
<cfquery name="getproducts">
SELECT *
FROM products
WHERE subCategoryID in (<cfqueryparam cfsqltype="cf_sql_integer" value="#subCategoryIDs#" list="true">)
ORDER BY RAND()
</cfquery>

Object

FindStructFindValue

<cfset sbiztemplist = "">
<cfset arrSearch = structfindvalue(structConcerns.IncidentsDetail,subbusiness,"all")>
<cfloop from="1" to="#arrayLen(arrSearch)#" index="arr">
    <cfif arrSearch[arr].key eq "SubBusiness">
        <cfif NOT listfindNoCase(sbiztemplist,arrSearch[arr].owner.Orgname,"|")>
            <cfset sbiztemplist = listAppend(sbiztemplist,arrSearch[arr].owner.Orgname,"|")>
        </cfif>
    </cfif>
</cfloop>

Create a Excel and write data and download

<!--- Create a obj --->
<cfset decSheetObj=SpreadsheetNew()>

  <!--- Write something  --->
  <cfscript>
    spreadsheetSetCellValue(variables.decSheetObj, 123, 56, 4);
  </cfscript>

  <!--- Write to server --->
  <cfspreadsheet action="write" filename="/report.xlsx" sheetname="Declaration" name="decSheetObj" overwrite="true" />

  <!--- Download --->
  <cfheader name="Content-Disposition" value="attachment; filename=Report_#dateFormat(now(), 'yyyymmdd ')##timeFormat(now(), 'HHmmss')#.xlsx" />
  <cfcontent file="/report.xlsx" type="application/vnd.ms-excel" deletefile="true" />

ColdFusion to js

JSStringFormat(string)

Special Characters & Quotations

写成两个就行了

<cfset mystring="We all said ""Happy birthday to you.""">
<cfset mystring2='Then we said "How old are you now?"'>
<cfoutput>
  #mystring#<br>
  #mystring2#<br>
  Here is a number sign: ##
</cfoutput>

Output:

We all said "Happy birthday to you." 
Then we said "How old are you now?" 
Here is a number sign: # 

List

在 HTML 中以

<cfset local.errorRowNum="123,321,124" />

的形式出现 一开始可以使用空值, 不需要 ListNew()这样的方法来新建 List, 之后再使用 ListAppend 来添加数据

ListAppend

一定要赋值给原来的 list, 单独调用一下函数不赋值是不会有效果的.

<cfset fruitlist = ListAppend(fruitList, "kiwi") />

Query to List: ValueList

将 Query 的 Result 转换为 List

valueList(column, [delimiter])

ListLen

获取 List 的长度, 在 Loop 的时候可能会用到

ListContains

ListContains(list, substring [, delimiters, includeEmptyValues ])

##ListContains(aList, "wo")#
Description

Determines the number of elements in a list. Integer; the number of elements in a list.

Function syntax
ListLen(list[, delimiters])
ListLen(list[, delimiters, includeEmptyValues])
Parameters
  • list

A list or a variable that contains one.

  • delimiters

A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter.

  • includeEmptyValues

If includeEmptyValues is set to true, all empty values in the list will be considered when computing length. If set to false, the empty list elements are ignored.

Example
<cfset list="Partner,Response Date,Response Status" />
<cfloop from="1" to="#listLen(list)#" index="i">
  <cfoutput>
    listGetAt(list, i)
  </cfoutput>
</cfloop>

Array

cfscript 中以

data=[0,0,0,0,0]

的形式出现

在 HTML 中以

<!--- 这句声明可以省略 --->
<cfset local.errorRowNum=arrayNew(1) />

<cfset local.errorRowNum=[1,2,3] />

<!--- 可以不按顺序赋值,但是使用未赋值的 index 可能报错 --->
<cfset local.errorRowNum[3]=arrayNew(1) />
<cfset local.errorRowNum[4]=arrayNew(1) />
<cfset local.errorRowNum[5]=arrayNew(1) />

以及

<cfset myarray=ArrayNew(1)>
<cfset myotherarray=ArrayNew(2)>
<cfset biggerarray=ArrayNew(3)>

<cfset biggerarray[1][1][1]=myarray>
<cfset biggerarray[1][1][1][10]=3>
<cfset biggerarray[2][1][1]=myotherarray>
<cfset biggerarray[2][1][1][4][2]="five deep">

<cfset biggestarray=ArrayNew(3)>
<cfset biggestarray[3][1][1]=biggerarray>
<cfset biggestarray[3][1][1][2][3][1]="This is complex">
<cfset myarray[3]="Can you see me">

的形式出现

几个特性

  • 效率比 Struct 要快

ArrayAppend

<cfset ArrayAppend(array_name, {value})>

放在 cfset 之中, 或者直接在 output 的时候用双井号调用 注意如果赋值的话就是 True or False

ListToArray

格式

listToArray("list", [delimiters])

Demo

<h1>Demo for listToArray</h1>
<cfquery name="query" datasource="CC_TEST">
  select top(3) * from ltbContact;
</cfquery>
<cfdump var="#query#" expand="false">
  <cfset xAxisLabelsdata=listToArray(ValueList(query.CONTACT_LASTNAME,'|'),'|') />
  <cfdump var="#xAxisLabelsdata#" expand="false">

Query to Array: toArray()

qSites.siteid.toArray()

Debug Tips

由于 ColdFusion 是服务器端进行解析的, 一般不能够分步执行

一般使用的调试方法

  1. 使用 <cfabort> 来中断某段代码后方的所有代码

  2. 使用 <cfdump> 来进行查看, 甚至可以查看

  3. 可以直接 dump 出表单名来查看所有数据

  4. <cfscript> 中可以使用

WriteDump(vars)

来进行 dump


cfinclude & include in cfscript

用于文件引用

示例

<cfinclude template="myinclude.cfm">
<cfinclude template="……/myinclude.cfm">
<cfinclude template="/CFIDE/debug/myinclude.cfm">

<cfscript>
include "myinclude.cfm";
</cfscript>

ColdFusion Linebreak

tags: 换行, line break, coldfusion

Solution1&2

Use Chr(10) as \n There is no support for \n or \r in CF. From the Live Docs

  • Chr(10) returns a linefeed character
  • Chr(13) returns a carriage return character
  • The two-character string Chr(13) & Chr(10) returns a Windows newline

Available if for normal string var output

<cfset someStr="This is line 1" & Chr(10) & "This is line 2" & Chr(10) & "This is line 3" />
<cfset NL=Chr(10) />
<cfset someStr="This is line 1 #NL# This is line 2#NL#This is line 3" />

Solution3

If you are into platform-independent development, you can do:

<cfset NL=CreateObject("java", "java.lang.System" ).getProperty("line.separator")>

For example, in your application.cfm/cfc or somewhere else high-level and use that.

Solution4

use

<*br*>

example:

"labelFontSize" = 7,
"labels" = ["Near Misses & Concern <*br*> Reports Logged", "First Aid Cases", "Other Recordable Cases", "Job Transfer or Restriction", "DAFW", "Fatalities"]

cfparam

<cfparam name="FORM.username" default="NULL"/>

使用方法

  • 可以直接写对应的 CF 变量
  • 可以使用表单提交过来的数据, 注意是获取表单里面对应 name 的数据
  • 可以使用 type 参数设定获取过来的类型, 如果不是对应类型就会报错?