Search Results

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

Page 197/1488 | < Previous Page | 193 194 195 196 197 198 199 200 201 202 203 204  | Next Page >

  • PHP stream_context_set_option SSL certificate as string

    - by Roger Thomas
    I've got a weird issue. Basically, I need to do this: $handle = stream_context_create(); stream_context_set_option($handle , 'ssl', 'local_cert', '/tmp/cert'); However. The certificate is not held as a file within the server. Rather it's an encrypted string held in a clustered database environment. So instead of the certificate being a file name pointer, its the physical content of the certificate. So instead of using the file name, I need to specify the content of the certificate instead. For example: $cert = '-----BEGIN CERTIFICATE-----.... upWbwmdMd61SjNCdtOpZcNW3YmzuT96Fr7GUPiDQ -----END CERTIFICATE-----'; Does anyone have any idea whatsoever how on earth I can do this? I'm scratching my head over this problem, but my gut instinct says it is doable. Thanks in advance everyone!

    Read the article

  • NSDictionary with key => String and Value => c-Style array

    - by Gautam Borad
    I need an NSDictionary which has key in the form of string (@"key1", @"key2") and value in the form of a C-style two-dimentional array (valueArray1,valueArray2) where valueArray1 is defined as : int valueArray1[8][3] = { {25,10,65},{50,30,75},{60,45,80},{75,60,10}, {10,70,80},{90,30,80},{20,15,90},{20,20,15} }; And same for valueArray2. My aim is given an NSString i need to fetch the corresponding two-dimentional array. I guess using an NSArray, instead of c-style array, will work but then i cannot initialize the arrays as done above (i have many such arrays). If, however, that is doable please let me know how. Currently the following is giving a warning "Passing argument 1 of 'dictionaryWithObjectsAndKeys:' from incompatible pointer type" : NSDictionary *myDict = [NSDictionary dictionaryWithObjectsAndKeys:valueArray1,@"key1", valueArray2,@"key2",nil];

    Read the article

  • BASH statements execute alone but return "no such file" in for loop.

    - by reve_etrange
    Another one I can't find an answer for, and it feels like I've gone mad. I have a BASH script using a for loop to run a complex command (many protein sequence alignments) on a lot of files (~5000). The loop produces statements that will execute when given alone (i.e. copy-pasted from the error message to the command prompt), but which return "no such file or directory" inside the loop. Script below; there are actually several more arguments but this includes some representative ones and the file arguments. #!/bin/bash # Pass directory with targets as FASTA sequences as argument. # Arguments to psiblast # Common db=local/db/nr/nr outfile="/mnt/scratch/psi-blast" e=0.001 threads=8 itnum=5 pssm="/mnt/scratch/psi-blast/pssm." pssm_txt="/mnt/scratch/psi-blast/pssm." pseudo=0 pwa_inclusion=0.002 for i in ${1}/* do filename=$(basename $i) "local/ncbi-blast-2.2.23+/bin/psiblast\ -query ${i}\ -db $db\ -out ${outfile}/${filename}.out\ -evalue $e\ -num_threads $threads\ -num_iterations $itnum\ -out_pssm ${pssm}$filename\ -out_ascii_pssm ${pssm_txt}${filename}.txt\ -pseudocount $pseudo\ -inclusion_ethresh $pwa_inclusion" done Running this scripts gives "<scriptname> line <last line before 'done'>: <attempted command> : No such file or directory. If I then paste the attempted command onto the prompt it will run. Each of these commands takes a couple of minutes to run.

    Read the article

  • vb.net 2008 multilingual string display adding resources err:MissingManifestResourcesException

    - by Naresh
    Developing a multilingual application in VB.Net 2008, Im able to add resources to forms and create a multilingual forms depending on uiculture. On reading Msdn on creating the multilingual string values for messagebox contents, have added the .resource file to the project files path as specified. There is no error on compilation but throws the MissingManifestResourceException error Dim rm As ResourceManager rm = ResourceManager.CreateFileBasedResourceManager("strFormResources", ".", Nothing) Dim ci As CultureInfo ci = New CultureInfo("fr-FR") MessageBox.Show(rm.GetString("sample1", ci)) Could not find any resources appropriate for the specified culture (or the neutral culture) on disk. baseName: strFormResources locationInfo: fileName: strFormResources.resources There is strFormResources.resources and strFormResources.fr-FR.resources in Resources of the project. I have searched for this error details but could not find a solution. What am i doing wrong or is there any other method for displaying multilingual strings in the messagebox. Thanks in advance

    Read the article

  • Convert string to GUID with sscanf

    - by Andy Li
    I'm trying to convert a string to GUID with sscanf: GUID guid; sscanf( "11111111-2222-3333-4455-667788995511", "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", &guid.Data1, &guid.Data2, &guid.Data3, &guid.Data4[0], &guid.Data4[1], &guid.Data4[2], &guid.Data4[3], &guid.Data4[4], &guid.Data4[5], &guid.Data4[6], &guid.Data4[7]); However, in runtime, it fails and exits with "Error: Command failed". Why? How to fix it? I do not want to compile with /clr so cannot use System.

    Read the article

  • copy text (Indian language- GUjarati) from word document to web page text area problem.

    - by Avinash
    Hi all, I am developing one site in Indian language (Gujarati). My problem is as below: My client wants that they able to copy Gujarati text from word document and paste into the Text area. But when i copy text from word doc and paste into text area the its get converted to the English letters. http://www.chanakyanipothi.com/gujchanakya/Gopika.ttf Above is the link of fonts which I am using. I can provide you the demo code for you to make some work on it. Is there any special thing which I am missing. Hope I am clear to you. I am running in PHP and apache. Thanks Avinash

    Read the article

  • Python MQTT: TypeError: coercing to Unicode: need string or buffer, bool found

    - by user2923860
    When my python code tries to connect to the MQTT broker it gives me this Type Error: Update- I added the Complete Error Traceback (most recent call last): File "test.py", line 20, in <module> mqttc.connect(broker, 1883, 60, True) File "/usr/local/lib/python2.7/dist-packages/mosquitto.py", line 563, in connect return self.reconnect() File "/usr/local/lib/python2.7/dist-packages/mosquitto.py", line 632, in reconnect self._sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0)) File "/usr/lib/python2.7/socket.py", line 561, in create_connection sock.bind(source_address) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) TypeError: coercing to Unicode: need string or buffer, bool found The code of the python file is: #! /usr/bin/python import mosquitto broker = "localhost" #define what happens after connection def on_connect(rc): print "Connected" #On recipt of a message do action def on_message(msg): n = msg.payload t = msg.topic if t == "/test/topic": if n == "test": print "test message received" # create broker mqttc = mosquitto.Mosquitto("python_sub") #define callbacks mqttc.on_message = on_message mqttc.on_connect = on_connect #connect mqttc.connect(broker, 1883, 60, True) #Subscribe to topic mqttc.subscribe("/test/topic", 2) #keep connected while mqttc.loop() == 0: pass I have no idea why its giving me this it work 2 days ago.

    Read the article

  • Can a DevExpress XtraGrid be filled using a a Dynamic SELECT statement string

    - by Gerhard Weiss
    Can a DevExpress XtraGrid be filled using a a Dynamic SELECT statement string? i.e. SELECT * FROM Employee or SELECT * FROM Dependents To fill our XtraGrids currently, we use a ORM that creates entities. To do this it takes a lot of steps and time. What is driving me to ask this question is we do a lot of client aquistions where we get hundreds of files. I do not want to create entities for all of these then have to create an XtraGrid for each entity. Ideally if I can just feed it a SELECT statement and the XtraGrid could render it then I could use the XtraGrid very nice data minipulation features (Filter, Group By, etc). If you have any other ideas or suggestions please to not hesitate to post them.

    Read the article

  • Best way to sanitize content with PHP?

    - by Jens Törnell
    Which is the best way to "sanitize" content? An example... Example - Before sanitize: Morbi mollis ante vitae massa suscipit a tempus est pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla mattis iaculis consectetur. Morbi mollis ante vitae est pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla mattis iaculis consectetur. Example - After sanitize: <p>Morbi mollis ante vitae massa suscipit a tempus est pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla mattis iaculis consectetur.</p> <p>Morbi mollis ante vitae est pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla mattis iaculis consectetur.</p> What it should do It should add p-tags instead of line break like. It should remove empty space like tripple spaces It should remove double line breaks. It should remove tabs. It should remove line breaks and spaces before the content if any. It should remove line breaks and spaces after the content if any. Right know I use the str_replace function and it should be a better solution for this? I want the function to look like this: function sanitize($content) { // Do the magic! return $content; }

    Read the article

  • apostrophe in mysql/php

    - by fusion
    i'm trying to learn php/mysql. inserting data into mysql works fine but inserting those with apostrophe is generating an error. i tried using mysql_real_escape_string, yet this doesn't work. would appreciate any help. <?php include 'config.php'; echo "Connected <br />"; $auth = $_POST['author']; $quo = $_POST['quote']; $author = mysql_real_escape_string($auth); $quote = mysql_real_escape_string($quo); //************************** //inserting data $sql="INSERT INTO Quotes (vauthor, cquotes) VALUES ($author, $quote)"; if (!mysql_query($sql,$conn)) { die('Error: ' . mysql_error()); } echo "1 record added"; ... what am i doing wrong?

    Read the article

  • Algorithm for analyzing text of words

    - by Click Upvote
    I want an algorithm which would create all possible phrases in a block of text. For example, in the text: "My username is click upvote. I have 4k rep on stackoverflow" It would create the following combinations: "My username" "My Username is" "username is click" "is click" "is click upvote" "click upvote" "i have" "i have 4k" "have 4k" .. You get the idea. Basically the point is to get all possible combinations of 'phrases' out of a sentence. Any thoughts for how to best implement this?

    Read the article

  • How to use my own connection when using iBatis Data Mapper?

    - by Amitabh
    How can I use my own connection Provider when using iBatis Data Mapper? I have to use UserId and Password of the user performing the db operation in the ConnectionString? E.g. The following ConnectionString has to be modified to insert the userid and password for user performing the db operation. Data Source=TEST;Persist Security Info=True;User ID={userID};Password={password} How can this be handled in iBatis DataMapper?

    Read the article

  • Java how can I add an accented "e" to a string?

    - by behrk2
    Hello, With the help of tucuxi from the existing post Java remove HTML from String without regular expressions I have built a method that will parse out any basic HTML tags from a string. Sometimes, however, the original string contains html hexadecimal characters like é (which is an accented e). I have started to add functionality which will translate these escaped characters into real characters. You're probably asking: Why not use regular expressions? Or a third party library? Unfortunately I cannot, as I am developing on a BlackBerry platform which does not support regular expressions and I have never been able to successfully add a third party library to my project. So, I have gotten to the point where any é is replaced with "e". My question now is, how do I add an actual 'accented e' to a string? Here is my code: public static String removeHTML(String synopsis) { char[] cs = synopsis.toCharArray(); String sb = new String(); boolean tag = false; for (int i = 0; i < cs.length; i++) { switch (cs[i]) { case '<': if (!tag) { tag = true; break; } case '>': if (tag) { tag = false; break; } case '&': char[] copyTo = new char[7]; System.arraycopy(cs, i, copyTo, 0, 7); String result = new String(copyTo); if (result.equals("&#x00E9")) { sb += "e"; } i += 7; break; default: if (!tag) sb += cs[i]; } } return sb.toString(); } Thanks!

    Read the article

  • iPhone NSXMLParser parsing string and storing in a NSNumber variable and different data types

    - by anubhav
    Hi, I am trying to parse a XML File using NSXMLParser, I also have a Container class, in which I have a few instance variables. One of the elements that I am trying to parse in the XML is: <book sn="32.859669048339128" pn="-116.917800670489670"> I am trying to save the value of sn and pn in an instance variable of object Container: NSNumber *sn, NSNumber *pn. I want it so that when my parser get the attributeValues it can save it as a Double (or float) in those NSNumber pointers. Right now, all it does it just saves a string to the NSNumber. The Parser Code looks like this: if([elementName isEqualToString:@"book"]){ container = [[Container alloc] init]; container.sn=[attributeDict objectForKey:@"sn"]; container.pn=[attributeDict objectForKey:@"pn"]; } I want it so that the type of container.sn is initialized to a float or double. Any ideas how to do this? Thanks in advance!

    Read the article

  • [C++] Index strings by other strings

    - by mcco
    Hello, I need to index specific strings with other strings and I can't really find a good way to do so. I tried to use tr1::unordered_map, but I'm having some difficulties using it. If someone could tell me what is the best way to do that I'd be really grateful :) I also need to index objects by a number (numbers are not in order so I can't use a vector)

    Read the article

  • Double split in C

    - by Dmitri
    Hi again dear community! OK. For example I have this line in my txt file: 1|1,12;7,19;6,4;8,19;2,2 . As you can see, it has 2 parts, separated by "|". I have no problems getting both parts, and separating second part ( 1,12;7,19;6,4;8,19;2,2 ) using ";" separator. BUT I do have problems with separating further by "," to get first and second number of each set. This is my current code: result = strtok(result, ";"); while(result != NULL ) { printf("%s\n", result); result = strtok(NULL, ";"); } It outputs me: 1,12 7,19 6,4 8,19 2,2 OK, great. But when I try to 'strtok' (I'm using this method for splitting) like this: result = strtok(result, ";"); while(result != NULL ) { //printf("%s\n", result); help = strtok(result, ","); while(help != NULL) { printf("<%s>", help); help = strtok(NULL, ","); } result = strtok(NULL, ";"); } I only get "<1,<12" like there is only one set in this set of numbers. I dont understand where are the rest of the numbers. Instead, output should be: <1,<12,<7,<19,<6,<4,<8,<19,<2,<2. Could someone please give a solution, how to get EACH number of each set this set of numbers. Maybe there are other methods or I'm doing something wrong :) Thank you! Best Regards, Dmitri

    Read the article

  • ASP.NET MVC Validation - localisation of the error string

    - by gmang
    I followed the techique ASP.NET MVC 2: Model Validation from Scott Gu. (http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx). However I am building a localised web site. How can I localized the error string? I tried the following by replacing the following: [RegularExpression(@"\d{4}",ErrorMessage="Must be a 4 digit year")] public Nullable YearOfWork { get; set; } With the following: [RegularExpression(@"\d{4}",ErrorMessage=Resources.SharedStrings.search_error1)] public Nullable YearOfWork { get; set; } but I get a complilation error: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type Please help!

    Read the article

  • bitwise OR on strings

    - by mr.bio
    How can i do a Bitwise OR on strings? A: 10001 01010 ------ 11011 Why on strings? The Bits can have length of 40-50.Maybe this could be problematic on int ? Any Ideas ?

    Read the article

  • Ranking based string matching algorithm..for Midi Music

    - by Taha
    i am working on midi music project. What i am trying to do is:- matching the Instrument midi track with the similar instrument midi track... for example Flute track in a some midi music is matched against the Flute track in some other music midi file... After matching ,the results should come ranking wise according to their similarity.. Like 1) track1 2) track2 3) track3 I have this sort of string coming from my midi music .. F4/0.01282051282051282E4/0.01282051282051282Eb4/0.01282051282051282 D4/0.01282051282051282C#4/0.01282051282051282C4/0.01282051282051282 Which ranking algorithm with good metrics should i use for such data ? Thanking you in anticipation!

    Read the article

  • Constructing a hash table/hash function.

    - by nn
    Hi, I would like to construct a hash table that looks up keys in sequences (strings) of bytes ranging from 1 to 15 bytes. I would like to store an integer value, so I imagine an array for hashing would suffice. I'm having difficulty conceptualizing how to construct a hash function such that given the key would give an index into the array. Any assistance would be much appreiated. The maximum number of entries in the hash is: 4081*15 + 4081*14 + ... 4081 = 4081((15*(16))/2) = 489720. So for example: int table[489720]; int lookup(unsigned char *key) { int index = hash(key); return table[index]; } How can I compute hash(key). I'd preferably like to get a perfect hash function. Thanks.

    Read the article

  • Code Golf: Word Search Solver

    - by Maxim Z.
    Note: This is my first Code Golf challenge/question, so I might not be using the correct format below. I'm not really sure how to tag this particular question, and should this be community wiki? Thanks! This Code Golf challenge is about solving word searches! A word search, as defined by Wikipedia, is: A word search, word find, word seek, word sleuth or mystery word puzzle is a word game that is letters of a word in a grid, that usually has a rectangular or square shape. The objective of this puzzle is to find and mark all the words hidden inside the box. The words may be horizontally, vertically or diagonally. Often a list of the hidden words is provided, but more challenging puzzles may let the player figure them out. Many word search puzzles have a theme to which all the hidden words are related. The word searches for this challenge will all be rectangular grids with a list of words to find provided. The words can be written vertically, horizontally, or diagonally. Input/Output The user inputs their word search and then inputs a word to be found in their grid. These two inputs are passed to the function that you will be writing. It is up to you how you want to declare and handle these objects. Using a strategy described below or one of your own, the function finds the specific word in the search and outputs its starting coordinates (simply row number and column number) and ending coordinates. If you find two occurrences of the word, you must output both's set of coordinates. Example Input: A I Y R J J Y T A S V Q T Z E X B X G R Z P W V T B K U F O E A F L V F J J I A G B A J K R E S U R E P U S C Y R S Y K F B B Q Y T K O I K H E W G N G L W Z F R F H L O R W A R E J A O S F U E H Q V L O A Z B J F B G I F Q X E E A L W A C F W K Z E U U R Z R T N P L D F L M P H D F W H F E C G W Z B J S V O A O Y D L M S T C R B E S J U V T C S O O X P F F R J T L C V W R N W L Q U F I B L T O O S Q V K R O W G N D B C D E J Y E L W X J D F X M Word to find: codegolf Output: row 12, column 8 --> row 5, column 1 Strategies Here are a few strategies you might consider using. It is completely up to you to decide what strategy you want to use; it doesn't have to be in this list. Looking for the first letter of the word; on each occurrence, looking at the eight surrounding letters to see whether the next letter of the word is there. Same as above, except looking for a part of a word that has two of the same letter side-by-side. Counting how often each letter of the alphabet is present in the whole grid, then selecting one of the least-occurring letters from the word you have to find and searching for the letter. On each occurrence of the letter, you look at its eight surrounding letters to see whether the next and previous letters of the word is there.

    Read the article

  • How to split a string by ',' or '[|]' unless the ',' is in '{}'

    - by floyddotnet
    i search for a regex to split the following string: aaa[bbb,ccc[ddd,{eee:1,mmm:999}],nnn[0,3]] aaa[bbb,ccc[ddd,{eee:1, mmm:[123,555]}],nnn[0,3]] aaa[bbb, ccc[ddd, ddd],nnn[0,3]] aaa[bbb,ddd[0,3]] by '[' or ']' or ',' unless the ',' is in '{}'. As example: split 'aaa[bbb,ccc[ddd,' to aaa, bbb, ccc, ddd is allow but not {eee:1,mmm:999}. the result: aaa, bbb, ccc, ddd, {eee:1,mmm:999}, nnn, 0, 3 aaa, bbb, ccc, ddd, {eee:1, mmm:[123,555]}], nnn, 0, 3 aaa, bbb, ccc, ddd, ddd, nnn, 0, 3 aaa, bbb, ddd, 0, 3 i have read meany other questions but i cant modifie the regex's there are post to do this what i want. the target language for the expression is javascript.

    Read the article

  • Hash of unique value = unique hash?

    - by Nebs
    Theoretically does hashing a unique value yield a unique value? Let's say I have a DB table with 2 columns: id and code. id is an auto-incrementing int and code is a varchar. If I do ... $code = sha1($id); ... and then store $code into the same row as $id. Will my code column be unique as well? What about if I append the current time? eg: $code = sha1($id . time()); Thanks.

    Read the article

  • how to merge xml string to main xml document object

    - by CliffC
    how can i merge the following xml string <employee> <name>cliff</name> </employee> to my existing xml document object XmlDocument xmlDoc = new XmlDocument(); XmlElement xmlCompany = xmlDoc.CreateElement("Company"); the final output should look like <Company> <employee> <name>cliff</name> </employee> </Company> thanks

    Read the article

  • Append XML string block WITH NAMESPACE REF to existing XmlDocument in .NET

    - by FT
    I have an xml document (XmlDocument) which looks like this... <stuff xmlns:n="hhtp://tempuri.com/"> </stuff> ... and a "fragment" (string) which looks like this <things> <thing n:type="info"> </thing> </things> I want to "inject" the fragment into the main document. How? (HINT: You can't use XmlDocumentFragment because the namespace 'n' isn't declared in the fragment, and the object model complains about this - throwing an 'unknown namespace' error even though the resultant document will be perfectly valid.)

    Read the article

< Previous Page | 193 194 195 196 197 198 199 200 201 202 203 204  | Next Page >