Search Results

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

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

  • NSData to display as a string

    - by topace
    Hello all, this is my first post. I am building an iPhone app and stuck with the following: unsigned char hashedChars[32]; CC_SHA256([inputString UTF8String], [inputString lengthOfBytesUsingEncoding:NSASCIIStringEncoding], hashedChars); NSData *hashedData = [NSData dataWithBytes:hashedChars length:32]; NSLog(@"hashedData = %@", hashedData); The log is showing like: hashedData = <abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh> But what I need is to convert hashedData into NSString that looks like: NSString *someString = @"abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh"; So basically the string needs to be like hashedData except I don't want the angle brackets and spaces in between. Any help is much appreciated.

    Read the article

  • Insert string from database into an aspx and have databinding expressions within that text evaluated

    - by Christopher Edwards
    Well, as you can see I want something quick-and-dirty! How can I get a string from a db that has aspx databinding syntax in it and have the databinding expressions evaluated? So I have text such as this stored in the DB:- Hello <%=User.Name %> I haven't seen you since <%=User.LastVisit %> And I want it to be inserted here say:- ... <body> <form id="form1" runat="server"> <div> <asp:FormView ID="FormView1" DataSourceID="DataSource1" runat="server"> <ItemTemplate> <-- insert stuff here! --> ... But with the databinding expressions evaluated. I'd rather not build a full parsing, templating and evaluation engine...

    Read the article

  • split html text in 2 paragraphs

    - by Luca Romagnoli
    hi i have a html text like this: aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa aa</a> adsfsadfsadfs i want to split it in 2 paragraphs. but i don't want to generate this situation: <p>aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa</p><p> aa</a> adsfsadfsadfs</p> how can i check if the split involves any tags and avoid it? thanks

    Read the article

  • SEARCHING AND REPLACING BRACKETS IN A STRING IN ORACLE 10G

    - by Tunde
    hello, Thanks as usual for your prompt and kind suggestions. i am currently developing a function that is meant to execute dynamically created SQL statements. this is done by concatenating the columns and fetching them via cursors. the problem is that when there is a function with a comma between its arguments, the concat concatenates the contents of the functions inclusive. Is it possible to skip contents of every bracket found in a string using REGEXP_SUBTR or REGEXP_REPLACE? Many thanks for the anticipated response.

    Read the article

  • Can I get a PTypeInfo from a string?

    - by Mason Wheeler
    This is probably going to be a "no", but is there any way I can use Delphi's RTTI, either old-school or the 2010 extended RTTI, to pass in a string containing the name of a type, specifically the name of an enumerated type, and have it give me the PTypeInfo for that type? I've looked through RTTI.pas and TypInfo.pas and I don't see any function that would do that, but I might have missed something. What I'm looking for: var info: PTypeInfo; begin info := GetTypeInfoFromName('TComponentStyle'); end; Or something like that. Thing is, the name of the enumerated type would be passed in; it wouldn't be known at compile time.

    Read the article

  • How do you print a limited number of characters?

    - by Mike Pateras
    Sorry to put a post up about something so simple, but I don't see what I'm doing wrong here. char data[1024]; DWORD numRead; ReadFile(handle, data, 1024, &numRead, NULL); if (numRead > 0) printf(data, "%.5s"); My intention with the above is to read data from a file, and then only print out 5 characters. However, it prints out all 1024 characters, which is contrary to what I'm reading here. The goal, of course, is to do something like: printf(data, "%.*s", numRead); What am I doing wrong here?

    Read the article

  • Interview question: Check if one string is a rotation of other string.

    - by Webdev
    A friend of mine was asked the following question today at interview for the position of software developer. Given two string s1 and s2 how will you check if s1 is a rotated version of s2 ? Example: if s1 = "stackoverflow"; then the following are some of its rotated versions: "tackoverflows" "ackoverflowst" "overflowstack" where as "stackoverflwo" is not a rotated version. The answer he gave was: Take s2 and find the logest prefix that is a substring of s1, that will give you the point of rotation. Once you find that point, break s2 at that point to get s2a and s2b, then just check if concatenate(s2a,s2b) == s1 It looks like a good solution to me and my friend. But the interviewr though otherwise. He asked for a simpler solution. Please help me by telling how would you do this in Java/C/C++ ? Thanks in advance.

    Read the article

  • Regex to Exclude Double spaces

    - by Ian
    Hi, I am looking for a regular expression for c# asp.net 3.5 that will fail if there are ever any double spaces in a sentence or group of words. the cat chased the dog = true the cat chased the dog = false (doubles spaces occur at random intervals) thanks

    Read the article

  • Copying a java text file into a String.

    - by Deepak Konidena
    Hi, I run into the following errors when i try to store a large file into a string. Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2882) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:515) at java.lang.StringBuffer.append(StringBuffer.java:306) at rdr2str.ReaderToString.main(ReaderToString.java:52) As is evident, i am running out of heap space. Basically my pgm looks like something like this. FileReader fr = new FileReader(<filepath>); sb = new StringBuffer(); char[] b = new char[BLKSIZ]; while ((n = fr.read(b)) > 0) sb.append(b, 0, n); fileString = sb.toString(); Can someone suggest me why i am running into heap space error? Thanks.

    Read the article

  • Parsing a String into date with pattern:"dd/MM/yyyy"

    - by kawtousse
    Hi, I want to insert a date having this format MM/dd/YYYY for example:04/29/2010 to 29/04/2010 to be inserted into mysql database in a field typed Date. So i have this code: String dateimput=request.getParameter("datepicker"); DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Date dt = null; try { dt = df.parse(dateimput); System.out.println("date imput is:" +dt); } catch (ParseException e) { e.printStackTrace(); } but it gives me those error: 1-date imput is:Fri May 04 00:00:00 CEST 2012 (it is not the correct value that have been entered). 2-dismatching with mysql date type. I can not detect the error exactly. Please help.

    Read the article

  • Insert multiple records from a XML string differing on one parameter in SQL SERVER 2008

    - by Rohit
    Below in a query which inserts records to SimpleDictationProfileMapping table after reading it from a XML string. Now this query inserts a single record in which DictationCaptureProfileID is @dictationCaptureProfileId . Now i want to insert multiple rows in which @dictationCaptureProfileId is different and other 2 values are same. What i want to achieve by this is in case parent changes all child values should also change. INSERT INTO SimpleDictationProfileMapping ( DictationCaptureProfileID, DictationProfileMappingAttributeID, DictationProfileMappingAttributeValue ) SELECT @dictationCaptureProfileId, row.value('@attrId','varchar(max)'), row.value('@value', 'varchar(max)') FROM @simpleDictationCaptureProfileMappings.nodes('/simpleMappingAtribute/attribute') AS d ( row ) ; I want INSERT INTO SimpleDictationProfileMapping ( DictationCaptureProfileID OR (SELECT DictationCaptureProfileID FROM DictationCaptureProfile WHERE SystemDictationCaptureProfileID = @systemDictationCaptureProfileID), DictationProfileMappingAttributeID, DictationProfileMappingAttributeValue ) SELECT @dictationCaptureProfileId , row.value('@attrId','varchar(max)'), row.value('@value', 'varchar(max)') FROM @simpleDictationCaptureProfileMappings.nodes ('/simpleMappingAtribute/attribute') AS d ( row ) ; Please tell how to achieve this.

    Read the article

  • Python named print?

    - by Mark
    I know it's a really simple question, but I have no idea how to google it. how can I do print '<a href="%s">%s</a>' % (my_url) So that my_url is used twice? I assume I have to "name" the %s and then use a dict in the params, but I'm not sure of the proper syntax? just FYI, I'm aware I can just use my_url twice in the params, but that's not the point :)

    Read the article

  • Search for a String and replace it with a variable

    - by chrissygormley
    Hello, I am trying to use regular expression to search a document fo a UUID number and replace the end of it with a new number. The code I have so far is: read_file = open('test.txt', 'r+') write_file = open('test.txt', 'w') r = re.compile(r'(self.uid\s*=\s*5EFF837F-EFC2-4c32-A3D4\s*)(\S+)') for l in read_file: m1 = r.match(l) if m1: new=(str,m1.group(2)) new?????? This where I get stuck. The file test.txt has the below UUID stored in it: self.uid = '5EFF837F-EFC2-4c32-A3D4-D15C7F9E1F22' I want to replace the part D15C7F9E1F22. I have also tried this: r = re.compile(r'(self.uid\s*=\s*)(\S+)') for l in fp: m1 = r.match(l) new=map(int,m1.group(2).split("-") new[4]='RHUI5345JO' But I cannot seem to match the string. Thanks in advance for any help.

    Read the article

  • Convert a list of strings [ '3', '1' , '2'] to a list of sorted integers [ 1, 2, 3] in Python, how?

    - by Shamim
    I have: L1 = ['11', '10', '13', '12', '15', '14', '1', '3', '2', '5', '4', '7', '6', '9', '8'] this is a list of strings, right? I need to make it a list of integers as follows: L2 = [11, 10, 13, 12, 15, 14, 1, 3, 2, 5, 4, 7, 6, 9, 8] finally I will sort it like below: L3 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] by L2.sort() please let me know how I can get to L3 from L1

    Read the article

  • Searching through Collections in Java

    - by Click Upvote
    I have a java properties file containing a key/value pair of country names and codes. I will load the contents of this file into a Collection like List or HashMap. Then, I want users to be able to search for a country, e.g if they type 'Aus' in a textbox and click submit, then I want to search through the collection I have, containing a key/value pair of country codes/names (e.g AUS=Australia), and return those countries which are found matching. Is there any more efficient way of doing this, other than looping through the elements of the collection and using charAt()?

    Read the article

  • Why many "normal" string in my flashlog file

    - by randy
    I suddenly find that there are many "normal" trace in my file flashlog.txt (supposed at your Window's location:{SysDrive}:\Documents and Settings{yourName}\Application Data\Macromedia\Flash Player\Logs). normal normal normal normal normal normal 1/10/2011 15:32:13.008 [INFO] org.spicefactory.parsley.core.view.impl.DefaultViewManager Add view root: null/flash.display::Stage normal normal normal But when I run the application with the FlashBuilder, the logging in the consul page is ok, it doesn't include any "normal" String. I am very confused by this, I thought that the output of the flashlog.txt file should be the same as that of the consul of FlashBuilder.And I don't think I have added such a stupid trace in my code. The question is how can I find out where these "normal" trace come from and how to remove it. This problem is resolved by restarting the computer as suggested.

    Read the article

  • How do we achieve "substring-match" under O(n) time?

    - by Pacerier
    I have an assignment that requires reading a huge file of random inputs, for example: Adana Izmir Adnan Menderes Apt Addis Ababa Aden ADIYAMAN ALDAN Amman Marka Intl Airport Adak Island Adelaide Airport ANURADHAPURA Kodiak Apt DALLAS/ADDISON Ardabil ANDREWS AFB etc.. If I specify a search term, the program is supposed to find the lines whereby a substring occurs. For example, if the search term is "uradha", the program is supposed to show ANURADHAPURA. If the search term is "airport", the program is supposed to show Amman Marka Intl Airport, Adelaide Airport A quote from the assignment specs: "You are to program this application taking efficiency into account as though large amounts of data and processing is involved.." I could easily achieve this functionality using a loop but the performance would be O(n). I was thinking of using a trie but it seems to only work if the substring starts from index 0. I was wondering what solutions are there which gives a performance better than O(n)?

    Read the article

  • Choosing connectionstring in VB.NET application at startup

    - by MatsT
    I have a VB.NET application with a connection to an SQL Server 2003. On the server there are two databases, MyDatabase and MyDatabase_Test. What I would like to do is to show a dialog when the program starts that let's the user choose which database to use. My idea is to create a new form as the starup form that sets this property and then launches the main form. Currently the connectionstring is specified in the application config file. Best would be if I can specify two different connection strings in that file to choose from, but for now it is also acceptable with other solutions like hardcoding the two connectionstrings into the startup form.

    Read the article

  • split sting in xsl for content with /

    - by kristina
    I have some content being pulled in from an external xml with xsl. in the xml the title is merged with the author with a backslash seperating them. How do I seperate the title and author in xsl so I can have them with differnt tags The Maze / Jane Evans to be The Maze Jane Evans Thanks

    Read the article

  • How do make my encryption algorithm encrypt more than 128 bits?

    - by Ranhiru
    OK, now I have coded for an implementation of AES-128 :) It is working fine. It takes in 128 bits, encrypts and returns 128 bits So how do i enhance my function so that it can handle more than 128 bits? How do i make the encryption algorithm handle larger strings? Can the same algorithm be used to encrypt files? :) The function definition is public byte[] Cipher(byte[] input) { }

    Read the article

  • Convert matched string of UTF-8 values to UTF-8 characters in Ruby

    - by user1475154
    Trying to convert output from a rest_client GET to the characters that are represented with escape sequences. Input: ..."sub_id":"\u0d9c\u8138\u8134\u3f30\u8139\u2b71"... (which I put in 'all_subs') Match: m = /sub_id\"\:\"([^\"]+)\"/.match(all_subs.to_str) [1] Print: puts m.force_encoding("UTF-8").unpack('U*').pack('U*') But it just comes out the same way I put it in. ie, "\u0d9c\u8138\u8134\u3f30\u8139\u2b71" However, if I convert a raw string of it: puts "\u0d9c\u8138\u8134\u3f30\u8139\u2b71".unpack('U*').pack('U*') The output is perfect as "??????"

    Read the article

  • How to prefix a positive number with plus sign in PHP

    - by user318466
    I need to design a function to return negative numbers unchanged but should add a + sign at the start of the number if its already no present. Example: Input Output ---------------- +1 +1 1 +1 -1 -1 It will get only numeric input. function formatNum($num) { # something here..perhaps a regex? } This function is going to be called several times in echo/print so the quicker the better.

    Read the article

  • Typecast to a type from just the string representation of the type name

    - by Water Cooler v2
    sTypeName = ... //do some string stuff here to get the name of the type /* The Assembly.CreateInstance function returns a type of System.object. I want to type cast it to the type whose name is sTypeName. assembly.CreateInstance(sTypeName) So, in effect I want to do something like: */ assembly.CreateInstance(sTypeName) as Type.GetType(sTypeName); How do I do that? And, what do I take on the left side of the assignment expression, assuming this is C# 2.0. I don't have the var keyword.

    Read the article

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