Can states in a Plant UML state diagram be positioned relative to another state? - plantuml

I've made a plantuml state diagram which looks like this:
I'd like to position "MainActivity" state to the right of the "Idle" state, such that the arrows for [instruction] and [done] end up horizontal.
I know this is can be done for notes and text, but I haven't seen any syntax for the states themselves.
Is this possible in PlantUML?
For reference, this is my PlantUML script:
#startuml
skinparam state {
StartColor PaleGreen
EndColor Red
BackgroundColor Gold
BackgroundColor<<Junction>> GreenYellow
BorderColor Gray
FontName Consolas
}
[*] -> Creating
Creating --> Idle : initialised
Idle : wait here for instructions
Idle --> MainActivity : [instruction]
state MainActivity {
[*] --> DoFirstThing
DoFirstThing --> FirstThingSuccess : [OK]
DoFirstThing --> FirstThingFailed : [not OK]
FirstThingSuccess --> SecondThing
SecondThing --> SecondThingFailed
SecondThing --> SecondThingSuccess
SecondThingSuccess --> WritingReport
SecondThingFailed --> WritingReport
FirstThingFailed --> WritingReport
WritingReport --> [*]
}
MainActivity --> Idle : [done]
#enduml

Yes. You can define the direction of the arrows by inserting them in between the dashes of the arrow notation, such as "MainActivity -left-> Idle" (see section 7.5 in the PlantUML reference guide).
The following code :
plantuml
#startuml
skinparam state {
StartColor PaleGreen
EndColor Red
BackgroundColor Gold
BackgroundColor<<Junction>> GreenYellow
BorderColor Gray
FontName Consolas
}
[*] -> Creating
Creating --> Idle : initialised
Idle : wait here for instructions
Idle -left-> MainActivity : [instruction]
state MainActivity {
[*] --> DoFirstThing
DoFirstThing --> FirstThingSuccess : [OK]
DoFirstThing --> FirstThingFailed : [not OK]
FirstThingSuccess --> SecondThing
SecondThing --> SecondThingFailed
SecondThing --> SecondThingSuccess
SecondThingSuccess --> WritingReport
SecondThingFailed --> WritingReport
FirstThingFailed --> WritingReport
WritingReport --> [*]
}
MainActivity -left-> Idle : [done]
#enduml
gives you this diagramme :
(PS : You could do the same for the "Creating" state to make it look more consisten)

Related

Is there a way to place node name to the right in PlantUML?

To increase readability I would like to place (interface) node names to the right of the node. Is this somehow possible?
#startuml
left to right direction
() "longer_interface_name" as interface
[component one] --> interface
[component two] --> interface
[component three] --> interface
[component four] --> interface
[component five] --> interface
#enduml
leads to
but I'd like to have something like

Need explanation with Icecast URL authentication

Foreword: I am stuck due to poor coding skills and a lack of understanding of the details of the URL authentication. I am not a coder but an amateur who usually get by with a little help from Google.
Challenge 1:
I am trying to set Icecast up in such a way that the audio stream can only be heard when you log in to my website. The method is called URL authentication by Icecast. Here is the link to the official documentation:
https://icecast.org/docs/icecast-2.4.0/auth.html
My problem: I understand that I have to integrate certain queries in the icecast.xml that are then answered by the player on my website. Unfortunately, I don't know where to integrate these codes. In a file in the webroot? In the header of the player page?
Challenge 2:
Another thing is that the player is working, but when I hit the pause button and restart the player 10 minutes later the song picks up there I paused the player even though the radio stream is already 2 titles ahead. So the cover art does not match the audio.
I guess that also has something to do with certain tweaks in the icecast.xml. Again ... I don't know how to add these tweaks and how to address them on my website (same issue as with the authentication).
Due to royalty issues, my website is behind a firewall for the time being.
Can anyone shed some light on my questions?
I included the code of my icecast.xml and of the iFrame that contains the player.
Best wishes,
Paul
This is the iFrame that contains the Drupal website and the HTML5 player:
<html>
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta name=viewport content="width=device-width, initial-scale=1">
<style type="text/css">
html, body {
background: #333333;
height: 100%;
margin: 0px;
padding: 0px;
border: 0px;
}
iframe {
width: 100%;
height: 92%;
margin: 0px;
padding: 0px;
border: none;
display: block;
}
</style>
<body>
<?php
print('<iframe id="drupal_site" src="http://test.zoootradio.com" height="92%" width="100%" frameborder="0"></iframe>');
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header("Pragma: no-cache"); // HTTP 1.0.
header("Expires: 0"); // Proxies.
print('<audio id="player" controls>');
print('<source src="http://192.168.2.50:8000/zr.mp3" type="audio/mpeg">');
print('</audio>');
?>
</body>
</html>
This is my icecast.xml file:
<icecast>
<location>Earth</location>
<admin>icemaster#localhost</admin>
<limits>
<clients>15</clients>
<sources>1</sources>
<queue-size>524288</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>10</source-timeout>
<burst-on-connect>1</burst-on-connect>
<burst-size>65535</burst-size>
</limits>
<authentication>
<!-- Sources log in with username 'source' -->
<source-password>XXXXXXX</source-password>
<!-- Relays log in with username 'relay' -->
<relay-password>XXXXXXX</relay-password>
<!-- Admin logs in with the username given below -->
<admin-user>XXXXXXX</admin-user>
<admin-password>XXXXXXX</admin-password>
</authentication>
<hostname>192.168.2.50</hostname>
<!-- You may have multiple <listener> elements -->
<listen-socket>
<port>8000</port>
<!-- <bind-address>127.0.0.1</bind-address> -->
<!-- <shoutcast-mount>/stream</shoutcast-mount> -->
</listen-socket>
<http-headers>
<header name="Access-Control-Allow-Origin" value="*" />
</http-headers>
<mount type="normal">
<mount-name>/zr.mp3</mount-name>
<authentication type="url">
<option name="stream_auth" value="http://test.zoootradio.com/player"/>
</authentication>
</mount>
<fileserve>1</fileserve>
<paths>
<!-- basedir is only used if chroot is enabled -->
<basedir>/usr/share/icecast2</basedir>
<!-- Note that if <chroot> is turned on below, these paths must both
be relative to the new root, not the original root -->
<logdir>/var/log/icecast2</logdir>
<webroot>/usr/share/icecast2/web</webroot>
<adminroot>/usr/share/icecast2/admin</adminroot>
<!-- <pidfile>/usr/share/icecast2/icecast.pid</pidfile> -->
<alias source="/" destination="/status.xsl"/>
<!-- The certificate file needs to contain both public and private part.
Both should be PEM encoded.
<ssl-certificate>/usr/share/icecast2/icecast.pem</ssl-certificate>
-->
</paths>
<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<!-- <playlistlog>playlist.log</playlistlog> -->
<loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
<logsize>10000</logsize> <!-- Max size of a logfile -->
<!-- If logarchive is enabled (1), then when logsize is reached
the logfile will be moved to [error|access|playlist].log.DATESTAMP,
otherwise it will be moved to [error|access|playlist].log.old.
Default is non-archive mode (i.e. overwrite)
-->
<!-- <logarchive>1</logarchive> -->
</logging>
<security>
<chroot>0</chroot>
<!--
<changeowner>
<user>nobody</user>
<group>nogroup</group>
</changeowner>
-->
</security>
1 - "URL auth"
Your icecast.xml does not contain any definition, so you don't have URL-auth configured.
What are you really trying to achieve?
2 - pause
Streams can't be paused, don't try to do it, it will break things. If you stop a stream, make sure that you do it in a way that makes the browser actually drop the connection.
Also you should always use a 'cache buster' or other way to ensure that the browser does not try to use cached stream content. (See my other answers on related topics here)

Waypoints animation issue at 3d.io

The camera animation always starts from the initial camera pose.
We do not want this behaviour.
You can check this issue with:
https://app.3d.io/default_setup.
This code worked before. We didn't change anything.
<a-entity camera="" tour="autoStart: false" wasd-controls="" look-controls="" position="-2.073 1.6 -1.474" rotation="-2.063 203.308 0">
<a-entity tour-waypoint="Top View" io3d-uuid="add7b140-7563-463a-b324-75e2b460e915" position="-7.959815433483447 22.172638840745442 1.675735956699384" rotation="-89.9 450 0"></a-entity>
<a-entity tour-waypoint="Living" io3d-uuid="486a6760-e8d1-456d-a2d0-5358d65b2ef1" position="1.1168750348397785 1.037108274040117 1.7797448740972899" rotation="0 412.98472385428914 0"></a-entity>
<a-entity tour-waypoint="Kitchen" io3d-uuid="4a0f17c1-fcde-4706-9188-48ddeb808927" position="-0.4316313757947364 1.37 0.10205065263211961" rotation="0 491.46180963572306 0"></a-entity>
<a-entity tour-waypoint="Dining" io3d-uuid="5d76c74b-a2b5-4ddf-a6e9-a6fe009377b7" position="-1.0699430785395438 8 -3.5236261145326577" rotation="-38.48648648648648 539.873168157716 0"></a-entity>
<a-entity tour-waypoint="Bedroom" io3d-uuid="4d6fec29-1467-40be-8f91-5435f0317072" position="-9.650512503727434 8 2.1338268605968826" rotation="-59.152761457109314 594.7591069330199 0"></a-entity>
<a-entity tour-waypoint="Bedroom" io3d-uuid="3851ec4b-53c0-47d4-afc2-3d646043eb5d" position="-9.639031885443684 8 5.539305773258945" rotation="-56.77438307873098 400.8960173400832 0"></a-entity>
<a-entity tour-waypoint="Master Bedroom" io3d-uuid="97eabbe1-578a-48ee-a40f-60af0187f2b1" position="-13.334875006116892 8 -1.701906768812833" rotation="-59.08108108108104 494.6322427235562 0"></a-entity>
<a-entity tour-waypoint="Top View" io3d-uuid="fe33bb66-b1fe-4d13-9904-2e98fc05a525" position="-7.959815433483447 22.172638840745442 1.675735956699384" rotation="-89.9 450 0"></a-entity>
</a-entity>
This code doesn't work as desired either. The camera still kept same position.
document.querySelector('[camera]').components['tour'].updateViewPoint({position:{y:1.6}, rotation:{x:0}})
It turns out that there was a somewhat breaking change in aframe-animation-component moving to version 4.x.x and if you find yourself using the following way of including that component:
<script src="https://unpkg.com/aframe-animation-component/dist/aframe-animation-component.min.js"></script>
you wanna change it for this line:
<script src="https://unpkg.com/aframe-animation-component#3.2.5/dist/aframe-animation-component.min.js"></script>
The tour animation will always tween from the current camera position to the next tour point.
So what you want to do is set your camera to the starting position either in aframe source code or programmatically:
<a-entity camera position="x y z"></a-entity>
Or via JavaScript:
document.querySelector('[camera]').setAttribute('position', 'x y z');
Then you can set the next waypoint programmatically:
document.querySelector('[camera]').components['tour'].goTo(waypointUuid)
Or you can start the tour:
document.querySelector('[camera]').components['tour'].playTour()
If this does not work for you please describe your desired outcome and share your code with glitch or app creator.

How to click element using Cucumber without using xpath?

My application requires to test favorite feature for any product.Products List & UI
When a user click on the heart icon shown in the snippet, it will add that product into Favorites list. I would like to know about the Capybara/Cucumber method to click on the heart icon.
I have tried using XPATH but it seems not working. The code that I tried is as follow.
When(/^I click on the favourite icon on the first product$/) do
find(:xpath,'/html/body/div[1]/div[2]/div/div/div/span/div/div/div/div[3]/div[1]/span[1]/div/div/div/div/div[4]/div[2]/div/favorite/a').click
end
I have also tried following capybara method using XPATH. It is also not working.
When(/^I click on the favourite icon on the first product$/) do
find(:xpath,'//a[contains(., "#heart")]).click
end
Also, I tried following code which is throwing out an error.
When(/^I click on the favourite icon on the first product$/) do
within("div.search-results-wrapper") do
find(first('a.ng-scope')).trigger(:mouseover)
end
end
Error:
The given selector #<Capybara::Node::Element:0x007fd18d841690> is either invalid or does not result in a WebElement. The following error occurred:
InvalidSelectorError: An invalid or illegal selector was specified (Selenium::WebDriver::Error::InvalidSelectorError)
The HTML code for the Favorite icon is as follow:
<favorite product="result" ng-if="!ui.showIpsaProductCell()" class="product-action ng-scope ng-isolate-scope"><a ng-mousedown="product.favoriting = true" ng-mouseenter="product.showList = true" active="::product.favoriting" ng-click="toggle(true)" class="ng-scope active">
<i ng-class="::{
'icon-heart-filled':
product.hasFavorite || !showCount || newProductPage,
'icon-heart-outline':
!product.hasFavorite && showCount && !newProductPage
}" class="heart icon-heart-filled"></i>
<!-- ngIf: ::showCount --><span class="count ng-scope" ng-if="::showCount">
1
</span><!-- end ngIf: ::showCount -->
<!-- ngIf: ::addToList && product.hasFavorite --><div component="add-to-list" ng-if="::addToList && product.hasFavorite" class="ng-scope">
<!-- ngInclude: '/modules/components/add-to-list/add-to-list.tpl.html' --><span ng-include="'/modules/components/add-to-list/add-to-list.tpl.html'" ng-controller="AddToListCtrl" class="ng-scope"><div ng-mouseleave="product.showList = false" class="add-to-list-desktop ng-scope">
<!-- ngIf: product.showList -->
<!-- ngIf: product.showListMenu && product.showList -->
</div>
</span></div><!-- end ngIf: ::addToList && product.hasFavorite -->
</a></favorite>
Since you have multiple "favourite" icons you would need to find your icon within a given parent container, not being able to see the full html page it would go something like:
within(".myParentContainer") do
find(".icon-heart-filled").click
end

Ext js Custom charts

I'm using ExtJS for displaying charts. I want to use scatter chart, in which axis should be in the middle, instead of default axes.
For that i tried to place the axes, x and y, accordingly in the middle of the panel, and drew the chart without axis in that panel with absolute layout. I know this might not be the right way of doing. Please suggest me how it can be done.
Thanks in advance.
I'm using FusionCharts.
Here is a example, how i use it in my Extjs Page (EXTJS Ver. 3.4.1)
For Perform below example, you must have to download FusionCharts.
After That, Copy "Column2D.swf" to your root director.
Add .js files to your .php or .html page
<script type="text/javascript" src="js/utility/FusionCharts.js"></script>
<script type="text/javascript" src="js/chartdata/chartdata.js" ></script>
Create .js file with your data. (Here We Have 'chartdata.js' )
var dataStringCredit ='<chart baseFontSize="12" baseFont="Arial,Helvetica,sans-serif" xAxisName="Top 5 Products Using Invoiced Sales Dollers for Last 12 Months" alternateVGridColor="AFD8F8" baseFontColor="114B78" toolTipBorderColor="114B78" toolTipBgColor="E7EFF6" useRoundEdges="1" showBorder="0" bgColor="FFFFFF,FFFFFF">\n\
<set label="ABC" value="23" color="AFD8F8"/> \n\
<set label="123" value="12" color="F6BD0F"/> \n\
<set label="XYZ" value="17" color="8BBA00"/> \n\
<set label="MNO" value="14" color="A66EDD"/> \n\
<set label="789" value="12" color="F984A1"/>\n\
</chart>';
In your .js file, whene you want to add/call/show your chart.
A. Add This Data at start of the page.
FusionCharts.setCurrentRenderer('javascript');
var paymentchart = new FusionCharts("Column2D.swf", "ChartId_flash", "440", "400", "0", "1" );
paymentchart.setXMLData( dataStringCredit );
paymentchart.render("divagingchart");
B. Add This Where chart display.
items:[{
html: '<div id="divagingchart"></div>'
}]
Your Chart Look like something this.

Resources