Search Results

Search found 37183 results on 1488 pages for 'string conversion'.

Page 163/1488 | < Previous Page | 159 160 161 162 163 164 165 166 167 168 169 170  | Next Page >

  • Deleting entire lines in a text file based on a partial string match with Windows PowerShell

    - by Charles
    So I have several large text files I need to sort through, and remove all occurrences of lines which contain a given keyword. So basically, if I have these lines: This is not a test This is a test Maybe a test Definitely not a test And I run the script with 'not', I need to entirely delete lines 1 and 4. I've been trying with: PS C:\Users\Admin (Get-Content "D:\Logs\co2.txt") | Foreach-Object {$_ -replace "3*Program*", ""} | Set-Content "D:\Logs\co2.txt" but it only replaces the 'Program' and not the entire line.

    Read the article

  • Winforms ComboBox autocomplete search multiple parts of string

    - by studiothat
    Very similar question to this one... http://stackoverflow.com/questions/522521/autocomplete-for-combobox-in-wpf-anywhere-in-text-not-just-beginning but my issue is for windows-forms rather than WPF. I have a winforms databound combox working great with autocomplete list coming from the data items in the combobox. Of course the client wants it to work "better", and that means that they want the autocomplete to work by searching and showing autocomplete options for any matching (contains()) string not just the starting string (startswith()) I know it's probably not just a property that can be set in the combobox, but can anyone point me in the right direction?

    Read the article

  • TimeSpan to Localized String in C#

    - by MadBoy
    Is there an easy way (maybe built in solution) to convert TimeSpan to localized string? For example new TimeSpan(3, 5, 0); would be converted to 3 hours, 5minutes (just in polish language). I can of course create my own extension: public static string ConvertToReadable(this TimeSpan timeSpan) { int hours = timeSpan.Hours; int minutes = timeSpan.Minutes; int days = timeSpan.Days; if (days > 0) { return days + " dni " + hours + " godzin " + minutes + " minut"; } else { return hours + " godzin " + minutes + " minut"; } } But this gets complicated if i want to have proper grammar involved.

    Read the article

  • Regex for circular replacement

    - by polygenelubricants
    How would you use regex to write functions to do the following: Replace lowercase 'a' with uppercase and vice versa Where words are separated by whitespaces and > and < are special markers, replace >word with word< and vice versa Replace postincrement (i++;) with preincrement (++i;) and vice versa. Variable names are [a-z]+. Input is just a bunch of these statements. Bonus: also do decrement. Also interested in solutions in other flavors. Note: this is NOT a homework question. See also my previous explorations of regex: Regex split into overlapping strings (Alan Moore's answer is especially instructive) Can you use zero-width matching regex in String split? (my solution exploits a known Java regex bug with regards to non-obvious length lookbehind!)

    Read the article

  • Codeigniter PHP Framework - Need to get query string

    - by Siva
    Hi, I'm creating a e-commerce site using Codeigniter. My question is, how should i get the query string. Am using a saferpay payment gateway, the gateway response will be like this http://www.test.com/registration/success/?DATA=<IDP+MSGTYPE%3D"PayConfirm"+KEYID%3D"1-0"+ID%3D"KI2WSWAn5UG3vAQv80AdAbpplvnb"+TOKEN%3D"(unused)"+VTVERIFY%3D"(obsolete)"+IP%3D" 123.25.37.43"+IPCOUNTRY%3D"IN"+AMOUNT%3D"832200"+CURRENCY%3D"CHF"+PROVIDERID%3D"90"+PROVIDERNAME%3D"Saferpay+Test+Card"+ACCOUNTID%3D"99867-94913159"+ECI%3D"2"+CCCOUNTRY%3D"XX"%2F>&SIGNATURE=bc8e253e2a8c9ee0271fc45daca05eecc43139be6e7d486f0d6f68a356865457a3afad86102a4d49cf2f6a33a8fc6513812e9bff23371432feace0580f55046c To handle the response i need to get the query string data. Help would be much appreciated. Thanks in advance. - Siva

    Read the article

  • Removing non-alphanumeric characters in an Access Field.

    - by Jacques Tardie
    I need to remove hyphens from a string in a large number of access fields. What's the best way to go about doing this? Currently, the entries are follow this general format: 2010-54-1 2010-56-1 etc. I'm trying to run append queries off of this field, but I'm always getting validation errors causing the query to fail. I think the cause of this failure is the hypens in the entries, which is why I need to remove them. I've googled, and I see that there are a number of formatting guides using vbscript, but I'm not sure how I can integrate vb into Access. It's new to me :) Thanks in advance, Jacques

    Read the article

  • TypeError: can't convert String into Integer

    - by demas
    I have code: class Scene def initialize(number) @number = number end attr_reader :number end scenes = [Scene.new("one"), Scene.new("one"), Scene.new("two"), Scene.new("one")] groups = scenes.inject({}) do |new_hash, scene| new_hash[scene.number] = [] if new_hash[scene.number].nil? new_hash[scene.number] << scene end When I'm lauching it I get error: freq.rb:11:in `[]': can't convert String into Integer (TypeError) from freq.rb:11:in `block in <main>' from freq.rb:10:in `each' from freq.rb:10:in `inject' from freq.rb:10:in `<main>' If I change scenes to: scenes = [Scene.new(1), Scene.new(1), Scene.new(2), Scene.new(1)] the problem dissapear. Why I get error message in the first case? Why Ruby decide to convert scene.number from String to Integer? And one additional question about the 'inject' method. When Ruby initialize the 'new_hash' variable and how can Ruby know the type of this variable?

    Read the article

  • regex to filter all but whitelisted characters from a multi-language string

    - by jeroen
    I am trying to cleanup a string coming from a search box on a multi-language site. Normally I would use a regex like: $allowed = "-+?!,.;:\w\s"; $txt_search = preg_replace("/[^" . $allowed . "]?(.*?)[^" . $allowed . "]?/iu", "$1", $_GET['txt_search']); and that works fine for English texts. However, now I need to do the same when the texts entered can be in any language (Russian now, Chinese in the future). How can I clean up the string while preserving "normal texts" in the original language? I though about switching to a blacklist (although I´d rather not...) but at this moment the regex just completely destroys all original input.

    Read the article

  • Paste string of date format mm/dd/yy to iWork-Numbers

    - by David.Chu.ca
    I have trouble to paste a list of strings in the format of 'mm/dd/yy' into iWork-Numbers. For example: 04/01/10 04/03/10 04/13/10 The result will be: 2004-01-10 2004-03-10 04/13/10 It looks like that Numbers convert the mm into year, then month and last day. Is there any way to paste whatever as they are? Do I have to change settings in Numberers or System preference?

    Read the article

  • dhtmlxgrid: getting an xml string of grid data

    - by user823527
    The dhtmlxgrid documentation is saying that I should be able to get a string with the grid data with the serialize feature. mygrid.setSerializationLevel(true,true); var myXmlStr = mygrid.serialize(); I'd like to use that feature to get the updated grid data. But I don't get the xml string. Is that feature not available in the open source version? If I could get a csv string, that would also be OK. But I don't get that either. var gridcsv=mygrid.serializeToCSV(); document.getElementById("mytextareax").value = gridcsv; The html information for the grid is: <a href="#" onclick="savegrid();">Save Grid</a> <textarea id="mytextareax"><rows><row id='r1'><cell>index ... </rows></textarea> <div id="mytextarea" style="width:400px; height: 400px;"> </div> <div id="gridbox" style="width:600px; height:270px; background-color:white;"></div> <a href='#alfa' onClick="ser()">Reload grid with another structure</a> <br> The script for creating the grid is: <script> mygrid = new dhtmlXGridObject('gridbox'); mygrid.setImagePath("../../codebase/imgs/"); mygrid.loadXML("../common/grid500.xml"); function ser(){ mygrid.clearAll(true); mygrid.loadXML("../common/gridH3.xml"); } function savegrid(){ alert('save grid'); mygrid.setSerializationLevel(true,true); var myXmlStr = mygrid.serialize(); /* document.getElementById("mytextarea").innerHTML = myXmlStr; */ document.getElementById("mytextareax").value = myXmlStr; alert(myXmlStr); } </script> Is there any way to get the data out of the dhtmlx grid to be able to create my own xml file from it?

    Read the article

  • B64 String Being Stripped From HttpService JSON Object Flex 4.0

    - by user163757
    I am trying to decode some b64 images obtained from a web service in my Flex application. The response of this web service is a basic JSON object, with a property (B64Image) that contains the encoded string. The service works fine from my regular browser, however the b64 string gets stripped. So the object the result handler gets has a null value for B64Image. Anyone see something wrong here? EXPECTED OUTPUT { "PropertyPhotos": [ { "B64Image": "/9j/4AAQSkZJRgABAQEAYABgAAD....etc" } ] } <s:HTTPService id="photoService" url="http://localhost/dev/photohandler.ashx" resultFormat="text" result="photoService_resultHandler(event)" fault="photoService_faultHandler(event)"> </s:HTTPService>

    Read the article

  • Unicode issue in Django

    - by Kave
    I seem to have a unicode problem with the deal_instance_name in the Deal model. It says: coercing to Unicode: need string or buffer, __proxy__ found The exception happens on this line: return smart_unicode(self.deal_type.deal_name) + _(u' - Set No.') + str(self.set) The line works if I remove smart_unicode(self.deal_type.deal_name) but why? Back then in Django 1.1 someone had the same problem on Stackoverflow I have tried both the unicode() as well as the new smart_unicode() without any joy. What could I be missing please? class Deal(models.Model): def __init__(self, *args, **kwargs): super(Deal, self).__init__(*args, **kwargs) self.deal_instance_name = self.__unicode__() deal_type = models.ForeignKey(DealType) deal_instance_name = models.CharField(_(u'Deal Name'), max_length=100) set = models.IntegerField(_(u'Set Number')) def __unicode__(self): return smart_unicode(self.deal_type.deal_name) + _(u' - Set No.') + str(self.set) class Meta: verbose_name = _(u'Deal') verbose_name_plural = _(u'Deals') Dealtype: class DealType(models.Model): deal_name = models.CharField(_(u'Deal Name'), max_length=40) deal_description = models.TextField(_(u'Deal Description'), blank=True) def __unicode__(self): return smart_unicode(self.deal_name) class Meta: verbose_name = _(u'Deal Type') verbose_name_plural = _(u'Deal Types')

    Read the article

  • How to create a UDF that takes a query string and returns the query's resultset

    - by Martin
    I want to create a stored procedure that takes a simple SELECT statement and return the resultset as a CSV string. So the basic idea is get the sql statement from user input, run it using EXEC(@stmt) and convert the resultset to text using cursors. However, as SQLServer doesn't allow: select * from storedprocedure(@sqlStmt) UDF with EXEC(@sqlStmt) so I tried Insert into #tempTable EXEC(@sqlStmt), but this doesn't work (error = "invalid object name #tempTable"). I'm stuck. Could you please shed some light on this matter? Many thanks EDIT: Actually the output (e.g CSV string) is not important. The problem is I don't know how to assign a cursor to the resultset returned by EXEC. SP and UDF do not work with Exec() while creating a temp table before inserting values is impossible without knowing the input statement. I thought of OPENQUERY but it does not accept variables as its parameters.

    Read the article

  • PHP find first of occurrence of string

    - by mike
    I have a string of data like below and I've been struggling trying to figure out how to split it up so that I can use it efficiently. "United States FirstName: Mike LastName: Wolf City: Chicago" I need to split up the string in to substrings and the list may not always be in the same order. For example it could vary like below: "United States City: Chicago FirstName: Mike LastName: Wolf" "United States FirstName: City: Chicago Mike LastName: Wolf" I need to find which parameter comes first after 'United States'. It could be 'City:', 'FirstName:' or 'LastName:'. And, I also need to know the start position of the first parameter. Thanks in advance!

    Read the article

  • Simple Adapter error

    - by Rahul Varma
    Hi, I have the following errors when i try to access the simple adapter from my program... Plz can anyone help me solving the error... Desperate to get it done.... android.widget.SimpleAdapter.getCount(SimpleAdapter.java:95) android.widget.ListView.setAdapter(ListView.java:431) com.stellent.gorinka.MusicListActivity.list(MusicListActivity.java:76) com.stellent.gorinka.MusicListActivity$1.run(MusicListActivity.java:67) android.os.Handler.handleCallback(Handler.java:587) android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:123) android.os.Handler.handleCallback(Handler.java:587) android.os.Handler.dispatchMessage(Handler.java:92) android.os.Looper.loop(Looper.java:123) Here' the code for Adapter... public class SongsAdapter extends SimpleAdapter{ static List<HashMap<String,String>> songsList; Context context; LayoutInflater inflater; public SongsAdapter(Context context,List<HashMap<String,String>> imgListWeb,int layout,String[] from,int[] to,LayoutInflater inflater) { super(context,songsList,layout,from,to); this.songsList=songsList; this.context=context; this.inflater=inflater; // TODO Auto-generated constructor stub }@Override public View getView(int postition,View convertView,ViewGroup parent)throws java.lang.OutOfMemoryError{ try { View v = ((LayoutInflater) inflater).inflate(R.layout.row,null); ImageView images=(ImageView)v.findViewById(R.id.image); TextView tvTitle=(TextView)v.findViewById(R.id.text1); TextView tvAlbum=(TextView)v.findViewById(R.id.text2); TextView tvArtist=(TextView)v.findViewById(R.id.text3); HashMap<String,String> songsHash=songsList.get(postition); String path=songsHash.get("path"); String title=songsHash.get("title"); String album=songsHash.get("album"); String artist=songsHash.get("artist"); String imgPath=path; final ImageView imageView = (ImageView) v.findViewById(R.id.image); AsyncImageLoaderv asyncImageLoader=new AsyncImageLoaderv(); Bitmap cachedImage = asyncImageLoader.loadDrawable(imgPath, new AsyncImageLoaderv.ImageCallback() { public void imageLoaded(Bitmap imageDrawable, String imageUrl) { imageView.setImageBitmap(imageDrawable); } }); imageView.setImageBitmap(cachedImage); tvTitle.setText(title); tvAlbum.setText(album); tvArtist.setText(artist); return v; } catch(Exception e){ Log.e("error",e.toString()); } return null; } And also in my main program the focus is not entering the loop... The implementation in the loop isnt getting executed...Here's the code for it... public void list() { Log.d("#####","#####"); LayoutInflater inflater=getLayoutInflater(); String[] from={}; int[] n={}; adapter=new SongsAdapter(getApplicationContext(),songNodeDet,R.layout.row,from,n,inflater); lv.setAdapter(adapter);} private Handler handler = new Handler() { public void handleMessage(Message msg){ Log.d("*****","handler"); removeDialog(0); p.dismiss(); } }; public void webObjectList(Object[] imgListObj,String logInSess) throws XMLRPCException{ songNodeWeb = new HashMap<?,?>[imgListObj.length]; if(imgListObj!=null){ Log.e("completed","completed"); for(int i=0;i<imgListObj.length;i++){ //imgListObj.length songNodeWeb[i]=(HashMap<?,?>)imgListObj[i]; String nodeid=(String) songNodeWeb[i].get("nid"); Log.e("img",i+"completed"); HashMap<String,String> nData=new HashMap<String,String>(); nData.put("nid",nodeid); Object nodeget=client.call("node.get",logInSess,nodeid); HashMap<?,?> imgNode=(HashMap<?,?>)nodeget; String titleName=(String) imgNode.get("titles"); String movieName=(String) imgNode.get("album"); String singerName=(String) imgNode.get("artist"); nData.put("titles", titleName); nData.put("album", movieName); nData.put("artist", singerName); Object[] imgObject=(Object[])imgNode.get("title_format"); HashMap<?,?>[] imgDetails=new HashMap<?,?>[imgObject.length]; imgDetails[0]=(HashMap<?, ?>)imgObject[0]; String path=(String) imgDetails[0].get("filepath"); if(path.contains(" ")){ path=path.replace(" ", "%20"); } String imgPath="http://www.gorinka.com/"+path; paths.add(imgPath); nData.put("path", imgPath); Log.e("my path",path); String mime=(String)imgDetails[0].get("filemime"); nData.put("mime", mime); SongsList songs=new SongsList(titleName,movieName,singerName,imgPath,imgPath); SngList.add(i,songs); songNodeDet.add(i,nData); } Log.e("paths values",paths.toString()); // return imgNodeDet; handler.sendEmptyMessage(0); } } public void getSongs() throws MalformedURLException, XMLRPCException { String ur="http://www.gorinka.com/?q=services/xmlrpc"; URL u=new URL(ur); client = new XMLRPCClient(u); //Connecting to the website HashMap<?, ?> siteConn =(HashMap<?, ?>) client.call("system.connect"); // Getting initial sessio id String initSess=(String)siteConn.get("sessid"); //Login to the site using session id HashMap<?, ?> logInConn =(HashMap<?, ?>) client.call("user.login",initSess,"prakash","stellentsoft2009"); //Getting Login sessid logInSess=(String)logInConn.get("sessid"); websongListObject =(Object[]) client.call("nodetype.get",logInSess,""); webObjectList(websongListObject,logInSess); Log.d("webObjectList","webObjectList"); runOnUiThread(returnRes); } }

    Read the article

  • Can nusoap returns arrray of string ?

    - by Tim
    Hi all, I would like to return an array of string in my web services I've tryed : <?php require_once('nusoap/nusoap.php'); $server = new soap_server(); $server->configureWSDL('NewsService', 'urn:NewsService'); $server->register('GetAllNews', array(), array('return' => 'xsd:string[]'), 'urn:NewsService', 'urn:NewsService#GetAllNews', 'rpc', 'literal', '' ); // Define the method as a PHP function function GetAllNews() { $stack = array("orange", "banana"); array_push($stack, "apple", "raspberry"); return $stack; } but it doesn't work. What is the correct syntax for that ? Thanks in advance for any help

    Read the article

  • Base64 Encode String in VBScript

    - by Patrick Cuff
    I have a web service load driver that's a Windows Script File (WSF), that includes some VBScript and JavaScript files. My web service requires that the incoming message is base64 encoded. I currently have a VBScript function that does this, but it's very inefficient (memory intensive, mostly due to VBScripts awful string concatenation) [Aside; Yes, I've seen Jeff's latest blog post. The concatenation is happening in a loop across messages that are 1,000's to 10,000's bytes in size.] I've tried using some custom string concatenation routines; one using an array and one using ADODB.Stream. These help, a little, but I think it would help more if I had some other way of encoding the message rather than via my own VBS function. Is there some other way of encoding my message, preferebly using native Windows methods?

    Read the article

  • unwanted quote marks in output from printf

    - by Gary
    I have some address data which has been exported from a database. If the address had multiple lines, the exported data has joined all the lines into one string with the former lines being separated by dollars signs. Here's one of the addresses: INFORMATION DELIVERY DEPT$704 CHERRY ST$ATLANTA, GA 30332-0900 I'm splitting this into an array on the dollar sign and outputting the three array elements into separate tab-separated fields with printf. For some reason, it comes out like this: INFORMATION DELIVERY DEPT 704 CHERRY ST "ATLANTA, GA 30332-0900" I don't want the quotes around that final field. Can anyone explain why this is happening and how to suppress it? This is being done in Windows Vista with gawk3.1.6. Thanks! gary

    Read the article

  • Look up and string operation; fetch a value based on searching a partial string

    - by Sam
    I have 2 sets of data. One set to be filled up by fetching relevant data from a data array. DATA to be FILLED: Part#1 Part#2 ------ ------- 4021006 3808587 3870480 3083410 3873905 3890030 4002065 3699803 3930218 ARRAY OF DATA: Part#1 Part#2 ------ ------- 4021006;3808587 1 3808587 2 3870480;3083410;4002065 3 3083410 34 3873905 54 3890030 32 4002065;3930218 65 3699803 75 3930218 68 I need to match Part#1 and find Part#2. EXPECTED OUTPUT Part#1 Part#2 ------ ------- 4021006 1 3808587 1;2 3870480 3 3083410 3;4 3873905 54 3890030 32 4002065 3;65 3699803 75 3930218 65;68 Can anyone help.

    Read the article

  • Extract / Parse Tags from Mixed Content String

    - by Andreas
    Hello, i want to parse Tags from a mixed Content String. The string goes like this: "<PERSON>yasir arafat</PERSON> , the president of the <LOCATION>palestinian authority</LOCATION> , on the defensive , mr . sharon believes , a government official" I only want to use jaxp. Got anybody an idea for this. May an easy way with Expressions. But i need the Element names as well though. Best Regards Andreas

    Read the article

  • Split a line from a para in java

    - by John
    Hi... I am having problem splitting a para into line.... i need to first read a file then split in into lines if i get a . or ! or ? I also need to remove any extra white space... This is wad i've written so far.... try { Scanner line = new Scanner(mFile); mLine = line.nextLine(); String Matrix[]=mLine.split("\\."); for (int i = 0; i < Matrix.length; ++i) { System.out.println(Matrix[i]); } Input: Hi. My name is John. Who are you ? Output: Hi My name is John Who are you

    Read the article

  • Passing a string from C# to cpp with COM

    - by Yaron Naveh
    I have a C# COM server which is consumed by a cpp client. One of the C# methods returns a string. In cpp the returned string is represented in Unicode (UTF-16), at least according to the memory view. Is this always the case with COM strings? Is there a way to use UTF-8 instead? I saw some code where strings were passed between cpp and c# as byte arrays. Is there any benefit in this?

    Read the article

  • php regex expression to get title

    - by 55skidoo
    I'm trying to strip content titles out of the middle of text strings. Could I use regex to strip everything out of this string except for the title (in italics) in these strings? Or is there a better way? Joe User wrote a blog post called The 10 Best Regex Expressions in the category Regex. Jane User wrote a blog post called Regex is Hard! in the category TechProblems. I've tried to come up with a regex expression to cover this, but I think it might need two. The trick is that the text in bold is always the same, so you could search for that, like this: regex: delete everything before and including wrote a blog post called regex: delete in the category and everything after it.

    Read the article

  • Most clever way to parse a Facebook OAuth 2 access token string

    - by RyOnLife
    It's a bit late, but I'm disappointed in myself for not coming up with something more elegant. Anyone have a better way to do this... When you pass an OAuth code to Facebook, it response with a query string containing access_token and expires values. access_token=121843224510409|2.V_ei_d_rbJt5iS9Jfjk8_A__.3600.1273741200-569255561|TxQrqFKhiXm40VXVE1OBUtZc3Ks.&expires=4554 Although if you request permission for offline access, there's no expires and the string looks like this: access_token=121843224510409|2.V_ei_d_rbJt5iS9Jfjk8_A__.3600.1273741200-569255561|TxQrqFKhiXm40VXVE1OBUtZc3Ks. I attempted to write a regex that would suffice for either condition. No dice. So I ended up with some really ugly Ruby: s = s.split("=") @oauth = {} if s.length == 3 @oauth[:access_token] = s[1][0, s[1].length - 8] @oauth[:expires] = s[2] else @oauth[:access_token] = s[1] end I know there must be a better way!

    Read the article

  • I need to Split a string based on a complex delimiter

    - by Jason
    In C# I need to split a string (a log4j log file) into array elements based on a particular sequence of characters, namely "nnnn-nn-nn nn:nn:nn INFO". I'm currently splitting this log file up by newlines, which is fine except when the log statements themselves contain newlines. I don't control the input (the log file) so escaping them somehow is not an option. It seems like I should be able to use a comparator or a regex to identify the strings, but String.Split does not have an option like that. Am I stuck rolling my own, or is there a pattern or framework component that can be of help here?

    Read the article

< Previous Page | 159 160 161 162 163 164 165 166 167 168 169 170  | Next Page >