Hi guys. I'm writing a tiny program that takes user input using Getops, and based on it, the program will either try to match a pattern against some text, or substitute text for what matched.
The problem I'm having is that I can't get the substitution portion to work. I'm looking at the qr// entry in the man pages: http://perldoc.perl....
I am using Sphinx to document a webservice that will be deployed in different servers. The documentation is full of URL examples for the user to click and they should just work. My problem is that the host, port and deployment root will vary and the documentation will have to be re-generated for every deployment.
I tried defining substi...
I'm using a Substitution control in my master page, and I want to render a user control content (related to the login area of my website) in the Substitution .
Seems like I must have a reference for the requested page so that it could render the control. But I need to render the control in the master page itself, as it's shared across mu...
I just had a user tell me his registration key didn't work. It took me quite a while to figure out that he entered the capital letter "O" instead of the number "0".
So I decided that it is best for my registry checker to treat both "O" and "0" as equivalent, so both will work.
I can think of two other possible mixups:
The number "1...
Is there a way to do command substitution in BASH shell without breaking output into multiple arguments?
I copy the path of some directory (from the location bar in a GUI file browser) to clipboard and then issue the following command, where the command xsel returns the clipboard content, which is the path of the directory in this case:...
Let's say I have some original text:
here is some text that has a substring that I'm interested in embedded in it.
I need the text to match a part of it, say: "has a substring".
However, the original text and the matching string may have whitespace differences. For example the match text might be:
has a
substring
or
has a s...
Let's say I have a word selected in visual mode. I would like to perform a substitution on that word and all other instances of that word in a file by using s//. Is there a way to use the highlighted text in the s/<here>/stuff/ part without having to retype it?
...
Is it possible to create a single regexp to replace < and > with their entity equivalents?
s/<|>/<|>/
...
How can I replace all occurrence of user defined latex macros with their definitions?
For example, given this file
old.tex
\newcommand{\blah}[2]{#1 \to #2}
...
foo \blah{egg}{spam} bar
...
how to generate the file below in an automatic way
new.tex
...
foo egg \to spam bar
...
Instead of reimplementing latex macro logic with perl...
is it possible to specify parameters for :joins similar way as for :conditions?
here is an example (sql code is irrelevant)
named_scope :threads, {
:joins => [" LEFT JOIN groups_messages gm ON messages.id=gm.message_id AND gm.group_id IN (?) ",@group_ids_array],
:conditions => ["creator_id=? AND messages.id IN (?)", current_user_i...
The following lines of comma-separated values contains several consecutive empty fields:
$rawData =
"2008-02-06,8:00 AM,14.0,6.0,59,1027,-9999.0,West,6.9,-,N/A,,Clear\n
2008-02-06,9:00 AM,16,6,40,1028,12,WNW,10.4,,,,\n"
I want to replace these empty fields with 'N/A' values, which is why I decided to do it via a regex substitution.
...
Which one of these is cheaper?
$_ = 'abc123def';
s/\d+/$&*2/e;
say;
s/(\d+)/$1*2/e;
say;
...
Assuming the following text file, which is actually a data dump of funds and price statistics:
PBCPDF
05/01/2006
0.0000
0.0000
PBCPDF
0.0000
06/01/2006
0.0000
0.0000
PBCPDF
0.0082
[… lines repeat …]
What I wanted to achieve is to delete all instances of PBCPDF except for the first one, which I could write the substitution comman...
Greetings dear Experts!
Could you please advice me on how to cope with the problem:
@echo off
cls
setlocal enabledelayedexpansion
path=%CD%;%path%
set NumberOfPages=553
rem set /A MaxFileIndex=%Counter% - 1
set MaxFileIndex=1
del Output.txt
for /l %%i in (0,1,%MaxFileIndex%) do call :GenerateFileList %%i
goto :eof
:::::::::::::...
Looks like context parameter of asp:net substitution control method is missing the current session once the page is output cached.
Aside from getting the substitution control's content thru ajax or using some other method to store data that would otherwise be in session (like database) is there anything else I can do?
Is there a workar...
Is there a good way to do multiple substitutions for aliasing a command?
For example
alias cmd = 'ssh -R $1:$2:$1:$2 $3 | something {$1, $2, $3}'
cmd 127.0.0.1 1234 server
Something like this..
Actually, this doesn't really make any sense to pipe the output like this, but similar syntax is what I'd like to see.
It's be nice to have...
Log4J appears to have an annoying restriction – at runtime, variable substitution does not appear to work.
In this example
File: Log4j.properties
file_pattern=%d{ISO8601} %-5p %m%n
log4j.rootLogger=DEBUG, FileAppender
log4j.appender.FileAppender=org.apache.log4j.FileAppender
log4j.appender.FileAppender.layout=org.apache...
Hi,
I am a vim user, and I want to be able to loop over a range of substrings when I am substituting. How can I use some vim magic to go from a set of lines like this:
Afoo
Bfoo
Cfoo
Dfoo
to
Abar
Bbar
Cbaz
Dbaz
???
I want to search my file from the start for the next occurance of foo, and replace the first two instances with bar...
I want to substitute, the "\" that appears in the Windows directory link to a "/".
I tried using s//\////g, but it doesn't seem to do the trick.
...
According to this article http://support.microsoft.com/kb/2014472 you can't use Response filters and Substitution controls together. Has anyone found a workaround for this? I am trying to process complete HTML response just before it's written to client and I do use substitution controls widely.
...