Search Results

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

Page 46/302 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Replace occurance of character with all letters in the alphabet

    - by McAvoy
    I have created a scrabble game with a computer opponent. If a blank tile is found in the computer's rack during the word generation if needs to be swapped out for every letter in the alphabet. I have my current solution to solve this problem below, but was wondering if there is a better more efficient way to accomplish this task. if (str.Contains("*")) { char c = 'A'; String made = ""; while(c < 'Z') { made = str.ReplaceFirst("*", c.ToString()); if (!made.Contains("*")) { wordsMade.Add(made); if (theGame.theTrie.Search(made) == Trie.SearchResults.Found) { validWords.Add(made); } } else { char ch = 'A'; String made2 = ""; while (ch < 'Z') { made2 = made.ReplaceFirst("*", c.ToString()); wordsMade.Add(made2); if (theGame.theTrie.Search(made2) == Trie.SearchResults.Found) { validWords.Add(made2); } ch++; } } c++; }

    Read the article

  • Replace data in MySQL table with data from another table

    - by Oli
    I am trying to modify an existing MySQL database for use in a new application. I have a table of items (table_items), which has multiple fields, including "ItemID" and "ItemName". I have another table (table_list) which has "ItemName" in it, but no ItemID. I need to either update this table to contain ItemID instead of ItemName, or create a new table which imports ItemIDs from table_items as opposed to the ItemName when table_list.ItemName = table_items.ItemName. I have tried the following: UPDATE table_list A, table_items B SET A.ItemName = B.ItemID WHERE A.ItemName = B.ItemName The current table has over 500,000 rows and every time i try this in PHPMyAdmin i get the error "the MySQl server has gone away". Any help greatly appreciated.

    Read the article

  • Notepad++ regular expression find and replace $_REQUEST with $_GET but a more secure

    - by David
    What I am doing is replacing, in a large program, all $_REQUEST['var'] and mysql_escape_string($_REQUEST['var']) with either the 1st or 2nd line below the dotted line. Now, I have figured out this much of the regular expression but I would like to make it simpler. Instead of having to run the top one first then the 2nd one I would like to just run one all together. I tried this but it did not work. (mysql_escape_string\()*$_REQUEST\[\'([^']*)\'\]\)(\)*) So below is what works but again have to do it twice. $_REQUEST\[\'([^']*)\'\] mysql_escape_string\($_REQUEST\[\'([^']*)\'\]\) (isset($_GET['\1'])?mysql_real_escape_string($_GET['\1']):false) (isset($_POST['\1'])?mysql_real_escape_string($_POST['\1']):false) ============================ Update: Yeah, after some research I figured out that Notepad++ does not support most regular expressions. I guess one additional step can not hurt a person. It's just laziness. *NOTE: BUT if anyone wants to try feel free to comment. At least it is just 2 steps and not 20.

    Read the article

  • SQL update statement to change the value of a field and not replace it

    - by wzzrd
    I'm in the process of migrating some databases. I have this table that has a couple of hundred rows, and has a filename column. To each record in this table, the filename column needs to be altered and part of a path needs to be prepended to the value that is in that field. The table is like: | 1 | filename1 | | 2 | filename2 | and needs to become: | 1 | path/filename1 | | 2 | path/filename2 | I am not an SQL guru, but I know the basics. This eludes me though. Is there a way to do something like: update table set filename = 'path/' + filename where id = 1;

    Read the article

  • Replace Emails and HREFS with enclosing HREFS in C#

    - by Nissan Fan
    I have an Email body that used to be plain text, but now I've made it HTML. The emails are generated using a number of methods and none of them are easy to convert. What I have is: Some content [email protected], some http://www.somewebsite/someurl.aspx. What I'd like to do is create a function that automatically encloses all email addresses and all URLs withing a string in HREF tags so that the HTML email reads properly in all email clients. Does anyone have a function for this?

    Read the article

  • Wherewith replace Dictionary.Where(p => p.Key is T)

    - by abatishchev
    I have a System.Collections.Generic.Dictionary<System.Web.UI.Control, object> where all keys can be either type of System.Web.UI.WebControls.HyperLink or type of System.Web.UI.WebControls.Label. I want to change Text property of each control. Because HyperLink doesn't implement (why??) ITextControl, I need to cast Label or HyperLink explicitly: Dictionary<Control,object> dic = .. dic .Where(p => p.Key is HyperLink) .ForEach(c => ((HyperLink)c).Text = "something") dic .Where(p => p.Key is Label) .ForEach(c => ((Label)c).Text = "something") Are there ways to workaround such approach?

    Read the article

  • how to get values sent by location.replace(URL)

    - by kawtousse
    hi everyone, In my javascript function I do livke this in order to redirect parameters to servlet: var ids1=document.getElementById("projet").value; document.location.href("http://localhost:8080/Opc_Web_App/ServletAffectation?ids1="+ids1); and in the servlet I do the following to get Value: String idprojet= request.getParameter("projet"); System.out.println("le projet selectionné est :" +idprojet); the problem that i didnt have the result of System.out.print in my screen; so in other terms the servlet didn't get the parameter. I can not see the problemn untill now. Please help. Thank you.

    Read the article

  • Replace Emails and HREFS with enclosing HREFS

    - by Nissan Fan
    I have an Email body that used to be plain text, but now I've made it HTML. The emails are generated using a number of methods and none of them are easy to convert. What I have is: Some content [email protected], some http://www.somewebsite/someurl.aspx. What I'd like to do is create a function that automatically encloses all email addresses and all URLs within a string in HREF tags so that the HTML email reads properly in all email clients. Does anyone have a function for this?

    Read the article

  • Find and replace date within a file

    - by user1629011
    My apologies if my title is not descriptive enough, I believe the following will be. I have 3 files which are just plain text, within each file, is a date Date: 2012-08-31 for example I would like to get a command/script to find this and update to the current date, but the date will be ever changing and may not be known going in (without viewing the contents of the file Knowing what the date is, its simple enough with sed, but how can I do this knowing the syntax of the line I want to modify, but not the specific values. ("Date: " at least is unchanging)

    Read the article

  • Pattern match and replace in Javascript

    - by T_t
    There is something in my mind: In a web page,there are lots of things we can see from our browser.One of them is text. Now i have some patterns,"abc","hello",or some other strings.In the text, i want to find all the patterns and change the color or background-color of them. Like this: text: what a wonderful day! pattern: "a","day" resulet: what a wonderful day! How can solve this whit Javascript?

    Read the article

  • What Design Pattern To Replace 'CurrentStep' Variable

    - by Rob P.
    Tried to search but didn't know how to phrase it. I've got some code that is essentially... Private CurMajorStep as Integer = 0 Private CurMinorStep as Integer = 0 Public Sub PerformNextStep() Select Case iMajorStep Case 0 ThingOne() Case 1 ThingTwo() Case 2 ThingThree() Case 3 ThingFour() Case 4 AnythingElse() Case 5 Finish() End Select End Sub And then, in some of those, the CurMinorStep keeps track of the current state of that particular 'step'. I hope that all makes sense. The code is messy and I know it's going to be problematic to maintain. Can someone point me to a clean OO pattern to handle this?

    Read the article

  • Javascript replace query string + with a space

    - by BruceClark
    I'm grabbing the query string parameters and trying to do this: var hello = unescape(helloQueryString); and it returns: this+is+the+string instead of: this is the string Works great if %20's were in there, but it's +'s. Any way to decode these properly so they + signs move to be spaces? Thanks.

    Read the article

  • Replace url() relative path with full domain in css files

    - by deepwell
    I'd like to run a script on release that replaces all url() declarations in a css file with the full domain path, because images are hosted on a static web server. Example Current: background-image: url(/images/menu.gif); Desired: background-image: url(http://example.com/images/menu.gif); Current: background-image: url('/images/menu.gif'); Desired: background-image: url('http://example.com/images/menu.gif'); Current: background-image: url("/images/menu.gif"); Desired: background-image: url("http://example.com/images/menu.gif"); I have concocted a bash script using sed to do just that, but it does not handle url with quotes url(''), or urls that already have a full path. STATIC_HOST="http://example.com" sed -i '' "s|url(\([^)]*\)|url($STATIC_HOST\1|g" main.css

    Read the article

  • Replace umlaute (äüö) for SEO link in rails - best way

    - by ole_berlin
    Hi, I'm using the permalink_fu plugin to create permalinks from titles. My problem is: If the title contains german characters, they are just replaced with '_'. What I need is something that replaces ä with ae ü with ue ö with oe I fount String.tr but the problem here is that it replaces 1 character with 1 replacement, so it would work for replacing é with e ø with o etc. Does anyone have a nice and clean solution for that? Thanks

    Read the article

  • bashscript for file search and replace!

    - by D3orn
    Hey I try to write a littel bash script. This should copy a dir and all files in it. Then it should search each file and dir in this copied dir for a String (e.g @ForTestingOnly) and then this save the line number. Then it should go on and count each { and } as soon as the number is equals it should save againg the line number. = it should delete all the lines between this 2 numbers. I'm trying to make a script which searchs for all this annotations and then delete the method which is directly after this ano. Thx for help...

    Read the article

  • mod_rewrite replace all instances of ampersand with %26 for later

    - by Supernovah
    Hey there! I want to simply not use ampersand in my URL so I can pass ampersands further down into my system when a file is requested. The problem is Apache deals with it differently. I don't know how I already rewrite the requested file to index.php?url=$1 so I can see what it was, but if it has an ampersand in there, it can't continue past it! how can I escape the ampersand or turn it into it's hex equal (%26)? <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] </IfModule>`

    Read the article

  • How can I use GPRename's regex feature to reinsert the matched-group into the 'replace'?

    - by David Thomas
    I've been using GPRename to batch-rename files; this is rather more efficient than individually correcting each file, but still seems to be less efficient than it might be, primarily because either I don't understand the regex syntax used, or because the regex implementation is incomplete1 Given a list of files of the following syntax: (01) - title of file1.avi (02) - title of file2.avi (03) - title of file3.avi I attempted to use the 'replace' (with the regex option selected, the case-sensitive option deselected): (\(\d{2}\)) The preview then shows (given that I've specified no 'replace with' option as yet): title of file1.avi title of file2.avi title of file3.avi Which is great, clearly the regex is identifying the correct group (the (01)). Now, what I was hoping to do (using the JavaScript syntax) in the 'replace with' option is use: $1 (I also tried using '$1', \1 and '\1') This was just to check that I could access the matched group, and it seems I can't, the matched group is, as I suppose might be expected, replaced with the literal replacement string. So, my question: is it possible to match a particular group of characters, in this case the numbers within the brackets, and then insert those into the replacement string? Therefore: (01) title of file1.avi (02) title of file2.avi (03) title of file3.avi Becomes: 01 title of file1.avi 02 title of file2.avi 03 title of file3.avi I absolutely suspect the former, personally.

    Read the article

  • What happens to my Swap space if I choose to replace Windows with Ubuntu?

    - by Ramandeep
    When I install Ubuntu 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 cannot make a swap space. So what then? I've 1GB RAM. Will only my C drive get replaced or what will happen? If only C drive is affected, then will data on the other 2 drives get saved? If yes, how can I access it (on which drive of Ubuntu) after installing Ubuntu?

    Read the article

  • How to replace GRUB with BURG without overwriting MBR?

    - by StepTNT
    I'd like to install BURG but I don't want it to overwrite my MBR. That's because I've got two bootloaders in my system : Default Windows 7 in MBR Grub in /dev/sda2 With the first power button, it will boot into Windows and with the second button it boots from /dev/sda2, loading Grub and then Kubuntu. Now I want to replace GRUB with BURG. I've installed Burg with burg-install /dev/sda2 --force because I don't want my MBR to be overwritten (pressing the first power button MUST load Windows and avoid showing any sign of Linux). Setup was completed without errors, If I open burg-manager it loads my settings, allowing me to change them and to test everything with burg-emu, so I've changed my settings but the second power button still loads GRUB (Even a different version from the default Kubuntu one). How can I replace GRUB that's on /dev/sda2 with BURG and without overwriting MBR?

    Read the article

  • Javascript Tips and Tricks

    - by ybbest
    1. Replace all , in one Javascript string. var totalAmount= "100,000,000,000"; var find= ","; //Replace the first , with the empty string var replace=""; totalAmount= totalAmount.replace(find,replace); alert(totalAmount); var totalAmount2= "100,000,000,000"; var newFind=/,/g //Replace all , with empty string totalAmount2= totalAmount2.replace(newFind,replace); alert(totalAmount2);

    Read the article

  • Javascript Tips and Tricks

    - by ybbest
    1. Replace all , in one Javascript string. var totalAmount= "100,000,000,000"; var find= ","; //Replace the first , with the empty string var replace=""; totalAmount= totalAmount.replace(find,replace); alert(totalAmount); var totalAmount2= "100,000,000,000"; var newFind=/,/g //Replace all , with empty string totalAmount2= totalAmount2.replace(newFind,replace); alert(totalAmount2);

    Read the article

  • Notepad++. How to replace diffrent characters with corresponding letters at once?

    - by Algis
    How to find and replace in Notepad++ multiple different characters to corresponding letters at once throughout the text? For example, I have 32 characters that I want to replace. So I have the character like “À”, and I want to replace it with the letter “A”. Next, I have the character like “Æ” and I want to replace it with the letter “?” and so on. Generally, I have 32 such characters and each time I need to do the same operation. Is any way to do this at once? Please view the sample. http://tinypic.com/view.php?pic=34jenv4&s=6 Thanks

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >