Search Results

Search found 35302 results on 1413 pages for 'string literals'.

Page 103/1413 | < Previous Page | 99 100 101 102 103 104 105 106 107 108 109 110  | Next Page >

  • preg_match find multiple partial appearances of a word in a string

    - by Rubytastic
    Any regex gurus around here? its driving me crazy. Say I have this string: "bookstore books Booking" I want to count the number "books" appears in this and return the number. Currently I have this which is not working: $string = "bookstore books Booking"; if (preg_match_all('/\b[A-Z]+books\b/', $string, $matches)) { echo count($matches[0]) . " matches found"; } else { echo "match NOT found"; } On top of this the "books" inside the preg_match_all should become a $var Anyone an idea how to count correctly?

    Read the article

  • find whether the string starts and ends with the same word

    - by Ajax
    I am trying to check whether the string starts and ends with the same word. egearth. s=raw_input(); m=re.search(r"^(earth).*(earth)$",s) if m is not None: print "found" my problem is when the string consists only of one word eg: earth At present I have hard coded this case by if m is not None or s=='earth': print "found" Is there any other way to do this? EDIT: words in a string are separated by spaces. looking for a regex solution some examples: "earth is earth" ,"earth", -- valid "earthearth", "eartheeearth", "earth earth mars" -- invalid

    Read the article

  • more efficient way to pickle a string

    - by gatoatigrado
    The pickle module seems to use string escape characters when pickling; this becomes inefficient e.g. on numpy arrays. Consider the following z = numpy.zeros(1000, numpy.uint8) len(z.dumps()) len(cPickle.dumps(z.dumps())) The lengths are 1133 characters and 4249 characters respectively. z.dumps() reveals something like "\x00\x00" (actual zeros in string), but pickle seems to be using the string's repr() function, yielding "'\x00\x00'" (zeros being ascii zeros). i.e. ("0" in z.dumps() == False) and ("0" in cPickle.dumps(z.dumps()) == True)

    Read the article

  • Send XML String as Response

    - by Sri Kumar
    Hello All, I am getting my Request from a third party application(different domain) to my ASP application. I am handling the request and doing the business part in my application and as a acknowledgement I need to send XML string as Response to the same Page which POSTED the request to my Application. I was successful in retrieving the input from Request using the following code NameValueCollection postPageCollection = Request.Form; foreach (string name in postPageCollection.AllKeys) { ... = postPageCollection[name]); } But i am not sure how to send back the response along with XML String to the site(different domain)? EDIT: How to get the URL from where the POST happened.

    Read the article

  • Error debugging - Conversion from String to Double

    - by Jamie Taylor
    I'm doing some error debugging trying to get the errors on our website down to a minimum and there seems to be an error that is popping up quite a lot Conversion from string "" to type 'Double' is not valid. I'm unable to replicate this problem but I can see that it is happening. I've been looking through the code in one of the pages and strolled across this Dim varWeek As String If varWeek < 10 Then 'Do something' End If Could this be causing the problem as it is trying to see if a String is less than 10 which is an Integer? As I said before as I am unable to see this error in the first place so changing this to an Integer doesn't change anything on my system. Thanks.

    Read the article

  • SQLCe local db in temp- path in connectionstring?

    - by Petr
    Hi, I have SQL Ce db in my app, which is included in my app directory. While debugging its OK, but when published and run with setup.exe, it retrieves "file not found" in temporary directory the app is ran from. I would like to run from standard location, but I dont know how to change it. I am using this string: SqlCeConnection connection = new SqlCeConnection("Data Source=database.sdf;Persist Security Info=False;"); When I run setup.exe, the app never starts, stating that in its temporary directory the db file was not found. When I run app.exe, it works. I do not understand it...:( EDIT: I can see that in the VS project settings, there is connection string and there is "Data Source=|DataDirectory|\Database.sdf" The path should be something like local directory? Thanks!

    Read the article

  • Doxygen C++ comment string parser in python?

    - by Sebastian
    Does anybody know of a python module to parse a doxygen style C++ comment string? I mean a string like this (simple example): /** * A constructor. * A more elaborate description of the constructor. * @param param1 test1 * @param param2 test2 */ and I would like to extract the brief, the long description, the parameters, the return value etc. I'm currently doing this using string methods and regular expressions but my solution is not very robust. Alternatively can anybody recommend an easy to use python parser lib that I can set up quickly? Thanks in advance

    Read the article

  • Check if a string substitution rule will ever generate another string.

    - by Mgccl
    Given two strings S and T of same length. Given a set of replacement rules, that find substring A in S and replace it with string B. A and B have the same length. Is there a sequence of rule application, such that it make string S into string T? I believe there is no better way to answer this than try every single rule in every single state. Which would be exponential time. But I don't know if there are better solutions to it.

    Read the article

  • String Functions in IIS Url Rewritting Module

    - by Nariman
    The IIS URL Rewrite Module ships with 3 built-in functions: * ToLower - returns the input string converted to lower case. * UrlEncode - returns the input string converted to URL-encoded format. This function can be used if the substitution URL in rewrite rule contains special characters (for example non-ASCII or URI-unsafe characters). * UrlDecode - decodes the URL-encoded input string. This function can be used to decode a condition input before matching it against a pattern. The functions can be invoked by using the following syntax: {function_name:any_string} The question is: can this list be extended by introducing a Replace function that's available for changing values within a rewrite rule action or condition?

    Read the article

  • Method not returning string value c# <List>

    - by Santii20
    public List<string> Test_IsDataLoaded() { try { if (GRIDTest.Rows.Count != 0) { int countvalue = GRIDTest.Rows.Count; GRIDTest.Rows[0].WaitForControlReady(); List<string> ReleaseIDList = new List<string>(); int nCellCount = GRIDTest.Cells.Count; for(int nCount = 0;nCount<nCellCount ;nCount++) { if(nCount %5==0) ReleaseIDList.Add((GRIDTest.Cells[0].GetProperty("Value").ToString())); } return ReleaseIDList; } } catch (Exception) { } } Method throws me error = Not all code path return a value. Whats wrong in code.

    Read the article

  • Select Columns Only if String length is greater than 2

    - by Zee-pro
    Similar Question may be asked but I am unable to find anything that fits my needs. How can I select only columns where string length is greater than 2 This is how much has done yet. SELECT * FROM Table1 WHERE (Table1.ID = @ID) Or something like WHERE (Table1.ID = @ID) AND (LEN(*) > 2) Thank for all of your help I have a Table, in which I have 35 columns and a User ID column, now I want to select and display information from only those columns which have 2 string. I Like to Select only columns which have 2 string and the defined ID by User not the Whole Row !! I hope I am making sense. Table Desired Result DI 35 Lesson 4 Maths Lesson 9 ICT Lesson 12 English

    Read the article

  • How to re-order a List<String>

    - by tarka
    I have created the following method: public List<String> listAll() { List worldCountriesByLocal = new ArrayList(); for (Locale locale : Locale.getAvailableLocales()) { final String isoCountry = locale.getDisplayCountry(); if (isoCountry.length() > 0) { worldCountriesByLocal.add(isoCountry); Collections.sort(worldCountriesByLocal); } } return worldCountriesByLocal; } Its pretty simple and it returns a list of world countries in the users locale. I then sort it to get it alphabetic. This all works perfectly (except I seem to occasionally get duplicates of countries!). Anyway, what I need is to place the US, and UK at the top of the list regardless. The problem I have is that I can't isolate the index or the string that will be returned for the US and UK because that is specific to the locale! Any ideas would be really appreciated.

    Read the article

  • String Functions in IIS Url Rewrite Module

    - by Nariman
    The IIS URL Rewrite Module ships with 3 built-in functions: * ToLower - returns the input string converted to lower case. * UrlEncode - returns the input string converted to URL-encoded format. This function can be used if the substitution URL in rewrite rule contains special characters (for example non-ASCII or URI-unsafe characters). * UrlDecode - decodes the URL-encoded input string. This function can be used to decode a condition input before matching it against a pattern. The functions can be invoked by using the following syntax: {function_name:any_string} The question is: can this list be extended by introducing a Replace function that's available for changing values within a rewrite rule action or condition? Another way to frame the question: is there any way to do a global replace on a URL coming in using this module? It seems that you're limited to using regular expressions and back-references to construct strings, without a search/replace functionality to replace every X with Y in {REQUEST_URI} before issuing a redirect.

    Read the article

  • Specific Strings And NSScanner

    - by Garry
    I need to determine whether a string (sourceString) contains another string (queryString) and if it does, at what offset. I'm guessing that NSScanner might do the trick but I don't fully understand the documentation. Let's say sourceString = @"What's the weather in London today?" If I set queryString to equal @"What's the weather", I'd like a method that would determine that, in this case, YES (sourceString does contain queryString) and the offset is 0 (i.e. at the start of sourceString). Any suggestions?

    Read the article

  • Using jQuery, how to modify text outside of tags?

    - by Jacob
    Given a string of text that is both adjacent to a span and inside of a div, what are some methods to modify just that text, leaving the surrounding HTML intact? For example: <div id="my-div">modify this text<span id="my-span"></span></div> I have tried things like $('#my-div').html(function(i, elem){blah;}); but this seems to cause the span to be deleted and a new span to be added, because some styling is lost. I realize that it would be best to wrap the text string in its own HTML tags before applying client-side code, but that is out of my control.

    Read the article

  • Attaching catalog with SQL Authentication credentials attaches it as Read-Only

    - by Nissim
    Hello, As part of our product's installation process, a database is attached to the server. We use EXEC sp_attach_db in order to attach it to MSSQL. The problem occures when we try to attach it with "SQL Authentication" connection string - the database is attached to the server as read-only, thus preventing any write access from being performed This is driving us nuts... it's working just fine with Windows Authentication, and the only difference is the connection string... I tried googling for it but no mention for such a scenario is found. Any ideas anyone? It's important to mention that the MDF/LDF physical files are not set with "ReadOnly" attribute, so this is not the problem.

    Read the article

  • How do I create an NSArray with string literals?

    - by Kyle
    I'm attempting to create an NSArray with a grouping of string literals, however I get the compile error "Initializer element is not constant". NSArray *currencies = [NSArray arrayWithObjects:@"Dollar", @"Euro", @"Pound", nil]; Could someone point out what I'm doing wrong, and possibly explain the error message?

    Read the article

  • moving EDMX file System.Data.MetadataException: Unable to load the specified metadata resource.

    - by Dani
    I have a ASP.NET MVC 2 project. I've created edmx file on the class library project that holds the model. now I've created another class library called it shared and moved the edmx file over there. resolved some issues, everything compiles, but it can't find the connection string resource at runtime. I've copied the ConnectionString part of the Web.Config to the main file, the old class library app.config file and the new class library app.config file. Still get this error: System.Data.MetadataException: Unable to load the specified metadata resource. Line 75: public myProjdb() : base("name=myProjdb", "MyProjdb") in the MyProj.Designer.cs file. Any Idea how to resolve this issue ? Is there a better way to store connection string data ?

    Read the article

  • PHP - string to image only produces black background

    - by Phil Jackson
    Hi im really having a problem find how to fix this. $string = "foo"; $font = 4; $width = ImageFontWidth($font) * strlen($string); $height = ImageFontHeight($font); $im = @imagecreatetruecolor ($width,$height); $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 0, 0, 0); imagestring($im, 5, 0, 0, $string, $textcolor); imagegif($im, 'somefile.gif', 8); imagedestroy($im); I cannot seem to change the background from black. Does anyone have any ideas?

    Read the article

  • Store code line in a string?

    - by user1342164
    I need to store code in a string so that if a value is true, it is in the code line if not true its not in the code line. When I populate summarytextbox if consulting amount is "" then dont use this code if is does have an amount include the code. Is this possible? Other wise I would have to do a bunch if then statements. When I do the following below it cant convert to double. Dim ConsultingFee As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Session("ConsultingFeeAmount") = "" Then Else 'Store the following line in a string???? ConsultingFee = +Environment.NewLine + Session("ConsultingFee") + " Amount: " + Session("ConsultingFeeAmount") End If SummaryTextBox.Text = Session("TeachingHospital") + Environment.NewLine + Session("HospitalAddress") + Environment.NewLine + Session("HospitalCity") + Environment.NewLine + Session("HospitalState") + Environment.NewLine + Session("HospitalZip") + Environment.NewLine + Session("HospitalTIN") + ConsultingFee End Sub

    Read the article

  • AES Key encoded byte[] to String and back to byte[]

    - by Tom Brito
    In the similar question "Conversion of byte[] into a String and then back to a byte[]" is said to not to do the byte[] to String and back conversion, what looks like apply to most cases, mainly when you don't know the encoding used. But, in my case I'm trying to save to a DB the javax.crypto.SecretKey data, and recoverd it after. The interface provide a method getEncoded() which returns the key data encoded as byte[], and with another class I can use this byte[] to recover the key. So, the question is, how do I write the key bytes as String, and later get back the byte[] to regenerate the key?

    Read the article

  • C# COM+ component isn't getting the constructor string

    - by Kyle W
    I've created a COM+ component in C# with a strong name, COM Visible, ProgId, etc... I've then registered the assembly with regasm, and imported it into the COM+ Applications in Component Services. It runs just fine, and loads up the DLL, except that the constructor string that is passed in is always empty. The method signature is protected override void Construct(string constructString), and it is being called before the method on the actual component. In the component details in COM+ Applications, the constructor string is checked and a value is entered. Any help is appreciated.

    Read the article

  • Convert long number as string in the serialization

    - by Bruno
    I have a custom made class that use a long as ID. However, when I call my action using ajax, my ID is truncated and it loses the last 2 numbers because javascript loses precision when dealing with large numbers. My solution would be to give a string to my javascript, but the ID have to stay as a long on the server side. Is there a way to serialize the property as a string? I'm looking for some kind of attribute. Controller public class CustomersController : ApiController { public IEnumerable<CustomerEntity> Get() { yield return new CustomerEntity() { ID = 1306270928525862486, Name = "Test" }; } } Model public class CustomerEntity { public long ID { get; set; } public string Name { get; set; } } JSON Result [{"Name":"Test","ID":1306270928525862400}]

    Read the article

  • SQL select statement - returning records starting with variable length string

    - by alpheus
    I am using an alphabetical sorting feature and need a SQL statement to return records beginning with a variable length string. However, records also need to be returned if there are periods, spaces, or dashes between any of the characters in the string. For example, the string could be "M" (easy). Or "MA" (in which case it needs to return records starting with "MA", "M.A", "M A", and "M-A"). Or "MAA", and so on. This is the statement I have so far: "SELECT * from table where LEFT(name," + value.Length + ")='" + value + "'" But I can't work out how to get it to return results where there are periods, spaces or dashes in name. Any help constructing the statement would be great.

    Read the article

  • Escaping and unescaping a string with single and double quotes in Javascript

    - by Reina
    I have a search box that a user can search for any string including single AND double quotes, once they have searched, the backend is passing the keyword back to me so I can put it back in the box. I don't know what the string is so I can't escape quotes myself, below is an example: var keyword = "hello"; $("#selectionkeywords").val(); The issue I am having is that if the user enters "hello" the keyword becomes ""hello"" and I get this error: missing ) after argument list [Break On This Error] jQuery("#selectionkeywords").val(""hello""); The user could also enter single quotes so that rules it out as well. I tried using escape unescape but I still have the same issue e.g. escape(""hello"") I could get the value in an unescaped format e.g. "hello" but I don't know what to do with it, escape doesn't work on it I end up with this %26%23034%3Bhello%26%23034%3B So I'm pretty much stuck at the moment as I can't do anything to the string, any ideas?

    Read the article

< Previous Page | 99 100 101 102 103 104 105 106 107 108 109 110  | Next Page >