var html = "<div>"+title+"<br/>";
document.write(title.replace(/ /g,"-"));
html+= '<p><a href="go.aspx?title=' + title + '">Details<\/a></p></div>';
hi all,i want to replace title space with dash
hi,
since eregi replace was deprecated on version 5.3 i want to make my program compatible with new version of php
http://php.net/manual/en/function.eregi-replace.php
so, i'm trying to use preg_replace like this
preg_replace(",",'','20,000.00');
but come with error
i'm familiar with eregi_replace(',','','20,000.00'); i'm not familiar with regex expression. what is the best replacement for eregi_replace?
I have and NSMutableArray and I want to replace it with another, but if I try to do it like this...
firstArray = secondArray;
...then it seems to erase the entire firstArray and I get this error message..
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)'
...and the bounds should be (6) not (0).
Is there a correct way to replace the array?
PS: I already checked the secondArray and it functions fine.
Hi - thanks for clicking.
I am trying to get status feedback using an IFrame for file uploads. I am not trying to get progress or percentages -
just when a file is done uploading and if it was a success or failure.
THE PROBLEM is that I can't seem to get the server response
to appear on the client. I have to following design:
I have an iframe on my page:
<iframe id="target_frame" src="" style="border:0px; width:0px; height:0px"></iframe>
The form tag points to it:
<form enctype="multipart/form-data" id="fileUploadForm" name="fileUploadForm" action="picupload.aspx" method="post" target="target_frame">
And the submit button starts a file upload via the iframe:
<input id="submit" type="submit" value="upload" />
In the picupload.aspx.cs file, I have a method that returns
dynamic data. I then send it to the client:
message = data;
Response.Write(String.Format("<script language='javascript' type='text/javascript'>window.parent.handleResponse('{0}');</script>", message));
On the client, I have a response handler:
function handleResponse(msg) {
document.getElementById('statusDiv').innerHTML = msg;
}
My intent is to see the msg value change for each uploaded file but I never see anything appear in statusDiv, let alone dynamically changing messages.
Can somebody please help??
Hi I am trying to get a cookie from a site which I can do no problem. The problem arises when I try and save the cookie to a NSString in a holder class or anywhere else for that matter and try and access it outside the delegate method where it is first created.
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
int i;
NSString* c;
NSArray* all = [NSHTTPCookie cookiesWithResponseHeaderFields:[response allHeaderFields] forURL:[NSURL URLWithString:@"http://johncleary.net"]];
//NSLog(@"RESPONSE HEADERS: \n%@", [response allHeaderFields]);
for (i=0;i<[all count];i++)
{
NSHTTPCookie* cc = [all objectAtIndex: i];
c = [NSString stringWithFormat: @"%@=%@", [cc name], [cc value]];
[Cookie setCookie: c];
NSLog([Cookie cookie]) // Prints the cookie fine.
}
[receivedData setLength:0];
}
I can see and print the cookie when I am in the method but I cant when trying to access it form anywhere else even though it gets stored in the holder class
@interface Cookie : NSObject
{
NSString* cookie;
}
+ (NSString*) cookie;
+ (void) setCookie: (NSString*) cookieValue;
@end
int main (void)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
JCLogin* login;
login = [JCLogin new];
[login DoLogin];
NSLog([Cookie cookie]); // Crashes the program
[pool drain];
return 0;
}
Hi - I am looking for a solution to replace an image with another image when you focus on a text field.
There are 4 text fields and 5 images (1 image is the default image)
When you focus on each of the text fields, the correct image should replace the default image..
Thanks for any guide on this
Hi guys,
I'm developing a Flash website (as3) where I need to be able to upload directly to YouTube by using the DATA API.
However in order to do so, I had to use a proper HTML form on top of my flash object.
Why? Because of the Browser Based Upload restictions.
I first hide the form using JQuery and with a little CSS the form is display just where I want it.
Within flash I use ExternalInterface.call() to show/hide the form when I need it!
ExternalInterface.call("YTUploader.showIt");
The upload process is working great my only problem is that the form can be displayed easily...
You just need a tool like firebug and you can use the form wherever you want on my flash app.
So I was wandering which will be the best way to 'protect' this form or the best way to limit its access.
Any advices will be appreciated.
Thanks for your time.
Jk.
hi,
I need to call a function with some javascript everytime my View is updated (I enabled ajax option, there is not page refresh).
How can I make it ? I'm inspecting php code in Views to find it, but I cannot find it.
thanks
Hi, my app presents a listview, from a database cursor and XML, that needs to replace the values in a column with various words based on the integer value contained in the cursor. For example, if the value is -1, replace it with the word "Invalid", but if the value is = 0 then just display the value.
I was under the impression this could magically be done via XML... TIA.
I do something like
UPDATE OR REPLACE someTable SET a=1, b=2 WHERE c=3
I expect if it doesnt exist it will be inserted into the DBs. But nothing happens and i get no errors. How can i insert data, replace it if it already exist and use a where for the condition (instead of replacing BC of a unique ID)
Hi Guys I have this Table
I need to replace the First Letter in ACCT_NAME with the First Name of ACCT_SHORT_NAME. Records like the Higliighted(RAFFMAN) should not be changed. I have tried:
select acct_name, ACCT_SHORT_NAME,replace(acct_name, substr(acct_name, 1, 1), ACCT_SHORT_NAME)
from tbaadm.gam where schm_type = 'TDA' and rcre_user_id = 'SYSTEM' and substr(acct_name,2,1) = ' '
I am getting:
This means that am Picking the whole value in ACCT_SHORT_NAME. WHat is the best way to do what am trying to do?
use sed to replace every occurrence of /dir with $dir (replace / with $) in every script in a directory.
sed "s#/dir#$dir#g"
The $ keeps being interpreted as a function or variable call.
Is there a way around this?
thanks
How to Find and Replace the 'Enter' characters in the text file? Here is my code:
string searchString( "\r" ); // <------- how to look for ENTER chars?
string replaceString( "XXXX" );
assert( searchString != replaceString );
string::size_type pos = 0, pos3 =0;
while ( (pos = test.find(searchString, pos)) != string::npos ) {
test.replace( pos, searchString.size(), replaceString );
pos++; }
How to replace space and dash coming together with only dash in php
e.g below is my url
[url] = http://kjd.case.150/1 BHK+Balcony- 700+ sqft. spacious apartmetn Bandra West
In this I want to replace all special characters with dash in php.In url there is already 1 dash after balcony.If i m replacing dash with special chars then it becomes two dash bcoz already there is 1 dash in url and i want only 1 dash.
I am recording audio in iPhone ..
This is my Audio Queue object
AudioQueueNewInput(
&audioDescription,
recordingCallback, self,
CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0,
&mInputQueue
);
But i want to run this in a seperate RunLoop..How to create custom CFRunLoop ?
Please help me..Thanks in advance.
I had a regex that replaced all URLs from a given string:
my_string = "www.example.com test www.mysite.com"
my_string.gsub!(/[a-zA-Z0-9\-\.]+\.(com|net|de|org|uk|biz|info|co.uk|es|de)(\/\S*)?/i,'(site hidden)')
As a result of the above I get: "(site hidden) test (site hidden)"
How could I change the regex to not replace www.mysite.com ???
It means that the replace should output "(site hidden) test www.mysite.com"
Thanks !
The following jQuery Javascript code is included on an otherwise empty page.
$(function() {
for (var i = 0; i < 10; i++) {
element = $('<div>' + i + '</div>');
element.click(function() {
alert(i);
});
$('body').append(element);
}
});
The desired behavior is that this code should generate 10 div elements numbered from 0 to 9. When you click on a div element, an alert popup will show the number of the div element you clicked on (i.e. if a user clicks on the div element labeled '4', the alert popup should show the number 4).
The alert popup instead shows the number 10 regardless of which div element is clicked on.
How can I modify this code to make it behave in the desired way?
Hello,
I am using a regular expression search to match up and replace some text. The text can span multiple lines (may or may not have line breaks).
Currently I have this:
$regex = "\<\?php eval.*?\>"
Get-ChildItem -exclude *.bak | Where-Object {$_.Attributes -ne "Directory"} |ForEach-Object {
$text = [string]::Join("`n", (Get-Content $_))
$text -replace $RegEx ,"REPLACED"}
I want to replace new lines in text with coma or space but do not change the last new line.
I know of this question: How to replace new lines with tab characters - but it does produce an tab on end instead of new line.
So far I have come with:
awk 'NR>1{printf","} {printf $1} END{printf"\n"}'
Is there an easier way to do this? This is not an assignment, I am just curious want to level up my scripting.
I am using jQuery star rating control found at http://www.fyneworks.com/jquery/star-rating/#tab-Overview . I am using 5 stars, each star having a particular value from 1 to 5. The control is getting displayed and behaving properly. However, I have a requirement of getting the value of the star clicked, immediately after a star is clicked. I do not know how to do it.
I appreciate your help.
Maybe it's just too late for me to do this, but I'm trying to replace a character between 2 string with regex in PHP.
Example string:
other | text [tag]text|more text|and more[/tag] end | text
My goal is to replace | with <br/> between [tag] and [/tag].
Tried with this, seems it wasn't that easy though:
/<td>(\|)<td>/gsi
Searched a bit, but couldn't make out an answer with the stuff I found.
Hope you can help, thanks
Hi all
There are a lot of numbers like 200 20.5 329.2...in a file. Now, I need replace every number A with A*0.8. Is there any simple method to replace original value with another based on original value?
Best Regards,