file output when using perl MIME::Parser - perl

How do I get the path for the below option?
basiclly messages will be parsed to following dir "/tmp/msg-1370789006-11903-0" which is made up of
time and process ID , how do I get that into my varible for later use?
### Tell it where to put things:
$parser->output_under("/tmp");

The distro's overall documentation (also found in the distro's README file) contains the following useful information:
Overview of the classes
Here are the classes you'll generally be dealing with directly:
(START HERE) results() .-----------------.
\ .-------->| MIME:: |
.-----------. / | Parser::Results |
| MIME:: |--' `-----------------'
| Parser |--. .-----------------.
`-----------' \ filer() | MIME:: |
| parse() `-------->| Parser::Filer |
| gives you `-----------------'
| a... | output_path()
| | determines
| | path() of...
| head() .--------. |
| returns... | MIME:: | get() |
V .-------->| Head | etc... |
.--------./ `--------' |
.---> | MIME:: | |
`-----| Entity | .--------. |
parts() `--------'\ | MIME:: | /
returns `-------->| Body |<---------'
sub-entities bodyhandle() `--------'
(if any) returns... | open()
| returns...
|
V
.--------. read()
| IO:: | getline()
| Handle | print()
`--------' etc...
Which leads us to looking at MIME::Body's documentation, which include the following:
### Where's the data?
if (defined($body->path)) { ### data is on disk:
print "data is stored externally, in ", $body->path;
}
else { ### data is in core:
print "data is already in core, and is...\n", $body->as_string;
}
### Get rid of anything on disk:
$body->purge;

Related

remove all characters in every line starting from the character "\" in a text file using powershell

I have 50 lines text file ($file1) like and i need to remove the characters starting from an specific character "/" until,the end of the line.
Sample text file:
| Area | vserver | file-id |connection-id | session-id | open-mode | path |
| manphsan01 | manphs101 | 9980 | 4278018043 | 5065142205921760710 | rw | Share01\Mandaue\Data01 |
| manphsan01 | manphs101 | 1790 | 4278020659 | 5065142205921763223 | rwd | FinanceDept\ARCHIVING |
| manphsan01 | manphs101 | 1824 | 4278020659 | 5065142205921763223 | rwd | Share01\Cebu\Year2022 |
| manphsan01 | manphs101 | 1976 | 4278020659 | 5065142205921763223 | rwd | SGSDept\General\Document |
My desired output sh0uld be like:
| Area | vserver | file-id |connection-id | session-id | open-mode | path |
| manphsan01 | manphs101 | 9980 | 4278018043 | 5065142205921760710 | rw | Share01 |
| manphsan01 | manphs101 | 1790 | 4278020659 | 5065142205921763223 | rwd | Finance |
| manphsan01 | manphs101 | 1824 | 4278020659 | 5065142205921763223 | rwd | Share01 |
| manphsan01 | manphs101 | 1976 | 4278020659 | 5065142205921763223 | rwd | SGSDept |
the command i used is like this:
$var = Get-content $file1
$var.Substring(0, $var.IndexOf('\')) | FT -AutoSize or
$var.Substring(0, $var.IndexOf('backslash')) | FT -AutoSize
My command will work if my data is only 1 line but multiple lines it wont work. I am not sure why the 'backslash' is not showing on the command when i posted it.
ny ideas how to make this work?
You can get away with plain-text processing if you can assume that only one field on each line of your structured text file contains \ and that it and everything after it - up until the next field delimiter, | - should be removed:
# Transforms all matching lines and outputs them.
# Pipe to Set-Content to save back to a file; use -Encoding as needed.
(Get-Content $file) -replace '\\.+?(?= \|)'
The above uses a -replace operation with a regex to remove the unwanted part of matching lines (lines that don't match are passed through as-is).
For an explanation of the regex and the ability to experiment with it, see this regex101.com page.
As for what you tried:
$var = Get-content $file1 stores the individual lines of file $file1 as an array in variable $var1.
To process the resulting lines one by one, you need a loop construct, such as a foreach statement or the ForEach-Object cmdlet; e.g. foreach ($line in $var) { ... }
While $line.Substring(0, $line.IndexOf('\')) works in principle, it will cause a statement-terminating error (exception) for every $line value that contains no \ character, as Theo notes, notably with your file's header line.
While this could easily be fixed with try { $line.Substring(0, $line.IndexOf('\')) } catch { $line }, the bigger problem is that it would remove everything through the end of the line, which contradicts your desired output, which shows that the next field seprator, | should be retained.
The above -replace operation fixes both these problems; note that it implicitly loops over the array of input lines and performs the replacement operation on each, returning an array of (potentially) transformed lines.
Also note that a formatting cmdlet such as Format-Table (-FT) should only be used for for-display output; it doesn't produce usable data - see this answer for more information; also, it has no formatting effect on strings.

escape pipe( | ) character inside table. in Github pages

In my github page, the escape charecters not working currectly.
https://alirezanet.github.io/Gridify/
but its working currectly in github
if i remove these backslashes from MD file entire table will break in github,
how can i fix this?
| Name | Operator | Usage example |
| --------------------- | -------- | --------------------------------------------------------- |
| Equal | `==` | `"FieldName==Value"` |
| AND - && | `,` | `"FirstName==Value , LastName==Value2"` |
| OR - \|\| | `\|` | `"FirstName==Value \| LastName==Value2"` |
| Parenthesis | `()` | `"( FirstName=*Jo,Age<<30) \| ( FirstName!=Hn,Age>>30 )"` |
You can use:
<code>|</code>
in replacement of |

Define array in env file for snapshot

In my projet I have several targets to build several variants of my app. In order to handle this with snapshot, I use environnements as described here: https://github.com/fastlane/fastlane/blob/master/docs/Advanced.md#environment-variables
It works fine for defining my scheme but I do not manage to use it for languages.
.env.first_environment
SCHEME = MyScheme
LANGUAGES = en-GB,es-ES
Snapfile
languages([
ENV['LANGUAGES']
])
# The name of the scheme which contains the UI Tests
scheme ENV['SCHEME']
If I have only one language it works, but as soon as there is a comma in the env variable, I have some problems. When I launch fastlane I have:
+----------------------------+------------------------------+
| Summary for snapshot 1.2.2 |
+----------------------------+------------------------------+
| workspace | ./my_app.xcworkspace |
| devices | ["iPhone 4s"] |
| languages | ["en-GB,es-ES"] |
| output_directory | ./fastlane/Snapshots/MyScheme|
| ios_version | 9.1 |
| stop_after_first_error | false |
| skip_open_summary | false |
| clear_previous_screenshots | false |
| buildlog_path | ~/Library/Logs/snapshot |
| clean | false |
| scheme | My-Scheme |
+----------------------------+------------------------------+
For the language option I have "en-GB,es-ES" instead of "en-GB","es-ES".
Answer from #AliSoftware:
In env file
...
LANGUAGES = "en-GB,es-ES"
...
In Snapfile
...
languages(
ENV['LANGUAGES'].split(",")
)
...
Thanks.

Using named fields to determine ranges with vsum in Emacs org-table-mode, impossible?

I have been trying to simplify a semi-complex table that I have by adding named fields, without a problem, until I get to the vsum operator. I had the formula set to $M=vsum($3..#-4) which works, however I am continuously having to add and remove items from those fields, which changes the column numbering. This results in me having to change the field specifications of the vsum range after every update/change. I thus tried naming the top field and bottom fields with the thought of supplying the named variables to vsum, giving me a table similar to the following:
| / | <> | <> |
|---+--------+---------|
| | Title1 | Title 2 |
|---+--------+---------|
| _ | | START |
| | name | 1000 |
| | name | 3456 |
| | name | 123 |
| ^ | | END |
|---+--------+---------|
| _ | | MT |
| # | Total | #ERROR |
| # | | |
|---+--------+---------|
#+TBLFM: $MT=vsum($START..$END)
This is the debug formula output from the above table:
Substitution history of formula
Orig: vsum($START..$END)
$xyz-> vsum((1000)..(123))
#r$c-> vsum((1000)..(123))
$1-> vsum((1000)..(123))
-----------^
Error: Expected `)'
I have tried embrasing the named field variables in parenthesis, and several other ways but have thus far not been able to get this to work. I am hoping I am just missing something and being blind, but perhaps this is not possible to do?
I have also tried the sum-up function with no success as well. Thank you in advance for your assistance.
The following solution works by using #II and #III to refer to all entries between the second and third hline.
| / | <> | <> |
|---+--------+---------|
| | Title1 | Title 2 |
|---+--------+---------|
| | name | 1000 |
| | name | 3456 |
| | name | 123 |
|---+--------+---------|
| _ | | MT |
| # | Total | 4579 |
| # | | |
|---+--------+---------|
#+TBLFM: $MT=vsum(#II..#III)
Documentation: http://orgmode.org/manual/References.html#References

Cannot read (or find?) ResourceBundle

Below is my project structure.
Project
|
|--src
| |
| |--com
| | |
| | |--jasper
| | |
| | |--JasperDemo.java
| |
| |--i18n.properties
|
|
|--Arabic.jrxml
In the properties file there is a key text1.paragraph and it's value may be in any language(most preferable arabic).
In the .jrxml file I have set ResourceBundle="i18n" and in the textfield have used $R{text1.paragraph}
Now the problem is that when I run it from eclipse in the PDF file I get output of the field as $R{text1.paragraph} not it's value