我想知道coldfusion是否有内置函数来查找字符串中的电子邮件地址.
我试图阅读查询输出ex."约翰史密斯jsmith@example.com",只拿出电子邮件.
在过去,我做了类似这样的事情,我在计算字符串的空格,在第二个字符串后,我正在消除左边的所有字符,它保留了电子邮件地址.
虽然这可以在我的情况下工作,但它并不安全,几乎可以保证可能以不同格式出现的数据的错误和误用,例如"John jsmith@example.com",在这种情况下,我将擦除所有信息.
我从我们的客户端收到excel文件,我需要从他们创建一个csv文件.我的问题是excel文件中的值与我们的标准不匹配,只是通过复制它来创建csv文件.在创建文件时,我需要获取值并将它们按正确顺序放置.我通读了liveocs的CF,但是找不到任何有效的东西.
我正在考虑创建一个结构并将数据拉出来,然后根据我的结构创建csv文件,但我之前没有做过这样的事情,我不确定它是否可能.我还想过使用listGetAt而不是结构但仍然没有尝试过.
以前有人这样做过吗?我正在努力将硬编码作为尽可能少的值,因为如果我们得到第二个具有相同问题的客户端,我认为这将成为未来的问题.
更新(过去几天我改变了我的代码,所以这就是我现在所拥有的)
<cfset DataDirectory = "E:\testfolder\test.xlsx">
<cfspreadsheet action="read" src="#DataDirectory#" excludeHeaderRow="true" headerrow="1" query="queryData">
<cfquery name="contact" datasource="#ds#">
select ClientBrandID
from ClientBrands
where surveyReferralID IN
(select surveyReferralID from clientAdmin where username = '#res#')
</cfquery>
<cfscript>
dataFile = structNew();
StructInsert(datafile,"ClientBrandID",contact.ClientBrandID);
StructInsert(datafile,"surveyType", queryData.surveyType);
</cfscript>
<cfscript>
///We need an absolute path, so get the current directory path.
theFile= "E:\testfolder\NewTest.csv";
//Create a new Excel spreadsheet object and add the query data.
theSheet = SpreadsheetNew("PatientData");
SpreadsheetAddRow(theSheet, "ClientBrandID,SurveyType,Location,ClientContactID,FirstName,LastName,HomePhone,WorkPhone,CellPhone,Email"); <!---This is the header of the new CSV ---> …Run Code Online (Sandbox Code Playgroud) 有没有办法通过使用CFLocation将用户重定向到新窗口?据我所知,你不能target=_blank在CFLocation中使用.还有另一种方法吗?
这是我的代码:
<cfif cgi.PATH_INFO eq "/procedure-page.cfm">
<cflocation url="http://www.example.com/example/example.cfm?id=XXXXXX&contactid=#returnStruct.contactID#&doctorid=#officeLocation#" addtoken="no" >
<cfelse>
<cflocation url="http://www.example.com/example/example.cfm?id=#example#&contactid=#returnStruct.contactID#&doctorid=#officeLocation#" addtoken="no" >
</cfif>
Run Code Online (Sandbox Code Playgroud) 这是我的代码:
returnStruct.myList = myList;
returnStruct.first = trim(ListGetAt(myList,3));
returnStruct.last = trim(ListGetAt(myList,13));
returnStruct.address = trim(ListGetAt(myList,15));
returnStruct.city = trim(ListGetAt(myList,2));
returnStruct.state = trim(ListGetAt(myList,9));
Run Code Online (Sandbox Code Playgroud)
一切正常,直到myList达到空值,然后一切都崩溃了.我发现了一个命令"includeEmptyValues"我可以设置为"是",但我不熟悉它和ColdFusion 9的文件是不是我遇到的最好.
我需要一些oracle sql的帮助.问题:我有2个员工和部门表.我从一个查询得到了平均部门薪水,我想用它来看看有多少员工赚的钱多于他们部门的平均水平.到目前为止我有这个.
此查询返回部门的平均值:
select ROUND(AVG(Salary), 2) Dept_avg_sal
from employee, department
where department.department_id = employee.department_id
group by department_name
Run Code Online (Sandbox Code Playgroud)
我想做的是:
select employee_name,
salary,
d.department_name
from employee e,
department d
where salary > (select ROUND(AVG(Salary), 2) Dept_avg_sal
from employee,
department
where department.department_id = employee.department_id
group by department_name)
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:01427.00000 - "单行子查询返回多行"
我知道同一部门的2名员工赚的钱多于平均水平,我认为这是造成这个问题的原因.
EMPLOYEE_NAME - SALARY - -DEPARTMENT_NAME- DEPT_AVG_SAL
-------------------- ---------------------- -------------------- ------------
FISHER - 3000.00 - SALES - 2500.00
JONES - 3000.00 - ACCOUNTING - 2750.00
KING - 5000.00 - EXECUTIVE - 4500.00
**SCOTT …Run Code Online (Sandbox Code Playgroud) 我需要创建一个在影子表中写入更改的触发器.我知道如何创建触发器但我的挑战是我需要新表中的记录即使在回滚后仍然存在.
这是输出结果的示例
INSERT INTO department VALUES (95, 'PURCHASING', 'CHICAGO');<br>
ROLLBACK;
1 rows inserted.
rollback complete.
SELECT * FROM department_log;
DEPARTMENT_ID DEPARTMENT_NAME ADDRESS OPERATION_TIME
---------------------- -------------------- -------------------- ------------------
90 HR CHICAGO 03-NOV-11
95 PURCHASING CHICAGO 03-NOV-11
SELECT * from department WHERE department_id >= 90;
DEPARTMENT_ID DEPARTMENT_NAME ADDRESS
---------------------- -------------------- --------------------
90 HR CHICAGO
Run Code Online (Sandbox Code Playgroud) 我试图用jquery从嵌套列表中选择一个项目,但到目前为止我无法做到
这是我到目前为止所尝试的
jQuery的:
$(document).ready(function() {
var $target= ("div>ul>li>ol>li:nth-child(4)");
$target.fadeOut('fast');
});
Run Code Online (Sandbox Code Playgroud)
这是我的HTML代码:
<div>
<ul>
<li>
<ol>
<li>something</li>
<li>something</li>
<li>something</li>
<li>something</li> <--- This is what I am trying to access
</ol>
</li>
<li>something else</li>
<li>something else</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud) 我有一个div,每当用户从下拉菜单中选择不同的选项时,它会显示不同的html.我想要实现的是操纵div输出的id.
这是我的html下拉代码:
<select name="surveys" id="surveys" required>
<option value="">Select a Survey</option>
<cfloop query="application.clientAdminSurveys">
<option value="#name#">#name#</option>
</cfloop>
</select>
Run Code Online (Sandbox Code Playgroud)
这是控制下拉列表的JS:
$('#surveys').change(function (event) {
var survey = $('#surveys').val().toLowerCase();
if(survey.indexOf('consultation') !== -1 && survey.indexOf('cancellation') === -1 ){
$('.type').show();
$('.type').html('<input type="text" id="consultServiceType" name="consultServiceType" placeholder="Consult Service Type" /> <input type="text" id="eventDate" name="consultDate" placeholder="Consult Date" /><input type="text" id="consultantName" name="consultantName" placeholder="Consultant Name" /> ');
}else if(survey.indexOf('cancellation') !== -1){
$('.type').show();
$('.type').html('<input type="text" id="eventDate" name="cancellationDate" placeholder="Cancellation Date" />');
}else if(survey.indexOf('procedure') !== -1 && survey.indexOf('cancellation') === -1){
$('.type').show();
$('.type').html('<input type="text" id="serviceType" name="serviceType" …Run Code Online (Sandbox Code Playgroud) 我有一个小函数,使用ColdFusion 9和jQuery从我的数据库中删除记录
该函数存在于其他3个位置,它是相同的并且按预期运行,但它似乎与此页面有错误.
Html表单代码
<form name="devRatingCat" method="post" action="" >
<table class="table table-bordered table-striped" >
<tr>
<th> </th>
<th>ID</th>
<th>Category Name</th>
</tr>
<cfloop query="categories">
<tr>
<td><input class="checkbox" type="checkbox" name="mark" value="#recID#"></td>
<td>#recID#</td>
<td>#categoryname#</td>
</tr>
</cfloop>
</table>
<hr />
<div class="pull-left">
<button class="btn btn-danger" type="button" onClick="dlteCatR(mark);" >Delete</button>
</form>
Run Code Online (Sandbox Code Playgroud)
jQuery的
function dlteCatR(field)
{
var $srt = $(field);
var r = confirm("Are you sure you want to delete this Category? \n You will not be able to revert this change!")
if(r==true){
for(i=0; i<$srt.length; i++){
if($srt[i].checked == …Run Code Online (Sandbox Code Playgroud) 我正在尝试学习如何使用,scriptProtect但我想知道是否还有其他事情我需要做的,以尽可能保护我的应用程序.此外,scriptProtect是否充当HTMLEditFormat,还是完全独立的东西?
最后我的应用程序是在另一个应用程序ex: example.com/myapp/index.cfm,我想,我必须添加scriptProtect主体下application.cfc的example.com正确吗?如果是这样,我是否应该从主应用程序中获得由此标记引起的错误?我应该编写一个扩展的组件,并在application.cfc其中添加并添加scriptProtect吗?
coldfusion ×6
coldfusion-9 ×6
jquery ×3
javascript ×2
oracle ×2
cflocation ×1
oracle10g ×1
sql ×1
triggers ×1