cfdocument crashing on Coldfusion 9 & Mac - coldfusion

I am trying to generate a simple pdf using cfdocument tag like this -
<cfdocument format="PDF">
<cfoutput>
Bacon ipsum dolor sit amet sirloin fatback #dateformat(now(), "short")#
</cfoutput>
</cfdocument>
But for some reason, the above code causes the browser to go in loop or something and after several minutes of execution I get JRun Out of memory error.
I am using MAC OS 10.7.5 and Coldfusion 9
Any clue will be helpful.

I found the solution here -
http://blog.maestropublishing.com/2012/01/19/adobe-coldfusion-9-on-mac-lion-fix-for-cfdocument-and-hanging-admin/
Just add the following two lines to jvm.config file
-Djava.awt.headless=true
-Dawt.toolkit=sun.awt.HToolkit

Related

Regex Get Text Between 2 Words

I need to put one word and obtain the html tag with the word inclusive.
Example:
Text input: Madhuparna
I need to obtain:
June 5, 2021 By Madhuparna
bla bla bla Madhuparna bla bla bla
Test text:
<p>The entire purpose speed up the process.</p><p>June 5, 2021 By Madhuparna</p>\r\n<p>The entire purpose of a terminal emulator is to imitate how the regular computer terminals perform and allowing the main computer to connect to and use a remote computer through a command-line or a graphical interface. The terminal emulators are known to carry out the functions using the software.</p>\r\n<a>It allows file transfer between the main and the remote computer using SSH (Secure Shell) and also enables the host system to execute applications on the remote system. While it features a graphical user interface, programmers rather prefer the text-based interface to gain more control over all functions and speed up the process.</a><p>bla bla bla Madhuparna bla bla bla</p>
What I do for now but not work:
<(\S*?)[^>]*>.*?Madhuparna.*?<\/\1>|<.*?\/>
please try the following:
*edit - getting slightly messier now (and quite "hacky")...
/<([pali]{1,2})>[^<>]*Madhuparna[^<>]*<\/\1>/g
Probably not entirely optimised but does the job as per your sample.
This assumes that the only tags you are encountering (as per your sample) are <p> and <a> but please update the first capturing group ([pa]) of the regex if needed.
Proof here: https://regex101.com/r/16jjLn/1 - (updated)
The explanation panel on the link above will explain what the regex is doing.
I have just tested this. It's working well.
Please try this again.
/<(\S+)(>| .*?>)[^<>]*Madhuparna[^<>]*<\/\1>/g
I have just changed your test text like this.
<p>The entire purpose speed up the process.</p>
<p class="test">June 5, 2021 By Madhuparna</p>
<p >The entire purpose of a terminal emulator is to imitate how the regular computer terminals perform and allowing the main computer to connect to and use a remote computer through a command-line or a graphical interface. The terminal emulators are known to carry out the functions using the software.</p>
<a>It allows file transfer between the main and the remote computer using SSH (Secure Shell) and also enables the host system to execute applications on the remote system. While it features a graphical user interface, programmers rather prefer the text-based interface to gain more control over all functions and speed up the process.</a>
<span>bla bla bla Madhuparna bla bla bla</span>
This can be applied to all tags.
I'm not sure if this is right for you, but I hope it helps you. :)

Find and replace text in Illustrator using Apple script

I am using the current version of Illustrator CC. I would like the ability to find and replace 5 instances/frames of text within an Illustrator or EPS file. Maybe a drag and drop type of script that executes a prompt for a find and replace field?
Is this possible? Any suggestions would be much appreciated!
SO's for getting help with your own code. For requesting scripts, try Adobe's Illustrator Scripting forum.

download mp3 from google translate text to speech in Albanian

I am trying to download mp3 files from Google translate using the Albanian country code "al"
http://translate.google.com/translate_tts?tl=al&q=dritare
but I get
video playback aborted due to a network error
I'm using Firefox and windows 7.
I use this method successfully with other languages for example Italian
http://translate.google.com/translate_tts?tl=it&q=esercito
and then I can download the mp3 just fine. I have also tried English and Greek.
Albanian text to speech it is supported by Google translation and I can hear the text pronounced in Albanian when I press the sound icon.
I have also tried in Chrome and it isn't working there either.
Thanks
The code for the Albanian language is "sq" not "al" which is the country's code. So if you type for example
http://translate.google.com/translate_tts?tl=sq&q=po
everything works fine!

Universal directory format for both windows or unix

I am working on a side project that is meant to be deployable on CF servers residing on both windows and unix systems. Is there a way that I can manage absolute pathing in directory structures in a way that would be universal? In other words, I don't want have to have a bunch of conditional statements littering the code to manage if you are windows versus unix servers.
I've been working exclusively in unix-based OS for the past 8 years, so it's been a long time since I had to worry about Windows.
I am working in CF 9.01 FWIW.
Thanks!
Check out the ColdFusion System Functions. You can use some of those functions to dynamically retrieve pathing information from the server, regardless of the platform.
Just create a test.cfm file and start outputting those values to get familiar with them. I think these will be of particular interest.
Sample test.cfm:
<html>
<head></head>
<body>
<cfoutput>
<p>GetBaseTemplatePath() = #GetBaseTemplatePath()#</p>
<p>GetDirectoryFromPath(GetBaseTemplatePath()) = #GetDirectoryFromPath(GetBaseTemplatePath())#</p>
<p>GetCurrentTemplatePath() = #GetCurrentTemplatePath()#</p>
<p>ExpandPath("*.*") = #ExpandPath("*.*")#</p>
</cfoutput>
</body>
</html>

CFDocument PDFs are huge (ColdFusion 8)

I wanted to add a PDF generation button for articles. Everything is working well until I noticed that the file sizes are upwards of 4MB for a document with 200KB of JPG images and about 120KB of HTML. So, I tossed the CFDocument into the CFPDF tag which reduced it to 1.5MB. Better. Then I put it through Acrobat's web optimizer which took it down to 335KB. I cannot find an "optimizing" solution with either CFDocument or CFPDF. I was hoping for a quality setting or something. I should also note that CFDocument takes a while to process (relatively speaking). Since ColdFusion 9 added an optimize function, I'm guessing that I'm out of luck until this server is upgraded. True?
<cfdocument format="pdf"
localurl=true
name="loc.tempPDF">
<cfoutput>#loc.articleContent#</cfoutput>
</cfdocument>
<cfpdf action = "write"
destination = "#expandPath('\pdf\temp.pdf')#"
source = "loc.tempPDF"
overwrite = "yes"
saveOption = "linear" />
That's correct, there is currently no way to optimize PDFs in ColdFusion 8 with the native cfdocument or cfpdf tags. If you absolutely have to make this happen without upgrading to CF9 (which has much improved PDF compression), then you could look at the iText library for generating PDFs via Java.
I built a Document Management System using CF 6.1 a few years ago. I used GhostScript to create, concatenate and optimize PDFs.
Here's a blog post showing how you can use GS to optimize a PDF's size.