I am defining multiple CSS Media Queries for different vieqport or device widths...
So my question is can 2 CSS Media Query definition blocks overlap OR only 1st match gets applied. How does it work ?
Also what is the correct method to apply for multiple devices..i mean the order of defining ?
you can combine multiple media queries in a comma-separated list; if
any of the media queries in the list is true, the associated style
sheet is applied. This is the equivalent of a logical "or" operation.
https://developer.mozilla.org/en/CSS/Media_queries
So
This is the equivalent of a logical "or" operation
makes it look like only one match is applied.
http://reference.sitepoint.com/css/mediaqueries seems to confirm this as well.
If this is true (and it is untested by me), then I would create a common stylesheet to deliver all the common styles no matter what media query is matched and then have device independent stylesheets with additional styles for each targeted device.
It's weird. If you write:
<link media="screen and (max-width: 1250px)" href="/css/small.css" type="text/css" rel="stylesheet" />
<link media="screen and (max-height: 850px)" href="/css/small.css" type="text/css" rel="stylesheet" />
It acts like a XOR (having 2 stylesheets). If both conditions are met (width < 1250 AND height < 850) the stylesheet is not applied.
But if you write:
<link media="screen and (max-width: 1250px), screen and (max-height: 850px)" href="/css/small.css" type="text/css" rel="stylesheet" />
It works fine. So comma is the solution for everything.
Related
i am trying to check if a specific input from a hardware device is linked to my plc application on Twincat 3.1, in my example below i would like to check if "Terminal Overtemperature" is linked to a variable in the plc application side at runtime.
I appreciate any help, thanks in advance.
PS1: I do know that i can evaluate the "InputToggle" or the "CycleCounter" but these variables will only provide information if any input is linked.
PS2: I also try the method provided by Beckhoff Infosys Documentation (pragma approach), Attribute 'TcLinkTo' / 'TcLinkToOSO', this will force to link the variable every time that the configuration is downloaded nevertheless if the input is not found or if the parameter is not correctly set in the attribute (ex. wrong name) this will just generate a warning in compiling time and this warning will be deleted at runtime
New answer
There is a way. You can do this with F_GetMappingStatus
The function F_GetMappingStatus returns the current mapping status of a PLC variable. The function returns an ENUM value (data type: EPlcMappingStatus) with the values MS_Unmapped, MS_Mapped or MS_Partial.
Make sure you call it in the Cyclic Context, that is not during FB_init or call_after_init, see here:
Next up there is the F_GetMappingStatus function. It checks whether a variable is linked to a physical device. Great to use for automatic simulation and fallback or hiding items in a template. This is a function that you do not want to call cyclicly given it is fairly expensive. It is therefore perfect to be called as part of the initialization phase. However, if called outside the Cyclic Context it will always return EPlcMappingStatus.MS_Unmapped, regardless of actual mapped status. This is undesirable and therefore it must be called inside a regular task cycle. You can either use the PlcTaskSystemInfo.FirstCycle, or have it part of your initialization state inside your FB body.
Old answer
You can use the Automation Interface's HRESULT ProduceMappingInfo();. This method will return an XML file with all mapped variables.
Example return from InfoSys:
<VarLinks>
<OwnerA Name="TIID^Device 1 (EtherCAT)">
<OwnerB Name="TIXC^Untitled2^Untitled2_Obj1 (CModule1)">
<Link VarA="Term 1 (EK1100)^Term 3 (EL1008)^Channel 5^Input" VarB="Inputs^Value" />
<Link VarA="Term 1 (EK1100)^Term 2 (EL2008)^Channel 4^Output" VarB="Outputs^Value" />
</OwnerB>
</OwnerA>
<OwnerA Name="TIPC^Untitled1^Untitled1 Instance">
<OwnerB Name="TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 2 (EL2008)">
<Link VarA="PlcTask Outputs^MAIN.bOutput1" VarB="Channel 1^Output" />
<Link VarA="PlcTask Outputs^MAIN.bOutput3" VarB="Channel 3^Output" />
<Link VarA="PlcTask Outputs^MAIN.bOutput2" VarB="Channel 2^Output" />
</OwnerB>
<OwnerB Name="TIID^Device 1 (EtherCAT)^Term 1 (EK1100)^Term 3 (EL1008)">
<Link VarA="PlcTask Inputs^MAIN.bInput1" VarB="Channel 1^Input" />
<Link VarA="PlcTask Inputs^MAIN.bInput3" VarB="Channel 3^Input" />
<Link VarA="PlcTask Inputs^MAIN.bInput2" VarB="Channel 2^Input" />
<Link VarA="PlcTask Inputs^MAIN.bInput4" VarB="Channel 4^Input" />
</OwnerB>
</OwnerA>
</VarLinks>
I am using OSMNX to gather OSM map data to create a road network. I have real time flow data from HERE, and it is in this format:
<TRAFFICML_REALTIME xmlns="http://traffic.nokia.com/trafficml-flow-3.2" CREATED_TIMESTAMP="2021-10-26T21:42:30Z" MAP_VERSION="" UNITS="metric" VERSION="3.2">
<link type="text/css" rel="stylesheet" id="dark-mode-custom-link"/>
<link type="text/css" rel="stylesheet" id="dark-mode-general-link"/>
<style lang="en" type="text/css" id="dark-mode-custom-style"/>
<style lang="en" type="text/css" id="dark-mode-native-style"/>
<RWS TY="TMC" MAP_VERSION="202103" EBU_COUNTRY_CODE="3" EXTENDED_COUNTRY_CODE="E3" TABLE_ID="39" UNITS="metric">
<RW LI="339-01403" DE="Abdülezelpaşa Caddesi/Kadir Has Caddesi" PBT="2021-10-26T21:42:30Z" mid="e7816666-0334-48a9-b15b-673a10edf88f">
<FIS>
<FI>
<TMC PC="30026" DE="Atatürk Bulvarı/Atatürk Köprüsü" QD="+" LE="0.10589"/>
<SHP FC="3">41.02248,28.96148 41.02258,28.96139 </SHP>
<SHP FC="3">41.02258,28.96139 41.02268,28.9613 </SHP>
<SHP FC="3">41.02268,28.9613 41.02274,28.96123 41.02279,28.96119 41.02284,28.96116 </SHP>
<SHP FC="3">41.02284,28.96116 41.0229,28.96114 41.02296,28.96113 41.02303,28.96112 </SHP>
<SHP FC="3">41.02303,28.96112 41.02309,28.96111 41.02313,28.9611 41.02318,28.96108 41.02323,28.96105 41.02328,28.96101 41.02333,28.96097 </SHP>
<CF CN="0.93" FF="39.0" JF="0.0" SP="41.45" SU="41.45" TY="TR"/>
</FI>
I am trying to pair the OSM roads with this data. Is using road names the only option or is there a way I can achieve this with shape coordinates?
HERE Traffic supports 3 types of map matching mechanism (Reference).
TMC (Traffic Message Channel) - You need HERE map data content to get the location codes to mapping traffic flow to the map. But OSM doesn't bundled Traffic Location Tables which is used to mapping between HERE Traffic and map content, so it's not possible to do this way.
OLR (OpenLR Location Referencing) - You can use OLR to mapping to any map data geometries but you will need to decode OLR base64 string and mapping to the map with your algorithm because OLR only indicates start and end of road segments, you need to calculate the roads between them. Basically, it's very difficult because you need to write your own decoder first, then write your routing algorithm to perform this job.
SHP (Shape Points)- Use the shape points, however the coverage is limited and variable from time to time because it's an addition to TMC coverage.
If your requirement is to display level of congestion on the map, I would suggest to use HERE Traffic Tile instead
I am working on a set of Polymer elements (buttons in this particular case) some of which should re-use the same HTML snippet. A structure for a custom button is as follows:
...
<link rel="import" href="button-base.html" id="content">
<link rel="import" href="styles.html">
<link rel="import" href="behavior.html">
<dom-module id="dg-button">
<template>
<style include="button-styles"></style>
<!-- HERE I want the content of button-base.html -->
</template>
<script>
Polymer({
is: 'custom-button',
behaviors: [DG.ButtonBehavior]
});
</script>
</dom-module>
Styles and behavior work as they should.
The problem is: I am not sure how to get content of button-base.html into the specified place of the local DOM without defining button-base as yet another element and then using it as <button-base></button-base>.
The reasons I want to avoid converting it to the new element are:
I want the content of button-base to be a first-class citizen of the custom-button element's local DOM so that all the methods defined in the behavior would still apply using just this.myMethod() for buttons that do not import button-base and rather use custom local DOM.
I need to be able to declaratively set properties on this new custom-button so that they get reflected on DOM elements within button-base.html automatically.
For example, the content of the button-base.html is as follows:
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-button/paper-button.html">
<paper-button id="internalButton" raised$="[[raised]]">
<span id="defaultContent">
<content></content>
</span>
</paper-button>
I would like to set raised on my custom-button in a way that it gets mapped to paper-button automatically without proxying all of the possible attributes through a new element (in case I define base-button as a new element and import it as <base-button></base-button> in custom-button).
Any ideas on how to make this import work?
I have sling mappings setup that rewrite outgoing paths to the external URL. An example of this rewrite:
/content/www-sitename/home.html would be rewritten to http://www.sitename.com/home.html
I have also configured the LinkCheckerTransformerFactory: linkcheckertransformer.rewriteElements=["a:href","area:href","form:action","link:href","meta:content"]
Some HTML on a page component:
<head>
<link rel="canonical" href="/content/www-sitename/home.html" />
<meta name="canonical" content="/content/www-sitename/home.html" />
</head>
When visited, only the link:href has been rewritten, meta:content is unchanged:
<head>
<link rel="canonical" href="http://www.sitename.com/home.html" />
<meta name="canonical" content="/content/www-sitename/home.html" />
</head>
Worth noting is that the link:href was not rewritten prior to configuring the linkcheckertransformer.rewriteElements to include it. Why did this change work for link:href, but not meta:content. Aside from creating a custom rewrite filter, what can be done to get links in meta:content attributes to be rewritten?
nerd answer is correct, by default the internal Sling mechanism responsible for parsing HTML (htmlparser) supports only following tags: a, area, form, base, link, script, body, so even if you add meta:content to the LinkChecker configuration, CQ won't recognize the <meta> as a tag which needs processing.
In order to reconfigure htmlparser, create a node named generator-htmlparser under /libs/cq/config/rewriter/default with following properties:
jcr:primaryType = nt:unstructured
includeTags = [A, AREA, FORM, BASE, LINK, SCRIPT, BODY, META]
The includeTags property should be multivalued, so you can add other tags in the future.
If you don't want to override the content under /libs, create your own rewriter configuration:
Copy /libs/cq/config/rewriter/default and its children to /apps/YOURAPP/config/rewriter/my-rewriter.
Set order property on the my-rewriter to 1.
Create generator-htmlparser under the my-rewriter as above.
I think you have to add meta tag to the htmplparser generator.
see my question and answer: How to add additional element to htmlparser generator
As an experiment I'm going to try use sass and 960gs system together on sinatra, but it occurs many trouble with this. Has nobody any idea what can go wrong in my case?
app.rb:
get '/reset.css' do
sass :reset
end
get '/960.css' do
sass :'960gs'
end
get '/main.css' do
sass :main
end
get '/' do
erb :index
end
layout.erb:
<link rel="stylesheet" href="/reset.css" type="text/css" />
<link rel="stylesheet" href="/960gs.css" type="text/css" />
<link rel="stylesheet" href="/main.css" type="text/css" />
960gs.sass, reset.sass, main.sass is in views subdirectory, but only main.sass renders whe I run application.
Thanks for help.
Greetings
Z.
I'm sure I've given this answer before but couldn't find it…
My advice, having used the route you've tried above in the past, is to precompile assets such as these. I use Guard along with Guard-SASS with a line like:
guard 'sass', :input => 'app/views/stylesheets', :output => 'app/public/css', :style => "compressed"
and then use normal stylesheet links in the layout. It's easier to manage and faster.