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"
I am a rank beginner in C#. I am currently using this code:
objGraphics.Clear(SystemColors.Control);
What I want to do is Clear this object to black (or some other RGB color), and I'm stumped as to how to replace the SystemColors.Control with, preferably, an RGB color spec. I'd probably want to clear to black most of the time. Any help will be much appreciated!
I need to remove this string if found in my string:
<p><br/> </p>
Cant replace this:
<p><br/>Test. </p>
The whitespace expression I am using wasn't working for that, thank you for your help!
I have this html:
<a href="http://www.site.com/">This is the content.</a>
I just need to get rid of the anchor tag html around the content text, so that all I end up with is "This is the content".
Can I do this using Regex.Replace?
Hi,
I am trying to get an instance of a class to the load an external swf and show it.
So far I have the following:
1) I wrote a class that uses the Loader class to load an external swf "loadExtSWF".
2) I have a fla named "MainSWF.fla" that uses a document class "MainSWF.as".
3) I have the MainSWF.as file that instances "loadExtSWF" and calls loadExtSWF.startLoad to load the swf.
This almost works. The instance of loadExtSWF loads the external swf, but the swf is not displayed.
If I replace the fla's document class with loadExtSWF (this has an empty constructor) instead of MainSWF, and run loadExtSWF.startLoad, then the external swf is loaded and displayed.
It seems that the way I initially do it, loads the swf to the wrong stage (?).
Any ideas? Thanks for the help.
Bye,
RaamEE
P.S.
If you replace the document class for test_tsscreen from test_tsscreen.as to TSScreen.as, and remove the comment inside the test_tsscreen's constructor, the swf will be loaded.
my code is:
file test_as3.swf
an external as3 swf file.
file test_tsscreen.fla
the fla is empty and references test_tsscreen.as as its document class.
file test_tsscreen.as
package {
import flash.display.MovieClip;
import TSScreen;
public class test_tsscreen extends MovieClip{
var tsScreen1;
public function test_tsscreen(){
// var tsScreen1:TSScreen = new TSScreen(10,10,100,100,0.5,0);
var tsScreen1:TSScreen = new TSScreen();
tsScreen1.startLoad(this.stage);
}
}
}
file TSScreen.as
package {
import flash.display.MovieClip;
import flash.display.*;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
public class TSScreen extends MovieClip implements ITSScreenable{
public function TSScreen():void{
// startLoad(this); //Look important comment in above text
}
function startLoad(_this:Stage) {
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("test_as3.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
_this.parent.addChild(mLoader);
mLoader.load(mRequest);
trace(this.name);
trace(_this.name);
}
function onCompleteHandler(loadEvent:Event) {
addChild(loadEvent.currentTarget.content);
}
function onProgressHandler(mProgress:ProgressEvent) {
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
}
}
}
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?
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.
I have a Flex/Actionscript 3 application that displays RSS feeds in a Text element. It strips out any HTML formatting present, but it's not handling HTML special entity codes properly -- it's rendering &mdash as the literal string instead of replacing it with an em-dash, etc. Is there any systematic way I can make it handle those codes properly, or am I going to need to manually replace those strings regex style?
Guys, could you help me with treating text sent with GET method. How to detect and treat line foldings in text? The text is sent from textarea through AJAX using GET method. How to detect line foldings in text when it is sent in GET method?
And I want to replace all line foldings with special character for example like "|" before sending to PHP script.
How to do it?
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?
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
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?
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*]'
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?
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 notice these characters are all illegal
#%<>?\/*+|:"
I notice these are encoded (%NN where NN is the hex value) but can be replace without problem
$,;=& @
(note the space which is typically encoded as + (but may be %20))
#%?/+ i understand. But whats do the following characters do? <>\*|":
Note: I understand what : does in the domain part (its the port) as @ is a login but after the first / why is : illegal? (@ isnt)
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 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?
$(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?
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 .
products purchased
--------------------------
bana
bana
bana
stra
kiwi
reward requirements table (related to a rewards table)
reward id, products
----------------------
1,bana
1,bana
1,bana
2,stra
2,bana
3,stra
4,cart
5,bana
5,bana
5,oliv
Can you help me with sql to get rewards
the products purchased qualifies for?
In the case above the reward ids would be:
1
2
3
If there is a better design that would make the solution easier I welcome those as well. I'm using product names for the sake of easier explaining, I hope. (I'll replace with product ids later)
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?
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.
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?