Can´t set threshold in configuration file - qt

Thus far I´ve managed to create a Log4Qt configuration file and load it with PropertyConfigurator. Everything seems to work fine, I can set loggers, appenders, assign levels etc.
The only thing that doesn´t work is setting a threshold for an appender.
This is how i set up my configuration file:
void createNewLoggerConfigurationFile(QString fileName)
{
QSettings settings(fileName, QSettings::IniFormat);
settings.setValue("log4j.appender.A1", "org.apache.log4j.FileAppender");
settings.setValue("log4j.appender.A1.file", "C:/Users/Fujitsu/Desktop/LogOutput.txt");
settings.setValue("log4j.appender.A1.layout", "org.apache.log4j.TTCCLayout");
settings.setValue("log4j.appender.A1.layout.DateFormat", "ISO8601");
settings.setValue("log4j.appender.ADataManager", "org.apache.log4j.FileAppender");
settings.setValue("log4j.appender.ADataManager.file", "C:/Users/Fujitsu/Desktop/DataManagerLogOutput.txt");
settings.setValue("log4j.appender.ADataManager.layout", "org.apache.log4j.TTCCLayout");
settings.setValue("log4j.appender.ADataManager.layout.DateFormat", "ISO8601");
settings.setValue("log4j.appender.ADataManager.threshold", "DEBUG");
settings.setValue("log4j.rootLogger", "ALL, A1");
settings.setValue("log4j.logger.DataManager", "ALL, ADataManager");
}
The resulting error message (from Log4Qt, I guess) reads as follows:
10 [] ERROR Log4Qt::Factory - Cannot convert to type 'Level' for property 'threshold' on object of class 'Log4Qt::FileAppender' (Log4Qt::Factory::CONFIGURATOR_UNKNOWN_TYPE_ERROR, 29)
Any ideas?

Related

Stimulsoft pdf export exceed cookie size

I'm trying to export my report into PDF.
I'm using ASP.NET as my backend and the problem happens after I pass the report to a controller method.
I get this error:
$exception {"The value size of the cookie is '..........'. This
exceeds the configured maximum size, which is
'4096'."} System.Net.CookieException
right here:
I've used chrome debug mode for cookie and I get this :
StiMobileDesignerDictionarySettings={"createFieldOnDoubleClick":false,"createLabel":false,"useAliases":false};
StimulsoftMobileDesignerLastTabOnPropertiesPanel=Properties;
formSerializeArray=[{"name":"Id","value":""},{"name":"Region","value":""},{"name":"Name","value":""},
{"name":"Address","value":""},{"name":"Plaque","value":""},{"name":"Phone","value":""},
{"name":"PostalCode","value":""},{"name":"BuildingType","value":""},
{"name":"Area","value":""},{"name":"Height","value":""},
{"name":"HeightCode","value":""},
{"name":"CrossingPosition","value":""},
{"name":"PermanentEquipment","value":""},
{"name":"SafetyEquipment","value":""}, {"name":"Branches","value":""},
{"name":"WC","value":"null"},
{"name":"SafetyAndSecuritySystem","value":""},
{"name":"ApprovedUsage","value":""},
{"name":"TypeOfGoodStored","value":""},
{"name":"Category","value":""}, {"name":"Type","value":""},
{"name":"AverageMonthlyInputCapacity","value":""},
{"name":"AverageNumberOfVisitsPerDay","value":""},
{"name":"AverageNumberOfVisitsPerMonth","value":""},
{"name":"PersonOrCompany","value":""},
{"name":"NationalCode","value":""}, {"name":"Fname","value":""},
{"name":"LName","value":""}, {"name":"FatherName","value":""},
{"name":"BirthCertificateNumber","value":""},
{"name":"BirthCertificateSerial","value":""},
{"name":"City","value":""}, {"name":"From_BirthDate","value":""},
{"name":"To_BirthDate","value":""},
{"name":"MaritalStatus","value":"null"},
{"name":"Gender","value":"null"}, {"name":"NationalId","value":""},
{"name":"CoName","value":""}, {"name":"CompanyType","value":""},
{"name":"EconomicCode","value":""},
{"name":"InsuranceWorkshopCode","value":""},
{"name":"BusinessLicenseNumber","value":""},
{"name":"WorkRecord","value":""},
{"name":"CompanyActivityContext","value":""},
{"name":"CompanyActivityCategory","value":""},
{"name":"CompanyMainActivity","value":""},
{"name":"From_CompanySabtDate","value":""},
{"name":"To_CompanySabtDate","value":""},
{"name":"From_CompanyLicenseValidityFromDate","value":""},
{"name":"To_CompanyLicenseValidityFromDate","value":""},
{"name":"From_CompanyLicenseValidityToDate","value":""},
{"name":"To_CompanyLicenseValidityToDate","value":""},
{"name":"FK_UserId","value":""}, {"name":"FK_RoleId","value":""},
{"name":"From_RegDate","value":""}, {"name":"To_RegDate","value":""},
{"name":"LastModifiedFK_UserId","value":""},
{"name":"LastModifiedFK_RoleId","value":""},
{"name":"From_LastModifiedDate","value":""},
{"name":"To_LastModifiedDate","value":""}];
StimulsoftWebViewerExportSettingsOpeningGroups={"SavingReportGroup":true,"PageRangeGroup":true,"SettingsGroup":false};
ASP.NET_SessionId=ccrez4wdqv12gesmy1p4pv4s;
RequestVerificationToken=ofuyh7BLdQpVCUL6WRVfoptviEKrAIAYtx5zQKxBhPXKzXYUxUGv2JfBOAgDSCeKCVqtcL1yWkoe2kFaikKugahyNYE_wQ0h1eQWD5E3dzU1;
.AspNet.ApplicationCookie=2JlL0YaAFAVnpf_hmLJRmxhAFkpHbgymFgnegwPX1brf4_Mr6YZP8n2-2hZf0GsDbmLHjZXY6J0wiivyM4Cxl41n8nd9FHcc68Qn2G40iaa2t7XjYMdLbwP9ltbzwfl
UAMF5zSabhpIHCevtsmDysf45kNf9UxQ0IOu1QW7fj4Uib3qzIg560BThS9XUD9tLeNGfHXdwRfaqREnlaJ0NgBzkoL8scWiFNRpDmUbsKL5NUnH93ZwZKWrZAmPtp09Hni3fR8If4kn
LtjSctwAgwzxBTCUN1EW3o2qANDxVfwts7tDZ6kDRZA4it7umeDmwPP7qLiL_QiEEzC7bkVJq-WlcNRtsbTlyoHJROC79o6p6vFcNL1skDfF9snFb3Jm5lsY7Ol1A8r5slqj-
f6opbfJVfM2W5Zswg0p_zAaVhTE6AQUgDdPJeUOGu54k4DvnoIZ80IGEHTL7Yn4WL_SOJAxvNIPIrxjyqYjh9WF8c318eyROqAUqpQYbPuPg3KNCGM_n3vBaz-
3CCIyps1ijH994avhYmWlr4UCenxuy9mTUiXpjqrgRLW9SAd_4ycdIjtrL032E99Rq7GAgTYSgBRuA1ytDaGYSr4PdQcod-MsMOpR_fLM9I2vpgZqzOFoqUvbol6kf0G_
kyl6aWJoW982JB8N7Qz2bbY1Pxksrb3uf0jTBm5Nvwz5vyDoSPQcSeiJD-q7RNjXDRrCYk-lExCeSBGZkxYLC8sImOUfTr_
1CwZ2OGIln_rKrFcTQBbRRYgFk1JzhzkT9FQLVgqfdn4FBZNdRztAn8XyK9RBx4IkajDXyMvmowRDwd_bxH2QXA_wQRIcv-
WXwoB-MMVKvkfsHI3hTshROGtsy_aebaRby2D912Zssn33Y_BFvAypcb4JygQu5KbPaCD4GauQQGZ7DyPCDBBj1_GhwjmihgEs3EV6Owhm_yz--1ZQ-hpmoKzlLdoS4P7k1owKlcxA7wQ_67SFFsrGDUf_Yjewkk;
StimulsoftWebViewerExportSettingsPdf={"PageRange":"All","ImageResolution":"100","ImageCompressionMethod":"Jpeg",
"ImageQuality":"0.75","EmbeddedFonts":true,"ExportRtfTextAsImage":false,"PdfACompliance":false,"OpenAfterExport":false,
"AllowEditable":"No","PasswordInputUser":"","PasswordInputOwner":"","KeyLength":"Bit40","UseDigitalSignature":false,
"GetCertificateFromCryptoUI":false,"UserAccessPrivileges":"PrintDocument,
ModifyContents, CopyTextAndGraphics, AddOrModifyTextAnnotations"}
and check it inside this site https://www.javainuse.com/bytesize it returns :
Edit: I've checked again and this error also happen for any type of export :

posix_fallocate() failed: Operation not permitted while opening .realm file

I get the below error when i try to open and download .realm file in /tmp directory of serverless framework.
{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: posix_fallocate() failed: Operation not permitted" }
Below is the code:
let realm = new Realm({path: '/tmp/custom.realm', schema: [schema1, schema2]});
realm.write(() => {
console.log('completed==');
});
EDIT: this might soon be finally fixed in Realm-Core: see issue 4957.
In case you'll run into this problem elsewhere, here's a workaround.
This caused by AWS Lambda not supporting the fallocate and fallocate64 system calls. Instead of returning the correct error code in this case, which would be EINVAL for not supported on this file system, Amazon has blocked the system call so that it returns EPERM. Realm-Core has code that handles EINVAL return value correctly but will be bewildered by the unexpected EPERM returned from the system call.
The solution is to add a small shared library as a layer to the lambda: compile the following C file on Linux machine or inside lambda-ci Docker image:
#include <errno.h>
#include <fcntl.h>
int posix_fallocate(int __fd, off_t __offset, off_t __len) {
return EINVAL;
}
int posix_fallocate64(int __fd, off_t __offset, off_t __len) {
return EINVAL;
}
Now, compile this to a shared object with something like
gcc -shared fix.c -o fix.so
Then add it to a root of a ZIP file:
zip layer.zip fix.so
Create a new lambda layer from this zip
Add the lambda layer to your lambda function
Finally make the shared object be loaded by configuring the environment value LD_PRELOAD with value /opt/fix.so to your Lambda.
Enjoy.

Self-referential values in an R config file

Using the config package, I'd like elements to reference other elements,
like how path_file_a references path_directory.
config.yml file in the working directory:
default:
path_directory : "data-public"
path_file_a : "{path_directory}/a.csv"
path_file_b : "{path_directory}/b.csv"
path_file_c : "{path_directory}/c.csv"
# recursive : !expr file.path(config::get("path_directory"), "c.csv")
Code:
config <- config::get()
config$path_file_a
# Returns: "{path_directory}/a.csv"
glue::glue(config$path_file_a, .envir = config)
# Returns: "data-public/a.csv"
I can use something like glue::glue() on the value returned by config$path_file_a.
But I'd prefer to have the value already substituted so config$path_file_a contains the actual value (not the template for the value).
As you might expect, uncommenting the recursive line creates an endless self-referential loop.
Are there better alternatives to glue::glue(config$path_file_a, .envir = config)?
I came across the same problem and I've written a wrapper around config and glue.
The package is called gonfig and has been submitted to CRAN.
With it you would have:
config.yml
default:
path_directory : "data-public"
path_file_a : "{path_directory}/a.csv"
path_file_b : "{path_directory}/b.csv"
path_file_c : "{path_directory}/c.csv"
And in your R script:
config <- gonfig::get()
config$path_file_c
#> "data-public/c.csv"

Allocating memory in Flash for user data (STM32F4 HAL)

I'm trying to use the internal flash of an STM32F405 to store a bunch of user settable bytes that remain after rebooting.
I'm using:
uint8_t userConfig[64] __attribute__((at(0x0800C000)));
to allocate memory for the data I want to store.
When the program starts, I check to see if the first byte is set to 0x42, if not, i set it using:
HAL_FLASH_Unlock();
HAL_FLASH_Program(TYPEPROGRAM_BYTE, &userConfig[0], 0x42);
HAL_FLASH_Lock();
After that I check the value in userConfig[0] and I see 0x42... Great!
When I hit reset, however, and look at the location again, it's not 0x42 anymore...
Any idea where I'm going wrong? I've also tried:
#pragma location = 0x0800C00
volatile const uint8_t userConfig[64]
but I get the same result..
Okay I found an answer on the ST forums thanks to clive1. This example works for an STM32F405xG.
First we need to modify the memory layout in the linker script file (.ld file)
Modify the existing FLASH and add a new line for DATA. Here I've allocated all of section 11.
MEMORY
{
FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 1M-128K
DATA (RWX) : ORIGIN = 0x080E0000, LENGTH = 128k
...
...
}
Manual for editing linker files on the sourceware website
In the same file, we need to add:
.user_data :
{
. = ALIGN(4);
*(.user_data)
. = ALIGN(4);
} > DATA
This creates a section called .user_data that we can address in the program code.
Finally, in your .c file add:
__attribute__((__section__(".user_data"))) const uint8_t userConfig[64]
This specifies that we wish to store the userConfig variable in the .user_data section and const makes sure the address of userConfig is kept static.
Now, to write to this area of flash during runtime, you can use the stm32f4 stdlib or HAL flash driver.
Before you can write to the flash, it has to be erased (all bytes set to 0xFF) The instructions for the HAL library say nothing about doing this for some reason...
HAL_FLASH_Unlock();
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR );
FLASH_Erase_Sector(FLASH_SECTOR_11, VOLTAGE_RANGE_3);
HAL_FLASH_Program(TYPEPROGRAM_WORD, &userConfig[index], someData);
HAL_FLASH_Lock();

Boost-build/BJam language - checking the value of a flag

I need to edit a .jam file used by boost-build for a specific kind of projects. The official manual on BJAM language says:
One of the toolsets that cares about DEF files is msvc. The following line should be added to it. flags msvc.link DEF_FILE
;
Since the DEF_FILE variable is not used by the msvc.link action, we need to modify it to be: actions link bind DEF_FILE { $(.LD) ....
/DEF:$(DEF_FILE) .... } Note the bind DEF_FILE part. It tells bjam to
translate the internal target name in DEF_FILE to a corresponding
filename in the link
So apparently just printing DEF_FILE with ECHO wouldn't work. How can it be expanded to a string variable or something that can actually be checked?
What I need to do is to print an error message and abort the build in case the flag is not set. I tried:
if ! $(DEF_FILE)
{
errors.user-error "file not found" ;
EXIT ;
}
but this "if" is always true
I also tried putting "if ! $_DEF_FILE {...}" inside the "actions" contained but apparently it is ignored.
I am not sure I understand the global task you have. However, if you wanted to add checking for non-empty DEF_FILE -- expanding on the documentation bit you quote, you need to add the check in msvc.link function.
If you have a command line pattern (specified with 'actions') its content is what is passed to OS for execution. But, you can also have a function with the same name, that will be called before generating the actions. For example, here's what current codebase have:
rule link.dll ( targets + : sources * : properties * )
{
DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;
if <embed-manifest>on in $(properties)
{
msvc.manifest.dll $(targets) : $(sources) : $(properties) ;
}
}
You can modify this code to additionally:
if ! [ on $(<) return $(DEF_FILE) ] {
ECHO "error" ;
}

Resources