Can I use environment variable in the jaas.props file - jaas

I am using PropertyFileLoginModule and my jass.conf file looks like following
MyLogingModule {
org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required
debug="true"
file="${jetty.home}/jass.props";
};
now in the jaas.props file I have following entry.
tiger: ${tiger.password},admin
However instead of replacing ${tiger.password} with the actual value, it seems like it is expecting password to be exact string ${tiger.password}
Any suggestion how to get around this issue.

Related

ImageFileError: Cannot work out file type of ".nii"

When I try to load my .NII file as a 4D Niimg-like object (I've tried both nilearn and nibabel),
I get the below error
Error: ImageFileError: Cannot work out file type of
"/Users/audreyphan/Documents/Spring2020/DESPO/res4d/1/res4d_anat.nii"
Here is my code:
ds_name = '/Users/audreyphan/Documents/Spring2020/DESPO/res4d/1/res4d_anat.nii'
block = nib.load(ds_name) #Nibabel
block = image.load_img(ds_name) #Nilearn
Both attempts result in the same error.
I'm not sure what's causing this error to occur?
Thanks!
It looks like the libraries are not able to extract the file type from your file.
So first of all we have to be sure that the file is not corrupt. Therefore, can you load the data correctly with a tool such as ITK-SNAP (http://www.itksnap.org)?
If yes, you can try to define the file type by your own in the nibabel package by using the specific loader function. E.g. you can try each one of the following loader functions:
img_nifti1 = nib.Nifti1Image.from_filename(file)
img_nifti2 = nib.Nifti2Image.from_filename(file)
Oddly enough, this error also occurs when the access permissions are not set appropriately for the file you are trying to load. Try using chmod to change those access permissions appropriately and then loading the *.nii file.

Sending a pdf from public folder in express

I am trying to serve a PDF by adding watermark to it. I am using the image-watermark package for it
let option ={'text' : 'hello','color' : 'rgb(154, 50, 46)'};
res.setHeader('Content-Type', 'application/pdf');
res.setHeader('Content-Disposition', 'attachment; filename=test.pdf');
fs.createReadStream(watermark.embedWatermark('/pdf/js_tut.pdf', option)).pipe(res);
I am confused at what i did wrong? I am getting a 500 error. did I put the path name wrong? I have a public folder inside which I have a pdf folder inside which i have js_tut.pdf
Looking at the source code for the function embedWatermark, it doesn't actually return anything. You can see that here.
There is not a single return statement anywhere there.
So essentially what you're doing is this:
fs.createReadStream(undefined).pipe(res)
Which is likely why you're getting 500.

Where the statusFiles should be saved?

As mentioned here, I tried to use Status Files with the below code:
install(StatusPages) {
statusFile(HttpStatusCode.NotFound, HttpStatusCode.Unauthorized, filePattern = "#.html")
}
and saved the file as below:
But after running it, I got the standard 404 error, which means the file are not seen, do I need to add some thing, or I'm saving them in wrong place?
It looks like statusFiles() does a resolveResource(path), so it is looking at: src/main/resources/ and in order to make it understand/see the statusFiles folder, which is lying inside the resources folder, the filePattern is required to be tuned little nit to reflect it, so the correct code is:
statusFile(HttpStatusCode.NotFound, HttpStatusCode.Unauthorized, filePattern = "statusFiles/#.html")

Trying to get node-webkit console output formatted on terminal

Fairly new to node-webkit, so I'm still figuring out how everything works...
I have some logging in my app:
console.log("Name: %s", this.name);
It outputs to the browser console as expected:
Name: Foo
But in the invoking terminal, instead I get some fairly ugly output:
[7781:1115/085317:INFO:CONSOLE(43)] ""Name: %s" "Foo"", source: /file/path/to/test.js (43)
The numerical output within the brackets might be useful, but I don't know how to interpret it. The source info is fine. But I'd really like the printed string to be printf-style formatted, rather than shown as individual arguments.
So, is there a way to get stdout to be formatted either differently, or to call a custom output function of some sort so I can output the information I want?
I eventually gave up, and wrapped console.log() with:
log = function() {
console.log(util.format.apply(this, arguments));
}
The actual terminal console output is done via RenderFrameHostImpl::OnAddMessageToConsole in chromium, with the prefix info being generated via LogMessage::Init() in the format:
[pid:MMDD/HHMMSS:severity:filename(line)]
The javascript console.log is implemented in console.cc, via the Log() function. The printf style formatting is being done at a higher level, so that by the time the Log() function (or similar) are called, they are only passed a single string.
It's not a satisfying answer, but a tolerable workaround.
I was looking to create a command line interface to go along side my UI and had a similar problem. Along with not logging the values as I wanted I also wanted to get rid of the [pid:MMDD/HHMMSS:severity:filename(line)] output prefix so I added the following:
console.log = function (d) {
process.stdout.write(d + '\n');
};
so that console logging was set back to stdout without extra details. Unfortunately also a work around.

IzPack: How to show UTF-8 license with LicensePanel?

As title. My license file contains UTF-8 characters and by default IzPack's LicensePanel seems to expect ASCII text files.
Is there a solution to this?
UPDATE:
I tried using "encoding" attributes with my resource line:
<res id="LicencePanel.licence" src="Licence.txt" encoding="utf-8"/>
It didn't work.
I have had a similar problem with my LicencePanel.licence resource. I have an InfoPanel.Info resource in my installation as well. Both my info file (readme.txt) and licence (licence.txt) are in plain text format. My compiler accepts the readme file, but not the licence file when I run the installation.
Perhaps it isn't an encoding problem, since both files were in the same format, but the info file was accepted and the license was not.
Looks like this isn't going to work. I looked at the source for 4.3.5 and it looks like this may be a bug. Maybe it is fixed in a future version. I had a look at the source and this is the issue. Inside LicencePanel.java:
String resNamePrifix = "LicencePanel.licence";
licence = ResourceManager.getInstance().getTextResource(resNamePrifix);
ResourceManager has two methods:
public String getTextResource(String resource, String encoding) throws ResourceNotFoundException, IOException
public String getTextResource(String resource) throws ResourceNotFoundException, IOException
The first second one is being used while the first one should be used.
Edit: Just checked 5.0.0-rc1 and I think the issue occurs there too. (Didn't test just glanced at the code).