I am trying to do the implementation of opc ua client using eclipse milo sdk and the reference link am using is:
https://community.hortonworks.com/questions/176894/opc-ua-client-performance-with-eclipse-milo.html
for the Publish/Subscribe code since am having multiple nodes am not able to make out the data that I get corresponds to which node id and also the timestamp I am getting am not able to make out its in which format.
Item: org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaMonitoredItem#2b2c39b1
Value: DataValue{value=Variant{value=11}, status=StatusCode{name=Good, value=0x00000000, quality=good},
sourceTime=DateTime{utcTime=131771575305048867, javaDate=Fri Jul 27 15:02:10 IST 2018},
serverTime=DateTime{utcTime=131771575305048867, javaDate=Fri Jul 27 15:02:10 IST 2018}}
and when am using Async Read code am not getting timestamp.
[DataValue{value=Variant{value=3},
status=StatusCode{name=Good, value=0x00000000, quality=good}, sourceTime=DateTime{utcTime=0, javaDate=Mon Jan 01 05:30:00 IST 1601}, serverTime=DateTime{utcTime=0, javaDate=Mon Jan 01 05:30:00 IST 1601}},
DataValue{value=Variant{value=11}, status=StatusCode{name=Good, value=0x00000000, quality=good}, sourceTime=DateTime{utcTime=0, javaDate=Mon Jan 01 05:30:00 IST 1601},
serverTime=DateTime{utcTime=0, javaDate=Mon Jan 01 05:30:00 IST 1601}},
DataValue{value=Variant{value=8}, status=StatusCode{name=Good, value=0x00000000, quality=good},
sourceTime=DateTime{utcTime=0, javaDate=Mon Jan 01 05:30:00 IST 1601}, serverTime=DateTime{utcTime=0, javaDate=Mon Jan 01 05:30:00 IST 1601}}]
can anyone give me some idea on where am going wrong?
It might be easier to understand if you started with the examples from Milo itself, rather than a random benchmark someone wrote using Milo that you happened to stumble across.
Check out the examples:
Subscribe Example
Read Example
Related
I am new to java can anyone explain to me how this code works in this example
specially the LOOP portion
import java.util.*;
import static java.lang.System.out;
class FullMoons {
static int DAY_IM = 1000 * 60 * 60 * 24;
public static void main(String [] args) {
Calendar c = Calendar.getInstance();
c.set(2004,0,7,15,40);
long day1 = c.getTimeInMillis();
for (int x = 0; x < 60; x++) {
day1 += (DAY_IM * 29.52);
c.setTimeInMillis(day1);
out.println(String.format("full moon on %tc", c));
}
}
}
output is
full moon on Fri Feb 06 04:06:35 MST 2004
full moon on Sat Mar 06 16:38:23 MST 2004
full moon on Mon Apr 05 06:07:11 MDT 2004
an answer should be displayed in first three loops why it takes entire 60 runnings
What is the answer and why it should be displayed in first 3 loops?
This code creates Calendar and then added to the first full moon date the duration of lunar month (about 29.52 days).
The cycle body runs 60 times, because condition x < 60 and x++ increase x by 1.
//increase number of milliseconds
day1 += (DAY_IM * 29.52);
//set increased number to Calendar c
c.setTimeInMillis(day1);
//create formatted string
String s = String.format("full moon on %tc", c);
//output the string
out.println(s);
read more about how String.format() works in official documentation
This code will run 60 times throughout the Loop..
I realized my mistake which is iam only going by theory rather than doing practical...so guys this is lesson, and iam posting the result so that this question dosent create any unnecessary confusion further.
full moon on Fri Feb 06 04:08:48 IST 2004
full moon on Sat Mar 06 16:37:36 IST 2004
full moon on Mon Apr 05 05:06:24 IST 2004
full moon on Tue May 04 17:35:12 IST 2004
full moon on Thu Jun 03 06:04:00 IST 2004
full moon on Fri Jul 02 18:32:48 IST 2004
full moon on Sun Aug 01 07:01:36 IST 2004
full moon on Mon Aug 30 19:30:24 IST 2004
full moon on Wed Sep 29 07:59:12 IST 2004
full moon on Thu Oct 28 20:28:00 IST 2004
full moon on Sat Nov 27 08:56:48 IST 2004
full moon on Sun Dec 26 21:25:36 IST 2004
full moon on Tue Jan 25 09:54:24 IST 2005
full moon on Wed Feb 23 22:23:12 IST 2005
full moon on Fri Mar 25 10:52:00 IST 2005
full moon on Sat Apr 23 23:20:48 IST 2005
full moon on Mon May 23 11:49:36 IST 2005
full moon on Wed Jun 22 00:18:24 IST 2005
full moon on Thu Jul 21 12:47:12 IST 2005
full moon on Sat Aug 20 01:16:00 IST 2005
full moon on Sun Sep 18 13:44:48 IST 2005
full moon on Tue Oct 18 02:13:36 IST 2005
full moon on Wed Nov 16 14:42:24 IST 2005
full moon on Fri Dec 16 03:11:12 IST 2005
full moon on Sat Jan 14 15:40:00 IST 2006
full moon on Mon Feb 13 04:08:48 IST 2006
full moon on Tue Mar 14 16:37:36 IST 2006
full moon on Thu Apr 13 05:06:24 IST 2006
full moon on Fri May 12 17:35:12 IST 2006
full moon on Sun Jun 11 06:04:00 IST 2006
full moon on Mon Jul 10 18:32:48 IST 2006
full moon on Wed Aug 09 07:01:36 IST 2006
full moon on Thu Sep 07 19:30:24 IST 2006
full moon on Sat Oct 07 07:59:12 IST 2006
full moon on Sun Nov 05 20:28:00 IST 2006
full moon on Tue Dec 05 08:56:48 IST 2006
full moon on Wed Jan 03 21:25:36 IST 2007
full moon on Fri Feb 02 09:54:24 IST 2007
full moon on Sat Mar 03 22:23:12 IST 2007
full moon on Mon Apr 02 10:52:00 IST 2007
full moon on Tue May 01 23:20:48 IST 2007
full moon on Thu May 31 11:49:36 IST 2007
full moon on Sat Jun 30 00:18:24 IST 2007
full moon on Sun Jul 29 12:47:12 IST 2007
full moon on Tue Aug 28 01:16:00 IST 2007
full moon on Wed Sep 26 13:44:48 IST 2007
full moon on Fri Oct 26 02:13:36 IST 2007
full moon on Sat Nov 24 14:42:24 IST 2007
full moon on Mon Dec 24 03:11:12 IST 2007
full moon on Tue Jan 22 15:40:00 IST 2008
full moon on Thu Feb 21 04:08:48 IST 2008
full moon on Fri Mar 21 16:37:36 IST 2008
full moon on Sun Apr 20 05:06:24 IST 2008
full moon on Mon May 19 17:35:12 IST 2008
full moon on Wed Jun 18 06:04:00 IST 2008
full moon on Thu Jul 17 18:32:48 IST 2008
full moon on Sat Aug 16 07:01:36 IST 2008
full moon on Sun Sep 14 19:30:24 IST 2008
full moon on Tue Oct 14 07:59:12 IST 2008
full moon on Wed Nov 12 20:28:00 IST 2008
Okay I don't know how to explain this but if you look a
Players:
_Brand0n_:
'Fourm Link:': 'Null'
'Registered:': 'No'
'GamePoints:': '0'
'UUID:': 94bad256-7fa0-49c6-add1-50b61a854dc3
Reports:
'#R:': '0'
'TheeLux:': Hacking Time: Fri Jul 22 12:21:35 CDT 2016'
'Adam_Hall:': Hacking Time: Fri Jul 22 12:21:35 CDT 2016'
I need to be able to take the reports from TheeLux and Adam_Hall and print an msg saying
Adam_Hall: Hacking - Time: Fri Jul 22 12:21:35 CDT 2016
But I don't know how to take however many configuration sections and make them into strings ext. If this is confusing please post a comment and I'll try and clarify.
I am working on a tool which uses ews-java-api to create, update and delete calendar items in Outlook agenda. It has been working fine, but now sometimes when it tries to update some calendar item, I get following error:
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: At least one recipient isn't valid., A message can't be sent because it contains no recipients.
at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
at microsoft.exchange.webservices.data.core.ExchangeService.internalUpdateItems(ExchangeService.java:691)
at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
at be.vrt.quintiqexchange.main.QuintiqAdapter.insertUpdateCalendarItems(QuintiqAdapter.java:879)
at be.vrt.quintiqexchange.main.QuintiqAdapter.updateCalendarItems(QuintiqAdapter.java:796)
at be.vrt.quintiqexchange.main.QuintiqAdapter.run(QuintiqAdapter.java:286)
at java.lang.Thread.run(Thread.java:745)
Recently all the exchange accounts have been migrated from local Outlook servers to Office365 cloud servers. Maybe this has something to do with it? Or anybody have any idea on what is going wrong?
Following code is to perform the update for an item:
Item it = alitems.get(i);
...
it.update(ConflictResolutionMode.AlwaysOverwrite);
Following is the url being used to access office365 ews:
exchangewebservice = https://outlook.office365.com/EWS/Exchange.asmx
Thanks in advance
Edit: I use ews-java-api version 2.0
Edit: Here you can see that the error occurs on one line and than the next line, with the same recipient it doesn't occur...
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: At least one recipient isn't valid., A message can't be sent because it contains no recipients.
at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
at microsoft.exchange.webservices.data.core.ExchangeService.internalUpdateItems(ExchangeService.java:691)
at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
at be.vrt.quintiqexchange.main.QuintiqAdapter.insertUpdateCalendarItems(QuintiqAdapter.java:880)
at be.vrt.quintiqexchange.main.QuintiqAdapter.updateCalendarItems(QuintiqAdapter.java:703)
at be.vrt.quintiqexchange.main.QuintiqAdapter.run(QuintiqAdapter.java:283)
at java.lang.Thread.run(Thread.java:745)
WARN be.vrt.quintiqexchange.main.QuintiqAdapter - At least one recipient isn't valid., A message can't be sent because it contains no recipients.by UPDATE for subject: on Thu Jun 23 14:00:00 CEST 2016 Thu Jun 23 19:00:00 CEST 2016 of user name.lastname#domain.com
INFO be.vrt.quintiqexchange.main.QuintiqAdapter - Appointment updated for subject: NIET DAG on Fri Aug 05 10:00:00 CEST 2016 Fri Aug 05 18:00:00 CEST 2016 of user name.lastname#domain.com
INFO be.vrt.quintiqexchange.main.QuintiqAdapter - Appointment updated for subject: PROEF st5 on Mon Aug 22 10:00:00 CEST 2016 Mon Aug 22 20:30:00 CEST 2016 of user name.lastname#domain.com
This means that the recipient isn't really the issue, I guess...
p.s. I replaced the original mailaddress but believe me, it's a correct mailadres :)
In my case, if the address is not properly trimmed and has any whitespace characters at all, EWS vomits this exception up.
Basically i have built an appointment scheduler webapp using java servlets.
It relies heavily on javas Calendar.
The whole thing was developed on my macbook running mountain lion with jdk 1.6.
Now when testing it on my pc i have had some strange results.
Running:
System.out.println("selected = "+selected);
Calendar now = Calendar.getInstance();
System.out.println("a "+now.getTime());
now.setTimeInMillis(selected);
System.out.println("b "+now.getTime());
now.set(Calendar.MILLISECOND,0);
now.set(Calendar.SECOND,0);
now.set(Calendar.MINUTE,0);
now.set(Calendar.HOUR_OF_DAY,6);//start from 6am
System.out.println("d "+now.getTime());
now.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("e "+now.getTime());
on the PC will output:
selected = 1355835600000
a Wed Dec 19 19:35:36 EST 2012
b Wed Dec 19 00:00:00 EST 2012
d Wed Dec 19 06:00:00 EST 2012
e Sun Dec 23 06:00:00 EST 2012
Yet on the mac it will output:
selected = 1355835600000
a Wed Dec 19 19:33:57 EST 2012
b Wed Dec 19 00:00:00 EST 2012
d Wed Dec 19 06:00:00 EST 2012
e Sun Dec 16 06:00:00 EST 2012
As we can see here, if i build a table representing a weekly schedule off these values, the mac will start at 6am on the sunday contained in the current week.
But the pc will start at 6am on the sunday contained in the next week.
Which means any appointments i create are out of sync on the pc (different days to whats expected)
note: the pc has been tested with both jdk1.6 and jdk1.7
Does anyone know any solutions or reasons behind this?
Thanks
Possibly, this is a locale/timezone problem which might differ on both machines.
Make sure that both instances use the same locale by hard coding it for example:
Calendar.getInstance(Locale.US);
else getInstance() would use the default locale of your system.
So I'm following thenewboston's tutorials on Slick 2D. I'm loading the Image exactly as he said:
private org.newdawn.slick.Image playNow;
...
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
...
playNow = new org.newdawn.slick.Image("res/playNow.png");
This is my Eclipse project tree:
This is the output it gives me:
Tue Jul 03 09:31:53 PDT 2012 INFO:Slick Build #274
Tue Jul 03 09:31:53 PDT 2012 INFO:LWJGL Version: 2.8.5
Tue Jul 03 09:31:53 PDT 2012 INFO:OriginalDisplayMode: 1366 x 768 x 32 #60Hz
Tue Jul 03 09:31:53 PDT 2012 INFO:TargetDisplayMode: 640 x 360 x 0 #0Hz
Tue Jul 03 09:31:53 PDT 2012 INFO:Starting display 640x360
Tue Jul 03 09:31:53 PDT 2012 INFO:Use Java PNG Loader = true
Tue Jul 03 09:31:53 PDT 2012 INFO:Controllers not available
Exception in thread "main" java.lang.RuntimeException: Resource not found: res/playNow.png
at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)
at org.newdawn.slick.Image.<init>(Image.java:196)
at org.newdawn.slick.Image.<init>(Image.java:170)
at org.newdawn.slick.Image.<init>(Image.java:158)
at org.newdawn.slick.Image.<init>(Image.java:136)
at net.sourceforge.whowantsakookie.hamblaster.Menu.init(Menu.java:21)
at net.sourceforge.whowantsakookie.hamblaster.Game.initStatesList(Game.java:20)
at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at net.sourceforge.whowantsakookie.hamblaster.Game.main(Game.java:31)
The tutorial is located here
I am doing this exactly as the tutorial said, and it works for him in the video. Thanks in advance :)
No your problem is that the "res" folder is in the same folder as the "src" file is in!
move your "res" folder containing all of your pictures INTO the "src/net.sourceforge.whowant/" folder/package in your program.
In your program you will load it by using
playNow = new org.newdawn.slick.Image("res/playNow.png");
Hope this helps! :)