Friday, 20 February 2015

0x8007052e error In IIS

Hi,

 I got to resolve '0x8007052e' error. This error was coming only to virtual directories in IIS.














Normally reason for this type of error will be changing of Admin password of your system.

So how to resolve this error.

IIS Manger->Default Website->[Directory Name]
















Change password with newly changed Admin password
















Now you can run your file with out getting any error.

Note: If Admin passwords are used in CF admin data source and SQL. You have to change that also to use Datasource.

ChartJS & Google Visualization

Hi,


I got a chance to learn  ChartJS and Google Visualization. Both are basically for preparing charts using data, so user can feel more better with their data. How things are going point by point.


ChartJS

It have 6 types of different Chart, we can build charts directly. Documentation is also very handy, very easy to understand.

Documentation: http://chartjs.org/docs/

For linking: <script type="text/javascript" src="http://chartjs.org/assets/Chart.js"></script>

I have a fiddle to show

http://jsfiddle.net/ramakrishnap/0Lfzx74v/


Google Visualization(Google Charts)

In this there are many kinds of Charts,Graphs it also have pagination techniques. Understanding documentation takes time, implementation needs much care. It is rich with UI and functions.

Documentation: http://developers.google.com/chart/interactive/docs/reference

For linking: <script type="text/javascript" src="https://google.com/jsapi"></script>

I have a fiddle to show

http://jsfiddle.net/ramakrishnap/4gtLc9ss/









Tuesday, 10 February 2015

SMPP & CF


SMPP(Short Message Peer-to-Peer) protocol. The primary use of SMPP is to send and receive medium-to-high volumes of SMS texts.

The protocol is based on pairs of request/response PDUs (protocol data units, or packets) exchanged over OSI layer 4 (TCP session or X.25 SVC3) connections.

SMSC(SMS Centre) providers use both HTTP and SMPP for sending and receiving SMS texts.


  • Advantages of SMPP over HTTP
  • High-volume SMS messaging with a high speed. 
  • Delivery report with much info.
  • Network related info.
  • Efficient use of PDU over HTTP post.


Setting up SMPP event gateway in CF admin

For setting up Event Gateway we need a cfc file to receive acknowledgements/messages and a cfg file having configuration of port and shortcode of SMSC.

Go to 



CF ADMIN>Event Gateways > Gateway Instances


The major function of the cfc are:

onIncomingMessage:Every incoming message from SMSC and Delivery ack is handled by this function.Signature : public  function onIncomingMessage(required struct CFEvent)
Note :We can have other functionalities in CFC for logging and fetching the information.  


The CFG file should contain :


# Type of binding.Value can be either transciever,transmitter or receiverbinding=transciever
# This is the IP address of SMSCip-address=102.208.328.100
# Port to bind toport=80001
# Your system idsystem-id= demo_99647878
# Your passwordpassword= MinDFire6824

Note : Port differs depending on Shortcode.


Sending and Recieving Messages in SMPP

We need to buy a ShortCode  from SMSC, and get configuration details for ShortCode. CFC and CFG files are configured in cfadmin as above. We will use 'SUBMIT' and 'SUBMITMULTI' commands for individual and group broadcasts respectively.

Demo  for Sending and receiving messages

send.cfm
 <cftry>  
   <cfscript>  
      VARIABLES.cellNumList ='1234567890'; //CellNumber list  
      VARIABLES.msg = structNew();  
      VARIABLES.msg.command = "submit";  
      VARIABLES.msg.destAddress = VARIABLES.cellNumList;  
      VARIABLES.msg.shortMessage = 'Test Message from SMPP';  
      VARIABLES.msg.alertOnMsgDelivery = "1"; //To get delivey ack  
      VARIABLES.msg.sourceAddress = '1234'; //Shortcode Registered  
      VARIABLES.msg.registeredDelivery = "1";  
      VARIABLES.result = sendGatewayMessage("SMS Menu App", VARIABLES.msg);  
   </cfscript>  
   <cfoutput>  
    <!---We will get orderno, if success else empty response --->  
    Result - #InputBaseN( VARIABLES.result , 16 )#  
   </cfoutput>  
 <cfcatch type="any" >  
   <cfoutput>Oops!! Something went wrong #CFCATCH.message#</cfoutput>  
 </cfcatch>  
 </cftry>  

recieve.cfc


component  hint="SMS Event Gateway CFC" output="false"

{
 /**
 @hint Standard Message From CF server
 @Displayname onIncomingMessage
 @output false
 */
 public  function onIncomingMessage(required struct CFEvent)
 {
   try
   {
  var data = ARGUMENTS.CFEvent.DATA;
 /* If the message came from a handset and Operator,Network info is there */
  if(isDefined("data.data.optionalParameters")){
    writeLog(text='Incoming handset message from #data.data.sourceAddress# message is #data.data.Message#',file='incomingMessageLog'); 
    }
 /* When message doesnt contains optional parameter, only delivery notification*/
  else{
    writeLog(text='Delivary ack from #data.data.sourceAddress# and status is #data.data.message#',file='incomingMessageLog');
   }
  }
  catch(any ex)
  {
   /* Log the return Value into the Log file*/
    writeLog(text='Oops!! Something went wrong #CFCATCH.message#',file='incomingMessageLog');
  }
  
 } 
}


PDU(Protocol Data Unit)'s of SMPP












SUBMIT_SM:
This is used in individual broadcast of SMS.



SUBMIT_MULTI:
This is used in Group broadcast of SMS.

PDU of Received Acknowledgement:


This is the PDU we get in recieve.cfc after SMS delivered to user's cell number. We can get Info about the delivered time, status and error.

PDU of Received Message:

This is the PDU we get when the Shortcode assigned receives a message from User. We will have 'Message' which is texted. We can decrypt 'optionalParameters' for getting vendor info and other info related to Wireless Network .

Resource:
http://docs.nimta.com/SMPP_v3_4_Issue1_2.pdf
http://www.activexperts.com/sms-component/smpp-specifications/introduction/
http://help.adobe.com/livedocs/coldfusion/8/htmldocs/help.html?content=UseSMSGateway_06.html
http://help.adobe.com/livedocs/coldfusion/8/htmldocs/help.html?content=gateways_79.html#1172422

Sending List to Stored Procedure in CF

In CF we can acess stored procedures through <cfstoredproc> and we give param values in <cfprocparam> tags. We get some situations of passing list in <cfprocparam> as we don't have 'list' attribute in it. For sending list and acessing list in Stored procedures we have to use functions of SQL which is quite complex and time consuming.

We can make work around to achieve this using CF and Dynamic query in Stored procedures.
For passing Integer list value:
In CFM side

   <cfset VARIABLES.listValue = "1,2,3,4,5,6,7,8,9,10">  
 <cfstoredproc procedure="getClients" datasource="practise" >   
 <cfprocparam variable="ids" cfsqltype="cf_sql_VARCHAR" value=#VARIABLES.listValue# > <cfprocresult name="VARIABLES.getClients"></cfstoredproc>  
 <cfdump var="#VARIABLES.getClients#" > 
  

In SQL side
CREATE PROCEDURE [dbo].[getClients]  
 @ids varchar(255)  
 AS  
 BEGIN  
 declare @sql varchar(max)  
   set @sql = 'select * FROM Clients where id IN ('+@ids+')'  
   EXEC(@sql)  
 END  

For passing String list value:

In CFM side
 <cfset VARIABLES.listValue = 'ram,krishna,ramki'>  
 <cfset VARIABLES.listValue = replace(VARIABLES.listValue, ",", "','", 'all')>  
 <cfstoredproc procedure="getClients" datasource="practise">  
  <cfprocparam variable="ids" cfsqltype="cf_sql_VARCHAR" value=#VARIABLES.listValue#>  
  <cfprocresult name="VARIABLES.getClients">  
 </cfstoredproc>  
 <cfdump var="#VARIABLES.getClients#">  

In SQL side

 CREATE PROCEDURE [dbo].[getClients]  
 -- Add the parameters for the stored procedure here  
 @names varchar(255)  
 AS  
 BEGIN  
 declare @sql varchar(max)  
   set @sql = 'select * FROM Clients where companyName IN ('''+ @names +''')'  
 EXEC(@sql)  
 END