Import variable from bleg to aleg‏ - freeswitch

I need to import a variable from b-leg to a-leg but renaming. I use the parameter
<action application="set" data="import=this_is_a_variable_name"/>
https://wiki.freeswitch.org/wiki/Variable_import
The problem is that I can not change the name of the variable. Change the value of the variable in aleg.
Is this possible?

Related

How to pass a parameter as an environment variable

How do you pass a parameter as an environment variable?
Step 1: Open up user bash file 'vim ~/.bash_profile', write the environment variable and save the file
export TWLIO_NUMBER=+303....
Step 2: In the application porperties file, store the variable
twlio_number=${TWLIO_NUMBER}
Step 3: Import Value in order to use it
import org.springframework.beans.factory.annotation.Value;
#Value("${twlio_number}")
private String TWILIO_NUMBER;
Also, if I hardcode the value in the application properties file, the code works.
Pass those as Java-Opts. It will work.
How to pass JVM arguments in SpringBOOT
https://www.baeldung.com/spring-boot-command-line-arguments
So I have a system variable in my spring project.
String dataSourceUrl = System.getenv(DEFAULT_CONNECTION);
I am looking for something quick to set the variable in command line.
I found this command work in mac
export DEFAULT_CONNECTION=value (value wrap in single quote to prevent the values being replaced)
You can check by env | grep DEFAULT_CONNECTION
run as usual mvn spring-boot:run

How To Reference Yaml File Relative to Launch File?

I have a launch file that is loading a yaml file:
<launch>
<rosparam command="load file="filename.yaml" />
<node pkg="my_package" type="my_package_node" name="my_package_node" />
</launch>
The filename.yaml file cannot be found unless I put a complete path: "/home/username/blah/blah/blah". Seeing as this launch file is used on multiple machines by different users and locations for the repository, I obviously cannot hard-code the path. So now what? How do I reference it relative to the location of the launch file?
we can set environment variable PWD for the specified node, eg we'd like to pass a rviz configuration file to rviz, the relative path can be like this:
<arg name="rviz_file" value="$(eval env('PWD')+'/config/showme.rviz')"/>
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rviz_file)" required="true" />
Best answer I could find myself was to use $(find package_name) as a starting point:
<launch>
<rosparam command="load file="$(find package_name)/../../yamlFolder/filename.yaml" />
<node pkg="my_package" type="my_package_node" name="my_package_node" />
</launch>
Seems kinda silly though. No reference to the path relative to the launch file itself? Would definitely like a better answer.
If You are using ROS Packages, Launch Folders Are in the root folder of Package So $(find package) are actually one folder before your launch file
If your yaml file is in a ROS package, then I think using the find substitution arg as you do in your answer is the cleanest route. If it's someplace else, I would suggest leveraging environment variables with something like
<launch>
<arg name="yaml_path" default="$(optenv YAML_PATH)"/>
<arg if="$(eval yaml_path == '')" name="yaml_file" value="$(env HOME)/some_folder/filename.yaml" />
<arg unless="$(eval yaml_path == '')" name="yaml_file" value="$(arg yaml_path)/filename.yaml"/>
<rosparam command="load" file="$(arg yaml_file)"/>
</launch>
This kind of gives the best of all worlds. If you've set YAML_PATH as an environment variable (e.g. export YAML_PATH="$HOME/some_path" from terminal or in your bashrc) then the path for yaml_file will use it. If not, optenv will evaluate to an empty string and the arg yaml_file will be set to some default path relative to your home folder. AND, if you have a user that doesn't want to mess with the environment variables at all, they can still pass in a path manually by calling it like
roslaunch my_launch_file.launch yaml_path:=/home/my_name/my_preferred_folder

regexp in oozie distcp action

I am trying to copy all files that fit certain criteria into a folder
<action name="copy_mta_c">
<distcp xmlns="uri:oozie:distcp-action:0.2">
<arg>${NAME_NODE}${PATH_COMVERSE}${CURRENT_DATE_NO_DASH}_*/*mta.gz</arg>
<arg>${NAME_NODE}${PATH_MTA}/</arg>
</distcp>
<ok to="copy_mta_y"/>
<error to="KILL"/>
</action>
Here symbol * in ${CURRENT_DATE_NO_DASH}_* stands for A or B or C etc. It searches for all folders. If I use ${CURRENT_DATE_NO_DASH}_A it will only search 1 filder. How can I make it take only 2 out of all folders? I tried doing (A|B), but this didn't work.
I'm assuming this will be a bash expansion since your variables look like bash variables.
You can use this:
${CURRENT_DATE_NO_DASH}_[A-C]
Or this:
${CURRENT_DATE_NO_DASH}_{A,B,C}

Magento - Add own phtml with getChildHtml

In 1column.phtml i added the follow line:
<div id="ja-container" class="ja-lo-1col wrap">
<?php echo $this->getChildHtml('storeinfo.pthml'); ?>
I added the storeinfo.phtml file to the page/html folder. I know i have to add something to an xml file, but i have no idea what. Does someone knows what i have to do, to make it work?
storeinfo.phtml contains:
<div class="storeinfo">
<p class="StoreName"><?php echo Mage::app()->getStore()->getName(); ?></p>
<br/>
<?php echo Mage::getStoreConfig('design/head/default_description'); ?>
</div>
You have to first make an entry in your layout XML as given below:
<block type="module/file" name="myblock" as="myblock" template="PATH_TO_storeinfo.phtml"/>
and then you can use following line in your phtml file where you want that phtml to be included:
<?php echo $this->getChildHtml('myblock'); ?>
where myblock is the name and alias for your block defined in the layout XML.
The getChildHtml() function fetches the child block in a parent block.
For example:
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
</block>
The code above is the layout for ‘catalog/product/view.phtml’, here you can use
$this->getChildHtml('media')
to fetch the media block and output it in the place where the function is called. The child block which you need to output in the parent file should have an argument named ‘as’, which you would use in the getChildHtml() function.
you can addd below code to your local.xml or any module layout xml
<default>
<reference name="footer">
<block type="core/template" name="storeinfo" template="storeinfo.phtml"/>
</reference>
</default>
please check your template path as well.
hope this will help you.

Generic path to a module in Magento

Is there a generic way to receive the path to a Magento module? I want to link to an configuration file in the /etc folder in one of my modules.
You can ask for paths with getModuleDir method
Mage::getModuleDir('Model', 'Your_Extension');
Mage::getModuleDir('Block', 'Your_Extension');
Mage::getModuleDir('Helper', 'Your_Extension');
Mage::getModuleDir('controllers', 'Your_Extension');
Mage::getModuleDir('etc', 'Your_Extension');
getModuleDir only works where the first parameter is 'etc', 'controllers', 'sql', or 'locale'. Of course, you could just pass in a '' as the first parameter and append 'Model'/'Block'/'Helper' to the returned value.

Resources