I would like to make use of the message bundles feature in grails, but always run into the problem that I need multiline messages for text (instructions or help text for example).
Is there a way to create multiline messages or do I have to create single line messages with <br />s or \ns in between?
Or is it the wrong approach for longer text?
I believe you can simply end the line with a trailing slash (\) and continue on the next line in Java Properties files.
See: http://www.rgagnon.com/javadetails/java-0503.html
Related
I discovered from here that if you have a script you want to run in the rails console, you sometimes have to copy paste it line by line (copy pasting it all at once doesn't always work)
This is very tedious for lengthy scripts
Is there a work around or faster way?
Example - this will not copy paste from text editor to console:
class Article
def initialize(title, link, paragraphs)
#title = title
#link = link
#paragraphs = paragraphs
end
attr_reader :title
attr_reader :link
attr_reader :paragraphs
end
Edit
The above snipped does copy paste right into the rails console. But when I grab the same text from sublime text 3, it errors after the second line, with:
Display all 522 possibilities? (y or n)..
The Answer
I worked out why. My script (in sublime text) used tabs as indents. The rails console only accepts spaces as indents. That's an hour of my life I won't get back. I hope this saves someone else some time.
This issue (pasting multi-line code into irb on the console, on a Mac, using iTerm) bugged me for a long time and finally found the solution.
In my case the issue was with iTerm. It turns out iTerm by default pastes the content at a speed that is too fast for readline, the library that irb uses to read input.
The solution was to do Edit > Paste Special > Paste Slower, twice.
See here for a similar case: https://gitlab.com/gnachman/iterm2/issues/3607
SOLUTION
Open the rails console with this option:
rails console -- --nomultiline
You can paste many lines of code without problem then.
EXPLANATION
The problem here is that IRB wants to write a letter at a time. You can disable this behaviour by giving up the ability to move the cursor up and down when you write and edit a block of code before closing it.
Source:
https://tosbourn.com/speed-up-pasting-text-into-rails-console/
I can't comment because of reputation, so i add an answer about a 'tips' that can save some of your time.
In most of the text editor / IDE used to write code you can choose to replace the tabulation by an amount of space. It's a good thing to do so to avoid the tabulation characters in files raising some errors like yours ;)
https://www.sublimetext.com/docs/3/indentation.html
For me replacing tabs to spaces wasn't enough, maybe because the content i was trying to paste was so large. What worked for me was removing all unneeded spaces, replacing newlines with semicolons, and replacing do...end blocks with one line curly bracket blocks. Basically getting everything into as few lines as possible.
I have a code block in an org document
#+NAME: result_whatever
#+BEGIN_SRC python :session data :results value :exports none
return(8.1 - 5)
#+END_SRC
which I evaluate inline:
Now, does this work? Let's see: call_result_whatever(). I'd be surprised ...
When exporting to LaTeX, this generates the following:
Now, does this work? Let's see: \texttt{3.1}. I'd be surprised \ldots{}
However, I don't want the results to be displayed in monospace. I want it to be formatted in "normal" upright font, without any special markup.
How can I achieve this?
You should be able to get it work using the optional header arguments which can be added to call_function().
I don't have LaTeX installed on this system so can't fully test the outputs to ensure they come out exactly as desired, I'm using the plain text output to compare instead. However you can use the following syntax as part of your call to modify the results.
Now, does this work? Let's see call_results_whatever()[:results raw].
I'd be surprised ...
Without the [:results raw] the output to Plain Text (Ascii buffer) is Let's see `3.0999999999999996'.. With the added results it becomes Let's see 3.0999999999999996.
For full details of the available results keywords as well as other optional header arguments for the inline blocks please see Evaluation Code Blocks and Results arguments.
this is 5 years later. apparently in org-mode 8.2 or so, a new variable was introduced (documenting in "Evaluating Code Blocks" in the org-mode manual, but this from etc/ORG-NEWS in the source tree):
*** New option: org-babel-inline-result-wrap
If you set this to the following
: (setq org-babel-inline-result-wrap "$%s$")
then inline code snippets will be wrapped into the formatting string.
so, to eliminate \texttt{}
(setq org-babel-inline-result-wrap "%s")
The problem of this type can be solved in two ways:
1: Easy does it:
A plain query-replace on the exported buffer.
Once you're in the LaTeX buffer,
beginning-of-buffer or M-<
query-replace or M-%
enter \texttt as the string that you want to replace
enter nothing as the replacement
continue to replace each match interactively
with y/n or just replace everything with !
2: But I wanna!
The second way is to nag the org-mode mailing list into
implementing a switch or an option for your specific case.
While it's necessary sometimes, it also produces a system
with thousands of switches, which can become unwieldy.
You can try, but I don't recommend.
I've recently taken on a project of document conversion to HTML. That is, a client gives me a .DOC file, and I need to convert the contents to one long HTML file - no styling, no CSS, just clean HTML with paragraph tags, header tags tags, etc.
I found an application that does a pretty good job of automating the first part of it. The problem is that I need to do some advanced find and replace based on strings using variables.
For instance, I have footnotes that were converted properly. They're currently displayed as superscript numbers with the
I'd like to change how the footnote is displayed. Instead of a superscript number 6 for the 6th footnote, I'd like it to show (Note 6)
To do that on the entire document (hundreds of footnotes), I'm wondering if I can do something like:
FIND:
<sup><a name="FN[0-9]" href="FNR[0-9]">[0-9]</a></sup>
REPLACE:
<a name="FN%1" href="FNR%2">(Note %3)</a>
The problem is, I can't find a Find and Replace tool that lets me maintain the variables in the replace area. All I get is the superscript 6 appearing as (Note %3), as well as every other footnote doing the same thing.
Anyone have any ideas on how I can accomplish my task efficiently?
In Perl it would look roughly like this on the command line (I have NOT tested this):
perl -i -p -e's{<sup><a name="(FN\d)" href="(FNR\d)">(\d)</a></sup>}{<a name="$1" href="$2">(Note $3)</a>}' filenames....
-i says "Edit this file in place", -p means "print each line after we do whatever is in the -e switch".
That's assuming you're only looking for a single digit where you have [0-9]. If you want to match FN427, then you change (FN\d) to (FN\d+), for example.
This also assumes that the HTML that are you parsing looks EXACTLY LIKE THAT. If you get some HTML that is <a href=... name=... (with the attributes in opposite order than you have) then it will break. In that case, you'll want to use an HTML parser.
I hope that gives you enough to start with.
I'm using the text parameter to get multi line parameters, and write them to file.
If I use the rebuild, the text parameter is loaded as a single line string (where newline is removed).
Does anyone have an idea on how to fix this? I guess the rebuild plugin is the problem...
The multi-line text parameter seems to be rather buggy. One workaround you may consider is to substitute newlines with some custom escape system and then convert the escape sequences back to newlines inside your build.
A more advanced solution would be to modify the plugin itself to convert the escape sequences into newlines and use that modified plugin in your Jenkins. I've done that sort of thing for Claim Plugin to display failed matrix jobs which it did not do on its own. If you decide to take this route I can walk you through the main steps.
I have just enhanced the plugin to add TextParameterValue.jelly
That works fine, since text and textarea are not that different except new lines just use StringParameterValue.jelly as template and use <f:textarea name="value" value="${it.value}" /> instead of <f:textbox name="value" value="${it.value}" />
I'd like to include some comments in a SpecFlow feature.
I get the the following error:
Custom tool error: Parsing error near '/*'
I've tried the following:
// comment
/* comment */
-- comment
' comment
How do I do this?
As stated by sarfest above - its simply #-sign for comments.
There are no multiline comments but that's easily solved if you can do a vertical selection (hold down ALT-key and select in Visual Studio).
Vertical select and the enter a #-sign.
Additional information: the line has to start with a #, and optionally any whitespace. This means you cannot combine comments with actual code on the same line.
also, if you want to perform multiline comments in an easy way (on visual studio),
you can select the lines to be commented, and hit CTRL+K+C to comment, CTRL+K+U to Uncomment.
thank you for the wonderful idea. I just need to press ALT and select the entire lines (just the little space which holds only one character space in each line) and then enter # which result
from
xyz
abc
to
'# xyz'
'# abc'
You can add comment lines to the feature files at any place starting the line with the # sign. Be careful however, as comments in the specification are often signs of wrongly specified acceptance criteria.
The comment lines are ignored by SpecFlow.