Spring Batch : Display the error line number of a loading failed - spring-batch

I'd like to display the error line number of a file when a loading fails.
(sometimes I use lineMapper. For others loadings, I use fieldSetMapper)
Some people sais to use #{fileReader.currentItemCount}
or to redifine LineMapper but I don't understand how to use it.
Do you have somes examples ?
Regards.

Related

Custom Error Messages in CITRUS Test Results

I want to use my custom error messages in my citrus test results.
Example:
Original Error Message: java.io.FileNotFoundException: D:\expectedOutput\Smaple.xml (The system cannot find the file specified).
Custom Message: Hey The File was not found in your directory Please check. (Need to print like this in my test results failure message).
Please check the image hereenter image description here
You can not change this message in particular as this is coming from the thrown Java exception. You could implement your own TestReporter and/or TestListener though to translate the error into something matching your needs.
Something like: https://citrusframework.org/samples/reporting/

Discord.py mod log setup

I was wondering how one could make a command that sets up a mod log for a certain server, or start logging in one that already exists. This will probably require a database or JSON, anything is fine, as long as I can get it to work. Any help would be appreciated.
The way I would do this is with a .txt file that would contain all of the logs. I would add a line every time an event within the guild occurred, you could configure this to whatever events you wanted.
import datetime
#client.event
async def on_member_join(member):
with open("logs.txt", "a") as logsFile:
logsFile.write("\n[{}] {} just joined the server".format(datetime.datetime.now(),
member.name))
If you are currently using the logging module for discord.py or any other libraries, you can also use it for logging your own messages, either using the same or a separate logger.

How to add a custom library using add_block?

I created a custom library. This library contains only one subsytem block named RADAR. I am trying to use add_block and add this subsytem. Without any error the simulink file opens but the block does not appear.
This is how I load my library.
load_system('libdeneme');
And these are some of the code lines I tried.
add_block('simulink/libdeneme/RADAR','autoCreateDeneme')
add_block('simulink/libdeneme/RADAR','autoCreateDeneme')
add_block('libdeneme/RADAR','autoCreateDeneme')
add_block('libdeneme/RADAR',)
The source needs to be the library name then the name of the block in the library. Your first 2 lines don't work because your library is not the simulink library. But the source name in your last 2 attempts look right.
The destination needs to be the name of the model followed by the name to give the new block. Neither of your examples follow that format. (Surely the last example you give throws an error as it is invalid MATLAB syntax?)
You want something like
add_block('libdeneme/RADAR','nameOfModelToCopyTo/nameToGiveBlockInModel');

Getting only 100 crawl issues using webmaster tool

I am using Feed crawlIssues = wtr.GetCrawlIssues(encodedSiteID); to get the crawl errors from my webmaster tool account. There are more than 5k errors but the above code retrieves just the first 100. How do I retrieve all the errors?
Thanks
I've run into the same issue as you have, I only got the first 100 errors, too. Basically, because of a bug in the webmaster tools, it only shows you the errors in 100 batches.
It does not have a built in solution as far as I know, but there is a workaround. Instead of using the GetCrawlIssues function, you can access the data through http requests with the provided ExecRequest.exe command line tool. The basic usage is:
ExecRequest cl QUERY http://www.google.com/webmasters/tools/feeds/example_site.com/crawlissues/?start-index=1&max-results=100 example#gmail.com mypassword
This will output the resulting XML to the console. You can specify the starting point, and the number of errors you want to download:
?start-index=startIndex
&max-results=100
You can set the max-result value to wathever you want, but it will only download a maximum of 100 items.
After downloading in batches, you can get the data from the downloaded xml files.
If you only need the data, I've also written a small script in Python, you can check it out here, it's pretty straightforward.

Perl -Database-Connection Count/error handling

Using a perl script (Perl 5.8.6), I'm connecting to Sybase dataserver.
Looking for the following:
How many connections are currently opened by the script.
Generic (non-dataserver specific) Error handling modules/mechanism
When executing a stored proc, it returned the following error message.
DBD::Sybase::st execute failed: Server
message number=27000 severity=16
state=1 line=4 server=SYBDEV_HYD
procedure=j_err text=But this one does
[for Statement "EXEC sandbox..j_err"]
at
/usr/local/lib/perl5/site_perl/5.8.6/DBIx/ContextualFetch.pm
line 51.
Since the user of this script is a non-techie, trying to report only the message "But this one does" (that appears after the text=). Though I can parse this, trying to see if there is any generic module, since other dataserver (like MySQL, SQL Server etc.) can have their own way of reporting the error msg.
I'm not quite sure what you're asking, but you'll find a lot of information by reading through the documentation for DBD::Sybase and DBI. You probably have to keep track of the number of connections yourself (see the example for DBI->connect).
For error-handling, you should probably just compose a reasonable diagnostic message yourself along with a line number - you can do this easily with warn() or carp().
Please also feel free to edit your question with more specifics about what you are trying to do; some sample code would be helpful.