Search Results

Search found 9447 results on 378 pages for 'str replace'.

Page 41/378 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • regular expression on replace method of js not working

    - by user950146
    why this is not working var value = arr[row][col].replace(new RegExp('"', 'g'),'""'); Error : Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0) Timestamp: Tue, 10 Apr 2012 11:22:01 UTC Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Note: : Error copied directly from debugger of IE8

    Read the article

  • Replace special characters in python

    - by Marcos Placona
    Hi, I have some text coming from the web as such: £6.49 Obviously I would like this to be displayed as: £6.49 I have tried the following so far: s = url['title'] s = s.encode('utf8') s = s.replace(u'Â','') And a few variants on this (after finding it on this very same forum) But still no luck as I keep getting: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 100: ordinal not in range(128) Could anyone help me getting this right? UPDATE: Adding the reppr examples and content type u'Star Trek XI &#xA3;3.99' u'Oscar Winners Best Pictures Box Set \xc2\xa36.49' Content-Type: text/html; charset=utf-8 Thanks in advance

    Read the article

  • Safe ASCII char to replace whitespace before storing

    - by AngryWhenHungry
    My code passes a big bunch of text data to a legacy lib, which is responsible for storing it. However, it tends to remove trailing whitespace. This is a problem when I read the data back. Since I cannot change the legacy code, I thought about replacing the all spaces with some uncommon ASCII character. When I read back the text, I can replace them back. Is this a bad idea, considering that I cannot touch the legacy storage code? Which character can I use as a substitute? I was considering some char upwards of 180. There will only be spaces - no tabs or newlines - in the data. The data is alphanumeric, with special characters.

    Read the article

  • Replace String pattern in Java

    - by Hirantha
    I have the following string "value=\"\\d{4}((((0[1-9])|(1[0-2]))((0[1-9])|([12]\\d)|(3[01]))?)?|(\\-(((0[1-9])|(1[0-2]))(\\-((0[1-9])|([12]\\d)|(3[01])))?)?)?)d{4}" There I want to replace all the occurrences of "{" with NCHAR(0x7B) "}" with NCHAR(0x7D). An the content in-between "{ }" should remain unchanged: Ex: \\d{4} after replacing -> NCHAR(0x7B) 4 NCHAR(0x7D). Is there a way to do this using Regular Expressions in Java?. Anyway, this can be done processing the whole string using string operations.

    Read the article

  • Batch to copy and replace a txt file from one server to another

    - by Sunny
    I have two servers, server1 and server2 on same network but require username and password to be mapped. server1 has a text file as C:\Users\output.txt. I want to create and schedule a batch script on server1, which should copy and replace output.txt file from server1 to server2 at path E:\data\output.txt on daily basis. I don't want to map server2 manually every time I start my computer nor do I want to enter my username and password each time. I am using following commands in a batch, but not working; net use C: \\server2\E:\data server2password /user:server2domain\server2username /savecred /p:yes xcopy C:\Users\output.txt E:\data\

    Read the article

  • replace asp.net Response.Output with my own content

    - by WebDude
    I am trying to intercept a asp.net web request and based on a lookup replace the page thats going to be rendered to the client. example: is a request for "/about-us" comes to my web server, i will first see if i have a version of this in the database, otherwise i will revert to flat files. The version i will retrieve from the database will be a .aspx page that has to be rendered and containt web controls and inline serverside script. What is the best way to go about this? I have tried overriding the CreateHtmlTextWriter method but this seems too late in the process as the TextWriter passed to this method is already instantiated. I have also tried to Implement my own PageHandlerFactory but this seems to create an instance of Page of which i cannot seem to override its internal setting of the Response.Output stream. Amd i barking up the wrong tree here? what is the best approach to take here?

    Read the article

  • Replace <Unknown Source> in Java Rhino (JSR223) with actual file name

    - by Lord.Quackstar
    Hello everyone, In my code, all of the scripts are contained in .js files. Whenever one of the scripts contains an error, I get this: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "nonexistant" is not defined. (<Unknown source>#5) in <Unknown source> at line number 5 What bugs me is the <Unknown Source>. Multiple files are in one ScriptContext, and it can be hard to track down an error. It also looks horrible. Is there a way to replace <Unknown Source> with the actual file name? None of the methods I see support passing a File object, so I'm really confused here.

    Read the article

  • Replacing Text in a Toggled Anchor with JQuery

    - by willmcneilly
    Hi I'm trying to change the text in an anchor on toggle. I'm doing this way at the moment but have found that once the anchor markup has replaced the toggle no longer works. Can someone please explain why this is happening and a solution? Many thanks. $('a#toggleHeader').toggle(function() { $('#header-wrapper').slideUp(); $(this).replaceWith('< href=\"#\" id="toggleHeader">Show Header</>'); //Note:I've move the anchor because I can only post one anchor as a new user },function(){ $('#header-wrapper').slideDown(); $(this).replaceWith('<a href=\"#\" id="toggleHeader">Hide Header</a>'); });

    Read the article

  • css to replace characters in paragraph tag

    - by Thariama
    Already checked exisitng questions for this, but didn't find an exact match. My aim is to replace characters (like spaces) on a webpage with a small image using css. Example: <p><span>This is a text</span></p> becomes: <p><span>ThisIMGisIMGaIMGtext</span></p> (where IMG stands for a visible image (middot-pic for a space f.e.)) I cannot think of a suitable css selector. But myabe one of you guys (or girls) know a solution. Is this possible at all?

    Read the article

  • PHP: Return string between two characters

    - by Nic Hubbard
    I am wanting to use "keywords" within a large string. These keywords start and end using *my_keyword* and are user defined. How, within a large string, can I search and find what is between the two * characters and return each instance? The reason it might change it, that parts of the keywords can be user defined, such as *page_date_Y* which might show the year in which the page was created. So, again, I just need to do a search and return what is between those * characters. Is this possible, or is there a better way of doing this if I don't know the "keyword" length or what i might be?

    Read the article

  • Replace the callback for a GtkItem created from a GtkItemFactoryEntry

    - by rampion
    I'm writing a plugin that's modifying an existing UI. One thing I want to do is change what an existing menu item does. This is all using the Gtk library. The menu item (a GtkItem) is created from a GtkItemFactoryEntry (which is out of my control), and has its current behaviour defined by the callback in the GtkItemFactoryEntry. I can get handle on the menu item using gtk_item_factory_get_widget() and attach further actions to the menu item using gtk_signal_connect(), but I can't seem to disconnect the original callback using gtk_signal_disconnect() or gtk_signal_disconnect_by_func(). Is there any way I can remove or replace the original callback?

    Read the article

  • C# Replace two specific commas in a string with many commas

    - by Hal
    I am trying to change the date format in each line from commas to hyphens. The index of the comma separating the month and day day and year varies. lines_in_List[i] = lines_in_List[i].Insert(0, cnt + ","); // Insert Draw # in 1st column string one_line = lines_in_List[i]; // 0,5,1,2012,1,10,19,16,6,36,,, // 1,11,5,2012,49,35,23,37,38,28,,, // 2,12,10,2012,8,52,53,54,47,15,,, // ^-^--^ replace the ',' with a '-'. StringBuilder changed = new StringBuilder(one_line); changed[3] = '-'; changed[5] = '-'; changed[3] = '-'; lines_in_List[i] = changed.ToString(); }

    Read the article

  • Invalid XML Replace Content in PHP

    - by streetparade
    I have a invalid XML like this Warning: count() [function.count]: Node no longer exists in /var/bla/test.php <?xml version="1.0" encoding="ISO-8859-1"?> <nodes> <some>test</some> </nodes> Now i need a regex which would replace the Warning: count() [function.count]: Node no longer exists in /var/bla/test.php with "" how can i do that? The above xml is is not generated on my localmachine, its a api call which returned a invalid xml

    Read the article

  • Matching two sections same number of times

    - by Leszczu
    Hello, i need a HTML to parse: <span>some text<span><span><span>text</span></span></span></span> I need to remove unnecessary <span> occurrences, so that output is: <span>some text<span>text</span></span> I wrote a regex, which does this once: /<SPAN>[^<]*<\/SPAN>/i How to make this work same number of times on both <span> and </span>?

    Read the article

  • php define variable inside str_replace array

    - by john
    I have a template system, that replaces text such as {HEADER} with the appropriate content. I use an array like this, that replaces the key with the value using str_replace. $array = array("HEADER","This is the header"); foreach($array as $var => $content) { $template = str_replace("{" . strtoupper($var). "}", $content,$template); } Now im trying to use a defined variable like this: define("NAME","Site Name"); Inside the value for the header. So I want the defined variable to be inside the array which gets replaced so it would look like this, but it doesn't work. $array = array("HEADER","Welcome to ".NAME."'s website!"); Any ideas? tell me if im not clear

    Read the article

  • Simple: replace div with ajax content (jquery)

    - by user469110
    I followed this thread. I now have: <a href="#" onclick="$('#gc').load('test');">reload</a>... </span> <div id="gc"> empty </div> This is what I am getting: Uncaught exception: TypeError: Cannot convert '$('#gc')' to object Error thrown at line 1, column 0 in <anonymous function>(event): $('#gc').load('test'); What is that? I thought I would be able to select a div and replace the contents with load()?

    Read the article

  • Python . How to get rid of '\r' in string?

    - by draconisthe0ry
    I have an excel file that I converted to a text file with a list of numbers. test = 'filelocation.txt' in_file = open(test,'r') for line in in_file: print line 1.026106236 1.660274766 2.686381002 4.346655769 7.033036771 1.137969254 a = [] for line in in_file: a.append(line) print a '1.026106236\r1.660274766\r2.686381002\r4.346655769\r7.033036771\r1.137969254' I wanted to assign each value (in each line) to an individual element in the list. Instead it is creating one element separated by \r . i'm not sure what \r is but why is putting these into the code ? I think I know a way to get rid of the \r from the string but i want to fix the problem from the source

    Read the article

  • What of my Swap space if I choose to replace windows with ubuntu?

    - by Ramandeep
    When I install Ubunut 12.04 I'll be presented with three options - install ubuntu alongside windows, replace windows with ubuntu and 'something else'. If I choose 'replace windows' then I can not be able to make a swap space. So what then. I've 1GB ram. And if I choose 'replace windows' will my only C drive get replaced or what'll happen? If only C drive is affected then will data on the other 2 drives get saved? Again if yes, how can I access it (on which drive of ubuntu) after installing ubuntu?

    Read the article

  • Using JQuery to replace multiple instances of HTML on one page

    - by Kenneth B
    I've made a script which copies the alt attribute of an image and puts it into a <span>. It also formulates the information divided by a hyphen. It works like a charm, but only with one image. I would also like to wrap a <div> around the image to prevent unnecessary markup. Script snippets: HTML: <div id="hoejre"> <p> <span class="alignright"> <img src="tommy_stor.jpg" alt="Name - Title" width="162" height="219" /> <span></span> </span> </p> </div> jQuery: var alt = $("#hoejre p span img").attr("alt"); $('#hoejre p span span') .html("<strong>" + alt.replace("-", "</strong> <em>") + "</em>"); Output: <span class="alignright"> <img height="219" width="162" alt="Name - Title" src="tommy_stor.jpg"> <span> <strong>Name</strong><em>Title</em> </span> </span> How do you I repeat the effect on several images, with different information within?

    Read the article

  • script to search and replace deprecated functions

    - by user573881
    Hi, I am using the following script to search and replace the deprecated functions in a file with the newer ones. 5 for strFile in `ls deprecated_functions_search_and_replace.txt ` 6 do 7 sed "s/ereg_replace[^\(]*(\([^,]*\),/preg_replace\1('#'.\2.'#',/g" $strFile > temp_file 8 mv $strFile $strFile".bakup" 9 mv temp_file $strFile 10 11 sed "s/eregi[^\(]*(\([^,]*\),/preg_match\1('#'.\2.'#i',/g" $strFile > temp_file 12 mv $strFile $strFile".bakup" 13 mv temp_file $strFile 14 15 sed "s/ereg[^\(]*(\([^,]*\),/preg_match\1('#'.\2.'#',/g" $strFile > temp_file 16 mv $strFile $strFile".bakup" 17 mv temp_file $strFile 18 19 sed "s/split[^\(]*(\([^,]*\),/preg_split\1('#'.\2.'#',/g" $strFile > temp_file 20 mv $strFile $strFile".bakup" 21 mv temp_file $strFile 22 23 sed "s/mysql_escape_string/mysql_real_escape_string/g" $strFile > temp_file 24 mv $strFile $strFile".bakup" 25 mv temp_file $strFile 26 27 sed "s/set_magic_quotes_runtime(0)/\/\/set_magic_quotes_runtime(0)/g" $strFile > temp_file 28 mv $strFile $strFile".bakup" 29 mv temp_file $strFile 30 31 sed "s/ini_get('safe_mode')/false/g" $strFile > temp_file 32 mv $strFile $strFile".bakup" 33 mv temp_file $strFile 34 35 sed "s/session_register('\(.*\)')/$_SESSION['\1']=$\1/g" $strFile > temp_file 36 mv $strFile $strFile".bakup" 37 mv temp_file $strFile 38 39 sed "s/session_unregister('\(.*\)')/$_SESSION['\1']=''/g" $strFile > temp_file 40 mv $strFile $strFile".bakup" 41 mv temp_file $strFile 42 43 done However, when I run this script I am getting an error saying: sed: -e expression #1, char 60: invalid reference \2 on `s' command's RHS sed: -e expression #1, char 52: invalid reference \2 on `s' command's RHS sed: -e expression #1, char 50: invalid reference \2 on `s' command's RHS sed: -e expression #1, char 51: invalid reference \2 on `s' command's RHS I am unable to figure out whats going wrong. Someone please help me. Regards.

    Read the article

  • How to use walker to replace core function

    - by bellesebastien
    I want to modify the way pages are listed in the navigation, particularly the function el_start from wp-includes/classes.php. I've first modified the classes.php directly and it worked fine butnow I want to revert classes.php and move the modification out of wordpress' internal files. I wrote a walker class that I want to use but I don't know how to use it. I want to replace the current call wp_list_pages() to this: $walker_pages = new Walker_Page_CustomTitle; wp_list_pages(array('walker' => $walker_pages, 'title_li' => '', 'depth' => '1')); I've tried using a filter like so: function wp_list_pages_custom() { $walker_pages = new Walker_Page_CustomTitle; wp_list_pages(array('walker' => $walker_pages, 'title_li' => '', 'depth' => '1')); } add_filter('widget_area_primary_aside', 'wp_list_pages_custom'); But with this filter, the site won't load anymore. The tutorial here says I should put this code in header.php but that just puts my page links in the tag. I hope I'm making sense. Thanks.

    Read the article

  • Will JSON replace XML as a data format?

    - by 13ren
    When I first saw XML, I thought it was basically a representation of trees. Then I thought: the important thing isn't that it's a particularly good representation of trees, but that it is one that everyone agrees on. Just like ASCII. And once established, it's hard to displace due to network effects. The new alternative would have to be much better (maybe 10 times better) to displace it. Of course, ASCII has been (mostly) replaced by Unicode, for internationalization. According to google trends, XML has a x43 lead, but is declining - while JSON grows. Will JSON replace XML as a data format? (edited) for which tasks? for which programmers/industries? NOTES: S-expressions (from lisp) are another representation of trees, but which has not gained mainstream adoption. There are many, many other proposals, such as YAML and Protocol Buffers (for binary formats). I can see JSON dominating the space of communicating with client-side AJAX (AJAJ?), and this possibly could back-spread into other systems transitively. XML, being based on SGML, is better than JSON as a document format. I'm interested in XML as a data format. XML has an established ecosystem that JSON lacks, especially ways of defining formats (XML Schema) and transforming them (XSLT). XML also has many other standards, esp for web services - but their weight and complexity can arguably count against XML, and make people want a fresh start (similar to "web services" beginning as a fresh start over CORBA).

    Read the article

  • Replace in place, parsing & string manipulation.

    - by Mark Tomlin
    I'm trying to replace a set of characters within a string. The string may or may not have any data to change. The string is marked up in a way that allows for it to change it's color from a set of characters. The string can reset it's it's formatting to default by using a defined set of characters. This setup is very much like the ECMA-48 standard used on LINUX consoles for colors and other special effects. Where one string could be ^0Black^1Red^2Green^3Yellow^4Blue^5Purple^6Cyan^7White Producing the following HTML: <span style="color: #000">Black</span><span style="color: #F00">Red</span><span style="color: #0F0">Green</span><span style="color: #FF0">Yellow</span><span style="color: #00F">Blue</span><span style="color: #F0F">Purple</span><span style="color: #0FF">Cyan</span><span style="color: #FFF">White</span> Another string (^1Error^8: ^3User Error) could also produce: <span style="color: #F00">Error</span>: <span style="color: #FF0">User Error</span> You might of noticed the ^8 part of that string resets the color for that part of the string. What's the best way to go about parsing these kinds of strings?

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >