I would like to match a digit and replace it with that many spaces. Can this be done in less than 9 lines of code?
Example
"asnthsnth4nts4h3n" --> "asnthsnth nts h n"
My database has about 30 views, most of which have a reference to another database on this server (call it DB1).
Now, without going into the reasons why, I need to update all those views to DB2, also on the local server.
I would hate to have to do this manually on each view. Is there some SQL query I can run that will replace all occurrences of the string 'DB1' with 'DB2' in all my views?
I want to create an alert box with 3 radio buttons in it. It should be like
'Replace'
'Save'
'Merge'
along with OK and Cancel buttons. Any idea how to achieve this?
Hi,
Is there any function to replace the special characters by null in informatica
if we used replacestr function, i think we should specify all special characters
as follows replacestr(input,'!','~','@','#','$','%','^','&','*',null)
But we dont know what are teh special characters will be coming as input.
can u please let me know that which function will be suitable.
I have Perl code:
my $s = "The+quick+brown+fox+jumps+over+the+lazy+dog+that+is+my+dog";
I want to replace every + with space and dog with cat.
I have this regular expression:
$s =~ s/\+(.*)dog/ ${1}cat/g;
But, it only matches the first occurrence of + and last dog.
$(document).ready(function () {
//create the div
var div = $("<div></div>").css("position", "absolute").text("a short message").appendTo("body");
//attach the mousemove event
$("body").bind('mousemove', function(evt) {
div.css({
"left": evt.pageX + "px",
"top": evt.pageY + "px"
});
});
});
what im trying to do is replace a short message with an iframe, what do i do?
Hi,
I'm trying to use load to reload a portion of the current page (long story why) but am having an issue with the variable syntax.
Here is the snippet of code:
var pathname = window.location.pathname;
$('#menu').load("/cms.php #menu");
I woudl like to replace /cms.php with the variable, but am having issues with the corrent syntax.
Any help/advice would be much appricated.
A.
The following example is working when I manualy replace T wirh char *, but why is not working as it is:
template <typename T>
class A{
public:
A(const T _t) { }
};
int main(){
const char * c = "asdf";
A<char *> a(c);
}
When compiling with gcc, I get this error:
test.cpp: In function 'int main()':
test.cpp:10: error: invalid conversion from 'const char*' to 'char*'
test.cpp:10: error: initializing argument 1 of 'A<T>::A(T) [with T = char*]'
Hello.
This is really noob question. There is set of vim commands
: command1 : command2
etc., which I would neet to type in in a raw quite often. How to I make it automatic? It is simple regexp replace command set, however I cannot script those in sed, since it involves non-latin locales and for some reason vim handles non-latin regexps correctly, while sed not.
There's a command in VIM where you can say how many chars to replace, and VIM will put a "$" at that many characters out, and you can type in the replacement for those characters. The original and new text can be different lengths. What's the command for this?
hi,
I have a variable which stores the path on Windows. I want to replace all the \ with / in the path.
for eg. $path = C:\Users\scripts.ps1
Am new to Perl and tried something like
$path = s/\////
But it didnt work. can you please help me out....
I have seen some solutions, or at least tries, but none of them really work.
How do I strip all tags except those inside or [code] - and replace all the < and with < etc. in order to let js do some syntax highlighting on the output?
I've looked around for an answer to this, no luck.
what i want to do is replace:
http://localhost/mysite/admin/something
with:
http://localhost/mysite/admin/?p=something
Here's the best formula I came up with since yesterday:
RewriteEngine On
RewriteBase /mysite/
RewriteRule ^(superv/)([^\?/]+)$ $1\?p=$2 [NC]
Yet it's not working.
Note:
It think the "RewriteBase" thingy has nothing to do with the problem because this line is working like a charm:
RewriteRule ^(javascripts/main\.js)$ $1\.php [NC]
Any ideas? thanks in advance.
Hi guys,
I've got a string that comes from a POST form where I want to replace all spaced with some other character.
Here's that I did:
$cdata = str_replace(" ","#",$cdata);
And I got this.
--- Contact-ID#=#148 [10274da8]#Sinhronizacija#=#private [1000137d]#Uzvards#=#Zom [1000137c]#Vards#=#Tana [1000130e]#Talrunis#=#3333 [1000130e]#Mobilais#=#5555
As you can see, spaced before "[10..." are still there. Any ideas what could be the problem?
I have this code:
a=[['a','b','c'],['a','f','c'],['a','c','d']]
for x in a:
for y in x:
if 'a' in x:
x.replace('a','*')`
but the result is:
a=[['a','b','c'],['a','f','c'],['a','c','d']]
and bot a=[['b','c'],['f','c'],['c','d']]
What should I do so the changes will last?
Is it possible to add other else function in my JS like this: ?
if response == success redirect to home
if response == failed redirect to failed
$.ajax({
type: "POST",
url: action,
data: form_data,
success: function(response)
{
if(response == 'success')
window.location.replace("home");
else
$("#message").html("<div class='error_log'><p class='error'>Invalid username and/or password.</p></div>");
}
});
I am working on rolling a bit of my own version of linux for my real time car application. I plan to base it off of minimal ubuntu (only needsd 32 MB of memory). I am not the most skilled person with linux so not really sure how to assess components when adding them to my system. What I am looking for is a lightweight windows manager to replace gnome and it has to support the gtkmm library. Does anyone know of one?
This is the best way I could come up with to convert a MySQL GUID/UUID generated by UUID() to a binary(16):
UNHEX(REPLACE(UUID(),'-',''))
And then storing it in a BINARY(16)
Are there any implications of doing it this way that I should know of?
if we supposed that "A.B." is a value for an xml element called given-names
the following code converts this value to "A.tempspacetempspaceB." instead of "A. B."
foreach (XElement initial in doc.XPathSelectElements("//given-names"))
{
string v = initial.Value.Replace(".", ". ").TrimEnd(' ');
initial.SetValue(v);
}
So why tempspace comes here instead of literal space??
thank you for any help.
I understand the idea of generating a form token and storing it in a session, and also putting it as a hidden input in my forms.
But how could I make this work if I have pages with multiple forms, is it still safe to use the same token for each form?
And I still feel weary about bots and stuff on my website, can these form tokens really safely replace CAPTCHAs?
Hi,
I hope this question isn't too basic.
I have a string "-123445". Is it possible to remove the '-' character from the string?
I have tried the following but to no avail:
$mylabel.text("-123456");
$mylabel.text().replace('-', '');
Any help would be greatly appreciated.
Thanks,
Zaps
I'm trying to use sed to replace whitespace within a string. For example, given the line:
var test = 'Some test text here.';
I want to get:
var test = 'Sometesttexthere.';
I've tried using (\x27 matches the '):
sed 's|\x27\([^x27[:space:]]*\)[[:space:]]|\x27\1|g
but that just gives
var test = 'Sometest text here.';
Any ideas?
Hello
i just wander where can i find a tool that takes in my case java script string that is
unescape and converting it to escaped string so i could use it as string value in c++
for example characters like " i need to convert it to \"
i need something smart and not just replace all function .
I have set new division on postgress pg_operator table because i want tath when is division by zero return 0.
i have write this:
create operator / ( procedure = zero_division, leftarg = double precision, rightarg = double precision);
where zero_division is:
CREATE OR REPLACE FUNCTION zero_division(double precision, double precision)
RETURNS double precision AS
'select case when $2 = 0 then 0 else $1 / $2::real end;'
LANGUAGE sql IMMUTABLE
COST 100;
when i run value/ 0 i get error of division.
All of the SVN shops I've worked in have a strict rule - replace all tabs with spaces, to avoid whitespace conflicts and variations of tabs in different editors.
Is this a very common standard? Does it really make a huge difference, and is it worth the trouble to push this standard to a group of developers new to SVN?