Environment variable as Command line argument - clion

Is it possible to pass environmental variable as a parameter to executable?
I tried this, but I get a string "job_$JOB_ID" in my app instead of "job_123"
Another question that can be a workaround for me:
Is there a way to access this config dialog parameters as a text file? So that I cen edit Program arguments in text editor instead of CLion UI. Those configs must be stored somewhere in CLion app folder

If you are looking to pass a environment variable that is defined by in run config, then it is not possible.
If you want to edit the configuration in file. Then usually it is stored in .idea/workspace.xml. This has all the run configurations and everything stored.
I don't have clion but have PyCharm, any a sample from same is
...
...
<configuration name="scrape2" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="scripts" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/deprecated" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/deprecated/scrape2.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
...
You can see the environment variables are defined inside envs.
You can pass a externally defined environment variable using ${ENVNAME}. See below thread on SO
How to pass an environment variable as a command line parameter in Run/Debug configuration in PyCharm?

Related

geoserver returns black image on aerials

I am trying to upload aerial photos to geoserver to be shown as background. But everytime the image is black instead of detailed satellite image. Also tried on single tif files, but same result. Anybody have experience with this issue and know a solution?
I use ImageMosaic as plugin to upload the tifs.
This is the result of gdalinfo:
C:\Program Files\QGIS 3.8\bin>gdalinfo --format GTIFF D:\tile-20000-380000.tif
Format Details:
Short Name: GTiff
Long Name: GeoTIFF
Supports: Raster
Extensions: tif tiff
Mime Type: image/tiff
Help Topic: frmt_gtiff.html
Supports: Subdatasets
Supports: Open() - Open existing dataset.
Supports: Create() - Create writable dataset.
Supports: CreateCopy() - Create dataset by copying another.
Supports: Virtual IO - eg. /vsimem/
Creation Datatypes: Byte UInt16 Int16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64
<CreationOptionList>
<Option name="COMPRESS" type="string-select">
<Value>NONE</Value>
<Value>LZW</Value>
<Value>PACKBITS</Value>
<Value>JPEG</Value>
<Value>CCITTRLE</Value>
<Value>CCITTFAX3</Value>
<Value>CCITTFAX4</Value>
<Value>DEFLATE</Value>
<Value>LZMA</Value>
<Value>ZSTD</Value>
<Value>WEBP</Value>
<Value>LERC</Value>
<Value>LERC_DEFLATE</Value>
<Value>LERC_ZSTD</Value>
</Option>
<Option name="PREDICTOR" type="int" description="Predictor Type (1=default, 2=horizontal differencing, 3=floating point prediction)" />
<Option name="DISCARD_LSB" type="string" description="Number of least-significant bits to set to clear as a single value or comma-separated list of values for per-band values" />
<Option name="JPEG_QUALITY" type="int" description="JPEG quality 1-100" default="75" />
<Option name="JPEGTABLESMODE" type="int" description="Content of JPEGTABLES tag. 0=no JPEGTABLES tag, 1=Quantization tables only, 2=Huffman tables only, 3=Both" default="1" />
<Option name="ZLEVEL" type="int" description="DEFLATE compression level 1-9" default="6" />
<Option name="LZMA_PRESET" type="int" description="LZMA compression level 0(fast)-9(slow)" default="6" />
<Option name="ZSTD_LEVEL" type="int" description="ZSTD compression level 1(fast)-22(slow)" default="9" />
<Option name="MAX_Z_ERROR" type="float" description="Maximum error for LERC compression" default="0" />
<Option name="WEBP_LOSSLESS" type="boolean" description="Whether lossless compression should be used" default="FALSE" />
<Option name="WEBP_LEVEL" type="int" description="WEBP quality level. Low values result in higher compression ratios" default="75" />
<Option name="NUM_THREADS" type="string" description="Number of worker threads for compression. Can be set to ALL_CPUS" default="1" />
<Option name="NBITS" type="int" description="BITS for sub-byte files (1-7), sub-uint16 (9-15), sub-uint32 (17-31), or float32 (16)" />
<Option name="INTERLEAVE" type="string-select" default="PIXEL">
<Value>BAND</Value>
<Value>PIXEL</Value>
</Option>
<Option name="TILED" type="boolean" description="Switch to tiled format" />
<Option name="TFW" type="boolean" description="Write out world file" />
<Option name="RPB" type="boolean" description="Write out .RPB (RPC) file" />
<Option name="RPCTXT" type="boolean" description="Write out _RPC.TXT file" />
<Option name="BLOCKXSIZE" type="int" description="Tile Width" />
<Option name="BLOCKYSIZE" type="int" description="Tile/Strip Height" />
<Option name="PHOTOMETRIC" type="string-select">
<Value>MINISBLACK</Value>
<Value>MINISWHITE</Value>
<Value>PALETTE</Value>
<Value>RGB</Value>
<Value>CMYK</Value>
<Value>YCBCR</Value>
<Value>CIELAB</Value>
<Value>ICCLAB</Value>
<Value>ITULAB</Value>
</Option>
<Option name="SPARSE_OK" type="boolean" description="Should empty blocks be omitted on disk?" default="FALSE" />
<Option name="ALPHA" type="string-select" description="Mark first extrasample as being alpha">
<Value>NON-PREMULTIPLIED</Value>
<Value>PREMULTIPLIED</Value>
<Value>UNSPECIFIED</Value>
<Value aliasOf="NON-PREMULTIPLIED">YES</Value>
<Value aliasOf="UNSPECIFIED">NO</Value>
</Option>
<Option name="PROFILE" type="string-select" default="GDALGeoTIFF">
<Value>GDALGeoTIFF</Value>
<Value>GeoTIFF</Value>
<Value>BASELINE</Value>
</Option>
<Option name="PIXELTYPE" type="string-select">
<Value>DEFAULT</Value>
<Value>SIGNEDBYTE</Value>
</Option>
<Option name="BIGTIFF" type="string-select" description="Force creation of BigTIFF file">
<Value>YES</Value>
<Value>NO</Value>
<Value>IF_NEEDED</Value>
<Value>IF_SAFER</Value>
</Option>
<Option name="ENDIANNESS" type="string-select" default="NATIVE" description="Force endianness of created file. For DEBUG purpose mostly">
<Value>NATIVE</Value>
<Value>INVERTED</Value>
<Value>LITTLE</Value>
<Value>BIG</Value>
</Option>
<Option name="COPY_SRC_OVERVIEWS" type="boolean" default="NO" description="Force copy of overviews of source dataset (CreateCopy())" />
<Option name="SOURCE_ICC_PROFILE" type="string" description="ICC profile" />
<Option name="SOURCE_PRIMARIES_RED" type="string" description="x,y,1.0 (xyY) red chromaticity" />
<Option name="SOURCE_PRIMARIES_GREEN" type="string" description="x,y,1.0 (xyY) green chromaticity" />
<Option name="SOURCE_PRIMARIES_BLUE" type="string" description="x,y,1.0 (xyY) blue chromaticity" />
<Option name="SOURCE_WHITEPOINT" type="string" description="x,y,1.0 (xyY) whitepoint" />
<Option name="TIFFTAG_TRANSFERFUNCTION_RED" type="string" description="Transfer function for red" />
<Option name="TIFFTAG_TRANSFERFUNCTION_GREEN" type="string" description="Transfer function for green" />
<Option name="TIFFTAG_TRANSFERFUNCTION_BLUE" type="string" description="Transfer function for blue" />
<Option name="TIFFTAG_TRANSFERRANGE_BLACK" type="string" description="Transfer range for black" />
<Option name="TIFFTAG_TRANSFERRANGE_WHITE" type="string" description="Transfer range for white" />
<Option name="STREAMABLE_OUTPUT" type="boolean" default="NO" description="Enforce a mode compatible with a streamable file" />
<Option name="GEOTIFF_KEYS_FLAVOR" type="string-select" default="STANDARD" description="Which flavor of GeoTIFF keys must be used">
<Value>STANDARD</Value>
<Value>ESRI_PE</Value>
</Option>
</CreationOptionList>
<OpenOptionList>
<Option name="NUM_THREADS" type="string" description="Number of worker threads for compression. Can be set to ALL_CPUS" default="1" />
<Option name="GEOTIFF_KEYS_FLAVOR" type="string-select" default="STANDARD" description="Which flavor of GeoTIFF keys must be used (for writing)">
<Value>STANDARD</Value>
<Value>ESRI_PE</Value>
</Option>
<Option name="GEOREF_SOURCES" type="string" description="Comma separated list made with values INTERNAL/TABFILE/WORLDFILE/PAM/NONE that describe the priority order for georeferencing" default="PAM,INTERNAL,TABFILE,WORLDFILE" />
<Option name="SPARSE_OK" type="boolean" description="Should empty blocks be omitted on disk?" default="FALSE" />
</OpenOptionList>
Other metadata items:
LIBTIFF=INTERNAL
We recently found out the compression type was wrong. WEBP instead of Geotiff. It will be resolved.

Can't get Sass compiler to output in other directory than the one app.sass resides in

System: Windows 10 64bit, PhpStorm 2016.2 (the backslashes are not the problem, they are in the screenshot, but not in my actual code anymore)
This is my file structure
/css -> css files
/sass -> sass files
The app.sass is in the /sass directory, and when I change something there, the compiler automatically runs. But it puts the app.css and app.css.map in the /sass directory. Instead I like to have have it save to the /css directory.
This is my watcherTask.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectTasksOptions">
<TaskOptions isEnabled="true">
<option name="arguments" value="--no-cache --update $FileName$:$FileNameWithoutExtension$.css" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" value="Compiles .sass files into .css files" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="sass" />
<option name="immediateSync" value="true" />
<option name="name" value="Sass" />
<option name="output" value="$FileParentDir$/css/$FileNameWithoutExtension$.css:$FileParentDir$/css/$FileNameWithoutExtension$.css.map" />
<option name="outputFilters">
<array />
</option>
<option name="outputFromStdout" value="false" />
<option name="program" value="C:/Ruby22/bin/sass.bat" />
<option name="scopeName" value="Project Files" />
<option name="trackOnlyRoot" value="true" />
<option name="workingDir" value="$FileDir$" />
<envs />
</TaskOptions>
</component>
</project>
Any clue about what I am missing here?
Update: As requested, a screenshot of the watcher:
The field "output paths to refresh" corresponds to the "output" option.
The field "arguments" to the eh... arguments option.
The arguments option determines where the file source and target are:
--no-cache --update Source:Target
The default is
--no-cache --update $FileName$:$FileNameWithoutExtension$.css
which I then had to change to
--no-cache --update $FileName$:$FileParentDir$/css/$FileNameWithoutExtension$.css
This causes the system to save both the css and the css.map to the right folder.
Thanks #LazyOne for pointing this out.

Custom targets for widget Layout Updates in Magento 2

I would like help working out how to add a custom container as a 'Layout Update' for a widget..
Currently, I only have the 3 basic options to choose from (Main Content Area, Siderbar Main and Sidebar Additional), but I would like to be able to add widgets to containers that I've created through various default.xml files.
How would I go about doing that?
Thanks,
Luke
In widget.xml You create additional area.Under catalog module you can see that.
<widget id="new_products" class="Magento\Catalog\Block\Product\Widget\NewWidget" is_email_compatible="true"
placeholder_image="Magento_Catalog::images/product_widget_new.png" ttl="86400">
<label translate="true">Catalog New Products List</label>
<description translate="true">List of Products that are set as New</description>
<parameters>
<parameter name="display_type" xsi:type="select" required="true" visible="true">
<label translate="true">Display Type</label>
<description translate="true">All products - recently added products, New products - products marked as new</description>
<options>
<option name="default" value="all_products" selected="true">
<label translate="true">All products</label>
</option>
<option name="item" value="new_products">
<label translate="true">New products</label>
</option>
</options>
</parameter>
<parameter name="show_pager" xsi:type="select" visible="true"
source_model="Magento\Config\Model\Config\Source\Yesno">
<label translate="true">Display Page Control</label>
</parameter>
<parameter name="products_per_page" xsi:type="text" required="true" visible="true">
<label translate="true">Number of Products per Page</label>
<depends>
<parameter name="show_pager" value="1" />
</depends>
<value>5</value>
</parameter>
<parameter name="products_count" xsi:type="text" required="true" visible="true">
<label translate="true">Number of Products to Display</label>
<value>10</value>
</parameter>
<parameter name="template" xsi:type="select" required="true" visible="true">
<label translate="true">Template</label>
<options>
<option name="default" value="product/widget/new/content/new_grid.phtml" selected="true">
<label translate="true">New Products Grid Template</label>
</option>
<option name="list" value="product/widget/new/content/new_list.phtml">
<label translate="true">New Products List Template</label>
</option>
<option name="list_default"
value="product/widget/new/column/new_default_list.phtml">
<label translate="true">New Products Images and Names Template</label>
</option>
<option name="list_names"
value="product/widget/new/column/new_names_list.phtml">
<label translate="true">New Products Names Only Template</label>
</option>
<option name="list_images"
value="product/widget/new/column/new_images_list.phtml">
<label translate="true">New Products Images Only Template</label>
</option>
</options>
</parameter>
<parameter name="cache_lifetime" xsi:type="text" visible="true">
<label translate="true">Cache Lifetime (Seconds)</label>
<description translate="true">86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.</description>
</parameter>
</parameters>
<containers>
<container name="sidebar.main">
<template name="default" value="list_default" />
<template name="names_only" value="list_names" />
<template name="images_only" value="list_images" />
</container>
<container name="content">
<template name="grid" value="default" />
<template name="list" value="list" />
</container>
<container name="sidebar.additional">
<template name="default" value="list_default" />
<template name="names_only" value="list_names" />
<template name="images_only" value="list_images" />
</container>
</containers>
</widget>
Please go through the <containers> tag above code you will understand.There is a container tag

Angle brackets from XML replaced with HTML codes?

I am trying to read the content of an XML file (configs.xml) and insert it somewhere in the middle of another XML file (workspace.xml).
This is the code:
require "nokogiri"
workspace = File.open("workspace.xml")
xml = Nokogiri::XML(workspace)
workspace.close
# Add new configs
configs = File.read("configs.xml")
xml.search('component[name="RunManager"]').each do |node|
node.content=configs
end
puts xml
The output looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidLayoutPreviewToolWindow">
<option name="state">
<GlobalState/>
</option>
</component>
<component name="RunManager" selected="Android Application.Run on device">
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false"/>
<component name="SliceManager" selected="Android Application.Run on device">
<option name="analysisUIOptions">
<AnalysisUIOptions/>
</option>
</component>
</project>
As you can see, the inserted content in the middle has all angular braces < > replaced with HTML codes < &gt, and I don't know why, though I suspect this has to do something with encodings.
What is most interesting is that if printing the content of configs.xml alone (the one that gets inserted and modified) then the output is as expected:
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
// ............
</configuration>
When you set the contents of a node you actually set its text contents, meaning, Nokogiri automatically escapes it.
To add a node to your XML you need to use add_child
configs = File.read("configs.xml")
xml.search('component[name="RunManager"]').each do |node|
node.add_child configs
end

Why doesn't this XML disable my joomla radio button?

<field name="name" type="radio"
class="btn-group"
label="label"
description="description"
default="0"
disabled = "true"
filter="raw">
<option value="0">No</option>
<option value="1">Yes</option>
</field>
How are you disable radio button with xml ?
One thing is that the disabled feature only works on option level, not for the whole field.
So you would need to set it like this:
<field name="name" type="radio"
class="btn-group"
label="label"
description="description"
default="0"
filter="raw">
<option value="0" disabled="true">No</option>
<option value="1" disabled="true">Yes</option>
</field>
However it doesn't work well together with the btn-group class. This is probably a Bootstrap bug.

Resources