Search Results

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

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

  • Changing href atributes with nokogiri and ruby on rails

    - by fool
    Hi, I Have a HTML document with links links, for exemple: <html> <body> <ul> <li><a href="http://someurl.com/etc/etc">teste1</a></li> <li><a href="http://someurl.com/etc/etc">teste2</a></li> <li><a href="http://someurl.com/etc/etc">teste3</a></li> <ul> </body> </html> I want with Ruby on Rails, with nokogiri or some other method, to have a final doc like this: <html> <body> <ul> <li><a href="http://myproxy.com/?url=http://someurl.com/etc/etc">teste1</a></li> <li><a href="http://myproxy.com/?url=http://someurl.com/etc/etc">teste2</a></li> <li><a href="http://myproxy.com/?url=http://someurl.com/etc/etc">teste3</a></li> <ul> </body> </html> What's the best strategy to achieve this?

    Read the article

  • Java equivalent of C# @

    - by Simon Rigby
    Hi all, Quick question. Is there an equivalent of @ as applied to strings in Java: For example I can do @"c:\afolder\afile" in C# and have it ignore the escape characters when processing instead of having to do "c:\afolder\aFile". Is there a Java equivalent? hmmm: stackoverflow is escaping on me .. lol. The second example should read: c:(double-backslash)afolder(double-backslash)aFile

    Read the article

  • convert xml.documentElement.getElementsByTagName("marker")[index].getAttribute(temp) to string in ja

    - by user324884
    I am parsing xml file in javascript and after that want to cancatenate all the the data into string. but failing to do the same and it is returning undefined. GDownloadUrl("./include/dataemp2.xml", function(data) { var xml = GXml.parse(data); markers = xml.documentElement.getElementsByTagName("marker"); for(var t=0;t<18;t++) { var temp= markers[index].getAttribute("address"); html = html + temp; } }); it is returning as undefined because temp is not concatenating in "html"; whereas when i do this like html = html +markers[index].getAttribute("address"); it is giving me expected output;

    Read the article

  • substring with linq??

    - by phenevo
    I've got collection of words, and i wanna create collection from this collection limited to 5 chars Input: Car Collection Limited stackoverflow Output: car colle limit stack word.Substring(0,5) throws exception (length) word.Take(10) is not good idea, too... Any good ideas ??

    Read the article

  • php - preg_replace not working when string contains a hashtag

    - by Steven
    I found a function online for turning a url within a string into a clickable link. However, when the url contains a hashtag it doesn't work. eg. http://www.bbc.co.uk/radio1/photos/fearnecotton/5759/1#gallery5759 Here's the part of the function concerned: $ret = preg_replace( "#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret ); $ret = preg_replace( "#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret ); Any ideas? thanks

    Read the article

  • Convert any currency string to double

    - by James
    I need to store multiple currencies in SQL server. I understand that SQL won't support all different types of currencies (unless I store it as a string, but I don't want to do that). My idea was to convert all the values from their currency format to a standard double and store that instead. Then just re-format based on the culture info when displaying. However, I have tried doing something like e.g. var cultureInfo = new System.Globalization.CultureInfo("en-US"); double plain = return Double.Parse("$20,000.00", cultureInfo); This doesn't ever seem to work it always throws a FormatException. Even removing the currency symbol and just trying to do this based on the number alone does the same thing. This is just an example I want to support pretty much any type of currency. Is there a standard way of stripping out currency and getting the value as a double?

    Read the article

  • Can I free memory passed to SysAllocString?

    - by RichAmberale
    When allocating a new BSTR with SysAllocString via a wchar_t* on the heap, should I then free the original wchar_t* on the heap? So is this the right way? wchar_t *hs = new wchar_t[20]; // load some wchar's into hs... BSTR bs = SysAllocString(hs); delete[] hs; Am I supposed to call delete here to free up the memory? Or was that memory just adoped by the BSTR?

    Read the article

  • Any clever way to fix 'string or binary data would be truncated' warning with LINQ

    - by Simon_Weaver
    Is there a clever way to determine which field is causing 'string or binary data would be truncated' with LINQ. I've always ended up doing it manually by stepping through a debugger, but with a batch using 'SubmitChanges' I have to change my code to inserting a single row to find the culprit in a batch of rows. Am I missing something or in this day and age do I really have to still use a brute force method to find the problem. Please dont give me advice on avoiding this error in future (unless its something much cleverer than 'validate your data'). The source data is coming from a different system where I dont have full control anyway - plus I want to be lazy. PS. Does SQL Server 2008 actually tell me the field name. Please tell me it does! I'll upgrade!

    Read the article

  • Java - Parsing a Date from a String

    - by Yatendra Goel
    I want to parse a java.util.Date from a String. I tried the following code but got unexpected output: Date getDate() { Date date = null; SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd"); try { date = sdf.parse("Sat May 11"); } catch (ParseException ex) { Logger.getLogger(URLExtractor.class.getName()).log(Level.SEVERE, null, ex); return null; } return date; } When I run the above code, I got the following output: Mon May 11 00:00:00 IST 1970

    Read the article

  • How to store dynamic references to parts of a text

    - by Antoine L
    In fact, my question concerns an algorithm. I need to be able to attach annotations to certain parts of a text, like a word or a group of words. The first thing that came to me to do so is to store the position of this part (indexes) in the text. For instance, in the text 'The quick brown fox jumps over the lazy dog', I'd like to attach an annotation to 'quick brown fox', so the indexes of the annotation would be 4 - 14. But since the text is editable (other annotations could provoke a modification from text's author), the annoted part is likely to move (the indexes could change). In fact, I don't know how to update the indexes of the annoted part. What if the text becomes 'Everyday, the quick brown fox jumps over the lazy dog' ? I guess I have to watch every change of the text in the front-end application ? The front-end part of the application will be HTML with Javascript. I will be using PHP to develop the back-end part and every text and annotation will be stored in a database.

    Read the article

  • Splitting a string in ASP Classic

    - by Sam
    So here's my string: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam elit lacus, dignissim quis laoreet non, cursus id eros. Etiam lacinia tortor vel purus eleifend accumsan. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque bibendum vestibulum nisl vitae volutpat. I need to split it every 100 characters (full words only) until all the characters are used up. So we'd end up with: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam elit lacus, dignissim quis laoreet non, and cursus id eros. Etiam lacinia tortor vel purus eleifend accumsan. Pellentesque habitant morbi tristique and senectus et netus et malesuada fames ac turpis egestas. Quisque bibendum vestibulum nisl vitae volutpat. Any ideas on the best way to do that?

    Read the article

  • Double value not correct on Device

    - by Clue
    int min = Int32.Parse(minutebox.Text); double kj = Convert.ToDouble(a.kj); double res = ((kj * op.koerpergewicht) * min); textbox.Text = res.ToString(); Shows me the correct number (with its punctuation - i. e. 2.33) on my English WP7-Emulator. However it doesn't work on my Device, which is set to German. The value is correct but the point, comma or whatever in that double value isn't shown correct. 43.22 on Emulator - 4322 on Device Why is that?

    Read the article

  • Remove All After Deliminator PHP

    - by Belgin Fish
    Hi, I'm just wondering how I could remove everything after a certain deliminator in PHP ex: Posted On April 6th By Some Dude I'd like to have it so that it removes all the text including, and after, the deliminator "by" Thanks

    Read the article

  • PHP getimagesize with ampersand in string creates errors

    - by RobHardgood
    I'm using the getimagesize function in PHP, and the path string contains an ampersand, which otherwise is fine. The page gives me errors where getimagesize() is called. Looking at the source code, though, I see the ampersand is being passed through as & rather than just & I presume this is causing errors because PHP doesn't need to convert it to the html tag in order to find the path, right? Here is the error: Warning: getimagesize(image.php?name=username&pic=picture) [function.getimagesize]: failed to open stream: No such file or directory

    Read the article

  • How do I sort an ArrayList lexicographically?

    - by Jake
    I am trying to sort an ArrayList of Strings that represent card values. So, some cards contain letters ("King") and some contain Strings containing only a number ("7"). I know to use Collections.sort, but it only sorts Strings that contain letters. How do I get the ArrayList to be sorted by number as well as alphabetically?

    Read the article

  • how to use char* as char[]

    - by phunehehe
    Hello, I have a struck like this typedef struct bookStruct { char title[80]; char author[80]; } BookType; And I have two strings like this char *title = "A Book on C"; char *author = "A. Kelly"; Now I can't create a BookType like this BookType book = {title, author}; Can anyone tell me what is wrong? How can I do that?

    Read the article

  • How to do this Python / MySQL manipulation (match) more efficiently?

    - by NJTechie
    Following is my data : Company Table : ID Company Address City State Zip Phone 1 ABC 123 Oak St Philly PA 17542 7329878901 2 CDE 111 Joe St Newark NJ 08654 3 GHI 211 Foe St Brick NJ 07740 7321178901 4 JAK 777 Wall Ocean NJ 07764 7322278901 5 KLE 87 Ilk St Plains NY 07654 7376578901 6 AB 1 W.House SField PA 87656 7329878901 Branch Office Table : ID Address City State Zip Phone 1 323 Alk St Philly PA 17542 7329832221 1 171 Joe St Newark NJ 08654 3 287 Foe St Brick NJ 07740 7321178901 3 700 Wall Ocean NJ 07764 7322278901 1 89 Blk St Surrey NY 07154 7376222901 File to be Matched (In MySQL): ID Company Address City State Zip Phone 1 ABC 123 Oak St Philly PA 17542 7329878901 2 AB 171 Joe St Newark NJ 08654 3 GHI 211 Foe St Brick NJ 07740 7321178901 4 JAK 777 Wall Ocean NJ 07764 7322278901 5 K 87 Ilk St Plains NY 07654 7376578901 Resulting File : ID Company Address City State Zip Phone appendedID 1 ABC 123 Oak St Philly PA 17542 7329878901 [Original record, field always empty] 1 ABC 171 Joe St Newark NJ 08654 1 [Company Table] 1 ABC 323 Alk St Philly PA 17542 7329832221 1 [Branch Office Table] 1 AB 1 W.House SField PA 87656 7329878901 6 [Partial firm and State, Zip match] 2 CDE 111 Joe St Newark NJ 08654 3 GHI 211 Foe St Brick NJ 07740 7321178901 3 GHI 700 Wall Ocean NJ 07764 7322278901 3 3 GHI 287 Foe St Brick NJ 07740 7321178901 3 4 JAK 777 Wall Ocean NJ 07764 7322278901 5 KLE 87 Ilk St Surrey NY 07654 7376578901 5 KLE 89 Blk St Surrey NY 07154 7376222901 5 Requirement : 1) I have to match each firm on the 'File to be Matched' to that of Company and Branch Office tables (MySQL). 2) If there are multiple exact/partial matches, then the ID from Company, Branch Office table is inserted as a new row in the resulting file. 3) Not all the firms will be matched perfectly, in that case I have to match on partial Company names (like 5/8th of the company name) and any of the address fields and insert them in the resulting file. Please help me out in the most efficient solution for this problem.

    Read the article

  • how can I parse and group/do stats on user agent strings?

    - by user151841
    I have a database that has the various user-agent strings of visitors to our site. I'd like to do a 'survey' of them to see what browsers our users are using, so that I can know what features I can use in future development. Is there a tool to parse and run statistics on user-agent strings, or a bunch of strings like this? Ideally, I'd like to see a hierarchical grouping of the stats. For instance: Opera/9.80 (Windows Mobile; WCE; Opera Mobi/WMD-50301; U; en) Presto/2.4.13 Version/10.00 Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14912/1280; U; en) Presto/2.2.0 Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.13918/812; U; en) Presto/2.2.0 Opera/9.64 (Macintosh; Intel Mac OS X; U; en) Presto/2.1.1 Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.13918/786; U; en) Presto/2.2.0 Opera/9.60 (J2ME/MIDP; Opera Mini/4.0.10992/432; U; en) Presto/2.2.0 I'd like to see 6 entries for Opera, broken down into 3 for 9.80, 1 for 9.64 and 2 for 9.60, and so forth for all browsers. Other dimensions, such as OS, would cross the boundaries of the browser version hierarchy, but it might be nice to see also.

    Read the article

  • Convert Hexadecimal String to Data

    - by AriX
    Hi Stack Overflow, I have found a whole lot of different solutions to this problem, but not all of them work, and a lot of them seem somewhat hacky and inefficient. Basically I have a string of hexadecimal data (i.e. "55 AA 41 2A 00 94 55 AA BB BB 00 FF") which I would like to convert to raw data. What is the best way to do this? UPDATE: Vicky's solution worked great for me, but I changed it to work with hexadecimal strings that don't have spaces in between and changed the style a bit. int i = 0; char *hexString = "55AA412A009455AABBBB00FF" char *hexPtr = hexString; unsigned int *result = calloc(strlen(hexString)/2 + 1, sizeof *result); while (sscanf(hexPtr, "%02x", &result[i++])) { hexPtr += 2; if (hexPtr >= hexString + strlen(hexString)) break; } return result;

    Read the article

  • READING stderr from within Awk

    - by Dave
    I want to keep SSH debug info separate (and logged) from other input. However, if I simply redirect stderr to a log file, I risk combining output from SSH and output from the remote process on the host machine (that might send something to stderr): $ ssh -v somemachine 2 file.log So, I want to filter out only those lines that match "debug1": $ ssh -v somemachine | awk '/debug1/ {print "file.log"; next} {print}' Good so far, BUT ssh's debug output goes to stderr. So... $ ssh -v somemachine 2& | awk '/debug1/ {print "file.log"; next} {print}' Foiled again! I don't want to mix stdout and stderr. BAD! What does a kid like me do? I was about to go the route of named pipes or some such wildeness, but really, all I need to know is how to get awk to match patterns from stderr ONLY.

    Read the article

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