Search Results

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

Page 56/378 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • Javascript - Determine if String Is In List

    - by Emtucifor
    In SQL we can see if a string is in a list like so: Column IN ('a', 'b', 'c') What's a good way to do this in javascript? I realize one can use the switch function: var str = 'a' var flag = false; switch (str) { case 'a': case 'b': case 'c': flag = true; default: } if (thisthing || thatthing || flag === true) { // do something } But this is a horrible mess. It's also clunky to do this: if (thisthing || thatthing || str === 'a' || str === 'b' || str = 'c') { // do something } And I'm not sure about the performance or clarity of this: if (thisthing || thatthing || {a:1, b:1, c:1}[str]) { // do something } Any ideas?

    Read the article

  • How to find ordinal position of an element in XML using VBScript & XPATH

    - by chazzuka
    I have an XML like this <response> <doc> <arr name="URL"><str>string</str></arr> <arr name="ID"><int>1</int></arr> </doc> <doc> <arr name="URL"><str>string</str></arr> <arr name="ID"><int>2</int></arr> </doc> <doc> <arr name="URL"><str>string</str></arr> <arr name="ID"><int>3</int></arr> </doc> </response> How to get the ordinal position of doc element which has element arr(1)/int text = 2 I am Using Classic ASP thanks

    Read the article

  • Could I replace a stock PSU fan with a more quiet one?

    - by GaryJL
    I have a cheap 450W PSU with an exhaust fan at the rear. This fan, however, is very loud. Is it a good idea to replace the stock PSU fan with a quiet fan with similar airflow? The PSU fan is hard-wired to the PCB in the PSU so I was intending on snipping the stock fan wires and sealing the loose ends with electrical tape. I would then connect the new quiet fan to the PWR_FAN socket on the motherboard. Has anyone done this before themselves? Is it a good idea in the first place? Considering if my PSU fails, it could take out a couple of other components too.

    Read the article

  • How can I include .pdf files when I publish but not in a search and replace in visual studio?

    - by Mike
    More specifically my problem is if I include a pdf in my project and set its build action to content so it gets copied to the server when I publish, is there a way to exclude it from visual studios search and replace feature. Would a post build action be a solution to this? I just don't want anybody to do a global search and replace in my project and mess up the pdfs... I know I just said a mouth full so let me know if you need clarification. Thanks!!!

    Read the article

  • Breaking the loop in Jython

    - by kdev
    Hi everyone, I have a written a loop for and if condition and I want to break to loop completely when if gets satisfied. while count: i=0 for line in read_record: #print str.strip(count[1:28]) #print str.strip(read_record[i]) if string.find(str.strip(read_record[i]),str.strip(count[1:28]))>0: code=str.strip(read_record[i+19])+str.strip(read_record[i+20]) print code[25:] break i=i+1 So here if the if string.find condition gets satisfied I want to go to while loop flow. Please tell me what will be the best place to break and how should I modify the program so that once the if condition is satisfied I am out of the loop and start again with while loop.

    Read the article

  • â?? in my hmtl after purify

    - by mmcgrail
    I have a database the i am rebuilding the table structure was crap so I'm porting some of the data from one table to another. This data appears to have been copy past from MSO product so as I'm getting the data I clean it up with htmlpurifier and some alittle str_replace in php here the clean function function clean_html($html) { $config = HTMLPurifier_Config::createDefault(); $config->set('AutoFormat','RemoveEmpty',true); $config->set('HTML','AllowedAttributes','href,src'); $config->set('HTML','AllowedElements','p,em,strong,a,ul,li,ol,img'); $purifier = new HTMLPurifier($config); $html = $purifier->purify($html); $html = str_replace('&nbsp;',' ',$html); $html = str_replace("\r",'',$html); $html = str_replace("\n",'',$html); $html = str_replace("\t",'',$html); $html = str_replace(' ',' ',$html); $html = str_replace('<p> </p>','',$html); $html = str_replace(chr(160),' ',$html); return trim($html); } but when I put the results into my new table and out put them to the ckeditor I get those three characters. I then have a javascript function that is called to remove special characters from the content of the ckeditor too. it doesn't clean it either function remove_special(str) { var rExps=[ /[\xC0-\xC2]/g, /[\xE0-\xE2]/g, /[\xC8-\xCA]/g, /[\xE8-\xEB]/g, /[\xCC-\xCE]/g, /[\xEC-\xEE]/g, /[\xD2-\xD4]/g, /[\xF2-\xF4]/g, /[\xD9-\xDB]/g, /[\xF9-\xFB]/g, /\xD1/,/\xF1/g, "/[\u00a0|\u1680|[\u2000-\u2009]|u200a|\u200b|\u2028|\u2029|\u202f|\u205f|\u3000|\xa0]/g", /\u000b/g,'/[\u180e|\u000c]/g', /\u2013/g, /\u2014/g, /\xa9/g,/\xae/g,/\xb7/g,/\u2018/g,/\u2019/g,/\u201c/g,/\u201d/g,/\u2026/g]; var repChar=['A','a','E','e','I','i','O','o','U','u','N','n',' ','\t','','-','--','(c)','(r)','*',"'","'",'"','"','...']; for(var i=0; i<rExps.length; i++) { str=str.replace(rExps[i],repChar[i]); } for (var x = 0; x < str.length; x++) { charcode = str.charCodeAt(x); if ((charcode < 32 || charcode > 126) && charcode !=10 && charcode != 13) { str = str.replace(str.charAt(x), ""); } } return str; } Does anyone know off hand what I need to do to get rid of them. I think they may be some sort of quote

    Read the article

  • Is search and replace the only way to rename an asp control in the code behind file?

    - by Matt
    Is search and replace the only way to rename as asp control in the code behind file? I find this extremely annoying, but it is the only way I can find. Scenario: I'll find a variable that needs renaming (Usually to meet naming convention) I'll rename the variable in the aspx/ascx file. I'll have to go in the code behind files and search and replace. I get annoyed Are there any better ways - preferably that would not touch a similarly named variable in another scope in the project. I'm on VS2008 with resharper -- does VS2010 address this perhaps?

    Read the article

  • Is it normal for a SAS drive to have a few bad blocks, or should I replace my drive ASAP?

    - by Nate
    I have a drive—part of a RAID 1 mirror—that has two bad blocks. Adaptec Storage Manger e-mailed me when it detected the blocks. It shows 4 medium errors for that drive, but state is still “optimal”. This is my first time using Adaptec RAID controllers. I don’t know if an occasional bad block is normal, or if I should immediately replace that drive. Update: The drive failed later the same day! The disk subsystem is: Adaptec 6405 with ZMM (2) Seagate near-line SAS drives (ST31000424SS) The other drive hasn’t reported any bad blocks yet. I am running a consistency check.

    Read the article

  • GWT formating flextable content & Panel create on the fly

    - by graybow
    I have a project showing comments database I put the comments in FlexTable TabelKomen and I put the text in HTML format like this: private static final int y=1; public void UpdateTabelKomen(JsArray str){ for(int i=0; i str.length(); i++){ UpdateTabelKomen(str.get(i)); } } public void UpdateTabelKomen(ImageDetailData str){ TabelKomen.setWidget(y, 0, new HTML(str.getmember + "'s comment :" + str.getkomen())); TabelKomen.getFlexCellFormatter().setWordWrap(y, 0, true); y++; } The data was shown, but my text comment is not word wraped and make my flex table wider. Of course that will ruin my web appearance. I change new HTML with new ScrolPanel(new HTML) seems not working. so How can I Format my FlexTable? is there any option beside flextable or scrollpanel?

    Read the article

  • Is there a way to backup all my files and replace with 0-byte files with same name?

    - by laggingreflex
    My main drive on laptop keeps filling up so I take a backup on a USB and delete the original files. But then I find myself getting (downloading or getting from someone else) files that I already have backed-up but couldn't recall at the moment. So is there a way I can keep a 0-byte file with the same name as teh backed-up copy so that when I'm asked whether to overwrite the existing file, I can easily choose no knowing I probably have this file already in the backup. EDIT: better yet, replace with a shortcut(.lnk) on the external drive so I can access the files hassle free and not get any errors because of 0-byte files being accidentally opened.

    Read the article

  • How can I replace red in an image with a certain shade of gray?

    - by Malcolm Frexner
    In this image I have to change red to grey: I know I can just set the saturation to zero, but then the result is a grey that is to dark. I could just change the brightness, but that would also change the left lower part of the picture: Is there an adjustment that only works on the red parts of the image? I can't use a selection, because the setting has to be applied to lots of images. EDIT I tried to use "replace adjustment tool", but that did not work well for the shdows and bright parts of the image, even with the largest fuzzines. I used blue as the replacement colour, to have a better impression of what it does.

    Read the article

  • GWT formating flextable & Panel create on the fly

    - by graybow
    I have a project showing comments database I put the comments in FlexTable TabelKomen and I put the text in HTML format like this: private static final int y=1; public void UpdateTabelKomen(JsArray str){ for(int i=0; i str.length(); i++){ UpdateTabelKomen(str.get(i)); } } public void UpdateTabelKomen(ImageDetailData str){ TabelKomen.setWidget(y, 0, new HTML(str.getmember + "'s comment :" + str.getkomen())); TabelKomen.getFlexCellFormatter().setWordWrap(y, 0, true); y++; } The data was shown, but my text comment is not word wraped and make my flex table wider. Of course that will ruin my web appearance. I change new HTML with new ScrolPanel(new HTML) seems not working. so How can I Format my FlexTable? is there any option beside flextable or scrollpanel?

    Read the article

  • Is there an easy way to replace a deprecated method call in Xcode?

    - by Alex Basson
    So iOS 6 deprecates presentModalViewController:animated: and dismissModalViewControllerAnimated:, and it replaces them with presentViewController:animated:completion: and dismissViewControllerAnimated:completion:, respectively. I suppose I could use find-replace to update my app, although it would be awkward with the present* methods, since the controller to be presented is different every time. I know I could handle that situation with a regex, but I don't feel comfortable enough with regex to try using it with my 1000+-files-big app. So I'm wondering: Does Xcode have some magic "update deprecated methods" command or something? I mean, I've described my particular situation above, but in general, deprecations come around with every OS release. Is there a better way to update an app than simply to use find-replace?

    Read the article

  • C++ Exam Question

    - by Carlucho
    I just took an exam where i was asked the following: Write the function body of each of the methods GenStrLen, InsertChar and StrReverse for the given code bellow. You must take into consideration the following; How strings are constructed in C++ The string must not overflow Insertion of character increases its length by 1 An empty string is indicated by StrLen = 0 class Strings { private: char str[80]; int StrLen; public: // Constructor Strings() { StrLen=0; }; // A function for returning the length of the string 'str' int GetStrLen(void) { }; // A function to inser a character 'ch' at the end of the string 'str' void InsertChar(char ch) { }; // A function to reverse the content of the string 'str' void StrReverse(void) { }; }; The answer I gave was something like this (see bellow). My one of problem is that used many extra variables and that makes me believe am not doing it the best possible way, and the other thing is that is not working.... class Strings { private: char str[80]; int StrLen; int index; // *** Had to add this *** public: Strings(){ StrLen=0; } int GetStrLen(void){ for (int i=0 ; str[i]!='\0' ; i++) index++; return index; // *** Here am getting a weird value, something like 1829584505306 *** } void InsertChar(char ch){ str[index] = ch; // *** Not sure if this is correct cuz I was not given int index *** } void StrRevrse(void){ GetStrLen(); char revStr[index+1]; for (int i=0 ; str[i]!='\0' ; i++){ for (int r=index ; r>0 ; r--) revStr[r] = str[i]; } } }; I would appreciate if anyone could explain me toughly what is the best way to have answered the question and why. Also how come my professor closes each class function like " }; " i thought that was only used for ending classes and constructors only. Thanks a lot for your help.

    Read the article

  • Firefox: how to apply XSLT from plugin to opened XML document? (how to replace document with another

    - by aloispaulin
    Hi! I've developed a plug-in for Firefox, that can read and manipulate the content of the currently opened document. I would like to apply a XLST to the document in case it is XML. I have no problem to read the XML document and apply a XSLT to it in memory, however, I have no idea of how to replace the existing document with the newly created one. Thus, I see two possible scenarios: a) I replace the document with the result of the transformation b) I apply the XSLT directly to the XML All my attempts to realize one of both possible solutions have failed... Hoping the community can provide help! Many tnx in advance! Alois

    Read the article

  • Cannot implicitly convert type 'char*' to 'bool'

    - by neeraj
    i was trying to passing pointer value in the function , i really got stuck here I am a beginner , not getting what value should be put this is programme from the reference of the book "Cracking the coding interview " By Gayle Laakmann McDowell, class Program { unsafe void reverse(char *str) { char* end = str; char tmp; if (str) //Cannot implicitly convert type 'char*' to 'bool' { while(*end) //Cannot implicitly convert type 'char*' to 'bool' { ++end; } --end; while(str<end) { tmp = *str; *str+= *end; *end-= tmp; } } } public static void Main(string[] args) { } }

    Read the article

  • Need help creating a batch file to replace "." with "-"

    - by Brandon Ogle
    Like the title says, I need help creating a batch file to replace "." with "-", however I need to perserve the file extensions and it needs to work through the subfolders. I found another post on here that got the effect I wanted but it also swapped the . in my file extensions. I am a completely ignorant regarding shell script so please be detailed in your response. I have no idea what any of the switches mean or even how to specify the path for that matter. Thanks!

    Read the article

  • Permutations in python 2.5.2

    - by flpgdt
    Hi, I have a list of numbers for input, e.g. 671.00 1,636.00 436.00 9,224.00 and I want to generate all possible sums with a way to id it for output, e.g.: 671.00 + 1,636.00 = 2,307.00 671.00 + 436.00 = 1,107.00 671.00 + 9,224.00 = 9,224.00 671.00 + 1,636.00 + 436.00 = 2,743.00 ... and I would like to do it in Python My current constrains are: a) I'm just learning python now (that's part of the idea) b) I will have to use Python 2.5.2 (no intertools) I think I have found a piece of code that may help: def all_perms(str): if len(str) <=1: yield str else: for perm in all_perms(str[1:]): for i in range(len(perm)+1): #nb str[0:1] works in both string and list contexts yield perm[:i] + str[0:1] + perm[i:] ( from these guys ) But I'm not sure how to use it in my propose. Could someone trow some tips and pieces of code of help? cheers, f.

    Read the article

  • Is it possible to COMPLETELY replace the start menu?

    - by Subaru Tashiro
    I plan to make a replacement for the Windows 7 start menu, and I would like to know if that's even possible. I understand that the start menu is part of explorer.exe but I do not intend to replace explorer.exe. Is it possible to launch the replacement start menu by clicking the native start orb? Is it also possible to launch the replacement by pressing the Windows key or ctrl+esc ? Is the Windows key a macro for ctrl+esc ? or is it two different hotkeys that do the same thing? May I know if there is any software that do any one of these things?

    Read the article

  • I need an other videocard to replace my ATI HD 5870 which one is good? [closed]

    - by Chris
    At this moment I have a ATI HD 5870 iCooler 5 and I game a lot. I want to replace the card for another, I don't have room in my case to add another 5870. I mainly play games like Battlefield 3, but I can't play this game on Ultra high, for me is this pretty important. So here are my questions: Price is not an issue because computers are a big hobby to me and hobbies cost money :-) Can anyone recommend me a better card, ATI or Nvidia does not mather to me. Why is this card better?

    Read the article

  • Computer sometimes doesn't boot after power failure, what should I replace?

    - by user1416256
    I have a new computer that behaves strange after a power failure. When I switch off the computer it will not boot anymore. Completely unplugging the computer for about an hour cures the issue for the next boot. The internal leds are working I have no idea where to start looking. What, in your opinion could be the cause of this strange behaviour ? My best bet would be to replace the power supply Would that be a good place to start ?

    Read the article

  • C++ exam question on string class implementation

    - by Carlucho
    I just took an exam where i was asked the following: Write the function body of each of the methods GenStrLen, InsertChar and StrReverse for the given code bellow. You must take into consideration the following; How strings are constructed in C++ The string must not overflow Insertion of character increases its length by 1 An empty string is indicated by StrLen = 0 class Strings { private: char str[80]; int StrLen; public: // Constructor Strings() { StrLen=0; }; // A function for returning the length of the string 'str' int GetStrLen(void) { }; // A function to inser a character 'ch' at the end of the string 'str' void InsertChar(char ch) { }; // A function to reverse the content of the string 'str' void StrReverse(void) { }; }; The answer I gave was something like this (see bellow). My one of problem is that used many extra variables and that makes me believe am not doing it the best possible way, and the other thing is that is not working.... class Strings { private: char str[80]; int StrLen; int index; // *** Had to add this *** public: Strings(){ StrLen=0; } int GetStrLen(void){ for (int i=0 ; str[i]!='\0' ; i++) index++; return index; // *** Here am getting a weird value, something like 1829584505306 *** } void InsertChar(char ch){ str[index] = ch; // *** Not sure if this is correct cuz I was not given int index *** } void StrRevrse(void){ GetStrLen(); char revStr[index+1]; for (int i=0 ; str[i]!='\0' ; i++){ for (int r=index ; r>0 ; r--) revStr[r] = str[i]; } } }; I would appreciate if anyone could explain me toughly what is the best way to have answered the question and why. Also how come my professor closes each class function like " }; " i thought that was only used for ending classes and constructors only. Thanks a lot for your help.

    Read the article

  • What's the best way to replace the first letter of a string in Java?

    - by froadie
    I'm trying to convert the first letter of a string to lowercase. I know there's a capitalize method, but I want to accomplish the opposite. This is the code I used: value.substring(0,1).toLowerCase() + value.substring(1) Effective, but feels a bit manual. Are there any other ways to do it? Any better ways? Any Java string functions that do it for you? I was thinking of using something like a replace function, but Java's replace doesn't accept an index as a parameter. You have to pass the actual character/substring. Another way I can think of doing it is something like: value.replaceFirst(value.charAt(0), value.charAt(0).toLowerCase()) Except that replaceFirst expects 2 strings, so the value.charAt(0)s would probably need to be replaced with value.substring(0,1)s. Is this any better? Does it matter? Is there any standard way to do this?

    Read the article

  • breaking the look in jython

    - by kdev
    Hi everyone , I have a written a loop for and if condition and i want to break to loop completely when if gets satisfied. while count: i=0 for line in read_record: #print str.strip(count[1:28]) #print str.strip(read_record[i]) if string.find(str.strip(read_record[i]),str.strip(count[1:28]))>0: code=str.strip(read_record[i+19])+str.strip(read_record[i+20]) print code[25:] break i=i+1 so here if the if string.find condition gets satified i want to go to while loop flow. Please tell me what will be the best place to break and how should i modify the program so that once the if condition is satified iam out of the loop and start again with while loop .

    Read the article

  • What is the best solution to replace a new memory allocator in an existing code?

    - by O. Askari
    During the last few days I've gained some information about memory allocators other than the standard malloc(). There are some implementations that seem to be much better than malloc() for applications with many threads. For example it seems that tcmalloc and ptmalloc have better performance. I have a C++ application that uses both malloc and new operators in many places. I thought replacing them with something like ptmalloc may improve its performance. But I wonder how does the new operator act when used in C++ application that runs on Linux? Does it use the standard behavior of malloc or something else? What is the best way to replace the new memory allocator with the old one in the code? Is there any way to override the behavior or new and malloc or do I need to replace all the calls to them one by one?

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >