I am new to Taffy API framework. Trying to run the examples with Lucee but I get this error
invalid component definition, can't find component [resources.throwsException]
But it works all fine with ColdFusion.
May I miss something that it's very obvious. Or some mappings are required in Lucee but not in ColdFusion.
Thanks.
Below are the screen caps for additional details.
The webroot is folder name is play_taffy, under webroot, it is taffy with the lib and examples folder.
There are a lot of things going on here, so let me unpack them one by one. Taffy is very powerful and has a lot of functionality. It is worth the time. The examples on the other had also try to cover a lot of stuff. They kind of use a non standard approach to the directory structure.
Short answer
Based on your error message, one of two thing are happening, either ./Taffy/examples/api_LogToEmail/resources/savesLog.cfc does not exist or it has a path mapping in <cfcomponent extends="taffy.core.resource" taffy_uri="/foo"> that is not resolving.
Long answer
I see that you are using Ortus CommandBox. (Shameless plug follows). I have written code and have code on how to do this. If you go to https://github.com/jmohler1970/Taffy_video , You can find the first video.
If you go to https://coldfusion.adobe.com/profile/jamesmohler and click on blog, you will find eight videos on this very topic.
Some code
Over on, https://github.com/jmohler1970/Taffy_video Taffy,
Consider the following directory structure:
box.json has
{
"dependencies":{
"taffy":"git://github.com/atuttle/Taffy.git",
"formutils":"git://github.com/jmohler1970/FormUtils.git",
"northamerica":"git://github.com/jmohler1970/NorthAmerica.git"
},
"installPaths":{
"taffy":"taffy",
"formutils":"formutils",
"northamerica":"db_setup"
}
}
Note in the code that Taffy is no where to be seen. We have a very clean structure. Taffy has not been applied to it yet. This is a good thing. Because I know where Taffy in a more normal way. I don't have to wonder why the examples are the way the are. I can just worry about my own code.
application.cfc
component extends="taffy.core.api" {
...
this.mappings['/resources'] = expandPath('./resources');
this.mappings['/taffy'] = expandPath('./taffy');
This is where I get the mappings to work. This is likely different from the Taffy examples, but is much closer to what you might use in a production environment
Related
I've been reading everywhere about the need to organize your R projects and also to use Rmarkdown.
I see an incoherence I can't solve.
Suppose I set for the following standard organization:
Project
data
raw-data
code
docs
out
reports
and also home of setwd().
Now I want to use Rmarkdown with my main project file called My_project.Rmd
I create it at the root project level, then I get at every knit rendition 2 directories created My_project_cache and My_project_files on to of every .hml file rendered that conflicts with the above structure.
This is very impractical.
I tried setting the options of output to avoid this, per this tip, but it fails on the cache directory, and I did not succeeded in setting Knit options to bypass it. And no-one seems to be bothered by this question making the solution look like a dead-end.
The other solution is to put My_project.Rmd directly in reports/ but it feels a little awkward and on top of that it breaks the above project structure by imposing ../ paths everywhere.
The third solution is to work with Rmd format, only at the end of a project, but this seems a little defeating the purpose of documenting everything neatly in the first place.
There may be a 4th solution using R Notebook feature, but it works until you decide to try to finalize your "final" document , which of course is never really final.
What am I missing here ?
For reference, I'm using RStudio on a Mac.
I've been tasked with creating a deployable version of a ColdFusion web app to be installed on a clients server. I'm trying to find a way to give them a compiled version of our code, and my first inclination was to use the CFCompile utility that I found here. However, after running CFCompile, most of the code in the CFM files is still readable. The only thing that appears to be obfuscated at all is the actual ColdFusion code - all of the SQL Queries are still perfectly readable. (Example in the screenshot below)
The HTML and JavaScript are also still readable in the compiled code, but that doesn't matter as those can be seen in a web browser anyways.
Is there another way to distribute my source code in a format that is completely unreadable to the user? I'm guessing that for whatever method I choose, there will be some way of decompiling the code. That's not an issue, I just need to find a way to make it more difficult than opening the file and seeing the queries.
Hostek has a pretty good write up on the subject over on their site - How to Encrypt or Compile ColdFusion Files.
Basically, from that article:
Using cfcompile.bat
The cfcompile.bat utility will compile all .cfm and .cfc files within a given directory into Java bytecode. This has the effect of making your source code unreadable, and it also prevents ColdFusion from having to compile your ColdFusion files on first use which provides a small performance enhancement.
More details about using cfcompile.bat can be found in ColdFusion's Documentation
Using cfencode.exe
The cfencode.exe utility will apply basic encryption to a specific file or directory. If used to encrypt a directory, it will apply encryption to ALL files in the directory which can break any JS, CSS, images, or other non-ColdFusion files.
They do also include this note at the bottom:
Note: Encrypting your site files with cfencode does not guarantee absolute security of your source code, but it does add a layer of obfuscation to help prevent unauthorized individuals from viewing the source.
The article goes on to give basic instructions on how to use each.
Adobe has this note on their site regarding cfencode:
Note: You can also use the cfencode utility, located in the cf_root/bin directory, to obscure ColdFusion pages that you distribute. Although this technique cannot prevent persistent hackers from determining the contents of your pages, it does prevent inspection of the pages. The cfencode utility is not available on OS X.
I would also add that it will be trivial for anyone familiar with ColdFusion to decode anything encoded with this utility because they also provide the decoder.
I'm trying to build a static site with stasis and serve my assets with Optimus. Pictures reside under /resources/public/imgs/ . I can serve individual pictures after loading them as follows:
(optimus.assets/load-assets "public"
["/imgs/pic1.jpg"
"/imgs/pic2.jpg"])
The following attempt to serve pictures by regex does not work though:
(optimus.assets/load-assets "public"
[#"/imgs/.*\.jpg"])
I'm getting No files matched regex /imgs/.*\.jpg, which seems implausible.
I've done some digging around the Optimus code and may have found the culprit. When called with a regex the optimus.assets/load-assets function starts building the paths from the return value of (optimus.class-path/file-paths-on-class-path), which – in my case – consists of only the following:
optimus.class-path/file-paths-on-class-path
=> ("boot/" "boot/tag-release.properties" "boot/bin/" "boot/bin/ParentClassLoader.class" "Boot.class" "META-INF/" "META-INF/MANIFEST.MF")
Since resources isn't a subdir of any of these directories I'm not surprised that I don't get a match. So maybe my question ultimately is why I'm getting only these directories here? Is it because I'm using Boot rather than Leiningen which is presupposed by the tutorials on Optimus?
EDIT:
It has definitely something to do with Boot or at least the way I've set it up. Following Alan Thompson's advice I've created a minimal Leiningen project – load-assets worked flawlessly. The very same setup with Boot however does not. Ultimately it boils down to (System/getProperty "java.class.path" ".") returning wildly different things: Boot gives me "/home/phylax/bin/boot", i.e. my boot binary, whereas in Leiningen it gives me a plethora of directories in my actual project… any idea as to what I'm doing wrong? How can I setup Boot to work with Optimus?
Many thanks for any guidance you may give me on this
Oliver
I am attempting to create Word documents with ColdFusion, but it does not seem there is any way to do it with only ColdFusion. The best solution seems to be docx4j. However, I can't seem to find any in-depth docx4j and ColdFusion examples (Aside from this question). Where can I get some doc4jx and ColdFusion examples?
pulling the data from a database.
https://stackoverflow.com/a/10845077/1031689 shows one approach to doing this. There are other ways, as to which see http://www.slideshare.net/plutext/document-generation-2012osdcsydney
The document needs page numbers and to
Typically you'd add these via a header or footer. You might find it easier to start with an almost empty docx structured appropriately, rather than creating the necessary structures via ColdFusion calling docx4j. You could still do it this way in conjunction with the final paragraph of this answer below.
create a table of contents.
Search the docx4j forums for how to do this.
In general, it looks like the easiest approach would be to create a Java class file which does everything you want (by invoking docx4j), and for your ColdFusion to just invoke that Java class. In other words, do a bit of Java programming first, get that working, then hook it up to your ColdFusion stuff.
I am not sure what exactly you mean with creating word document, which in my opinion is pretty simple. Manipulating yes, a bit tricky with docx4j or so.
<cfsavecontent variable="variables.mydoc">
Your content here
</cfsavecontent>
<cffile action="write" file="#yourFile.doc#" output="#variables.mydoc#">
Also see this post
Creating a Word document in Coldfusion - how to have pagenumbering?
I have a fairly extensive wiki on ZWiki on Zope (in turn on Plone). Most pages are in reStructured text format, but there are several in straight HTML as well.
What is the best approach to migrate those pages over to a MediaWiki wiki with pages converted to MediaWiki and HTML formats? Of course I'd like to automagically convert all links (internal and external).
extract your wiki content to files, using the zwikiexport.py script. The command will be something like:
ZOPE/bin/zopectl run ZOPE/Products/ZWiki/bin/zwikiexport.py /zodb/path/to/wiki/folder
convert the restructured text markup to mediawiki markup. pandoc should work well - for each wiki page, run something like:
pandoc -r rst -w mediawiki PAGE.rst >PAGE.mw
convert the wiki links, which pandoc doesn't know about. Depending on your content, this may be the hardest part to do accurately. Write a perl script, or modify the zwikiexport script, using Zwiki's knowledge of where the links are (see methods in ZWikiPage.py).
import the mediawiki-format pages into mediawiki, however that's done
refinements:
the exported file tree will reflect your zwiki page hierarchy - if you use this heavily, you'll want to think about how to represent it in mediawiki
as Mark says, you'll lose the page history, unless you work extra hard to find a way to replicate that. The same goes for all page metadata you may have have been using (you can inspect most of this metadata in the page's Properties tab in the zope management interface). In particular the page creation time, last edit time, and the usernames of the page's creator and last editor are quite important, to understand your content. So I would try to script some way of preserving those or if all else fails, doing it by hand.
if you have uploaded files to the wiki, I think the export script might save those too, otherwise use the ZMI to export/save them. When you import them to mediawiki, you may need to choose a page to attach them to. You could use grep or Zwiki's search to find the pages that reference a particular file.
be prepared to iterate, testing the results pretty thoroughly and refining the process, before you declare victory. After that, the content will diverge and you won't want to re-do this.
manual fixups: at some point, it may be cheaper to stop fiddling with scripts and do the remaining cleanup by hand, by yourself or with an army of helpers.
Good luck! - Simon
http://zwiki.org
I've no experience of ZWiki and don't know how large your wiki is. But general advice - you can use find / replace in Notepad or Notepad++ - or you can write a macro in Excel.
This is per page copying which is only really suitable if your wiki is not larger than, say, 1000 pages.
I suspect you'll still have manually to check each page though, and update your scripts accordingly.
Good luck with it - I suspect you'll be pleased with the final result because MediaWiki is pretty awesome.
Update: one disadvantage of moving to a new wiki is that you will lose the page history (i.e. who wrote what, when).