tennessine / mqtt-spy

Automatically exported from code.google.com/p/mqtt-spy
0 stars 0 forks source link

XML issues #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Tried to edit the XML to add a subscription
2. XML became unusable
3.

What is the expected output? What do you see instead?

I would expect to be able to add subscriptions. Also XML file hard to use in 
NOTEPAD++ (which works for just about any other text file) as file does not 
contain CRLFs even though the documentation suggests it will be formatted as 
such

Can we have subscriptions saved when closing down - it's painful having to 
re-enter them.

What version of the product are you using? On what operating system?

JUST downloaded latest non-beta version.

Please provide any additional information below.

Windows 8

Original issue reported on code.google.com by petersca...@googlemail.com on 3 Jan 2015 at 8:07

GoogleCodeExporter commented 9 years ago
I would like to clarify - the program is truly WONDERFUL - but it really would 
be nice to be able to read the xml file in the likes of Notepad - and to store 
subscriptions

Original comment by petersca...@googlemail.com on 3 Jan 2015 at 8:14

GoogleCodeExporter commented 9 years ago
1) Editing XML - yes, you should be able to manually define subscriptions by 
editing the XML. If you attach the XML file you're trying to use I could help. 
Please also attach the mqtt-spy.log, which will probably contain more 
information about the problem you're experiencing. You can also define the 
subscriptions you use from the UI - go to 'Connections -> Manager connections', 
and for the connection you want, go to the Subscriptions tab and add the 
subscriptions you need - when ready, hit apply and that should save them to the 
configuration file. I'll try to make it easier, so watch this space... ;-)

2) Formatting - unfortunately JAXB (which mqtt-spy uses for XML marshalling) 
doesn't do nice formatting. For that, I use a Notepad++ plugin to do XML 
formatting - it's very good (I don't remember now whether it is a separate 
plugin or comes with Notepad++ though).

Original comment by kamil.ba...@gmail.com on 3 Jan 2015 at 8:51

GoogleCodeExporter commented 9 years ago
I've created Issue 22 to make saving subscriptions easier - this should make it 
to a release soon.

Original comment by kamil.ba...@gmail.com on 3 Jan 2015 at 9:12

GoogleCodeExporter commented 9 years ago
HI

I tried XML tools in Notepad++ - didn't seem to do anything... any chance the 
XML file in future could contain line breaks so it's readable? Can't be any 
harm in that? Other XML files appear formatted?

I tried the Connections/subscriptions  as per your suggestion but no matter 
what I did I ended up with a /samplesubscription/ instead of the one I was 
trying to put in. Am I doing something wrong or does that not work?

Original comment by petersca...@googlemail.com on 4 Jan 2015 at 12:41

GoogleCodeExporter commented 9 years ago
1) Formatting XML - OK, I'll look into that further...

2) Predefined subscriptions - when you go to the Subscriptions tab and use the 
provided button to add a topic, you can then double click on the created topic 
(i.e. /sampleSubscription/) in the table row to edit it. When happy with the 
new topic string, hit Enter to submit and then use the Apply button to save to 
config. Let me know if it worked for you.

Original comment by kamil.ba...@gmail.com on 4 Jan 2015 at 4:17

GoogleCodeExporter commented 9 years ago
I've created Issue 23 to address the formatting of XML. Should make it to a 
release soon...

Original comment by kamil.ba...@gmail.com on 4 Jan 2015 at 4:26

GoogleCodeExporter commented 9 years ago
Thanks for the responses above - I look forward to being able to edit the XML 
easily - and as for subscriptions - you are right of course - they work a 
treat. This is a great program. 

If I might say, the instructions for scripted items - I don't understand at all.
I want the program to send a script to "/time" every minute with the time in 
it. I feel sure this is possible but cannot figure it out from the instructions.

Original comment by petersca...@googlemail.com on 4 Jan 2015 at 4:45

GoogleCodeExporter commented 9 years ago
I've added a sample script for publishing current time to the Scripting wiki - 
try if it works for you and then modify it to suit your needs. 

Any problems - let me know...

Original comment by kamil.ba...@gmail.com on 4 Jan 2015 at 5:22

GoogleCodeExporter commented 9 years ago
FYI - the latest beta (0.1.5 beta build 26) should have the XML formatting 
sorted. Let me know if it works for you. Thanks for raising it!

Original comment by kamil.ba...@gmail.com on 4 Jan 2015 at 6:11

GoogleCodeExporter commented 9 years ago
The XML configuration on the 0.1.5 beta looks lovely - thank you.  Will the 
same happen to the log file which is also xml?

Original comment by petersca...@googlemail.com on 4 Jan 2015 at 8:31

GoogleCodeExporter commented 9 years ago
Thanks for help - see comment on wiki page. I understand the time script - but 
have no idea how to tell mqtt-spy about it - I assume one makes a text file 
with the script in it - I tried to enter the directory I put it in - under 
connection list - publications - but /samplepublication/ appears in the topic 
box regardless. Need simpler instruction.

Original comment by petersca...@googlemail.com on 4 Jan 2015 at 8:43

GoogleCodeExporter commented 9 years ago
Glad to hear the formatting works fine. Which log file do you mean? The 
mqtt-spy.log is a standard text file, with one line per log entry.

I replied to your comment on the wiki - all was good apart form the script 
file's extension - this needs to be ".js". Simply populate the publication 
script directory field and hit Apply to save the changes, and then reopen the 
connection. You should see your script on the list in Scripted publications 
pane. 

Original comment by kamil.ba...@gmail.com on 4 Jan 2015 at 9:08

GoogleCodeExporter commented 9 years ago
Sorry I meant to say STATS. Here's what my MQTT-SPY-STATS.XML file looks like.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:MqttSpyStats 
xmlns:ns2="http://baczkowicz.pl/mqtt-spy-stats"><ID>-2863844191502908376</ID><St
artDate>2014-12-30T18:17:28.720Z</StartDate><Connections>27</Connections><Subscr
iptions>16</Subscriptions><MessagesPublished>131</MessagesPublished><MessagesRec
eived>82</MessagesReceived></ns2:MqttSpyStats>

As you can see a little formatting would help.

Ok, I've renamed the script to "thetime.js".  I've put it in a directory under 
desktop (where my mqtt-spy file is) called "spyscripts".  under connection list 
- publication what exactly do I put in there?

Original comment by petersca...@googlemail.com on 4 Jan 2015 at 9:17

GoogleCodeExporter commented 9 years ago
Yes, the stats file should be formatted nicely too - restarting mqtt-spy should 
do it hopefully ;-)

I'm just updating the wiki on scripting - I agree it's not very 
straightforward... - will let you know when ready. But I've just realised there 
is an easier way to do it: clear the configured directory in the Publications 
tab (or leave it blank), and place your script file (thetime.js) in the 
mqtt-spy's home directory - where your configuration and stats files are. It 
should then pick it up on opening the connection tab.

Original comment by kamil.ba...@gmail.com on 4 Jan 2015 at 10:11

GoogleCodeExporter commented 9 years ago
Wiki updated - hopefully a bit better now. Let me know how you got on - sooner 
or later we'll get it working... ;-)

Original comment by kamil.ba...@gmail.com on 4 Jan 2015 at 10:42

GoogleCodeExporter commented 9 years ago
To be clear on this - the XML files generally, despite the program being on the 
desktop, seem to be in USERS/PETER/MQTT-SPY -  I didn't choose that  -they just 
ended up there - could make sense to make this configurable. Also - why is the 
LOG file on my desktop instead of in USERS/PETER/MQTT-SPY - surely best to keep 
them in one place wherever that might be.

Right, testing now - I put my thetime.js script in USERS/PETER/MQTT-SPY. 

Close connection, re-open -  nothing - nothing showing in connections - I'm 
subscribed to /time/ nothing happening.

But then if we do it that way how would it know which connection to work with?

Also under connection list it is still not untuitive to add topics though I did 
manage it last night. Under subscribe I hit the +ADD topic - and 
/samplesubscription/ appeared. I changed that to /time/ and hit APPLY. Didn't 
work - /samplesubscription/ reappeared. Tried again - it worked. something I'm 
missing here.

Original comment by petersca...@googlemail.com on 5 Jan 2015 at 5:17

GoogleCodeExporter commented 9 years ago
Something here... erm, having put the script file where it now suggests CLEARLY 
in the WIFI (good one) - I opened the BETA of MQTT-SPY  - nothing - no sign of 
my script which is merely your example in a file called thetime.js

A potential problem? When I tried instead to open the NON-beta of MQTT-SPY - it 
"can't process the configuration file" - presumably because of the slight 
changes to the format of the XML. Not a problem as long as we're aware of it.

But no - I put the THETIME.JS file (included here) into the same directory as 
the two XML files - and... nothing....

Original comment by petersca...@googlemail.com on 5 Jan 2015 at 5:26

GoogleCodeExporter commented 9 years ago
I meant WIKI...

Original comment by petersca...@googlemail.com on 5 Jan 2015 at 5:28

GoogleCodeExporter commented 9 years ago
1) Scripting

Please try the following:

a) put the script to your mqtt-spy's home directory (e.g. USERS/PETER/MQTT-SPY)
b) delete all connections
c) create a new connection
d) open the connection
e) expand the Scripted publications pane

And let me know what you can see there.

2) Location of mqtt-spy.log is defined in log4j.properties inside the jar - 
this can be edited; it defaults to the current directory of where you start the 
app; I'll see if there is an easy way to change that...

3) Adding publication and subscription topics to the tables

From what you wrote it seems you missed hitting the Enter button to tell JavaFX 
you are happy with the new value in the table.

When you hit the "Add topic" button, "/sampleSubscription/" or 
"/samplePublication" will appear - you double click on it, change it, and then 
press Enter to submit - this is how JavaFX knows to keep the new value. Then, 
to save the changes to the config file, hit Apply.

4) Can't process the configuration file

0.1.5 beta has got a new configuration parameter, so any previous versions 
won't understand it. If you want to go back to a previous version, either 
delete the configuration file or restore a default one from the app's menu.

Original comment by kamil.ba...@gmail.com on 5 Jan 2015 at 7:24

GoogleCodeExporter commented 9 years ago
Hi there 

Just to prove I am not going nuts..... 

A very short video

https://www.youtube.com/watch?v=9aJDpkfDzuA

:-)

Original comment by petersca...@googlemail.com on 5 Jan 2015 at 8:08

GoogleCodeExporter commented 9 years ago
Spotted something else to do with scripted publications - main panel - scripted 
publications... doesnt open and close properly - you have to click OFF the 
window for it to update..

HOWEVER... when it DOES - it shows my PUBLISHTIME!!! And it WORKS...

So - why on the main panel do you have to click off the panel (ie somewhere 
else on the Windows desktop) for the display to update.

and - why doesn't this show under the connections/publications window...

finally - when I CLOSE MQTT-SPY - and re-open - the scripted publications do 
not restart automatically... can you make this happen? Maybe on a button that 
says start at start up or something.

This is REALLY looking good but for these little issues!!!

Original comment by petersca...@googlemail.com on 5 Jan 2015 at 8:24

GoogleCodeExporter commented 9 years ago
Many thanks for the video - I think we're getting there.

So... now go to the connection tab and there you have 4 collapsible panes:

1) Publish message
2) Scripted publications (by default it is collapsed)
3) Define new subscription
4) Subscriptions and received messages

Expand the second one (Scripted publications). Is there anything in there?

The table on the Publications tab you were showing on the video is for 
predefining publication topics, which appear in the publication topic drop down 
for the "Publish message" pane.

Original comment by kamil.ba...@gmail.com on 5 Jan 2015 at 8:27

GoogleCodeExporter commented 9 years ago
Also, you might need to make the whole window bigger to see all expanded panes 
properly.

Original comment by kamil.ba...@gmail.com on 5 Jan 2015 at 8:28

GoogleCodeExporter commented 9 years ago
Hi - I made another video - so very near...... but there are still some things 
wrong... and a request... the publications don't appear to start automatically 
when you run the program - for a time script this is essential don't you 
think...  please take a look at the new video - I promise it's short..

https://www.youtube.com/watch?v=1nWctj0mvgw

Pete.

Original comment by petersca...@googlemail.com on 5 Jan 2015 at 8:32

GoogleCodeExporter commented 9 years ago
I didn't see your last message before writing my response - I'm glad it is 
working now. I'll reply later to discuss the other issues.

Original comment by kamil.ba...@gmail.com on 5 Jan 2015 at 8:32

GoogleCodeExporter commented 9 years ago
As I am sure we'll resolve this - if you want to do this by email so 
screengrabs can be included -- by ALL means email me at pete AT scargill DOT org

I'm in this morning - off to meetings for a couple of days. It would be nice if 
I could go away knowing the TIME script would keep on running even if my PC 
reboots :-)

GREAT JOB..... this has to be becoming the best test client out there...

Original comment by petersca...@googlemail.com on 5 Jan 2015 at 8:37

GoogleCodeExporter commented 9 years ago
I've created issue 24 (auto-start for scripts) and issue 25 (scripted 
publications pane).

Original comment by kamil.ba...@gmail.com on 5 Jan 2015 at 2:12

GoogleCodeExporter commented 9 years ago
Thank you for raising all these issues. I believe they all have been addressed 
now or moved to separate issues.

Original comment by kamil.ba...@gmail.com on 9 Jan 2015 at 9:01