Getting error in imagemagick - imagemagick

I am running a simple string to compare screenshot but i am getting an error
Error : 0x80041771
Code : 80041771
Source : ImageMagickObject.MagickImage.1
I am still getting output but my script got halted due to above error
Option Explicit
Sub Compare_Image()
Dim img
Dim msgs
Set img = CreateObject("ImageMagickObject.MagickImage.1")
msgs = img.Composite("C:\Users\manasm\Desktop\test\osd4_1.bmp",
"C:\Users\manasm\Desktop\test\osd4_sm.bmp", "-compose", "difference",
"C:\Users\manasm\Desktop\test\DIFFBLOCK.bmp")
Set img=Nothing
WScript.Quit(0)
End Sub
Please give some clue

Related

ADODB.recordset AddNew/Update Method Error -2147467259 (80004005)

I've been getting the following error when trying to write data from my HMI to a MSSQL db using ADODB.recordset with the AddNew/Update Methods. I'm using SQL Server Native Client 11.0 for the connection and Microsoft ActiveX Data Objects 6.0 Library.
Generic VBA Error -2147467259[Microsoft][SQL Server Native Client 11.0][SQL Server]FNGCO,ABCDEFGHI,1000003,2017-04-14,17:00:36:187,FOAML1,A1,,1
If it works this code should write each value to each column in the MSSQL database. I've got very similar code working in another part of the application, but I can't seem to get this working.
What I Have Tried So Far:
Checked against code running in another HMI, everything between the two appears to be identical.
Tried the same connection string with another ADODB.recordset and added data to the db with AddNew/Update.
Checked the database table to make sure all of the data I'm trying to enter fits the column (its not null, max characters not exceeded, etc...)
Here is my code:
On debug, the code halts at sqlrs1.Update.
Option Explicit
Const strSQLNCLI11_1 = "Driver={SQL Server Native Client 11.0};Server=TESTDEMO\SQLEXPRESS;Database=RABPI;Uid=sa;Pwd=testdemo;QueryTimeout=0"'
Private Sub Button1_Released()
On Error GoTo ErrHandler
Dim sqlcn2 As ADODB.Connection
Dim sqlrs1 As ADODB.Recordset
Set sqlcn2 = New ADODB.Connection
Set sqlrs1 = New ADODB.Recordset
sqlcn2.Open strSQLNCLI11_1
sqlrs1.Open "Select * from AT_BW_PRDN ;", _
sqlcn2, adOpenDynamic, adLockPessimistic
sqlrs1.AddNew
sqlrs1("AT_BW_BUS_UNIT") = "FNGCO"
sqlrs1("AT_BW_PID") = "ABCDEFGHI"
sqlrs1("AT_BW_PRDN_AREA") = "FOAML1"
sqlrs1("AT_BW_SHIFT") = "A1"
sqlrs1("AT_BW_ITEM_ID") = "1000007"
sqlrs1("AT_BW_REL") = 0
sqlrs1.Update
Exit Sub
ErrHandler:
LogDiagnosticsMessage "Generic VBA Error" & Err.Number & " " & Err.Description, ftDiagSeverityError, ftDiagAudienceOperator
Set sqlcn2 = Nothing
Set sqlrs1 = Nothing
Exit Sub
End Sub
UPDATE:
I made a test database and re-created the tables I'm trying to write to without any constraints or triggers and the code functioned properly.

GDK ESourceRegistry Used to Work but Not Anymore

I'm developing Thunderbird addon that uses libedataserver.so.
Addon uses js-ctypes to call e_source_registry_new_sync from the above library. See below code:
var lib = ctypes.open("libedataserver-1.2.so.18");
var GCancellable = {};
GCancellable.cls = new ctypes.StructType("GCancellable");
var GError = {};
GError.cls = new ctypes.StructType("GError");
var ESourceRegistry = {};
ESourceRegistry.cls = new ctypes.StructType("ESourceRegistry");
ESourceRegistry.e_source_registry_new_sync =
lib.declare(
"e_source_registry_new_sync",
ctypes.default_abi,
ESourceRegistry.cls.ptr,
GCancellable.cls.ptr,
GError.cls.ptr.ptr);
//below line causes an error
var sourceRegistry = ESourceRegistry.e_source_registry_new_sync(null, null);
It works perfectly fine on Ubuntu however on Fedora 21 it prints below output and hangs:
(thunderbird:2735): GLib-GObject-WARNING **: cannot register existing type 'EDBusSource'
(thunderbird:2735): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed
(thunderbird:2735): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(thunderbird:2735): GLib-GObject-WARNING **: invalid cast from 'EDBusSourceProxy' to '<invalid>'
I'm using Fedora 21 with evolution-data-server 3.12.11-1.fc21.
Ubuntu uses evolution-data-server 3.12.10.
I developed simple C application that calls e_source_registry_new_sync and it works perfectly fine.
Can someone suggest what might be the reason of this issue?
#UPDATE:
I raised a Fedora bug. According to Fedora maintainers issue is caused by loading libedataserver twice (my code and evolution-ews):
The problem seems to be that thunderbird loads libedataserver-1.2.so.18 on its own, while the libcamelews.so has a runtime dependency on libedataserver-1.2.so, but this is not (in runtime) satisfied by the thunderbird-loaded libedataserver-1.2.so.18, thus it is loaded again, which breaks the GLib type system.
Please comment if there is something I can do from addon side.
You are asking about the error happening with this function: https://developer.gnome.org/libedataserver/stable/ESourceRegistry.html#e-source-registry-new-sync
The docs state that on error, NULL is returned and GError is set appropriately. I 'll test the code later and see what's up but I'll tell you here how to test it yourself.
GError is not an opque structure. Define it like this:
var GQuark = ctypes.uint32_t;
GError.cls = new ctypes.StructType('GError', [
{'domain': GQuark},
{'code': ctypes.int},
{'message': ctypes.char.ptr}
]);
Taken from here: https://gist.github.com/Noitidart/dbe54fcd7794c8ddff6f#file-_ff-addon-snippet-gdk_giolaunch-js-L22
Then set up your code to return error like this:
var error = GError.cls.ptr(); // can use `null` if we dont care to see error but we want to know what is happening so we can fix it
var sourceRegistry = ESourceRegistry.e_source_registry_new_sync(null, error.address());
if (sourceRegistry.isNull()) {
console.error('An error occured when calling e_source_registry_new_sync!');
console.info('ERROR DETAILS', 'Domain:', error.contents.domain.toString(), 'Code:', error.contents.code, 'Message:', error.contents.message.readString());
}
Then based on the error details look up that code and message and it will tell you what's up, then search StackOverflow or wherever for a solution to it if it's not obvious.

CasperJs + jenkins : when a test fails, how to retrieve all information on this test

Well , I would like to know how to get back the information of a test failed in jenkins.
Here the result of my folder (fr) (it displays 22 min. but in parallel it's 3min) :
Here the description of the test failed -jenkins- :
Here the description of the test failed -casper- :
So my problem is jenkins displays only the message of the test failed, and I would like to have also useful information as line and code (in fact there is the console output but it's not convenient-> I've changed my mine, it is, see xUnit with Jenkins: how to display colors in the Build Console Output?, but I still want the information in the 'Pile d'exécution'/execution stack).
I found a solution, just change the message ... :
casper.test.on("fail", function(failure) {
failure.message = "Message : " + failure.message + "\nLine : "+ failure.line + "\nCode : " + failure.lineContents;
});
The error resume stack (with test.begin) is also modified though. But I don't care in jenkins, so we can use a condition like if casper.cli.get('xunit') { casper.test.on('fail'){...} ;}.
And so :
Rather simple actually ... I should have better search.
For Artjom :
In fact for errors it's quite verbose so I don't think there are changes to do, see :
But you can still customize it the same way and it could be something like that :
casper.test.on("fail", function(failure) {
//if error type undefined function
if(failure.message.message){//or failure.message.stack.TypeError
failure.message.message = "Message : " + failure.message.message + "\nLine : "+ failure.message.line;//in jenkins -> title
}
//else assert error
else{failure.message = "Message : " + failure.message + "\nLine : "+ failure.line + "\nCode : " + failure.lineContents;}
//console.log(JSON.stringify(failure,4,'\t')); //see parameters you can modify in the failure object
});
There isn't an error event, but different objects-properties- (compared to the type of error) in this fail event. So you can manipulate them in the way you want. But personally I'm interested by the message, the code and the line (and by default jenkins manages them with undefined error).
Now I'm working on a way to display also the screenshot path, to have something like that :
Message : No notice on the page
Line : 83
Code : this.test.assertTextDoesntExists('Notice', 'No notice on the page');
Screenshot : http://-jenkins-/job/-myJob-//lastFailedBuild/artifact/screenshots/fail0.png/
Well, I did it: https://github.com/n1k0/casperjs/pull/920
The aim is to click on the link in jenkins and display screen directly using the browser :)

Cannot display using foreach_in_collection

I am trying to use foreach_in_collection to display a collection the code I am using is:
foreach_in_collection itr $outputs {
puts [get_object_name[$itr]]
}
Here outputs is a collection which has values like out1, out2 etc. When I run this code I am getting an error like unknown command '_sel843'. I know to display he contents I have to convert it to list by using get_object_name. But it is not working. Please help.
get_object_name is an internal procedure which accept an element of a collection.
You should use this value directly, instead of evaluating it.
The correct code is:
foreach_in_collection itr $outputs { puts [get_object_name $itr] }
Rgds,

Problems with smooks

I am currently evaluating smooks (www.smooks.org). It looks just like what we need but I am having problems getting a simple example to work.
I've got an ant script which downloads me all the dependencies including the mapping and binding jars for EDIFACT messages.
I am trying to convert a simple EDIFACT APERAK message to Java using their EJC (I am using JavaSE for this little test).
The conversion fails with an exception that some block wasn't expected (see below). So I am wondering whether I am missing some configuration (notice the first few lines in the log output).
Has anyone worked with Smooks' EJC? How can I get more info about what line it is complaining?
So this is the code:
D00BInterchangeFactory factory = D00BInterchangeFactory.getInstance();
File file = new File("aperak.edi");
BufferedInputStream ediSource = new BufferedInputStream(new FileInputStream(file));
StreamResult xmlStream = new StreamResult();
StringWriter xmlWriter = new StringWriter();
xmlStream.setWriter(xmlWriter);
UNEdifactInterchange interchange = factory.fromUNEdifact(ediSource);
//System.err.println("MEssage "+xmlWriter.toString());
if(interchange instanceof UNEdifactInterchange41){
UNEdifactInterchange41 interchange41 = (UNEdifactInterchange41)interchange;
for(UNEdifactMessage41 message: interchange41.getMessages()){
Object messageObj = message.getMessage();
System.err.println("Ref Num "+message.getMessageHeader().getMessageRefNum());
if(messageObj instanceof Aperak){
Aperak aperak = (Aperak)message.getMessage();
System.err.println("Aperak "+aperak);
}
}
}
When I run it I get this exception
02-Nov-2011 15:58:09 org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy addCDU
WARNING: ContentHandlerFactory [org.milyn.delivery.JavaContentHandlerFactory] unable to create resource processing instance for resource [Target Profile: [[*]], Selector: [cdu-creator], Selector Namespace URI: [null], Resource: [org.milyn.smooks.scripting.groovy.GroovyContentHandlerFactory], Num Params: [1]]. org/codehaus/groovy/control/CompilationFailedException
02-Nov-2011 15:58:10 org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy addCDU
WARNING: ContentHandlerFactory [org.milyn.delivery.JavaContentHandlerFactory] unable to create resource processing instance for resource [Target Profile: [[*]], Selector: [cdu-creator], Selector Namespace URI: [null], Resource: [org.milyn.smooks.scripting.groovy.GroovyContentHandlerFactory], Num Params: [1]]. org/codehaus/groovy/control/CompilationFailedException
Exception in thread "main" org.milyn.SmooksException: Failed to filter source.
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:86)
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:61)
at org.milyn.Smooks._filter(Smooks.java:516)
at org.milyn.Smooks.filterSource(Smooks.java:475)
at org.milyn.Smooks.filterSource(Smooks.java:449)
at org.milyn.edi.unedifact.d00b.D00BInterchangeFactory.fromUNEdifact(D00BInterchangeFactory.java:58)
at org.milyn.edi.unedifact.d00b.D00BInterchangeFactory.fromUNEdifact(D00BInterchangeFactory.java:40)
at EDITestReader.readFile(EDITestReader.java:37)
at EDITestReader.main(EDITestReader.java:59)
Caused by: org.xml.sax.SAXException: Unknown/Unexpected UN/EDIFACT control block segment code '
UN'.
at org.milyn.edisax.unedifact.handlers.r41.UNEdifact41ControlBlockHandlerFactory.getControlBlockHandler(UNEdifact41ControlBlockHandlerFactory.java:53)
at org.milyn.edisax.unedifact.UNEdifactInterchangeParser.parse(UNEdifactInterchangeParser.java:95)
at org.milyn.smooks.edi.unedifact.UNEdifactReader.parse(UNEdifactReader.java:77)
at org.milyn.delivery.sax.SAXParser.parse(SAXParser.java:70)
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:75)
... 8 more
enter code here
The actual EDIFACT message is fairly simple:
UNA:+.? '
UNB+UNOC:3+IMP+XXX+20110902:1024+44090560'
UNH+440905601+APERAK:D:00B:UN:IMP10'
BGM+313++9+RE'
RFF+ACW:XXXXXXXXX1109020'
DTM+182:201109021018:203'
RFF+BM:XXXXXXXXX'
RFF+AGO:XXXXXXX1109020'
RFF+EQ:XXXXXXXX'
NAD+MS+IMP'
CTA+MS+:EDI'
COM+XXXXXXXXXXX:TE'
COM+support#XXXXX.XX:EM'
ERC+200:IMP02:DAK'
FTX+AAO+++ERR4045?: Gest.datum ist mehr als 90 Tage kleiner als das Tagesdatum+DE'
UNT+14+440905601'
UNZ+1+44090560'
When I remove the leading UNA and UNB segment it comes up with this exception: ([APERAK][D:00B:UN]. Must be a minimum of 1 instances of segment [BGM]). There is a BGM segment so I am not sure why it is complaining.
Caused by: org.milyn.edisax.EDIParseException: EDI message processing failed [APERAK][D:00B:UN]. Must be a minimum of 1 instances of segment [BGM]. Currently at segment number 2.
at org.milyn.edisax.EDIParser.mapSegments(EDIParser.java:460)
at org.milyn.edisax.EDIParser.mapSegments(EDIParser.java:411)
at org.milyn.edisax.EDIParser.parse(EDIParser.java:387)
at org.milyn.edisax.EDIParser.parse(EDIParser.java:371)
at org.milyn.edisax.unedifact.handlers.r41.UNHHandler.process(UNHHandler.java:80)
at org.milyn.edisax.unedifact.UNEdifactInterchangeParser.parse(UNEdifactInterchangeParser.java:98)
at org.milyn.smooks.edi.unedifact.UNEdifactReader.parse(UNEdifactReader.java:77)
at org.milyn.delivery.sax.SAXParser.parse(SAXParser.java:70)
UPDATE:
When I remove the carriage returns from the message
UNH+440905601+APERAK:D:00B:UN:IMP10'BGM+313++9+RE'RFF+ACW:XXXXXXXXX1109020'DTM+182:201109021018:203'
it works fine. But how do I get smooks to accept carriage returns and whitespaces and the two leading UNA/UNB segments? I probably skipped some part of message processing smooks normally does.
UPDATE 2:
Figured out UNA/UNB segments are supported (my mistake) but I am still having problems with the carriage returns.
Renat suggested to use a 'ignoreNewLines' option on the EDIParser. I've tried that but it doesn't seem to make a difference. I've also tried to configure smooks with this:
<?xml version="1.0" encoding="UTF-8"?>
<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.4.xsd">
<edi:reader mappingModel="/org/milyn/smooks/edi/xsd14/edi-to-xml-mapping.xml" ignoreNewLines="true" />
</smooks-resource-list>
Again with no success.
I have the feeling that the D00AInterchangeFactory (or what every version you use) configures its EDIParser differently and ignoreNewLines is ignored.
Is there a way to get the EDIParser the InterchangeFactory is using?
You need to add enable 'ignore new line' switch on the EDIParser.
You have multiple ways to do that, for example you can use a XMLReader#setFeature()
http://download.oracle.com/javase/1.5.0/docs/api/org/xml/sax/XMLReader.html#setFeature(java.lang.String,%20boolean)
or directly via EDIParser method call. See samples here
https://gist.github.com/825845
and here
https://gist.github.com/825843
Renat

Resources