ColdFusion Google Adwords Business Component Error - coldfusion

I am using Martin Orth's ColdFusion API for Google Adwords. I have been able to fix some errors to get the API working in most cases, but am running into a roadblock when I try to use the business.cfc component. I try to create the component the same way I have successfully created them for other components of the API with the syntax:
cfset oBusiness=createObject("component","com.google.adwords.api.v12.business")>
The results in a:
coldfusion.xml.rpc.CFCInvocationException: [java.lang.ClassNotFoundException : com.google.adwords.api.v12.business][coldfusion.runtime.CfJspPage$NoSuchTemplateException : Could not find the ColdFusion Component or Interface long.]
even though the business.cfc file is located as the specified path and has not been modified. Has anyone been able to get this component to work? If so, can you post a copy of your business.cfc file? Thanks in advance.

I just rewrote the entire code minus comments and hints (in past files there were many illegal chars) in a new file and it worked fine.

There is a new version (V201101) of the AdWords API library for ColdFusion at http://www.cfsolutions.de/coldfusion_adwords_api/docs/index.cfm

Related

content empty when using scrapy

Thanks for everyone in advance.
I encountered a problem when using Scrapy on Python 2.7.
The webpage I tried to crawl is a discussion board for Chinese stock market.
When I tried to get the first number "42177" just under the banner of this page (the number you see on that webpage may not be the number you see in the picture shown here, because it represents the number of times this article has been read and is updated realtime...), I always get an empty content. I am aware that this might be the dynamic content issue, but yet don't have a clue how to crawl it properly.
The code I used is:
item["read"] = info.xpath("div[#id='zwmbti']/div[#id='zwmbtilr']/span[#class='tc1']/text()").extract()
I think the xpath is set correctly and I have checked the return value of this response and it indeed told me that there is nothing under this directory. Results shown here:'read': [u'<div id="zwmbtilr"></div>']
If it has something, there should be something between <div id="zwmbtilr"> and </div>.
Really appreciated if you guys share any thoughts on this!
I just opened your link in Firefox with NoScript enabled. There nothing inside the <div #id='zwmbtilr'></div>. If I enable the javascripts, I can see the content you want. So, as you already new, it is a dynamic content issue.
Your first option is try to identify the request generated by javascript. If you can do that, you can send the same request from scrapy. If you can't do it, the next option is usually to use some package with javascript/browser emulation or someting like that. Something like ScrapyJS or Scrapy + Selenium.

Coldfusion CFC Mapping to external directories with CFCs that reference other folders

I've done some poking around and trial and error but I'm not coming up for a solution to this problem I have.
I have a folder structure like this (example)
Application.cfc
Objects\
Object.cfc
Utilities\
Util.cfc
API\
Resources\
index.cfm
Application.cfc
I have one site that points to the API folder (http://api.site.com) and another that points to the overall root (http://site.com)
From Api\Resource\index.cfm. I'm trying to createObject() on Objects\Object.cfc. I set up a mapping, either in CF Admin, or API\Application.cfc with this.mappings["/SiteRoot"] = "C:\wwwroot". Inside the index.cfm I do createObject("component","SiteRoot.Objects.Object"). This correctly access the Object.cfc.
The issue I'm having is that it fails because Object.cfc instantiates the Utilities\Util.cfc just by createObject("component","Utilities.Util"). The error is that Utilities.Util cannot be found.
There are other files in the very bottom root that can obviously call Object.cfc with no problems since it just goes into the Utilities folder naturally.
Any suggestions Or do I really need to just break the API Folder out of this root entirely?
Thanks!
UPDATE
It's not letting me answer my own question just yet but I wanted to post here before others chimed in.
Despite reiniting the application and restarting the application server, once or twice it wasn't working. Then suddenly, it just went and worked as I would have expected. Object.cfc could find Util.cfc correctly based on it's relative path.
I gave upvotes to those who responded as they were perfectly viable alternatives and solutions and would have gone with one of them had this not just started working. Demons, I tell you. Demons.
Thanks!
I think I would change your second create object call (the utilities one) to createObject("SiteRoot.Utilities.Util") ? Making sure that one mapping "governs" the starting point for all the objects no matter where instantiated.
If you really cannot change your code then just create a ColdFusion mapping called Utilities pointed at the Utilities folder.

org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Template not found

I am using Grails 1.3.7 and deploy to JBoss 5.1.1. when I try to access a page myPage.gsp in one of the plugins. I got the Template not found error.
the page is working ok when using grails run-app. and the template file are definitely in th correct location and it is NOT missing.
I had searched around this issue, there is nothing really out there. I am new to Grails, I cant understand why this file is not found as it is there.
File structure as following:
grailsPlugins
myplugin
grails-app
views
templates
_myTemplate.gsp
mypages
myPage.gsp
in the myPage.gsp, I have a line like this:
<g:render template="/templates/myTemplate"/>
Can anyone help on this?
I've encountered this same issue before, so just for reference for others, while adding the optional attribute plugin="myplugin" works to resolve the plugin location, it won't allow the application that installs the plugin to customize the myTemplate template(if there is ever a need to as there was in my case!)
I found that copying the templates over to the application on install or via a script, just like Spring Security copies login template when you run the s2-quickstart was the easiest way to completely resolve the issue.

ColdFusion 8 JavaLoader LingPipe or OpenNLP, how do I init it?

I'm using the JavaLoader.cfc. I've used it before, but am having trouble understanding how to get one of these libraries to respond to me.
I've placed the JAR files into my java folder. I've created the "JavaLoader" object and passed the "paths" to it. But it keeps saying it cannot find the class names in the jar files or something along those lines...
The requested class could not be found. The requested class
opennlp.tools.sentdetect could not be found in the loaded
jars/directories.
I recognize I'm a total n00b when it comes to Java and how to tie it in with ColdFusion. I'm sure it's something stupid that IF I KNEW I could probably use any JAR file at my disposal...
Please help if you can!
I checked the OpenNLP javadocs here and it seems that opennlp.tools.sentdetect has no constructor so that's why it returns an error. Which method do you want to call?
I've done a simple example to detect sentences but for that you need to get the english model available here :
<cfscript>
// load NLP jar libraries
sourcePaths = [expandPath("opennlp-tools-1.5.0\opennlp-tools-1.5.0.jar"),expandPath("opennlp-tools-1.5.0\lib\maxent-3.0.0.jar"),expandPath("opennlp-tools-1.5.0\lib\jwnl-1.3.3.jar")];
javaloader = createObject("component", "javaloader.JavaLoader").init(sourcePaths);
// load our model (here english model)
// you can create your own model using the TrainerTool
inputFile = ExpandPath("en-sent.bin");
modelIn = createObject("java", "java.io.FileInputStream").init(inputFile);
model = javaloader.create("opennlp.tools.sentdetect.SentenceModel").init(modelIn);
// let's try the sentence detector
sentenceDetector = javaloader.create("opennlp.tools.sentdetect.SentenceDetectorME").init(model);
sentences = sentenceDetector.sentDetect("I love working with Java in ColdFusion! CF rocks, really! But sometimes working with Java libraries is a bit tricky :-)");
</cfscript>
<cfdump var="#sentences#">
Have fun! :-)
No Java expert here either , but I did get POI to work by following Rays instructions here There's two articles. He covers setting up Javaloader
You issue may just be in the path to the JAR. Also be sure that you are passing the path to the JAR file as a string in an array.
Tip 1: You do not need to place the file in your java folder. Being able to place the JAR file in any directory (application root perhaps), is what JavaLoader gives you the power to do. Otherwise you might as well not use JavaLoader and just place the JAR files into the JVM classpath.
Tip 2: Be sure that initialize JavaLoader into the server scope, as it will reduce your overhead dramatically.

Translate xml content using web service API from Ektron CMS400.Net

First of all: I'm on Ektron CMS v8.1
I'm having a problem with dynamicly adding translated content to the cms via the Webservice API. I can perfectly add xml content by using the following object and method:
ContentSoapClient csc = new ContentSoapClient("ContentSoap");
csc.AddContent3(...);
I specify a language and the xml content gets inserted. But now I want to add a translated version of the xml to the cms. So I want it to have the same contentId!
Anyone has an idea on this? The only method in the csc object that recieves a contentId is 'csc.AddContent2(..)' But that doesn't import anything and just gives me an error saying my xml is incorrect. While my xml is correct..I checked it!
Thanks!
Found the answer..
Ektron apparantly uses alot of asmx files and I only checked the "/workarea/webservices/WebServiceAPI/Content/Content.asmx" webservice. I found the method 'AddTranslatedXMLContent()' I need in the "/Workarea/webservices/ContentWS.asmx" webservice.
I wish they just cleaned up their API... Would save us a lot of trouble.
Firstly, I haven't used the ContentSoapClient class and can't find any documentation on it.
Ektron often takes a language id when you create the API object. See if the ContentSoapClient contructor can take a Language Id.