Skip to content

Instantly share code, notes, and snippets.

@wellercs
wellercs / javaloader-elasticsearch-ClassNotFoundException
Last active January 30, 2016 00:20
elastic search class not found exception using JavaLoader
java.lang.ClassNotFoundException: org.elasticsearch.common.settings.ImmutableSettings at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.ClassLoader.findSystemClass(ClassLoader.java:1059) at com.compoundtheory.classloader.NetworkClassLoader.loadClass(NetworkClassLoader.java:488) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at coldfusion.runtime
<cfscript>
REReplaceNoCase("{{cms:winter_wonderland}}", "{{cms:(\w+)}}", "#getThemeData(theme='\1')#", "all");
function getThemeData(required string theme) {
writedump(arguments);
}
</cfscript>
@wellercs
wellercs / cfml-append-vs-addAll
Created December 3, 2015 23:50
CFML - array append versus addAll
<cfscript>
arr1 = [1];
arr2 = [2,3];
arr1.append(arr2);
writedump(arr1);
arr3 = [1];
arr4 = [2,3];
arr3.addAll(arr4);
writedump(arr3);
<cfscript>
// testxy gives expected results
testxy.actual_dimensions = "144xy210";
testxy.actual_dimension_width = listFirst(testxy.actual_dimensions, "x", true);
testxy.actual_dimension_height = listLast(testxy.actual_dimensions, "x", true);
writedump(testxy);
// testxx does not give expected results
// expected testxx.actual_dimension_height to be x210
testxx.actual_dimensions = "144xx210";
<cfscript>
// inside Application.cfc is service constructor
application.EnterpriseService = new path.to.EnterpriseService();
// inside site code somewhere
application.EnterpriseService.call(api_id=#, custom_args={});
// EnterpriseService.cfc
init() {
// some shared constants set here
@wellercs
wellercs / Twitter-cfc
Created November 4, 2013 04:46
Twitter CFC
<cfcomponent displayname="Twitter" output="false" hint="I provide functions for interacting with the Twitter API.">
<cfscript>
this.name = "Twitter";
variables.baseURI = "https://api.twitter.com/";
variables.charset = "UTF-8";
variables.version = "1.1";
</cfscript>
<cffunction name="init" access="public" output="false" returntype="any" hint="I initialize the component">
<cfargument name="apiKey" required="false" type="string" default="" hint="I am the API key to the Twitter API that was provided to us by Twitter.">
@wellercs
wellercs / cf_cfqueryparamWithSQLVar
Created November 1, 2013 16:06
Example of declaring and setting a SQL variable with cfqueryparam since there seems to be performance issues with large data sets when using cfqueryparam in a sub-select.
<cfset arguments.IsSold = 1>
<cfquery name="local.qryTraditional" datasource="cfartgallery">
SELECT
a1.ArtistID
, a1.FirstName
, a1.LastName
, (
SELECT TOP 1 LargeImage
FROM Art
WHERE IsSold = <cfqueryparam cfsqltype="cf_sql_bit" value="#arguments.IsSold#">
@wellercs
wellercs / Response-cfc-jquery-example
Created April 6, 2013 21:47
jQuery example of calling a function that consumes Response.cfc
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
url: '/sandbox/Demo.cfc', // this can be found at https://gist.github.com/wellercs/5327556
data: {
method: 'validateDemo',
fname: "John",
lname: "Doe",
email: "bademail",
@wellercs
wellercs / Response-cfc-example
Created April 6, 2013 20:43
Example of working with Response.cfc
<cffunction name="validateDemo" access="public" returntype="any" output="false">
<cfargument name="fname" type="string" required="true">
<cfargument name="lname" type="string" required="true">
<cfargument name="email" type="string" required="true">
<cfargument name="throwerror" type="boolean" required="false" default="false">
<cfset var local = {}>
<cftry>
<cfset local.responseobject = new Response()>
<cfchart format="png" chartwidth="270" xaxistitle="Visits last 7 Days" show3d="no" foregroundcolor="##333333" showborder="no" fontbold="yes" tipStyle="none" url="" showLegend="true">
<cfchartseries type="line" query="chartData" itemcolumn="dateRange" valuecolumn="FLASHvisits" datalabelstyle="none" seriesLabel="FloorPlan">
<cfif chartData.showVTS><cfchartseries type="line" query="chartData" itemcolumn="dateRange" valuecolumn="VTSvisits" seriesColor="blue" datalabelstyle="none" seriesLabel="IDS"></cfif>
<cfif chartData.showMobile><cfchartseries type="line" query="chartData" itemcolumn="dateRange" valuecolumn="MOBILEvisits" seriesColor="red" datalabelstyle="none" seriesLabel="Mobile"></cfif>
</cfchart>
<!---
The line that the stack trace says it's erroring on is:
<cfif chartData.showMobile><cfchartseries type="line" query="chartData" itemcolumn="dateRange" valuecolumn="MOBILEvisits" seriesColor="red" datalabelstyle="none" seriesLabel="Mobile"></cfif>
--->