I'm using SmartGWT -4.0 and tried to run the example of using DataSource with Json , RestDataSourceWithJson.zip .
but the development mode console returns me the following error :
[ ERROR ] [ restdatasourcewithjson ] 10:55:28.214 : XRP4 : WARN : RPCManager : performTransactionReply : No such transaction 0
com.smartgwt.client.core.JsObject $ SGWT_WARN : 10:55:28.214 : XRP4 : WARN : RPCManager : performTransactionReply : No such transaction 0
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0 ( Native Method )
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce ( NativeConstructorAccessorImpl.java : 57)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance ( DelegatingConstructorAccessorImpl.java : 45)
at java.lang.reflect.Constructor.newInstance ( Constructor.java : 525 )
at com.google.gwt.dev.shell.MethodAdaptor.invoke ( MethodAdaptor.java : 105)
at com.google.gwt.dev.shell.MethodDispatch.invoke ( MethodDispatch.java : 71)
at com.google.gwt.dev.shell.OophmSessionHandler.invok e ( OophmSessionHandler.java : 172)
at com.google.gwt.dev.shell.BrowserChannelServer.reac tToMessages ( BrowserChannelServer.java : 293)
at com.google.gwt.dev.shell.BrowserChannelServer.proc essConnection ( BrowserChannelServer.java : 547)
at com.google.gwt.dev.shell.BrowserChannelServer.run ( BrowserChannelServer.java : 364 )
at java.lang.Thread.run ( Thread.java : 722 )
this happens to any other project that uses json .
has anyone had this error ?
thanks for the help .
I have been getting this too when running a REST webapp using Smartgwt Datasources and XML messaging with Jersey, under Chrome. Other browsers don't throw this error.
You will get errors in that situation because running a Smartgwt app under Chrome is not supported (albeit sometimes useful to check what your CSS looks like), so I would just say use another browser for dev mode.
Source:
Smartgwt user guide, and this thread: http://forums.smartclient.com/showthread.php?t=30289
Related
I as trying to parse a json response. However, there is a trailing comma at the end of the reponse which throws an error while decoding it. How do i automatically format if from code such that it removes the comma and validates it?
[{"id" : "9991","last_message" : "How about tomorrow then?","members" : ["John", "Daniel", "Rachel"],"topic" : "pizza night", "modified_at" : 1599814026153}, {"id" : "9992","last_message" : "I will send them to you asap","members" : ["Raphael"],"topic" : "slides", "modified_at" : 1599000026153}, {"id" : "9993","last_message" : "Can you please?","members" : ["Mum", "Dad", "Bro"],"topic" : "pictures", "modified_at" : 1512814026153},]
Error
D/EGL_emulation( 7121): app_time_stats: avg=32.94ms min=4.95ms max=83.26ms count=30
E/flutter ( 7121): [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: FormatException: Unexpected character (at character 435)
E/flutter ( 7121): ..."Mum", "Dad", "Bro"],"topic" : "pictures", "modified_at" : 1512814026153},]
So, you should give some code from source, but I think you're using a http.Response object so you can do something like this:
String bodyRes = response.body;
bodyRes = bodyRes.endsWith(',]') ? bodyRes.replaceFirst(',]', ']', bodyRes.length - 2) : bodyRes;
I've got a module that generates the following FIRRTL
module Deep_1 :
input clock : Clock
input reset : UInt<1>
output io : {in : {flip data : SInt<8>[4]}, constIn : {flip data : SInt<8>[4]}, ...}
...
... (elided)
...
wire inputData : SInt<8>[4] #[Deep.scala 32:23]
wire constInputData : SInt<8>[4] #[Deep.scala 33:28]
reg outputData : SInt<8>[4], clock #[Deep.scala 34:23]
inputData[2] <= io.in.data[2] #[Deep.scala 37:18]
constInputData[2] <= io.constIn.data[2] #[Deep.scala 38:23]
node _T_209 = add(inputData[2], constInputData[2]) #[package.scala 32:44]
node _T_210 = tail(_T_209, 1) #[package.scala 32:44]
node _T_211 = asSInt(_T_210) #[package.scala 32:44]
outputData[2] <= _T_211 #[Deep.scala 39:19]
...
... (elided)
...
but when I try to run my tests through the firrtl interpreter I get
Exception during evaluation: error: ConcreteSInt(303, 9) bad width 9 needs 10 #[package.scala 32:44:#82.4]
Expression Evaluation stack
0 dut.outputData_2:Reg -> dut._T_211
1 dut._T_211:Node -> asSInt(dut._T_210)
2 dut._T_210:Node -> tail(dut._T_209, 1)
3 dut._T_209:Node -> add(dut.inputData_2, dut.constInputData_2)
If I understand this correctly, it is saying that the width of outputData[2] is 9 but 10 is needed. However, from what I can see, the width of both outputData[2] and _T_211 should be 8, the first by definition and the second as a result of the add() and tail() operations applied.
What am I missing?
How current is your software? I cannot reproduce the problem with current versions of the interpreter. I used the following firrtl test in the gist Attempt to reproduce firrtl-interpreter width error where I un-elided. As #Kamyar said, can you try using the Treadle backend. It is more modern and better supported at this point than is the interpreter.
We are using jOOQ to talk to a MySQL database containing this table:
CREATE TABLE daily_sessions
(
session_id INT AUTO_INCREMENT NOT NULL,
user_id VARCHAR(45) NULL,
day date NULL,
CONSTRAINT PK_DAILY_SESSIONS PRIMARY KEY (session_id)
);
We have enabled the support for the JSR-310 types, so we are using LocalDate on the Java/Kotlin side to map this.
What we are seeing is that the day field gets retrieved with an offset of one day. The inserts and select statements logged by jOOQ seem to indicate it is doing the right thing when binding SQL parameters, but when the result comes back it shows the day before:
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.i.DefaultConnectionProvider - setting auto commit : false
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.tools.LoggerListener - Executing query : select `daily_sessions`.`session_id`, `daily_sessions`.`user_id`, `daily_sessions`.`day` from `daily_sessions` where (`daily_sessions`.`user_id` = ? and `daily_sessions`.`day` = ?)
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.tools.LoggerListener - -> with bind values : select `daily_sessions`.`session_id`, `daily_sessions`.`user_id`, `daily_sessions`.`day` from `daily_sessions` where (`daily_sessions`.`user_id` = '87a09702-0d6b-485c-895c-986f238e1d30' and `daily_sessions`.`day` = {d '2011-11-11'})
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.tools.LoggerListener - Fetched result : +----------+------------------------------------+----------+
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.tools.LoggerListener - : |session_id|user_id |day |
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.tools.LoggerListener - : +----------+------------------------------------+----------+
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.tools.LoggerListener - : | 13|87a09702-0d6b-485c-895c-986f238e1d30|2011-11-10|
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.tools.LoggerListener - : +----------+------------------------------------+----------+
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.tools.LoggerListener - Fetched row(s) : 1
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.i.DefaultConnectionProvider - commit
2019-04-05 09:32:08 [Gax-20 ] DEBUG o.j.i.DefaultConnectionProvider - setting auto commit : true
2019-04-05 09:32:08 [Gax-20 ] DEBUG c.z.hikari.pool.PoolBase - HikariPool-1 - Reset (isolation) on connection com.mysql.cj.jdbc.ConnectionImpl#4af95547
Notice how the select filters on 2011-11-11, but the result table shows 2011-11-10.
This is from a test, run on my local machine (UTC+10), against the standard mysql Docker image running locally as well.
Despite using DATE, I assume we are running into some timezone issue, but I cannot reproduce the problem by talking JDBC directly. I tried running this in the same setup the other tests run in:
#Test
fun testDateColumn() {
DriverManager.getConnection("jdbc:mysql://localhost:8890/rewards-test", "root", "").use { con ->
con.createStatement().use { stmt ->
stmt.execute("insert into `daily_sessions` (`user_id`, `day`) values ('a20add98-5a93-417f-a771-848757b2b1f8', {d '2011-11-11'})")
}
con.createStatement().use { stmt ->
stmt.executeQuery("select `daily_sessions`.`session_id`, `daily_sessions`.`user_id`, `daily_sessions`.`day` from `daily_sessions` where (`daily_sessions`.`user_id` = 'a20add98-5a93-417f-a771-848757b2b1f8' and `daily_sessions`.`day` = {d '2011-11-11'})").use { rs ->
while (rs.next()) {
println("${rs.getString(3)} - ${rs.getDate(3)}")
}
}
}
}
}
This code produces the expected output. The SQL statements are straight copies from the jOOQ logs. There must be something else jOOQ does that I do not understand.
Do I need to configure timezones in jOOQ somehow? Or am I missing anything else?
Update
As proposed by Lukas in the comments, I tried changing my JDBC test to use prepared statements:
#Test
fun testDateColumn() {
DriverManager.getConnection("jdbc:mysql://localhost:8890/rewards-test", "root", "").use { con ->
con.prepareStatement("insert into `daily_sessions` (`user_id`, `day`) values (?, ?)").use { ps ->
ps.setString(1, "a20add98-5a93-417f-a771-848757b2b1f8")
ps.setDate(2, Date.valueOf(LocalDate.of(2011, 11, 11)))
ps.execute()
}
con.prepareStatement("select `daily_sessions`.`session_id`, `daily_sessions`.`user_id`, `daily_sessions`.`day` from `daily_sessions` where (`daily_sessions`.`user_id` = ? and `daily_sessions`.`day` = ?)").use { ps ->
ps.setString(1, "a20add98-5a93-417f-a771-848757b2b1f8")
ps.setDate(2, Date.valueOf(LocalDate.of(2011, 11, 11)))
ps.executeQuery().use { rs ->
while (rs.next()) {
println("${rs.getString(3)} - ${rs.getDate(3)}")
}
}
}
}
}
This indeed produces the wrong results, the output is 2011-11-10 for both the string and date variants. It seems there is something I don't understand in JDBC.
Update 2
The code above can be fixed by passing the default java.util.Calendar instance as a third parameter to the setDate method, i.e. replacing both cases above with:
ps.setDate(2, Date.valueOf(LocalDate.of(2011, 11, 11)), Calendar.getInstance())
Using this we see the expected output, whereas the plain version without the third parameter does not.
The JavaDoc of the setDate method says the absence of the Calendar object will cause the VM's time zone to be used, which seems to be exactly the same the definition of Calendar.getInstance() specifies, which seems to indicate nothing should change.
This turned out to be a known bug in the MySQL JDBC driver. My fix was to revert to a much older version which predates the problem.
I extracted some data from a mongo database using the RMongo library. I have been working with the data with no problem. However, I need to access a field that was saved, originally in the database, as JSON. Since rmongodb saves the data as data frame, I now have a large character vector of length 1:
res1 = "[ { \"text\" : \"#Kayture Beyoncé jam session ?\" , \"name\" : \"beponcé \xed\xa0\xbc\xed\xbc\xbb\" , \"screenName\" : \"ColaaaaTweedy\" , \"follower\" : false , \"mentions\" : [ \"Kayture\"] , \"userTwitterId\" : \"108061963\"} , { \"text\" : \"#Kayture fucking marry me\" , \"name\" : \"George McQueen\" , \"screenName\" : \"GeorgeMcQueen12\" , \"follower\" : false , \"mentions\" : [ \"Kayture\"] , \"userTwitterId\" : \"67896750\"}]"
I need to extract all the "text" attributes of the objects from this array (there are 2 in this example), but I can not figure out a fast way. I was trying using strsplit, or going from character to json files using jsonlite, and then to list, but it does not work.
Any ideas?
Thanks!
Starting from
res1 = "[ { \"text\" : \"#Kayture Beyoncé jam session ?\" , \"name\" : \"beponcé \xed\xa0\xbc\xed\xbc\xbb\" , \"screenName\" : \"ColaaaaTweedy\" , \"follower\" : false , \"mentions\" : [ \"Kayture\"] , \"userTwitterId\" : \"108061963\"} , { \"text\" : \"#Kayture fucking marry me\" , \"name\" : \"George McQueen\" , \"screenName\" : \"GeorgeMcQueen12\" , \"follower\" : false , \"mentions\" : [ \"Kayture\"] , \"userTwitterId\" : \"67896750\"}]"
you can use fromJSON() from the jsonlite package to parse that JSON object.
library(jsonlite)
fromJSON(res1)
text name screenName follower mentions userTwitterId
1 #Kayture Beyoncé jam session ? beponcé í ¼í¼» ColaaaaTweedy FALSE Kayture 108061963
2 #Kayture fucking marry me George McQueen GeorgeMcQueen12 FALSE Kayture 67896750
Format:
{
"lastUpdate" : "20/9/2012-12:12",
"data":[{
"user" : "_name_",
"username" : "_fullname_",
"photoURL" : "_url_"
}, {
"user" : "_name_",
"username" : "_fullname_",
"photoURL" : "_url_"
}, {
"user" : "_name_",
"username" : "_fullname_",
"photoURL" : "_url_"
}]
}
Aptana gives errors at the :
Screenshot Aptana JSON format
Why is that? It seems I'm not having any problems receiving and processing the data.
[EDIT 1] Error given: Syntax Error: unexpected token ":"
In Aptana json is parsed "as json" only when you create/open a file with extension .json.
When have a json object inside a .js file works only the javascript parser, for that you see the error, is not a valid token for JS.