Problems Running ImageMagick Conditional Padding From ColdFusion - coldfusion

I am working with a ColdFusion web app that takes an uploaded image and resizes it 4 times using ImageMagick. I am trying to add to apply some some conditional formatting to it and the code works via Command Prompt but it doesn't work correctly via the CF app.
Here's the code that is being sent to the server from CF (and works fine in the command prompt):
C:\path\cmd.exe /S /C ""C:\path\ImageMagick\magick.exe" "C:\path\800x77.jpg" -resize 600x600 -strip -quality 85 -gravity center -background white -extent "%[fx:w^<250?250:w]x%[fx:h^<250?250:h]" "C:\path\result600x250.jpg""
The carets are there to escape the lesser than signs but appear to break the ImageMagick formatting, as IM returns an image that is cropped to 250x250, rather than 600x250. Any ideas on how I can make it work correctly when CF runs it?
ImageMagick 7, CF2016, Windows Server 2008 R2 Datacenter
EDIT:
The code doesn't use a cfexecute. I added double quotes to the code being appended to the shell code and that gets me closer. Here's the line generating that part of the code for the shell script:
<cfset local.shellArguments &= ' -gravity center -background white -extent ""%[fx:w\^<#arguments.argResizeMinWidth#?#arguments.argResizeMinWidth#:w]x%[fx:h\^<#arguments.argResizeMinHeight#?#arguments.argResizeMinHeight#:h]""'>

Related

sympy pretty printing causes console to freeze

I had a fresh install of miniconda, sympy, spyder, qtconsole, matplotlib, and tried out sympy under spyder. However, the output of anything from the console freezes the kernel, making the session irresponsive:
Notice the red square at the upper right corner, indicating evaluating never stops. If I turn off pretty_print, the output can appear:
I have latex installed and work fine. I tried playing with init_printing but nothing works unless I turn off pretty_print. I do need the output to be readable. I uninstalled and reinstalled but no luck. How do I fix the output problem for pretty_print? The system is windows 10, and everything is default latest version as of 7/10/2021.
I ran into the same problem, and I got around it by explicitly calling init_printing(use_latex='mathjax'). As the doc below indicates, by default use_latex=None and sympy should be able to find a latex rendering option automatically, but it seems to fail to do so and somehow gets stuck.
use_latex : string, boolean, or None, default=None
If True, use default LaTeX rendering in GUI interfaces (png and
mathjax);
if False, do not use LaTeX rendering;
if None, make a guess based on the environment;
if 'png', enable latex rendering with an external latex compiler,
falling back to matplotlib if external compilation fails;
if 'matplotlib', enable LaTeX rendering with matplotlib;
if 'mathjax', enable LaTeX text generation, for example MathJax
rendering in IPython notebook or text rendering in LaTeX documents;
if 'svg', enable LaTeX rendering with an external latex compiler,
no fallback

Python Jupyter nbconvert limiting printed pages

I am running Jupyter with a Python 2.7 kernel and I was able to get
nbconvert to run on both the command line (ipython nbconvert --to pdf file.ipynb) as well as through the jupyter browser interface.
For some reason, however, my file only prints 4 out of the 8 total pages I see on the browser. I can convert an html preview (generated by Juypter) file, and then use an online converter at pdfcrowd.com to get the full pdf files printed.
However, the online converter is lacking in latex capability.
When I installed nbconvert, I did not manually install MikTex latex for windows, as I already had it successfuly installed for Rstudio and Sweave.
I didn't want to mess with the installation.
I printed a few longer files (greater than 4 pages), without latex and a few that had latex and printed the first couple of pages fine. But that last few pages always seem to get cut off from the pdf output.
Does anyone know if that might be causing it to limit the print output, or any other ideas why?
Also, I do notice the command line prompt where jupyter is launched has a few messages...
1.599 [\text{feature_matrix}
] =
?
! Emergency stop.
<inserted text>
1.599 [\text{feature_matrix}
] =
Output written on notebook.pdf (r pages)
[NbConvertApp] PDF successfully created
I ran another file and saw the output showed
!you can't use 'macro parameter character #,' in restricted horizontal mode.
...ata points }}{\mbox{# totatl data points}}
?
! Emergency stop
Look like it is somehow choking on using the latex character #
then halting publishing. But it at least publishes all the pages prior to the error and emergency stop.
While not a solution, I manually changed the latex symbol # to number and
the entire file printed. I wonder if this is a problem with my version of latex maybe?
halted pdf job
$$\mbox{accuracy} = \frac{\mbox{# correctly classified data points}}{\mbox{# total data points}}$$
passed pdf job
$$\mbox{accuracy} = \frac{\mbox{number correctly classified data points}}{\mbox{number total data points}}$$
edit: if it help anyone, I used the suggestion here, to use a backslash escape character before the #, to solve the issue; so it looks like it is a latex issue, if that helps anyone.

How to Horizontally Resize Text Layout in Python Shell?

I'm using Python 2.7 on Windows and my output which is a table containing 15 rows needs more than the width of my entire screen to be displayed properly.
I used pandas.set_option('display.width', 1920) to get this working. However, word wrap occurs. I want the Python Shell to get a Horizontal Scroll Bar. Checked under configure IDLE and couldn't find it. It just needs to be like the simple option of word wrap we get with Notepad.
EDIT: I've already tried that method explained in the question marked possible duplicate. That doesn't create a working toolbar. The text is still wrapped. The toolbar graphic is present but it is greyed out and has no functionality.
Here is the 11 year old opened issue showing IDLE doesn't support horizontal scroll bar. IDLEX as pointed out here provides extensions to IDLE and workaround that, apparently not working for Python 2.7.

Change colors of output log text from Django development server

When running the django test server on a local project, can you make 400/500 errors stand out in a different color in output text?
The colors can be controlled using the DJANGO_COLORS environment variable. See the docs on syntax coloring.
This requires a platform which supports colors.

Color coding emacs being accessed remotely with putty

I use PuTTY to log on to my university's unix server and then start emacs and code in that. is there anyway to color code the code. Its C++ and ive been doing research for 2 hours and found nothing
The first step is to do a M-x font-lock-mode and see if that works.
You also might be running into a problem with the terminal emulation colors, as emacs does font-locking (coloring) of code pretty much automatically now. Try running emacs with --color=always and see if that gives you color.