wro4j with orange wro4j-taglib - sometimes loading wrong group? - wro4j

We're using wro4j with the Orange wr4j-taglib, and sometimes when we deploy its loading the same resource twice instead of two different ones, but not on all the servers. Below is the snippet from our groups in wro.xml. We're using the build time solution, so the hashes for the property file and all the concatenated files are being generated at build time.
<group name="insertImageCore">
<js>/static/js/imageinsert/js/imageInsert.js</js>
<js>/static/js/imageinsert/js/util/imageInsertUtils.js</js>
<js>/static/js/imageinsert/js/util/imageDAO.js</js>
<js>/static/js/imageinsert/js/util/serviceCalls.js</js>
<js>/static/js/imageinsert/js/util/search.js</js>
<js>/static/js/jquery.ux.thumbGrid.js</js>
<js>/static/js/jquery.ux.stateManager.js</js>
<css>/static/css/jquery.ux.thumbGrid.css</css>
<css>/static/css/jquery.ux.stateManager.css</css>
</group>
<group name="insertImage">
<group-ref>insertImageCore</group-ref>
<js>/static/js/imageinsert/js/actionBar.js</js>
<js>/static/js/imageinsert/js/imageEdit.js</js>
<js>/static/js/imageinsert/js/imageEditPicnik.js</js>
<js>/static/js/imageinsert/js/imageEditPicmonkey.js</js>
<js>/static/js/imageinsert/js/imageEditAviary.js</js>
<js>/static/js/imageinsert/js/imageEditNone.js</js>
<js>/static/js/imageinsert/js/insertProps.js</js>
<js>/static/js/imageinsert/js/tabsManager.js</js>
<js>/static/js/imageinsert/js/uploadManager.js</js>
<js>/static/js/imageinsert/js/zoomView.js</js>
<js>/static/js/imageinsert/js/imageEdit.js</js>
<js>/static/js/imageinsert/js/tabs/baseTab.js</js>
<js>/static/js/imageinsert/js/tabs/imageUrl.js</js>
<js>/static/js/imageinsert/js/tabs/myLibrary.js</js>
<js>/static/js/imageinsert/js/tabs/picasaLibrary.js</js>
<js>/static/js/imageinsert/js/tabs/stockGallery.js</js>
<js>/static/js/imageinsert/js/tabs/templateImages.js</js>
<js>/static/js/moment/moment.js</js>
<css>/static/js/imageinsert/css/imageInsert.css</css>
</group>
In our jsps we're referencing the two groups as:
<wro:style groupNames='insertImage' exploded="${_explodeScripts}" />
<wro:style groupNames='insertImageCore' exploded="${_explodeScripts}" />
It ends up being included in the jsp as:
<link rel='stylesheet' href='/wro/insertImageCore-46098451.css' />
<link rel='stylesheet' href='/wro/insertImageCore-46098451.css' />
We've checked our JBoss /tmp directory on the bad machines, and it seems to be cleared out correctly during the deploy. Any ideas as to what is going on?

It looks like your problem is the names your using. Try renaming either insertImage or insertImageCore so that they don't start with the same string.
When the taglib can't find the mapping file that tells it what the combined css name is for that group it uses a fallback mechanism. The taglib gets all the files that exist in the wro root (which you must have configured o it can build proper paths) and compares their file names to the requested group. This comparision uses startsWith so when it finds a file named inserImageCore while looking for insertImage it thinks it's found the right one.
This assumes that you either don't have a mapping file or that it isn't being loaded.

Related

Creating Custom Component using Moqui and mount using MoquiConf.xml

I'm fairly new to moqui and reaching out for some help with creating custom component using moqui and mount the application on webroot using MoquiConf.xml
I had read https://www.moqui.org/MakingAppsWithMoqui-1.0.pdf and created tutorial component and successfully mounted using the below section from https://www.moqui.org/MakingAppsWithMoqui-1.0.pdf
Add a subscreens-item element under the subscreens element in the apps.xml file like:
location="component://tutorial/screen/tutorial.xml"/>
However my understanding based on the reading from Moqui Documentation below -->
https://www.moqui.org/docs/framework/User+Interface/XML+Screen is that i should be able to mount a custom component using MoquiConf.xml -> screen-facade in my custom component directory, without having to make changes in apps.xml under webroot (i really like this idea)
For #4 (Moqui Conf XML File) you can put these elements in any of the Moqui Conf XML files that get merged into that runtime configuration. The main way to do this is in a MoquiConf.xml file in your component directory so the configuration is in the same component as the screens and you don't have to modify and maintain files elsewhere. See more details about the Moqui Conf XML options in the Run and Deploy instructions. Here is an example from the MoquiConf.xml file in the moqui/example component:
<screen-facade>
<screen location="component://webroot/screen/webroot/apps.xml">
<subscreens-item name="example" menu-title="Example" menu-index="97"
location="component://example/screen/ExampleApp.xml"/>
</screen>
</screen-facade>
However i was not able to get this to work, i tried the MoquiConf.xml approach in tutorial component and also made a copy of example component and still no joy, Appreciate any pointers
My Configuration from my attempt with tutorial project
component/tutorial/MoquiConf.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!-- No copyright or license for configuration file, details here are not considered a creative work. -->
<moqui-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/moqui-conf-2.1.xsd">
<screen-facade>
<screen location="component://webroot/screen/webroot/apps.xml">
<subscreens-item name="tutorial" menu-title="Tutorial" menu-index="98" location="component://tutorial/screen/tutorial.xml"/>
</screen>
</screen-facade>
</moqui-conf>
component/tutorial/screen/tutorial.xml
<screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.1.xsd"
require-authentication="false" include-child-content="true" menu-image="glyphicon glyphicon-wrench" menu-image-type="icon">
<subscreens default-item="hello">
</subscreens>
<widgets>
<label type="h1" text="Hello world with Sub Screens!"/>
<subscreens-panel id="hello-app" type="popup"/>
<subscreens-active/>
</widgets>
</screen>
component/tutorial/screen/tutorial/hello.xml
<screen>
<widgets>
<render-mode>
<text type="html"
location="component://tutorial/screen/tutorial/hello.html"/>
</render-mode>
</widgets>
</screen>
component/tutorial/screen/tutorial/hello.html
<h1>Hello world! (from the hello.html file)</h1>
With the above MoquiConf.xml configuration, the Tutorial component would not even show in the Applications --> AppList (Menu), but works when i load using below change in base-component/webroot/screen/webroot/apps.xml
<subscreens default-item="AppList">
<subscreens-item name="tutorial" menu-title="Tutorial"
location="component://tutorial/screen/tutorial.xml"/>
</subscreens>
Pretty sure i'm missing a config as the above seems to work in example, tools and possibly other components, Appreciate any pointers
Sorry for the delay, i was able to use the online tutorial -> moqui.org/docs/framework/Quick+Tutorial included in David's comments, and was successful in completing the tutorial, Thanks David.

Why is makepri.exe creating more than one Resources.pri file?

I'm trying to create a Resources.pri file so that Windows 10 knows which images to use for my start tile on different resolutions. I'm following step 6 of MSDN's documentation linked below:
https://msdn.microsoft.com/en-us/library/windows/apps/dn393983.aspx#Specify_images_for_scaling__localization__and_high_contrast
I have all of my logo images labeled according to their scale. These are their names in my Assets folder:
70x70Logo.scale-80.png
70x70Logo.scale-100.png
70x70Logo.scale-140.png
70x70Logo.scale-180.png
150x150Logo.scale-80.png
150x150Logo.scale-100.png
150x150Logo.scale-140.png
150x150Logo.scale-180.png
When I use makepri.exe manually, it creates three Resources.pri files instead of just one with all of the scaling information I want in it. These are the files generated:
Resources.pri
Resources.scale-140.pri
Resources.scale-180.pri
Resources.pri has information for the 80% and 100% scales, but the other two files contain the information for the 140% and 180% scales. Any idea why the larger scales are being separated out into separate files? I've included below my TestAppConfig.xml file and the commands I'm using the generate the files.
TestAppConfig.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources targetOsVersion="10.0.0" majorVersion="1">
<packaging>
<autoResourcePackage qualifier="Language"/>
<autoResourcePackage qualifier="Scale"/>
<autoResourcePackage qualifier="DXFeatureLevel"/>
</packaging>
<index root="\" startIndexAt="\">
<default>
<qualifier name="Language" value="en-US"/>
<qualifier name="scale" value="100"/>
</default>
<indexer-config type="folder" foldernameAsQualifier="true" filenameAsQualifier="true" qualifierDelimiter="."/>
<indexer-config type="resw" convertDotsToSlashes="true" initialPath=""/>
<indexer-config type="resjson" initialPath=""/>
<indexer-config type="PRI"/>
</index>
<!--<index startIndexAt="Start Index Here" root="Root Here">-->
<!-- <indexer-config type="resfiles" qualifierDelimiter="."/>-->
<!-- <indexer-config type="priinfo" emitStrings="true" emitPaths="true" emitEmbeddedData="true"/>-->
<!--</index>-->
</resources>
Command to create TestAppConfig.xml
"C:\Program Files (x86)\Windows Kits\10\bin\x86\makepri.exe" createconfig /cf %USERPROFILE%\Documents\TestAppConfig.xml /dq lang-en-US_scale-100_contrast-high /pv 10.0.0
Command to create Resources.pri
"C:\Program Files (x86)\Windows Kits\10\bin\x86\makepri.exe" new /pr %USERPROFILE%\Documents\CreateResources /cf %USERPROFILE%\Documents\TestAppConfig.xml /in TestApp /of %USERPROFILE%\Documents\CreateResources\Resources.pri
Any insight into this is greatly appreciated! Let me know if I can provide and further details.
I ended up finding a solution, though I'm exactly sure why it worked/was required to create just one Resources.pri file. I found that setting the default language of all of the images allowed makepri.exe to add all of the image scales as resouces candidates to one Resources.pri file. For example, I found this file structure worked:
\Assets
\en-US
70x70Logo.scale-80.png
70x70Logo.scale-100.png
70x70Logo.scale-140.png
70x70Logo.scale-180.png
150x150Logo.scale-80.png
150x150Logo.scale-100.png
150x150Logo.scale-140.png
150x150Logo.scale-180.png
I was clued in by this snippet of documentation:
Note We recommend that you mark the default language on string resource files (such as en-US\resources.resw) and the default scale on images (such as logo.scale-100.png), even if these files will not be localized nor multiple resolution images provided
https://msdn.microsoft.com/en-us/library/windows/apps/hh965372.aspx
Go figure.
I hope others find this helpful. If anyone has anymore insight on why makepri.exe works this way, I'd be curious to know more.
I've just encountered this with languages rather than images, but removing this block from the auto-generated makepri config fixed it for me:
<packaging>
<autoResourcePackage qualifier="Language"/>
<autoResourcePackage qualifier="Scale"/>
<autoResourcePackage qualifier="DXFeatureLevel"/>
</packaging>

Reusing stopwords and other files in Solr multicore

I have a multicore setup for solr, the directory structure of which goes like
-multicore
|-core0
|--conf
|---schema.xml
|---solrconfig.xml
|---stopwords
|---synonyms
|-core1
|--conf
|---schema.xml
|---solrconfig.xml
|---stopwords
|---synonyms
Both of these cores essentially use the same stop words and synonyms file. Is there a way, both these files could be located at a common place and both the cores read it from there?
According to the CoreAdmin documentation, you can
specify properties in solr.xml which can be used in the solrconfig.xml and schema.xml files.
So as an example you could create something similar to the following:
<solr persistent="true" sharedLib="lib">
<property name="synonymns" value="<your path here>/synonyms.txt" />
<property name="stopwords" value="<your path here>/stopwords.txt" />
<cores adminPath="/admin/cores">
<core name="core0" instanceDir="core0"/>
<core name="core1" instanceDir="core1" />
</cores>
</solr>
Hopefully this should get you started, you will obviously want/need to modify the solr.xml settings to meet your specific needs. Also there are a few other options for how the properties can be defined and the use of defaults. Please refer to the documentation for more details.
Not sure if there is any elegant way with the latest releases.
You can check using the absolute path of the stopwords file.
We have just created a symbolic link to a common shared files which are updated avoiding duplicates.

CruiseControl.NET and Clearcase configuration

I'm having problems simply configuring the server for CruiseControl.NET. I am using the source block that is given by ThoughtWorks to set it up, but I cannot seem to get it to be error-free. I am pretty new to all this and some sort of direction would be fantastic.
Does anyone use this combination?
Do you have a ccnet.config file I can look at?
This is what does not work for me:
<cruisecontrol>
<project name="test">
<sourcecontrol type="clearCase">
<exec>batch file</exec>
<viewPath>path_name</viewPath>
<branch>main</branch>
<autoGetSource>false</autoGetSource>
<useLabel>true</useLabel>
<useBaseline>false</useBaseline>
<projectVobName>vob_name</projectVobName>
<viewName>projecy_name</viewName>
<executable>cleartool.exe</executable>
<timeout>50000</timeout>
</sourcecontrol>
</project>
</cruisecontrol>
Thank you.
I have no direct experience with this kind of setup, but if you are using the <projectVobName> tag, that means:
you are declaring a pvob (project vob used only in UCM to store project, stream, activities and components, all UCM data)
your view (with the root directory referenced in <viewPath>) must be an UCM view.
All the other path elements (like 'executable') should reference an absolute path (and not just "cleartool.exe")

Include build output as attachment

We have a CruiseControl.NET Server 1.5.0.4401 running. One project uses an external compiler, which is included via exec-task. This compiler is configured to write its output into a textfile that is located in the artifact directory. The filename is keil_Revision-x.txt (x is the revision number) whereas the configuration for this file looks like %ccnetartifactdirectory%\keil_%ccnetlabel%.txt.
We want this output file to be attached to the e-mail report CC is sending for each build. The configuration of the email-publisher is (a bit shortened) the following:
<email from="buildmaster#xxx.yy" mailhost="zzz" mailport="25" includeDetails="TRUE" useSSL="FALSE">
<users>
<!-- Here are some users -->
</users>
<groups>
<!-- Here are some groups -->
</groups>
<converters>
<!-- LDAP converter-->
</converters>
<modifierNotificationTypes>
<!-- Several notification types -->
</modifierNotificationTypes>
<subjectSettings>
<!-- Here are some subject settings -->
</subjectSettings>
<attachments>
<file>${CCNetArtifactDirectory}\keil_${CCNetLabel}.txt</file>
</attachments>
</email>
The only problem is, that the files are not attached. The debug output on the cruise control console doesn't contain any error message. The artifact directory contains all files, only they are not attached. Where is the failure?
Are Integration Properties like CCNetLabel available inside CCNET configuration? I venture to doubt that. Up to CCNET 1.4.4 SP1 they weren't. So please check the attachment node in Your project configuration to see if CCNetLabel has been resolved properly.
You need to define preprocessor constants that can replace the integration properties like this:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:define project.artifact.dir="C:\foodir" />
<project name="foo">
<artifactDirectory>$(project.artifact.dir)</artifactDirectory>
...
<publishers>
...
<email
from="buildmaster#xxx.yy"
mailhost="zzz"
mailport="25"
includeDetails="TRUE"
useSSL="FALSE">
....
<attachments>
<file>$(project.artifact.dir)\keil.txt</file>
</attachments>
</email>
</publishers>
</project>
</cruisecontrol>
You need to instruct your compiler to write the results to a file whose name is predictable by CCNET configuration. Since configuration has no access to the label it must not be part of the filename. If you want to keep the result files from being overwritten by each build, add an executable task that triggers a simple batch file whose purpose is to copy %ccnetartifactdirectory%\keil.txt to %ccnetartifactdirectory%\keil_%ccnetlabel%.txt.
Otherwise the answer to this question might help here as well.

Resources