php 5.3.2 and htmlentities flag ENT_XML1 - php-5.3

We're using PHP version 5.3.2 with FastCGI under Lighttpd 1.4.26:
$ /usr/lib/cgi-bin/php5 -v
PHP 5.3.2-1ubuntu4.20 with Suhosin-Patch (cgi-fcgi) (built: Jul 15 2013 17:10:44)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with XCache v1.3.0, Copyright (c) 2005-2009, by mOo
I've got a php script that's generating a notice to the Lighttpd web server error log:
2013-08-30 14:11:46: (mod_fastcgi.c.2711) FastCGI-stderr: PHP Notice:
Use of undefined constant ENT_XML1 - assumed 'ENT_XML1' in
/var/www/request.php on line 719
The script at that line is calling htmlentities():
htmlentities($xml, ENT_QUOTES | ENT_XML1, 'UTF-8')
The documentation for htmlentities() says that the constant ENT_XML1 was added on version 5.4.0, so I'm wondering how version 5.3.2 knows to "assume ENT_XML1" as its default? Did the 5.3.2 release possibly add that? It didn't jump out at me in the PHP5 ChangeLog.
Note: the script does appear to be converting the html entities in the $xml string.

The error that you're getting actually means that php doesn't recognize ENT_XML1 as a constant and is therefore converting it into the string 'ENT_XML1'. htmlentities isn't doing what you'd want it to do because you're not passing it the proper flags constants
htmlentities(ENT_QUOTES | 'ENT_XML1')
isn't the same as
htmlentities(ENT_QUOTES | ENT_XML1)

Related

FZF and NeoVim how to get files list

I try to use neovim with fzf plugins. Part of my init.lua is
-- Plugin imstallation section
local install_path = fn.stdpath('data')..'/site/pack/paqs/opt/paq-nvim'
if fn.empty(fn.glob(install_path)) > 0 then
cmd('!git clone --depth 1 https://github.com/savq/paq-nvim.git '..install_path)
end
-- Load the plugin manager
cmd 'packadd paq-nvim'
-- Set the short hand
local plug = require('paq-nvim').paq
-- Make paq manage it self
plug {'savq/paq-nvim', opt=true}
plug {'scrooloose/nerdtree', opt=true}
plug {'vim-airline/vim-airline', opt=true}
plug {'vijaymarupudi/nvim-fzf', opt=false}
plug {'ibhagwan/fzf-lua', opt=false}
require('paq-nvim').install()
require('paq-nvim').clean()
When I try to use command FzfLua files I observe message
fzf error 2 : unknown option: --headless
I work under Windows 10 and I use lua plugins : fzf-lua and nvim-fzf
fzf binary was installed and reachable
I cannot understand why rzr run with this strange option
What I did wrong?
Fzf-lua uses nvim-fzf actions for previews (and other functions) which calls lua functions by running neovim —headless … <lua function id>.
It seems that your neovim version does not support the headless option, I know of other users running fzf-lua on WSL, try with the official 0.5.1 appimage

Non-ASCII in URL in CMake ExternalProject_Add

I've had this ExternalProject_Add call in my CMake:
set(SIM_URL https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/vhnHilsimPlantModel-{build.number}.zip)
set(SIM_FILENAME vhnHilsimPlantModel-{build.number}.zip)
# Download and install
include(ExternalProject)
ExternalProject_Add(get_sim
DOWNLOAD_NAME ${SIM_FILENAME}
URL ${SIM_URL}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/sim_lib.a
STEP_TARGETS update)
It worked fine with the 2017 version of TeamCity. However, after our DevOps upgraded TeamCity to the 2019 version, this code started failing:
file='/home/user/sim/sim-prefix/src/vhnHilsimPlantModel-{build.number}.zip'
Old file will be removed and new file downloaded from URL.
-- Downloading...
dst='/home/user/build/apps/sim/sim-prefix/src/vhnHilsimPlantModel-{build.number}.zip'
timeout='none'
-- Using src='https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/vhnHilsimPlantModel-{build.number}.zip'
-- Retrying...
-- Using src='https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/vhnHilsimPlantModel-{build.number}.zip'
-- Retry after 5 seconds (attempt #2) ...
-- Using src='https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/vhnHilsimPlantModel-{build.number}.zip'
-- Retry after 5 seconds (attempt #3) ...
-- Using src='https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/vhnHilsimPlantModel-{build.number}.zip'
-- Retry after 15 seconds (attempt #4) ...
-- Using src='https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/vhnHilsimPlantModel-{build.number}.zip'
-- Retry after 60 seconds (attempt #5) ...
-- Using src='https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/vhnHilsimPlantModel-{build.number}.zip'
CMake Error at vahana_sim-stamp/download-vahana_sim.cmake:157 (message):
Each download failed!
error: downloading 'https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/vhnHilsimPlantModel-{build.number}.zip' failed
status_code: 22
status_string: "HTTP response code said error"
log:
--- LOG BEGIN ---
Trying 172.31.21.90...
The only way to fix it is to change { and } to %7B and %7D, respectively. This, technically should have been done in the first place, but it was working. Does anyone know why this change has to be done and/or why the non-ASCII characters have to be encoded when specifying the URL?
I am using CMake 3.10.2.
The TeamCity 9.X documentation for Obtaining Artifacts confirms that curly braces {build.number} could be used in the URL:
ARTIFACT_PATH is a path to the artifact on the TeamCity server. This path can contain a {build.number} pattern which will be replaced with the build number of the build whose artifact is retrieved.
However, this caused a few issues (one example here), as there are several reserved characters in the RFC's pertaining to URI/URL standards (in this case RFC 1738). The RFC 1738 standard deems a group of characters "unsafe" (including curly braces), in addition to the reserved characters for URIs:
Other characters are unsafe because
gateways and other transport agents are known to sometimes modify
such characters. These characters are "{", "}", "|", "", "^", "~",
"[", "]", and "`". [...] All unsafe characters must always be encoded within a URL.
Thus, the TeamCity software was updated thereafter to support the curly brace encodings as well. The TeamCity 10.X documentation for Obtaining Artifacts was updated to align with the standards for URL encoding:
ARTIFACT_PATH is a path to the artifact on the TeamCity server. This path can contain a {build.number} pattern (%7Bbuild.number%7D) which will be replaced by TeamCity with the build number of the build whose artifact is retrieved.
It seems that by the TeamCity 2019 versions, the support for using raw curly braces in the URL has been dropped altogether in alignment with the standard, and only the encoded version is allowed. So you can update your CMake code to something like this:
set(SIM_FILENAME vhnHilsimPlantModel-%7Bbuild.number%7D.zip)
set(SIM_URL https://teamcity.vh.com/guestAuth/rep/download/Sim_Feat/.lastSuccessful/${SIM_FILENAME})

Change character set on Microsoft R Server 9.0.1

Q: How to you change/update the character set on Microsoft R Server?
Issue: I am trying to read a CSV that is delimited with '§' but the R Server is not able to interperet the '§' character when I work remotely. Similarly for other characters like 'ø' , 'æ' and 'å'. When I work locally it's not an issue.
For example:
This works fine:
> x <- '§'
> x
[1] "§"
But when i login remotely to the server the following happens:
REMOTE> x <- '§'
REMOTE> x
[1] "?"
Setup: I am running Microsoft R Server 9.0.1 on Windows Server 2012 R2
Detailed sessionInfo:
REMOTE> sessionInfo() R version 3.3.2 (2016-10-31) Platform:
x86_64-w64-mingw32/x64 (64-bit) Running under: Windows Server >= 2012
x64 (build 9200)
locale: [1] LC_COLLATE=Norwegian (Bokm�l)_Norway.1252 [2]
LC_CTYPE=Norwegian (Bokm�l)_Norway.1252 [3] LC_MONETARY=Norwegian
(Bokm�l)_Norway.1252 [4] LC_NUMERIC=C
[5] LC_TIME=Norwegian (Bokm�l)_Norway.1252
attached base packages: [1] stats graphics grDevices utils
datasets methods base
other attached packages: [1] RevoUtilsMath_10.0.0 RevoUtils_10.0.2
RevoMods_10.0.0 [4] RevoScaleR_9.0.1 lattice_0.20-34
rpart_4.1-10
loaded via a namespace (and not attached): [1] R6_2.2.0
tools_3.3.2 CompatibilityAPI_1.1.0 [4] codetools_0.2-15
grid_3.3.2 iterators_1.0.8 [7] foreach_1.4.3
mrupdate_1.0.0 jsonlite_1.1
In addition to installing version 9.1 of Microsoft R Server I also had to make the following change for the server to work correctly with remote login:
Stop the service 'RServe9.0.0.0'
and go to C:\Program Files\Microsoft\R Server\R_SERVER\o16n\RServe\RScripts\source.R on the compute nodes
and change
```
#add more here if necessary......
```
to
```
#add more here if necessary......
options(encoding = "UTF-8")
```
and then start that service again, you should be able to use §.
Thanks to Microsoft for providing this fix.
This is a known bug, and has been patched in Microsoft R Server 9.1, please upgrade to solve your issue.

is there any scriptella jruby script sample/example?

I am new scriptella user.
Is there any sample or tutorial to use jruby
as scripting language?
Thanks and Regards,
Manish
== updated after ejboy's suggesstions ==
Copied jruby.jar (1.7.4) in lib.
However scriptella failed with following exception.
Jun 14, 2013 9:31:36 AM Script /bigdisk/work/cougar/code/leopard-monitor/analytics/kpoint_usage/scriptella/scripts/jruby_sample.xml execution failed.
/etl/script[1] failed: keySet
Location: /etl/script[1]
Jun 14, 2013 9:31:36 AM <SEVERE> Scriptella bug report. Submit to issue tracker.
Scriptella version: 1.1
Exception:
scriptella.execution.EtlExecutorException: /etl/script[1] failed: keySet Location: /etl/script[1]
at scriptella.execution.EtlExecutor.execute(EtlExecutor.java:190)
at scriptella.tools.launcher.EtlLauncher.execute(EtlLauncher.java:276)
at scriptella.tools.launcher.EtlLauncher.launch(EtlLauncher.java:193)
at scriptella.tools.launcher.EtlLauncher.main(EtlLauncher.java:321)
Caused by: scriptella.core.ExceptionInterceptor$ExecutionException: /etl/script[1] failed: keySet
at scriptella.core.ExceptionInterceptor.execute(ExceptionInterceptor.java:44)
at scriptella.core.Session.execute(Session.java:103)
at scriptella.execution.EtlExecutor.execute(EtlExecutor.java:227)
at scriptella.execution.EtlExecutor.execute(EtlExecutor.java:183)
... 3 more
Following is my xml file.
<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
<etl>
<description>
use jruby as scripting language.
</description>
<connection id="script-jruby" driver="script" url="out/test-out.csv"> <!-- classpath="path/to/jar:path/to/jar2"> -->
language=jruby
</connection>
<script connection-id="script-jruby">
puts "Hello world - using jruby"
</script>
</etl>
Try setting the language property to jruby and make sure the required jars are available on classpath. You can either copy them to <scriptella_home>/lib directory or include in the connection declaration:
<connection id="script" driver="script" classpath="path/to/jar:path/to/jar2">
language=jruby
</connection>

grails emacs mode - "Cannot open load file" "project-mode"

I am trying to use emacs for grails development. Tried on grails-emacs-mode
There are emacs and emacs23 on my ubuntu 12.04.
prayag#prayag:~$ ls -l /usr/share/emacs[tab][tab]
emacs/ emacs23/
As the grails-emacs-mode suggests, I copied grails-mode.el and primary.org files to my emacs23/site-list
prayag#prayag:~$ ls -l /usr/share/emacs23/site-lisp/
total 32
-rw-r--r-- 1 root root 3013 Nov 17 00:39 debian-startup.elc
drwxr-xr-x 2 root root 4096 Nov 17 00:39 dictionaries-common
-rw-r--r-- 1 root root 18205 Feb 14 01:11 grails-mode.el
-rw-r--r-- 1 root root 0 Feb 14 01:11 primary.org
-rw-r--r-- 1 root root 106 Sep 22 01:16 subdirs.el
Then, created init.el inside .emacs.d as there exists no .emacs file in home directory. The init.el conatains
(require 'grails-mode)
(setq grails-mode t)
(setq project-mode t)
(add-to-list 'auto-mode-alist '("\.gsp$" . nxml-mode)) ; Use whatever mode you want for views.
(project-load-all) ; Loads all saved projects. Recommended, but not required.
now, opening emacs23 doesn't show any grails in the menubar.
I also tried
M-x
load-file .emacs.d/init.el
which throws
Warning (initialization): An error occurred while loading `/home/prayag/.emacs.d/init.el':
File error: Cannot open load file, project-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
On starting emacs23 --debug-init, following error is thrown.
Debugger entered--Lisp error: (file-error "Cannot open load file" "project-mode")
require(project-mode)
eval-buffer(#<buffer *load*<2>> nil "/usr/share/emacs/23.3/site-lisp/grails-mode.el" nil t) ; Reading at buffer position 422
load-with-code-conversion("/usr/share/emacs/23.3/site-lisp/grails-mode.el" "/usr/share/emacs/23.3/site-lisp/grails-mode.el" nil t)
require(grails-mode)
eval-buffer(#<buffer *load*> nil "/home/prayag/.emacs.d/init.el" nil t) ; Reading at buffer position 23
load-with-code-conversion("/home/prayag/.emacs.d/init.el" "/home/prayag/.emacs.d/init.el" t t)
load("/home/prayag/.emacs.d/init" t t)
#[nil "\205\264
grails-mode requires project-mode as mentioned on the emacs-grails-mode page. So, you'll also need to install project-mode.
Also grab the remaining groovy packages(all but grails-mode) from here.
emacs-grails-mode-ext is a modest contribution to grails-mode allowing you to run Grails commands directly from emacs. For a given project(project-mode), you can run Grails commands such as create-domain-class, create-service, etc.
I also use the function ido-find-file-in-tag-files from here, I bind it to C-x C-M-f .
Simple guide with emacs-grails-mode:
Create a project from the command line or eshell -> grails create-app yourapp
Using dired, go to your Grails project folder
M-x project-new -> to create a new project(project-mode)
M-x project-save -> Save the project
M-x project-load-and-select -> Your project-name as argument
There's also a Grails menu if you use the menubar
You could also use my current emacs setup here, if you have emacs24 installed. I believe that it's available for Ubuntu 12.04, but I'm not sure. I usually build emacs from source on OSX or I use emacs-snapshot in Ubuntu.
Hope this helps.
I don't know Grail-mode at all. I've just clicked your link, and they state that project-mode is a dependency:
Dependencies:
project-mode is the only dependency.
As a consequence you will also have to install it. Link to the Emacs project code.
I am hoping for you this project does not have additional dependencies...
As a side note: later, try to install the last emacs (v24) which embeds a very convenient way to deal with package installation and dealing with packages dependencies. I've just check it out, it is present on an alternative (but very know) repository: Marmalade-repo.org.

Resources