Author: Pintu Kumar

Upload Multiple Selected Files in Coldfusion

Upload Multiple Selected Files using HTML5 input field that select multiple files to upload and coldfusion uploadall file action. select multiple files using HTML5 input field <form name="imageForm" action="new.cfm" method="post" enctype="multipart/form-data"> <input type="file" name="image" multiple="multiple" accept="image/jpeg, image/gif, image/png, application/zip" /><br /> <input type="submit" name="submit" value="Submit" /> </form> Upload Multiple Selected Files – Ccoldfusion <cfset uploadPath=

Create comma seprated file CSV Using PHP MySqli

Create comma seprated file using fwrite php function using with mysql query. It is very easy way to create CSV file. <?php $con = new mysqli("127.0.0.1","root","cx(ymc@!","demodb"); if ($con->connect_error) { die("Connection failed: " . $con->connect_error); } $sql = "SELECT phoneNo_int,fName_vch,lName_vch FROM users"; $result = $con->query($sql); $bufferDATA = ""; $exportPath = $_SERVER["DOCUMENT_ROOT"]."/demo/uploads"; $inpFileName = "users.csv"; $bufferDATA =

Get random records from mysql for day and Month and Year

Get random records for current day and for current month and for current year using by order by rand() function. Get random records from mysql. $Con=mysqli_connect("127.0.0.1","root","elearn@!xyz&^","elearnDB"); $SQL="SELECT blogName FROM Blogs ORDER BY RAND() LIMIT 5"; $Result = mysqli_query($Con,$SQL); while($row = mysqli_fetch_array($Result)) { echo $row["blogName"]; echo "<br>"; } Get random records for current day from mysql.

Create text image center using coldfusion imageDrawText

Create text image center using imageSetDrawingColor, imageDrawText, imageNew, writeToBrowser, coldfusion, structNew. Create text image center – Coldfusion <cfset text = "P"> <cfset imageWidth = 100 /> <cfset imageHeight = 100 /> <cfset txtWidth = 30 /> <cfset txtHeight = txtWidth /> <cfset textImg = imageNew("",imageWidth,imageHeight,"rgb","red")> <cfset x=max(textImg.width,textImg.height)> <cfset newheight=textImg.height*txtHeight/x> <cfset newwidth=textImg.width*txtWidth/x> <cfset newx = (textImg.width/2

Create text image in center using php imagettfbbox

Create text image in image center using imagedestroy, imagejpeg, imagettftext, imagettfbbox, imagefill, hexdec, imagesx, imagesy, strtoupper, font, imagecreatetruecolor. imagettfbbox() Function return array index values means 0 – lower left corner, X position 1 – lower left corner, Y position 2 – lower right corner, X position 3 – lower right corner, Y position 4 –

Autocomplete Textbox Jquery with Database Coldfusion

Autocomplete Textbox Jquery with Database Coldfusion using cfcomponent, coldfusion, StructNew ,cffunction, ArrayAppend, mysql, cfqueryparam, Jquery, Jquery Autocomplete. Autocomplete Textbox Jquery/HTML <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <cfform name="actoComp"> <table border="0" cellpadding="0" cellspacing="10"> <tr> <td>Account No<br> <cfinput type="text" name="accountNo" id="accountNo"> </td> <td><br><input type="submit" name="Submit" value="SUBMIT"></td> </tr> </table> </cfform> <script> $(document).ready(function() { $( "#accountNo" ).autocomplete({

Autocomplete Textbox Jquery with Database PHP

Autocomplete Textbox Jquery with Database php using Jquery, mysql, json_encode, htmlentities, stripslashes, strip_tags, trim, mysqli_connect, mysqli_query, autocomplete and array_push. Autocomplete Textbox – HTML/Javascript Code: <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <link

Bootstrap Table Server Side With Coldfusion Component and SQL Server

Bootstrap Table Server Side With Coldfusion Component and SQL Server. BS Table have licensed under the The MIT License. Bootstrap Table Server Side HTML/JavaScript code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>Bootstrap Table Server side with php and mysql</title> <!-- Bootstrap

Stored Procedures Benefits – Execution Speed

Stored Procedures have many benefits of using a stored procedures like increased execution speed, fast access data, consistency etc. Advantages of Stored Procedures 1. Execution Speed Increased execution speed is the most useful advantage. and they are optimized the first time they are compiled. They are cached on the server. 2. Security One of the

Web Service – Create And Call Web Service In Coldfusion

Create Web Service : Create a coldfusion component function with access “remote” and call webservice using cfscript with arguments, cfobject with arguments, cfhttp with arguments, cfinvoke with arguments. Create Web Service componentCFC.cfc <cfcomponent> <cffunction name="webServiceCFCFunction" access="remote" returntype="string" output="no"> <cfargument name="userName" type="string" required="yes"> <cfreturn "Welcome Mr. " & userName> </cffunction> </cfcomponent> Coldfusion have may diffrent ways

Get Last Insert Id From Database Table Using Coldfusion

Get Last Insert Id From MSSQL, Oracle, Sybase, Informix and MySQL Table Using Coldfusion with identifycol, rowid, sys_identity, serial_col, generated_key, @@identity, SCOPE_IDENTITY() Get Last Insert Id From Database Table Using Coldfusion <cfquery name="insertDatabase" datasource="MyDSN" result="queryResult"> INSERT INTO employee ( FName, LName ) VALUES ( 'sql', 'server' ) </cfquery> <cfoutput> #queryResult.GENERATED_KEY# - From MySQL #queryResult.identifycol# -

Create Coldfusion Database DSN Programmatically

Create Coldfusion Database DSN programmatically using structNew(), createObject(), component, setMySQL5(), verifyDSN(). Create Coldfusion Database DSN Programmatically <!---Login to administrator ---> <cfset adminAPI = createObject( 'component', 'cfide.adminapi.administrator' ) /> <cfset adminAPI.login( 'YourPassword' ) /> <cfset dsnName = "myTestDSN"> <cfscript> dsnAPI = createObject( 'component', 'cfide.adminapi.datasource' ); dsnStructure = structNew(); dsnStructure.driver = "mysql5"; dsnStructure.name="#dsnName#"; dsnStructure.host = "127.0.0.1"; dsnStructure.port

Create Quadrant Dynamically With Ajax Request

Create Quadrant Dynamically With Ajax Request using javascript type=”text/template”, javascript append function, javascript replace function and getJSON. Create Quadrant Dynamically With Ajax Request <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <input class="smsReports" type="checkbox" id="1" value="Deliverd">Deliverd <input class="smsReports" type="checkbox" id="2" value="UnDeliverd">UnDeliverd <script type="text/template" id="reportQuadrant"> <div class="col-sm-12 col-md-12 col-lg-4" id="{{reportID}}"> <div class="panel panel-primary" style="min-height:490px;"> <div class="panel-heading"> <h4 class="text-center">{{reportTitle}}</h4> </div>

ISO 8601 datetime String format in coldfusion

Convert Convert ISO 8601 datetime format into iso datetime format using coldfusion dateconvert, dateformat and timeformat. ISO 8601 datetime String format in coldfusion <cfset date = now() /> <cfset datetime = dateConvert( "local2utc", date )> <cfoutput> #dateFormat( datetime, "yyyy-mm-dd" ) & "T" & timeFormat( datetime, "HH:mm:ss" ) & "Z"# </cfoutput> Output: 2015-06-09T14:22:59Z

Read xlsx file in coldfusion and insert into database

Read xlsx file and insert into database using coldfusion, cfspreadsheet, database, cfquery, cfloop and startrow. Read xlsx file in coldfusion and insert into database <cfset importpath = "files\newFile.xlsx"> <cfspreadsheet action="read" src="#importpath#" query="data" headerrow="1"> <cfset colList = "EMAIL_ADDR,FIRST_NAME"> <cfoutput> <cfloop query="data" startRow="2"> <cfquery name="insertData" datasource="MBASPSQL2K"> INSERT INTO tempTable ( email_vch, name_vch ) VALUES ( '#data['EMAIL_ADDR'][currentRow]#', '#data['FIRST_NAME'][currentRow]#'

Twilio SMS API Integration With Coldfusion

Sending SMS And Receiving SMS Text Messages using Twilio API with Coldfusion using cfhttp. To get twilio SMS API: Login to twilio.com Go to account on click right side dropdown menu (username) link. Go to API Credentials portion and get AccountSID and AuthToken. Create A Sent Message Form: <cfif StructKeyExists(url,'sent')> <font color="#99CC33">Message Sent</font> </cfif> <cfform

Multiple Dialog Box Jquery UI On Single Page

Creating multiple jquery UI dialog box on single page and open it on click event one by one using loop, classes and id attribute. Multiple Dialog Box Jquery UI On Single Page <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Multiple jQuery UI Dialog</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <script type="text/javascript"> $(function() { var

Populate second select box list from the first box in coldfusion

Populate second select box list using bind with Coldfusion component from the first select box in Coldfusion Populate second select box list from the first box html/coldfusion code: <cfform> <cfquery name="getClients" datasource="DSNName"> SELECT clientId_int,clinetName_vch FROM Clients </cfquery> <table> <tr> <td>Select Client</td> <td> <select name="ClientID" id="ClientID"> <option value="0">Select Client</option> <cfoutput> <cfloop query="getClients"> <option value="#getClients.clientId_int#">#getClients.clinetName_vch#</option> </cfloop> </cfoutput>

Difference between StructCopy() AND Duplicate()

StructCopy(): Creates a clone of the structure by reference. Duplicate(): Creates a clone of top-level keys, values, and arrays in the structure by value; copies nested structures by reference. StructCopy() AND Duplicate() <cfset original = StructNew()> <cfset original.nested = StructNew()> <cfset original.nested.item = "original"> <cfdump var="#original#" label="Orignal Structure Without Modified"><br><br> <cfset copy = StructCopy(original)><!---Copy Structure