This is what I have set up instead of passing the array.
calling code
called function
All this does at this point is print the filenames. In the end, this will process the 4 file lists in 4 subshells. Processing involved calling a c++ widget to process each file. This setup allows 4 instances of the c++ app to run simultaneously and use availalble CPU resources. There will be a similar code block for hex core.
I get this this is written in long form at the moment. It would be nice for the code to be a bit more compact and elegant, but I don't see a clear way to put the function calls in a loop or something like that.
LMHmedchem
Last edited by LMHmedchem; 01-13-2015 at 05:52 PM..
I want to pass an array in my function, And my function will be changing the elements of the array in the fuction, but it should not affect the values in my array variable of main function (1 Reply)
Hi,
If this is the array that is being returned to me:
How would I get the values for each of the 3 records?
This works for 1 Record:
foreach $item (@results)
{
($id, $id2, $name, $date, $email) = split(/\|/, $item, 5);
print "$name<br>";
} (2 Replies)
Hi,
I have an output generated from a shell script like;
0x41,0xF2,0x59,0xDD,0x86,0xD3,0xEF,0x61,0xF2
How can I pass this value to the C function, as below;
int main(int argc, char *argv) {
unsigned char hellopdu={above value};
}
Regards
Elthox (1 Reply)
Hi,.
I am writing a script to get the new files and split them.
Requirement
Find the new files under the path "/wload/scmp/app/data/OAS" (There are 5 sub folders).
Gunzip the files which are having .gz suffix.
Put the list of files in the filename in the format... (0 Replies)
Hi All,
the below is my requirement..
i need to split the file based on line and put that files in a array and need to access that files through loop finally i should send the files through mail..
how can we achieve this ..I am new to shell script please guide me..
I am using KSH..
... (11 Replies)
hi,
I have a array say
SAP_ARRAY="s1.txt"
SAP_ARRAY="s2.txt"
how can i pass this full array to a function.
here is the sample code i am using..
CHECK_NO_FILES()
{
FARRAY=$1
echo "FARRAY = $FARRAY"
echo "FARRAY = $FARRAY"
............... (5 Replies)
Hi, guys
I just wanted to sort the elements of an array ascendingly.
I know the following code does work well:
array=(13 435 8 23 100)
for i in {0..4}
do
j=$((i+1))
while ]
do
if } -le ${array} ]]
then :
else
min=${array}
${array}=${array}
${array}=$min
fi... (5 Replies)
Hi All
I have multiple arrays like below.
set -A val1 1 2 4 5
set -A val2 a b c d
.
.
.
Now i would like to pass the individual arrays one by one to a function and display/ do some action.
Note : I am using ksh
Can you please advise any solution...
Thanks in advance. (7 Replies)
Hello,
I need to collect some statistical results from a series of files that are being generated by other software. The files are tab delimited. There are 4 different sets of statistics in each file where there is a line indicating what the statistic set is, followed by 5 lines of values. It... (8 Replies)
I'm able to read & print an array in varaible called "filelist"
I need to pass this array variable to a function called verify() and then read and loop through the passed array inside the function.
Unfortunately it does not print the entire array from inside the funstion's loop.
#/bin/ksh... (5 Replies)
Discussion started by: mohtashims
5 Replies
LEARN ABOUT DEBIAN
petal::i18n
Petal::I18N(3pm) User Contributed Perl Documentation Petal::I18N(3pm)NAME
Petal::I18N - Attempt at implementing ZPT I18N for Petal
SYNOPSIS
in your Perl code:
use Petal;
use Petal::TranslationService::Gettext;
my $translation_service = new Petal::TranslationService::Gettext (
locale_dir => '/path/to/my/app/locale',
target_lang => gimme_target_lang(),
);
my $template = new Petal (
file => 'example.html',
translation_service => $translation_service
);
# we want to internationalize to the h4x0rz 31337 l4nGu4g3z. w00t!
my $translation_service = Petal::TranslationService::h4x0r->new();
my $template = new Petal (
file => 'silly_example.xhtml',
translation_service => $ts,
);
print $template->process ();
I18N Howto
Preparing your templates:
Say your un-internationalized template looks like this:
<html xmlns:tal="http://purl.org/petal/1.0/">
<body>
<img src="/images/my_logo.png"
alt="the logo of our organisation" />
<p>Hello,
<span petal:content="user_name">Joe</span>.</p>
<p>How are you today?</p>
</body>
</html>
You need to markup your template according to the ZPT I18N specification, which can be found at
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ZPTInternationalizationSupport
<html xmlns:tal="http://purl.org/petal/1.0/"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="my_app">
<body>
<img src="/images/my_logo.png"
alt="the logo of our organisation"
i18n:attributes="alt" />
<p i18n:translate="">Hello, <span petal:content="user_name">Joe</span>.</p>
<p i18n:translate="">How are you today?</p>
</body>
</html>
Extracting I18N strings:
Once your templates are marked up properly, you will need to use a tool to extract the I18N strings into .pot (po template) files. To my
knowledge you can use i18ndude (standalone python executable), i18nextract.py (part of Zope 3), or I18NFool.
I use i18ndude to find strings which are not marked up properly with i18n:translate attributes and I18NFool for extracting strings and
managing .po files.
Assuming you're using i18nfool:
mkdir -p /path/to/my/app/locale
cd /path/to/my/app/locale
i18nfool-extract /path/to/my/template/example.html
mkdir en
mkdir fr
mkdir es
i18nfool-update
Then you translate the .po files into their respective target languages. When that's done, you type:
cd /path/to/my/app/locale
i18nfool-build
And it builds all the .mo files.
Making your application use a Gettext translation service:
Previously you might have had:
use Petal;
# lotsa code here
my $template = Petal->new ('example.html');
This needs to become:
use Petal;
use Petal::TranslationService::Gettext;
# lotsa code here
my $template = Petal->new ('example.html');
$template->{translation_service} = Petal::TranslationService::Gettext->new (
locale_dir => '/path/to/my/app/locale',
target_lang => gimme_language_code(),
);
Where gimme_language_code() returns a language code depending on LC_LANG, content-negotiation, config-file, or whatever mechanism you are
using to decide which language is desired.
And then?
And then that's it! Your application should be easily internationalizable. There are a few traps / gotchas thought, which are described
below.
BUGS, TRAPS, GOTCHAS and other niceties
Translation Phase
The translation step takes place ONLY ONCE THE TEMPLATE HAS BEEN PROCESSED.
So if you have:
<p i18n:translate="">Hello,
<span i18n:name="user_login" tal:replace="self/user_login">Joe</span>
</p>
It most likely will not work because the tal:replace would remove the <span> tag and also the i18n:name in the process.
This means that instead of receiving something such as:
Hello, ${user_login}
The translation service would receive:
Hello, Fred Flintstone
Or
Hello, Joe SixPack
etc.
To fix this issue, use tal:content instead of tal:replace and leave the span and its i18n:name attribute.
Character sets
I haven't worried too much about them (yet) so if you run into trouble join the Petal mailing list and we'll try to fix any issues
together.
Limitations
At the moment, Petal::I18N supports the following constructs:
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:translate
i18n:domain
i18n:name
i18n:attribute
It does *NOT* (well, not yet) support i18n:source, i18n:target or i18n:data.
perl v5.12.4 2011-08-25 Petal::I18N(3pm)