ArrayIndexOutOfBoundsException in Grid with Allow Selection (Genexus) - runtime-error

Im having this problem that I couldn't find a way to solve. I have a dynamic grid with the allow selection option in true ant I have filters that if they changed the grid is reloaded and maybe has less rows than before. The problem occurs when I had selected a row, for example number 10 and then I reload the grid and only has for example 4 rows. When I try to put "Apply" (wich aplies the filters and reloads the grid) it sends the famous "ArrayIndexOutOfBoundsException". This is because it remembers the last line selected. Is there any way to clean that? To forget the line that was selected?
Im using GeneXus X Evolution 1 version 10.1.32504 U2.5
Here is the error trace:
javax.servlet.ServletException: java.lang.ArrayIndexOutOfBoundsException: 9 >= 6
at java.util.Vector.elementAt(Unknown Source)
at com.genexus.GXObjectCollectionBase.elementAt(GXObjectCollectionBase.java:424)
at com.si.ayc.aycampliacionesgeneralpaso1_43_impl.strup8N0(aycampliacionesgeneralpaso1_43_impl.java:1008)
at com.si.ayc.aycampliacionesgeneralpaso1_43_impl.start8N2(aycampliacionesgeneralpaso1_43_impl.java:305)
at com.si.ayc.aycampliacionesgeneralpaso1_43_impl.executeStartEvent(aycampliacionesgeneralpaso1_43_impl.java:137)
at com.si.ayc.mpprincipalayc_impl.start042(mpprincipalayc_impl.java:216)
at com.si.ayc.mpprincipalayc_impl.ws042(mpprincipalayc_impl.java:225)
at com.si.ayc.mpprincipalayc_impl.webExecute(mpprincipalayc_impl.java:56)
at com.si.ayc.aycampliacionesgeneralpaso1_43_impl.webExecute(aycampliacionesgeneralpaso1_43_impl.java:110)
at com.genexus.webpanels.GXWebObjectBase.doExecute(GXWebObjectBase.java:177)
at com.si.ayc.aycampliacionesgeneralpaso1_43.doExecute(aycampliacionesgeneralpaso1_43.java:21)
at com.genexus.webpanels.GXWebObjectStub.callExecute(GXWebObjectStub.java:44)
at com.genexus.webpanels.GXWebObjectStub.doPost(GXWebObjectStub.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:402)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:170)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:157)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:131)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Unknown Source)
Thank you for reading and trying to help.
Manuela

Related

OptaPlanner Examples doesn't work and gives error

When I try to open OptaPlanner Examples from examples.bat, interface comes to my screen. But when I click on a random example it gives error and doesn't work. It starts like;
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: There is an error in a scoreDrl or scoreDrlFile.
at org.optaplanner.core.impl.score.director.ScoreDirectorFactoryFactory.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryFactory.java:306)
at org.optaplanner.core.impl.score.director.ScoreDirectorFactoryFactory.decideMultipleScoreDirectorFactories(ScoreDirectorFactoryFactory.java:103)
at org.optaplanner.core.impl.score.director.ScoreDirectorFactoryFactory.buildScoreDirectorFactory(ScoreDirectorFactoryFactory.java:68)
at org.optaplanner.core.impl.solver.DefaultSolverFactory.buildScoreDirectorFactory(DefaultSolverFactory.java:116)
at org.optaplanner.core.impl.solver.DefaultSolverFactory.buildSolver(DefaultSolverFactory.java:83)
at org.optaplanner.examples.common.business.SolutionBusiness.setSolver(SolutionBusiness.java:197)
at org.optaplanner.examples.common.app.CommonApp.createSolutionBusiness(CommonApp.java:130)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:118)
...
Caused by: java.lang.RuntimeException: [Message [id=1, level=ERROR, path=src/main/java/org/optaplanner/examples/conferencescheduling/solver/RulesE771C4C7BDBE449D9F55BB1736BF1764RuleMethods2.java, line=355, column=74439
text=ınt cannot be resolved to a type], Message [id=2, level=ERROR, path=src/main/java/org/optaplanner/examples/conferencescheduling/solver/RulesE771C4C7BDBE449D9F55BB1736BF1764RuleMethods2.java, line=360, column=76059
text=ınt cannot be resolved to a type], Message [id=3, level=ERROR, path=src/main/java/org/optaplanner/examples/conferencescheduling/solver/RulesE771C4C7BDBE449D9F55BB1736BF1764RuleMethods2.java, line=0, column=0
text=Java source of src/main/java/org/optaplanner/examples/conferencescheduling/solver/RulesE771C4C7BDBE449D9F55BB1736BF1764RuleMethods2.java in error:
I don't see this error with the latest OptaPlanner downloaded from https://www.optaplanner.org.
Would you mind reporting the issue with exact steps to reproduce it?

How to load SparkNLP offline model in python

I need to use sparknlp to do lemmatization in python, i want to use the pretrained pipeline, however need to do it offline. what is the correct way to do this? i am not able to find any python example.
I am passing token as the inputcol for lemmatization and lemma as the outputcol. Following is my code:
documentAssembler = DocumentAssembler().setInputCol("Transcript").setOutputCol("document")
tokenizer = Tokenizer().setInputCols(['document']).setOutputCol('token')
lemmatizer = LemmatizerModel().load("xx").setInputCols(["token"]).setOutputCol("lemma")
error message:
Py4JJavaError: An error occurred while calling None.com.johnsnowlabs.nlp.annotators.LemmatizerModel.
: java.lang.NoClassDefFoundError: Could not initialize class com.johnsnowlabs.util.ConfigHelper$
at com.johnsnowlabs.nlp.serialization.Feature.<init>(Feature.scala:22)
at com.johnsnowlabs.nlp.serialization.MapFeature.<init>(Feature.scala:145)
at com.johnsnowlabs.nlp.annotators.LemmatizerModel.<init>(LemmatizerModel.scala:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:247)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:238)
at py4j.commands.ConstructorCommand.invokeConstructor(ConstructorCommand.java:80)
at py4j.commands.ConstructorCommand.execute(ConstructorCommand.java:69)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.lang.Thread.run(Thread.java:748)
Not sure why you're getting this specific error (how did you initialize Spark?), but this is another issue.
To use the lemmatizer offline you first need to download a pretrained one, for example from here, and unzip it. Then change your code to
lemmatizer = LemmatizerModel().load("/path/to/unzipped/model").setInputCols...

Selenium findElement(By.cssSelector) for "text" that has no associated tag

Looking at HTML code with this as a web page drop list option:
<div class="select5-result-label" id="select5-result-label-31" role="option">
<span class="select2-match"></span>
"Jedi"
</div>
Attempting to use selenium css selectors to select/click the "Jedi" option. Tried:
- driver.findElement(By.id("select5-result-label-31")).click();
- driver.findElement(By.cssSelector("div#select5-result-label-31")).click();
- driver.findElement(By.cssSelector("div[text='Jedi']")).click();
but none of the attempts above have been able to select the drop list value. Returns runtime error message of:
*** Element info: {Using=css selector, value=div[text='Jedi']}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
Suspect it is because the "Jedi" value has no tag. Any suggestions to select/click the option above? Very much appreciated, thanks in advance.

TransactionTooLargeException on Samsung S7

one of my apps is throwing the following exception on an Samsung S7:
java.lang.RuntimeException:
at android.app.NotificationManager.notifyAsUser
(NotificationManager.java:342)
at android.app.NotificationManager.notify (NotificationManager.java:292)
at android.app.NotificationManager.notify (NotificationManager.java:276)
at
org.mypapp.test.service.NotificationReceiverRemoteViews.updateNotification
(NotificationReceiverRemoteViews.java:202)
at org.mypapp.test.service.NotificationReceiverRemoteViews.onReceive
(NotificationReceiverRemoteViews.java:63)
at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts
(LocalBroadcastManager.java:308)
at android.support.v4.content.LocalBroadcastManager.access$000
(LocalBroadcastManager.java:46)
at android.support.v4.content.LocalBroadcastManager$1.handleMessage
(LocalBroadcastManager.java:118)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6642)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358)
Caused by: android.os.TransactionTooLargeException:
at android.os.BinderProxy.transactNative (Native Method)
at android.os.BinderProxy.transact (Binder.java:628)
at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag
(INotificationManager.java:899)
at android.app.NotificationManager.notifyAsUser
(NotificationManager.java:336)
Here the code at line 202:
notificationManager.notify(NOTIFICATION_ID, mBuilder.build());
I also use an Samsung S7 and I have never gotten that error. I can't reproduce the error with the ansdroid studio emulator either. So I don't know how to fix an error I can't reproduce.
Any idea?
Possible reason is that you update RemoteViews instance before NotificationManager#notify instead of recreating a new one thus producing memory leak. I described this case in another answer

Unable to print node properties in DSE graph

Apologies as this might be very basic question on the topic but I am new to Gremlin/DSE Graph and i tried many ways to extract data i am inserting to my graph but somehow i am unable to make it work.
Here is what i have:
1. Graph with allow_scans set to true
2. Schema with propertyKey and vertexes defined and materialized index on NodeID of all Vertexes.
There are no relationships right now, just vertexes with data points.
I wrote a program to insert all my nodes to DSE Graph which is working successfully as i get response like below after program created every Vertex:
Result({u'id': {u'out_vertex': {u'community_id': 853347840, u'~label': u'vertex', u'member_id': 14}, u'~type': u'Name', u'local_id': u'00000000-0000-8012-0000-000000000000'}, u'value': u'amount', u'label': u'Name'})]
Ok So now the nodes are inserted, i want to extract them and print their names:
So i did:
g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').values('Name');
Above failed successfully with blank result. I mean it runs successfully with null output like there is no error but then there is no output. (null in gremlin-console and 'Success - No Results' in DataStax Studio)
Then i came across documentation that graph will not know if the 'has' will only return one node or more, so i used next for iterating as per documentation and tutorials:
g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').next().values('Name');
Even this failed with
org.apache.tinkerpop.gremlin.driver.exception.ResponseException
(Datastax studio doesnt show more information) - How can i debug this further?
I even came across lambda approach in which i use map :
g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').map{it.get().value('Name')};
which responded with 'it' not being defined.
(i even tried valueMap - not sure if it was even required)
What am i doing wrong to find and print properties values of a node?
Any directions or query which can help me extract the names and other properties? Even a multi-step query? however i don't think this should be that complicated.
UPDATE:
As per answer i get the following traceback:
gremlin> :> g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').valueMap(true).next();
org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
Type ':help' or ':h' for help.
Display stack trace? [yN]y
org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
at org.apache.tinkerpop.gremlin.console.groovy.plugin.DriverRemoteAcceptor.submit(DriverRemoteAcceptor.java:170)
at org.apache.tinkerpop.gremlin.console.commands.SubmitCommand.execute(SubmitCommand.groovy:41)
at org.codehaus.groovy.tools.shell.Shell.execute(Shell.groovy:104)
at org.codehaus.groovy.tools.shell.Groovysh.super$2$execute(Groovysh.groovy)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.codehaus.groovy.tools.shell.Groovysh.executeCommand(Groovysh.groovy:259)
at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:84)
at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:122)
at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:95)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:124)
at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:59)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:83)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:152)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:401)
I am able to do some similar operations in another graph. Is something wrong with the graph?
UPDATE 2
My Graph vertices were wrongly defined.
The key to drill down to this solution is in the ~label in the result. It points to vertex instead it should be Field
While defining the data insert team had put label in quotes when they had to put mention label without quotes. Hence i was not able to traverse the nodes.
You need to make sure to iterate the traversal. Most commonly you would use either:
iterate() get zero result
next() get one result
toList() get many results
I'd guess that NodeID is unique, so try something like this:
g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').
values('Name').next();
If you're interested in all of the properties on that vertex, try:
g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').
valueMap(true).next();

Resources