Search Results

Search found 7529 results on 302 pages for 'replace'.

Page 12/302 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • preg_replace replacing with array

    - by Scott
    What I want to do is replace the "[replace]" in input string with the corresponding vaule in the replace array. The total number of values will change but there will always be the same number in the replace array as in input string. I have tried doing this with preg_replace and preg_replace_callback but I can't get the pattern right for [replace], I also tried using vsprintf but the % in <table width="100%"> was messing it up. All help is greatly appreciated! Replace Array: $array = array('value 1','value 2','value 3'); Input String $string = ' <table width="100%"> <tr> <td>Name:</td> <td>[replace]</td> </tr> <tr> <td>Date:</td> <td>[replace]</td> </tr> <tr> <td>Info:</td> <td>[replace]</td> </tr> </table> '; Desired Result <table width="100%"> <tr> <td>Name:</td> <td>value 1</td> </tr> <tr> <td>Date:</td> <td>value 2</td> </tr> <tr> <td>Info:</td> <td>value 3</td> </tr> </table>

    Read the article

  • Replace Listmenu with Textfield

    - by BRADINO
    Say you have a dropdown form field where you ask the user how they heard about you. You have numerous options and also an other field where if they selected other, then they enter the value in a text field. This is a cleaner alternative where if the user selects Other, then the dropdown turns into a textfield of the same name, so that your post routine, grooming, validation, writing to DB etc all works seamlessly. This example uses prototype JS library. Here is a working example: How did you hear about BRADINO? Select Google Yahoo MSN Other All you have to do is have an dropdown option for Other and then add call the function onchange: onchange="overrideListmenu('how-heard');" Here is the javascript function that uses Prototype: function overrideListmenu(field){         if ($F(field) == 'Other'){             Element.replace($(field), '<input name="'+field+'" id="'+field+'" type="text" value="">');                 $(field).focus();         } } Here is the javascript function that uses jQuery: function overrideListmenu(field){         if ($('#'+field).val() == 'Other'){             $('#'+field).after('<input name="'+field+'" id="'+field+'" type="text" value="">').remove();                 $('#'+field).focus();         } } listmenu replace textfield textfield for other how did you hear about us

    Read the article

  • VB script + replace word only in specific line

    - by yael
    hi I find way to replace word in text file as the following strNewText = Replace(strText, "OLD_WORD", "NEW_WORD")t but this replace every OLD_WORD in the file my question is if it possible to replace the OLD_WORD with the NEW_WORD only on specific line for example I want to replace only on line that start with "THIS_LOCATION" THIS_LOCATION=OLD_WORD THX for help

    Read the article

  • How To Replace Notepad in Windows 7

    - by Trevor Bekolay
    It used to be that Notepad was a necessary evil because it started up quickly and let us catch a quick glimpse of plain text files. Now, there are a bevy of capable Notepad replacements that are just as fast, but also have great feature sets. Before following the rest of this how-to, ensure that you’re logged into an account with Administrator access. Note: The following instructions involve modifying some Windows system folders. Don’t mess anything up while you’re in there! If you follow our instructions closely, you’ll be fine. Choose your replacement There are a ton of great Notepad replacements, including Notepad2, Metapad, and Notepad++. The best one for you will depend on what types of text files you open and what you do with them. We’re going to use Notepad++ in this how-to. The first step is to find the executable file that you’ll replace Notepad with. Usually this will be the only file with the .exe file extension in the folder where you installed your text editor. Copy the executable file to your desktop and try to open it, to make sure that it works when opened from a different folder. In the Notepad++ case, a special little .exe file is available for the explicit purpose of replacing Notepad.If we run it from the desktop, it opens up Notepad++ in all its glory. Back up Notepad You will probably never go back once you switch, but you never know. You can backup Notepad to a special location if you’d like, but we find it’s easiest to just keep a backed up copy of Notepad in the folders it was originally located. In Windows 7, Notepad resides in: C:\Windows C:\Windows\System32 C:\Windows\SysWOW64 in 64-bit versions only Navigate to each of those directories and copy Notepad. Paste it into the same folder. If prompted, choose to Copy, but keep both files. You can keep your backup as “notepad (2).exe”, but we prefer to rename it to “notepad.exe.bak”. Do this for all of the folders that have Notepad (2 total for 32-bit Windows 7, 3 total for 64-bit). Take control of Notepad and delete it Even if you’re on an administrator account, you can’t just delete Notepad – Microsoft has made some security gains in this respect. Fortunately for us, it’s still possible to take control of a file and delete it without resorting to nasty hacks like disabling UAC. Navigate to one of the directories that contain Notepad. Right-click on it and select Properties.   Switch to the Security tab, then click on the Advanced button. Note that the owner of the file is a user called “TrustedInstaller”. You can’t do much with files owned by TrustedInstaller, so let’s take control of it. Click the Edit… button. Select the desired owner (you could choose your own account, but we’re going to give any Administrator control) and click OK. You’ll get a message that you need to close and reopen the Properties windows to edit permissions. Before doing that, confirm that the owner has changed to what you selected. Click OK, then OK again to close the Properties window. Right-click on Notepad and click on Properties again. Switch to the Security tab. Click on Edit…. Select the appropriate group or user name in the list at the top, then add a checkmark in the checkbox beside Full control in the Allow column. Click OK, then Yes to the dialog box that pops up. Click OK again to close the Properties window. Now you can delete Notepad, by either selecting it and pressing Delete on the keyboard, or right-click on it and click Delete.   You’re now free from Notepad’s foul clutches! Repeat this procedure for the remaining folders (or folder, on 32-bit Windows 7). Drop in your replacement Copy your Notepad replacement’s executable, which should still be on your desktop. Browse to the two or three folders listed above and copy your .exe to those locations. If prompted for Administrator permission, click Continue. If your executable file was named something other than “notepad.exe”, rename it to “notepad.exe”. Don’t be alarmed if the thumbnail still shows the old Notepad icon. Double click on Notepad and your replacement should open. To make doubly sure that it works, press Win+R to bring up the Run dialog box and enter “notepad” into the text field. Press enter or click OK. Now you can allow Windows to open files with Notepad by default with little to no shame! All without restarting or having to disable UAC! Similar Articles Productive Geek Tips Search and Replace Specific Formatting (fonts, styles,etc) in Microsoft WordHow to Drag Files to the Taskbar to Open Them in Windows 7Customize the Windows 7 or Vista Send To MenuKill Processes from the Windows Command LineChange Your Windows 7 Library Icons the Easy Way TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 PCmover Professional Use My TextTools to Edit and Organize Text Discovery Channel LIFE Theme (Win7) Increase the size of Taskbar Previews (Win 7) Scan your PC for nasties with Panda ActiveScan CleanMem – Memory Cleaner AceStock – The Personal Stock Monitor

    Read the article

  • Can "go" replace C++? [closed]

    - by iammilind
    I was reading wiki article about "go" programming language, where Bruce Eckel states: The complexity of C++ (even more complexity has been added in the new C++), and the resulting impact on productivity, is no longer justified. All the hoops that the C++ programmer had to jump through in order to use a C-compatible language make no sense anymore --they're just a waste of time and effort. Now, Go makes much more sense for the class of problems that C++ was originally intended to solve. Can go really replace C++(11) for new development in future? How about generic programming? I don't know go , but the amount of time (in)wasted in learning C++ seems to go in vain.

    Read the article

  • Strategy for building an application to replace a large spreadsheet

    - by Dan Walmsley
    I'm working on an application that is going to replace a rather large spreadsheet. The spreadsheet is used to budget purchases and things like that. It is the largest spreadsheet I have ever seen, and it required a lot of manual data entry, so this application is going to automate much of that. But as I'm working on this I've noticed its slow going. And I got to thinking this must be a common thing to do many companies will start with something like a spreadsheet, then when they get too big to maintain that, they will get a custom application built. So is there anything out there ( a framework or similar ) that does this sort of thing, migrating a spreadsheet to a custom application. I've had a quick Google but not really seen the kind of thing that I'm looking for. It's too late for this project, but I thought it would be worth having a look for next time. How do you guys tackle this problem?

    Read the article

  • How to replace all images in Libreoffice with their description

    - by user30131
    I have a very long document containing lots of svg images created using the extension TexMaths. This extension uses the latex installation to create svg image of the inputted equation (or set of equations). The latex code for each equation (or set of equations) is embedded in the image as part of its Description. Such a Description can be accessed by right clicking the svg image and choosing the option Description. I want to replace all the svg images using a suitable macro, by the embedded descriptions. e.g. from The Einstein's famous equation, [svg embedded equation : E = mc 2], tells us that mass can be converted to energy and vice-versa. To The Einstein's famous equation, E = mc^2, tells us that mass can be converted to energy and vice-versa. This will allow me to convert by hand the odt file containing numerous TexMaths equations to LaTeX.

    Read the article

  • how to replace windows 7 completely and repair grub

    - by sud
    I am trying to install ubuntu on HP probook 4530s x64 system. there is windows 7 already installed and i want to remove it. so i format C:\ drive and make to partation \ (sha2) and swap (sha4) from it. there is also a partation sha1 (300mb) for MBR (don't know what is it) i just leave it. after some time i get fatal error unable to install grub. and so i choose partation sha1 when it ask. no at boot time there is option to choose windows 7. and not for ubuntu and windows is also removed. i also try to install grub form other answers but no success. how to replace windows completely and where to install grub and what to do with 300mb (MBR).

    Read the article

  • Replace Android on HP Slate 21?

    - by user288626
    I want to replace Android with Ubuntu for Androids on my new HP Slate 21. As far as I known none has ever tried it yet and I would appreciate if Ask Ubuntu would help out here. Would I need to unlock & root first my machine? (In which case I will need a second machine plugged to my Slate...) Or can I just insert the bootable usb with the distribution I need and go from there as in a normal non-optical drive situation? Also where can I find the downloadable file/image of Ubuntu for Android as describe here? I see no link with the name on it.. Should I just download the normal dis and choose from options when installing it?

    Read the article

  • How do I replace Unity?

    - by Krista O'Connors
    I wanted to use Ubuntu 12.04 for its long term support. But I cannot stand Unity. I cannot find a way to replace it with compizconfig, so I tried replacing it with Lubuntu. When I restarted my computer started to load lubuntu, then just went right on with ubuntu as if nothing had happened. Likewise, it shows lubuntu when it shuts down. What is the deal? I'm confused here, is ubuntu 12.04 supposed to be an operating system or a desktop interface? Can I even run ubuntu with a Lubuntu interface? Is there a way to do this in compizconfig that I should be doing instead?

    Read the article

  • javascript: what does this syntax means?

    - by user1067138
    it is like this: (function () { //codes here })(); here is an example: (function () { var D = TED.EditorCore, E = TED.extend, A = TED.EditorInstanceManager, B = TED.augmentObject; window.TED["SimpleEditor"] = C; function C(F) { C.superclass.call(this, F) } C.defaultConfig = { height: "100px", width: "400px", //blablabla... flashNumLimit: 10, didaDelay: 300, imageWidthLimit: 570 }; E(C, D, { getContentLength: function () { return Math.ceil(this.filteHTML(this.editArea.innerHTML, ["img", "br"]).replace(/<img[^>]*>/gi, "mm").replace(/<br[^>]*>/gi, "m").replace(/&nbsp;/gi, "m").replace(/[^\x00-\xff]/g, "mm").length / 2) }, filteEditHTML: function () { return html = this.editArea.innerHTML.replace(/_moz_dirty=""/gi, "").replace(/\[/g, "[[-").replace(/\]/g, "-]]").replace(new RegExp("<\\/?(?:br[^>]*)>", "gi"), "[$1]").replace(new RegExp('<span([^>]*class="?at"?[^>]*)>', "gi"), "[span$1]").replace(new RegExp('<img([^>]*class="?(?:' + this.config.emptyClassName + "|" + this.config.smileyClassName + ')"?[^>]*)>', "gi"), "[img$1]").replace(/<[^>]*>/g, "").replace(/\[\[\-/g, "[").replace(/\-\]\]/g, "]").replace(new RegExp("\\[(/?(?:br|img|span)[^\\]]*)\\]", "gi"), "<$1>") }, filteSubmitHTML: function () { this.reLayout(); var G = this.editArea.innerHTML.replace(/_moz_dirty=""/gi, "").replace(/\[/g, "[[-").replace(/\]/g, "-]]").replace(new RegExp("<(/?(?:" + this.submitValidHTML.join("|") + ")[^>]*)>", "gi"), "[$1]").replace(new RegExp('<img([^>]*class="?(?:' + this.config.imageClassName + "|" + this.config.smileyClassName + "|" + this.config.flashClassName + "|" + this.config.musicClassName + ')"?[^>]*)>', "gi"), "[img$1]").replace(/<[^>]*>/g, "").replace(/\[\[\-/g, "[").replace(/\-\]\]/g, "]").replace(new RegExp("\\[(/?(?:" + this.submitValidHTML.join("|") + "|img)[^\\]]*)\\]", "gi"), "<$1>"); var F = document.createElement("div"); F.innerHTML = G; this.parseURL(F); return F.innerHTML } }); B(C, A) })(); what exactly does (funtion (){})(); do?

    Read the article

  • Replace an IP address with it's whois using bash

    - by user2099762
    I have a traffic log similar to this "page visited" for xxx.xxx.xxx.xxx at 2013-10-30 and I would like to replace the ip address with the result of it's whois lookup. I can export the ip addresses to a separate file and then do a whois on each line, but im struggling to combine them all together. Ideally i'd like to replace the ip address in the same string and print the new string to a new file. So it would look like "page visited" for example.com at 2013-10-30 Can anyone help Here's what I have so far grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' clean_cites.txt > iplist.txt for i in `cat iplist.txt` do OUTPUT=$(geoiplookup -f /usr/share/GeoIP/GeoIPOrg.dat $i) echo $i,$OUTPUT >> visited.txt done Like I said,this produces a separate file with a list of ip addresses and their relevant hostnames, so I either need to search for the ip address in file and and replace it with the text in file b (which will give the ip address and hostname) or replace the ip address in place. Thanks

    Read the article

  • postfix header_checks using regexp proper setup

    - by Philip Rhee
    I just can't seem to figure out why header_checks are not being evaluated. I'm on Ubuntu 12.04, postfix 2.7, dovecote, spamassasin, clamav, amavis. I add following line to /etc/postfix/main.cf : header_checks = regexp:/etc/postfix/header_checks And here is header_checks : /From: .*/ REPLACE From: [email protected] To test out regexp : #postmap -q "From: <werwe>" regexp:/etc/postfix/header_checks which evaluates correctly and give me return output of : REPLACE From: [email protected] However, when I try to send email from commandline or from php webpage, postfix will not replace the From header. I'm stumped.

    Read the article

  • Replacement Text Syntax for JavaScript’s String.replace()

    - by Jan Goyvaerts
    A RegexBuddy user told me that he couldn’t easily find a detailed explanation of the replacement text syntax supported by the String.replace() function in JavaScript. I had to admin that my own web page about JavaScript’s regular expression support was also lacking. I’ve now added a new Replacement Syntax section that has all the details. I’ll summarize it here: $1: Text matched by the first capturing group or the literal text $1 if the regex has no capturing groups. $99: Text matched by the 99th capturing group if the regex has 99 or more groups. Text matched by the 9th capturing group followed by a literal 9 if the regex has 9 or more but less than 99 groups. The literal text $99 if the regex has fewer than 9 groups. $+: Text matched by the highest-numbered capturing group. Replaced with nothing if the highest-numbered group didn’t participate in the match. $&: Text matched by the entire regex. You cannot use $0 for this. $` (backtick): Text to the left of the regex match. $' (single quote): Text to the right of the regex match. $_: The entire subject string.

    Read the article

  • How to replace the SharePoint date calendar control with more user friendly jQuery calendar control

    - by ybbest
    When you use the SharePoint date and time type for date of birth field, you will notice that the calendar control is extremely non-user-friendly. You can only navigate month by month as shown below. To resolve the issue, you can customize the list form page using SharePoint designer and replace the OOB calendar control with popular jQuery control. The solution works for both SharePoint 2010,2013 and office365. Here are the steps for how to achieve this. 1. Open SharePoint designer and create a New List Form called customNew and set as default form for the selected type. 2. Open style library in file explorer and copy jQuery and jQuery UI files into the style library in SharePoint site. You can download the jQuery and jQuery UI from the web and the content of the contactPersonCustomNewForm.js is as below. I use the dd/mm/yy format as my locale in Regional Settings is English(New Zealand). You need to change this if you live in another country with different date format $(document).ready(function() { $("img#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDateDatePickerImage").parent().hide(); $("img#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDateDatePickerImage").hide(); $("input#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDate").datepicker({ changeMonth:true, changeYear:true, showOn: "button", buttonImage: "/_layouts/images/calendar.gif", buttonImageOnly: true, defaultDate:"01/01/1970", yearRange: "c-20:c+20", dateFormat: "dd/mm/yy" }); }); In order to get the image and textbox selector above , you can open IE developer toolbar(click F12) and find the control ID as below: 3. Open SharePoint designer and edit the newly created New List Form customNew.aspx in advance mode. Then copy and paste the following links in the PlaceHolderAdditionalPageHead. <SharePoint:CssRegistration name="<%$SPUrl:~SiteCollection/Style Library/themes/ui-lightness/jquery-ui.css%>" runat="server"/> <SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/jquery-1.10.2.js" Defer="false" runat="server"/> <SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/jquery-ui-1.10.4.custom.min.js" Defer="false" runat="server"/> <SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/contactPersonCustomNewForm.js" Defer="false" runat="server"/>   4. Now go to the list and click add, you will see the new calendar control as shown below

    Read the article

  • Converting HTML to its safe entities with Javascript

    - by James P
    I'm trying to convert characters like < and > into &lt; and &gt; etc. User input is taken from a text box, and then copied into a DIV called changer. here's my code: function updateChanger() { var message = document.getElementById('like').value; message = convertHTML(message); document.getElementById('changer').innerHTML = message; } function convertHTML(input) { input = input.replace('<', '&lt;'); input = input.replace('>', '&gt;'); return input; } But it doesn't seem to replace >, only <. Also tried like this: input = input.replace('<', '&lt;').replace('>', '&gt;'); But I get the same result. Can anyone point out what I'm doing wrong here? Cheers.

    Read the article

  • Find and replace string in MySQL using data from another table

    - by Charlie
    Hi, sorry for formatting this wonky but hope you can understand it. I have two MySql tables, and I want to find and replace text strings in one using data in another. Texts - one column: messages 'thx guys' 'i think u r great' 'thx again' ' u rock' Dictionary - two columns: bad_spelling, good_spelling 'thx' 'thanks' ' u ' ' you ' ' r ' ' are ' I want SQL to go through and look at every row in messages and replace every instance of bad_spelling with good_spelling, and to do this for all the pairs of bad_spelling and good_spelling The closest I have gotten is this: update texts, dictionary set texts.message = replace(texts.message, dictionary.bad_spelling, dictionary.good_spelling) But this only changes 'thx' to 'thanks' (in 2 rows) and does not go on to replace ' u ' with ' you' or ' r ' with ' are '. Any ideas how to make it use all the rows in dictionary in the replace statement? -- PS forgot to mention that this is a small example and in the real thing I will have a lot of find/replace pairs, which may get added to over time.

    Read the article

  • Java escape HTML - string replace slow?

    - by cpf
    Hi StackOverflow, I have a Java application that makes heavy use of a large file, to read, process and give through to SolrEmbeddedServer (http://lucene.apache.org/solr/). One of the functions does basic HTML escaping: private String htmlEscape(String input) { return input.replace("&", "&amp;").replace(">", "&gt;").replace("<", "&lt;") .replace("'", "&apos;").replaceAll("\"", "&quot;"); } While profiling the application, the program spends roughly 58% of the time in this function, a total of 47% in replace, and 11% in replaceAll. Now, is the Java replace that slow, or am I on the right path and should I consider the program efficient enough to have its bottleneck in Java and not in my code? (Or am I replacing wrong?) Thanks in advance!

    Read the article

  • Allowing user to type only one "."

    - by Tartar
    I am trying to implement a simple javascript-html calculator. What i want to do is,typing only one '.' by the user. How can i control this ? Here is the code that i tried. I can already find the number of '.' but i'am confused now also this replaceAll function is not replacing '.' with empty string. String.prototype.replaceAll = function(search, replace) { //if replace is null, return original string otherwise it will //replace search string with 'undefined'. if(!replace) return this; return this.replace(new RegExp('[' + search + ']', 'g'), replace); }; function calculate(){ var value = document.calculator.text.value; var valueArray = value.split(""); var arrayLenght = valueArray.length; var character = "."; var charCount = 0; for(i=0;i<arrayLenght;i++){ if (valueArray[i]===character) { charCount += 1; } } if(charCount>1){ var newValue=value.replaceAll(".",""); alert(newValue); } }

    Read the article

  • replace a random word of a string with a random replacement

    - by tpickett
    I am developing a script that takes an article, searches the article for a "keyword" and then randomly replaces that keyword with an anchor link. I have the script working as it should, however I need to be able to have an array of "replacements" for the function to loop through and insert at the random location. So the first random position would get anchor link #1. The second random position would get anchor link #2. The third random position would get anchor link #3. etc... I found half of the answer to my question here: PHP replace a random word of a string public function replace_random ($str, $search, $replace, $n) { // Get all occurences of $search and their offsets within the string $count = preg_match_all('/\b'.preg_quote($search, '/').'\b/', $str, $matches, PREG_OFFSET_CAPTURE); // Get string length information so we can account for replacement strings that are of a different length to the search string $searchLen = strlen($search); $diff = strlen($replace) - $searchLen; $offset = 0; // Loop $n random matches and replace them, if $n < 1 || $n > $count, replace all matches $toReplace = ($n < 1 || $n > $count) ? array_keys($matches[0]) : (array) array_rand($matches[0], $n); foreach ($toReplace as $match) { $str = substr($str, 0, $matches[0][$match][1] + $offset).$replace.substr($str, $matches[0][$match][1] + $searchLen + $offset); $offset += $diff; } return $str; } So my question is, How can i alter this function to accept an array for the $replace variable?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >