server side includes: can I compute something inside a variable - apache

I'm trying to calculate the current index of my slides depending on the page that is shown.
So far I got this:
<!--#set var="page" value="0" -->
<!--#set var="slidesPerPage" value="4" -->
<!--#if expr="$QUERY_STRING = /p=1/" -->
<!--#set var="page" value="1" -->
<!--#elif expr="$QUERY_STRING = /p=2/" -->
<!--#set var="page" value="2" -->
<!--#endif -->
Now I want to "calculate" the current index like this:
<!--#set var="currentIndex" value="${$page * $slidesPerPage + 1}" -->
But this doesn't work.
Is this even possible?

after poking around some more and trying things on my own, I found a "solution" that kind of works:
<!--#exec cmd="printf $(($page * $slidesPerPage + 1))" -->
This just prints the output to page and doesn't store it in a variable, but it's enough for me right now.
If someone has a better/nicer solution, please let me know.

Related

VueJS3 dynamic asset

I load some images like this in my template:
<img
v-if="idRobot === 7"
src="~#/assets/img/faceTibot.png" />
But I'd like to load the asset dynamically. For example, something like this would be great:
<img
v-if="idRobot === 7"
:src="`~#/assets/img/${dynamicasset}.png`" />
Actually, when I do this, VueJS thinks I want to load the string "~#/assets/img/${dynamicasset}.png".
Is what I want even possible in VueJS3?
Ah, BTW I searched SO and found this but suggested require solutions don't work: https://stackoverflow.com/a/47480286/1098303
Thanks in advance
Have you tried this solution ?
<img :src="require(`~#/assets/img/${dynamicasset}.png`)" />

How can I configure a live template that generates a builder method in IntelliJ IDEA?

I oftentimes need to create builder methods in my code. These methods are similar to getters, but they return this and they use with instead of get.
To be faster with that task I'd like to create a live-template in IDEA.
This how far I got:
(in ~/.IntelliJIdea14/config/templates/user.xml this looks like this:)
<template name="builderMethod" value="public $CLASS_NAME$ with$VAR_GET$(final $TYPE$ $PARAM_NAME$) {
this.$VAR$ = $PARAM_NAME$;
return this;
}" description="create a builder method" toReformat="true" toShortenFQNames="true">
<variable name="CLASS_NAME" expression="className()" defaultValue="" alwaysStopAt="true" />
<variable name="VAR" expression="complete()" defaultValue="" alwaysStopAt="true" />
<variable name="PARAM_NAME" expression="VAR" defaultValue="" alwaysStopAt="true" />
<variable name="TYPE" expression="typeOfVariable("this." + VAR)" defaultValue="" alwaysStopAt="true" />
<variable name="VAR_GET" expression="capitalize(VAR)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_EXPRESSION" value="false" />
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
This nearly works, except for typeOfVariable("this." + VAR) which does not. I just guessed how to call this method, because I could not find any documentation on the syntax used in the expressions except for this page which does not even mention a script language name or something that would make googling for easier.
How do I fix the call to typeOfVariable?
Bonus question: How can I get complete() for VAR to only show fields?
Similar question but not does not even have a start: Live Template for Fluent-API Builder in IntelliJ
Replace typeOfVariable("this." + VAR) with typeOfVariable(VAR).
Edit:
Another way to generate builder methods is to use an appropriate setter template (instead of live template).
https://www.jetbrains.com/help/idea/2016.1/generate-setter-dialog.html
There is already a built-in setter template named "Builder" which generates setters such as:
public Foo setBar(int bar) {
this.bar = bar;
return this;
}
You can create your own template (e.g by copying it) and change it so that the method prefix is with.
And to make the generated method parameter final go to settings:
Editor | Code Style | Java
Select the Code Generation tab
Tick Make generated parameters final
IntelliJ IDEA add final to auto-generated setters

Creating fixed FCE with fluidcontent

Width this code i can define content:
<flux:flexform.section name="columns">
<flux:flexform.object name="column" label="column">
<flux:flexform.field.input name="demo" label="Demo field" />
</flux:flexform.object>
</flux:flexform.section>
<flux:flexform.grid>
<flux:flexform.grid.row>
<f:for each="{columns}" as="sectionObject" iteration="iteration">
<flux:flexform.grid.column>
<flux:flexform.content name="column{iteration.cycle}" label="Column {iteration.cycle}" />
</flux:flexform.grid.column>
</f:for>
</flux:flexform.grid.row>
</flux:flexform.grid>
This is flexible. I can Add new "Content Areas" through the section. But this is not what I want. I Want to define a very fixed two-column and a three-column FCE. My editor should not have to decide how many columns to use.
I am missing something like:
<flux:flexform.field.contentArea name="col1" label="Column 1" />
<flux:flexform.field.contentArea name="col2" label="Column 2" />
<flux:flexform.grid>
<flux:flexform.grid.row>
<flux:flexform.grid.column>
<flux:flexform.content name="col1" />
</flux:flexform.grid.column>
<flux:flexform.grid.column>
<flux:flexform.content name="col2" />
</flux:flexform.grid.column>
</flux:flexform.grid>
</flux:flexform.grid.row>
Thank you for your hint to the right direction.
You are very close to the solution with the code you already have. In this example I will use the new ViewHelper names - but you can get the same result using the old names as in your example. Which is which, should be easy to spot (note: you had a typo in your code example which I edited, rgid used instead of grid - such a typo would cause Flux to error out):
<flux:grid>
<flux:grid.row>
<flux:grid.column>
<flux:content name="col1" label="Nice name for column 1" />
</flux:grid.column>
<flux:grid.column>
<flux:content name="col2" label="Column 2" />
</flux:grid.column>
</flux:grid>
</flux:grid.row>
And remove the flux:form.section with object inside it - you don't need this when you make a statically defined grid.
Then to render this grid:
<flux:content.render area="col1" /> and so on.

#HtmlRaw One Word

im trying to use razor to generate a url like this
<img id="currentPic" src="/content/img/#Html.Raw(Model.user.defaultImage).png" />
but the .png bit is being added to the #htmlraw syntax and is not compiling. I know i need to tell the page that #htmlraw is over. I tried using ; which worked - but the ; was also displayed in the string when displayed.
How can i get it so it would display like this. When Model.user.defaultImage = random1
<img id="currentPic" src="/content/img/random1.png" />
thanks
try adding a new set of parenthesis
<img id="currentPic" src="/content/img/#(Html.Raw(Model.user.defaultImage)).png" />
Try #{Html.Raw(Model.user.defaultImage)}
I think you don't need Html.Raw, just use
<img id="currentPic" src="/content/img/#(Model.user.defaultImage).png" />
This feels like a hack, but works:
<img id="currentPic" src="/content/img/#Html.Raw(Model.user.defaultImage + ".png")" />

Exporting More Info Row to PDF using LogiXML not showing up

I am having some trouble trying to export a report to PDF format. I have an action report element to show the more info row, meaning, it is hidden by default (Show Mode : None) until the user clicks a particular element. However, this is creating problems when trying to export since, when I check the option in the Target.PDF element as to "Keep Show Elements", I'm coming up with a blank page. Any help would be appreciated. Thank you.
The best way to troubleshoot these types of export problems is to start simplifying the definition file so that you can easily isolate the issue. For your reports, I might start by remarking the MoreInfoRow so that it's effectively not impacting the export.
-Does the report export to PDF once the MoreInfoRow is gone? If yes, the we can assume the problem has to do with the MoreInfoRow. If no, then there is a different issue. If you've removed the MoreInfoRow and it still doesn't export properly, I might guess that the problem is either : 1) You're passing incorrect showmodes with the export or 2) the report requires parameters to be passed with the Action PDF as well that aren't getting set properly.
For additional details on ShowModes, I'd visit:
http://devnet.logixml.com/rdPage.aspx?rdReport=Article&dnDocID=1043
If the MoreInfoRow is the problem, you might try simplifying the report, in general. Here's a quick example that you can try:
<Report ID="Default" SavedBy="test">
<StyleSheet Theme="SimpleBlue" />
<Body>
<Label Caption="Export PDF" Class="ThemeLinkButton">
<Action Type="PDF">
<Target Type="PDF" KeepShowElements="True" Report="CurrentReport" />
</Action>
</Label>
<LineBreak LineCount="3" />
<DataTable ID="dtExport" Width="450">
<DataLayer Type="Static" ID="myData1">
<StaticDataRow id="001" name="Sample Row 1" />
<StaticDataRow id="002" name="Sample Row 2" />
<StaticDataRow id="003" name="Sample Row 3" />
</DataLayer>
<DataTableColumn ID="colid" Header="id">
<Label ID="lblid" Caption="#Data.id~">
<Action Type="ShowElement" ElementID="mirTest" ID="actShowMir" />
</Label>
</DataTableColumn>
<DataTableColumn ID="colname" Header="name">
<Label ID="lblname" Caption="#Data.name~" />
</DataTableColumn>
<MoreInfoRow ShowModes="None" ID="mirTest">
<Label Caption="This is the More Info Row" />
</MoreInfoRow>
</DataTable>
</Body>
</Report>