Search Results

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

Page 35/1488 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • very large string in memory

    - by bushman
    Hi, I am writing a program for formatting 100s of MB String data (nearing a gig) into xml == And I am required to return it as a response to an HTTP (GET) request . I am using a StringWriter/XmlWriter to build an XML of the records in a loop and returning the stringWriter.ToString() during testing I saw a few --out of memory exceptions-- and quite clueless on how to find a solution? do you guys have any suggestions for a memory optimized delivery of the response? is there a memory efficient way of encoding the data? or maybe chunking the data -- I just can not think of how to return it without building the whole thing into one HUGE string object thanks

    Read the article

  • string parsing to double fails in C++

    - by helixed
    Here's a fun one I've been trying to figure out. I have the following program: #include <iostream> #include <string> #include <sstream> using namespace std; int main(int argc, char *argv[]) { string s("5"); istringstream stream(s); double theValue; stream >> theValue; cout << theValue << endl; cout << stream.fail(); } The output is: 0 1 I don't understand why this is failing. Could somebody please tell me what I'm doing wrong? Thanks, helixed

    Read the article

  • Efficiently check string for one of several hundred possible suffixes

    - by Ghostrider
    I need to write a C/C++ function that would quickly check if string ends with one of ~1000 predefined suffixes. Specifically the string is a hostname and I need to check if it belongs to one of several hundred predefined second-level domains. This function will be called a lot so it needs to be written as efficiently as possible. Bitwise hacks etc anything goes as long as it turns out fast. Set of suffixes is predetermined at compile-time and doesn't change. I am thinking of either implementing a variation of Rabin-Karp or write a tool that would generate a function with nested ifs and switches that would be custom tailored to specific set of suffixes. Since the application in question is 64-bit to speed up comparisons I could store suffixes of up to 8 bytes in length as const sorted array and do binary search within it. Are there any other reasonable options?

    Read the article

  • Seg Fault when using std::string on an embedded Linux platform

    - by Brad
    Hi, I have been working for a couple of days on a problem with my application running on an embedded Arm Linux platform. Unfortunately the platform precludes me from using any of the usual useful tools for finding the exact issue. When the same code is run on the PC running Linux, I get no such error. In the sample below, I can reliably reproduce the problem by uncommenting the string, list or vector lines. Leaving them commented results in the application running to completion. I expect that something is corrupting the heap, but I cannot see what? The program will run for a few seconds before giving a segmentation fault. The code is compiled using a arm-linux cross compiler: arm-linux-g++ -Wall -otest fault.cpp -ldl -lpthread arm-linux-strip test Any ideas greatly appreciated. #include <stdio.h> #include <vector> #include <list> #include <string> using namespace std; ///////////////////////////////////////////////////////////////////////////// class TestSeg { static pthread_mutex_t _logLock; public: TestSeg() { } ~TestSeg() { } static void* TestThread( void *arg ) { int i = 0; while ( i++ < 10000 ) { printf( "%d\n", i ); WriteBad( "Function" ); } pthread_exit( NULL ); } static void WriteBad( const char* sFunction ) { pthread_mutex_lock( &_logLock ); printf( "%s\n", sFunction ); //string sKiller; // <----------------------------------Bad //list<char> killer; // <----------------------------------Bad //vector<char> killer; // <----------------------------------Bad pthread_mutex_unlock( &_logLock ); return; } void RunTest() { int threads = 100; pthread_t _rx_thread[threads]; for ( int i = 0 ; i < threads ; i++ ) { pthread_create( &_rx_thread[i], NULL, TestThread, NULL ); } for ( int i = 0 ; i < threads ; i++ ) { pthread_join( _rx_thread[i], NULL ); } } }; pthread_mutex_t TestSeg::_logLock = PTHREAD_MUTEX_INITIALIZER; int main( int argc, char *argv[] ) { TestSeg seg; seg.RunTest(); pthread_exit( NULL ); }

    Read the article

  • Crystal Reports Formula Workshop boolean condition to string

    - by Jay
    Hello, I'm currently trying to create a report using Crystal Reports that comes with Visual Studio 2008. I would like to include a field of type boolean on my report that shows a string rather than true or false. The string should contain either contain a € or a % sign. How would I go about doing this in the Formula Workshop? I've tried things like e.g. if {tblAankoopDetails.SoortKorting} = true then "€" else "%" However this never seems to work and results in warnings such as "The formula result must be a number". This should be fairly simple but this is my first go at using Crystal Reports. Help would be much appreciated. Jay

    Read the article

  • Not-quite-JSON string deserialization in Python

    - by cpharmston
    I get the following text as a string from an XML-based REST API 'd':4 'ca':5 'sen':1 'diann':2,6,8 'feinstein':3,7,9 that I'm looking to deserialize into a pretty little Python dictionary: { 'd': [4], 'ca': [5], 'sen': [1], 'diann': [2, 6, 8], 'feinstein': [3, 7, 9] } I'm hoping to avoid using regular expressions or heavy string manipulation, as this format isn't documented and may change. The best I've been able to come up with: members = {} for m in elem.text.split(' '): m = m.split(':') members[m[0].replace("'", '')] = map(int, m[1].split(',')) return members Obviously a terrible approach, but it works, and that's better than anything else I've got right now. Any suggestions on better approaches?

    Read the article

  • PHP: How to check if query string or POST vars contain same var twice

    - by thomasrutter
    It may sound strange, but in my PHP application I need to check if the same variable name has been declared more than once in the query string or POST variables, and return an error value if this is the case. If my application doesn't return an error in this case, it fails a compliance check. When accessing vars using $_GET, $_POST, etc, PHP only returns the last value given for each variable name. I can't find a way to tell if any variable appeared more than once. I simply need to find out if the query string or the variables in the POST body contained the same variable name more than once, whatever the values.

    Read the article

  • String labels on boxplot outliers

    - by Benoît Collette
    Hi! I want to put string labels on outliers in a boxplot. Here's a simplification of the dataset I'm using: [,x] [,y] [,z] 7 2 a 10 2 b 112 3 c boxdata<-boxplot(x ~ y) To put values as label on outliers by group, I use this function: for(i in 1:length(boxdata$group)){ text(boxdata$group[i], boxdata$out[i], which(x==boxdata$out[i]),labels=boxdata$out[i],pos=4) } The problem is that I want to put z (string) as label instead of outlier value, but I don't know how to proceed. What do I need to do? Thank you! Ben

    Read the article

  • parsing string off a configuration using strtok in C

    - by Jessica
    in the configuration file i have entries similar to this one: filepath = c:\Program Files\some value Where the path can contain spaces and there are no quotes on that string. I tried parsing this with strtok like: char *option; char *value; value = strtok(line, " ="); strcpy(option, value); value = strtok(NULL, " ="); where line is the line I am reading from the file, option will contain the left side of the equal (filepath) and value will contain the right side (c:\program files\some value). I know, it's poor coding, but I haven't found something better. sorry... In any case, for those options where there's no space in the right side it works great, but in those containing spaces it only return the string until the 1st space: c:\Program. Is there any other way to do this? Code is appreciated. Jessica

    Read the article

  • Copying part of a string in C

    - by wolfPack88
    This seems like it should be really simple, but for some reason, I'm not getting it to work. I have a string called seq, which looks like this: ala ile val I want to take the first 3 characters and copy them into a different string. I use the command: memcpy(fileName, seq, 3 * sizeof(char)); That should make fileName = "ala", right? But for some reason, I get fileName = "ala9". I'm currently working around it by just saying fileName[4] = '\0', but was wondering why I'm getting that 9. Note: After changing seq to ala ile val ser and rerunning the same code, fileName becomes "alaK". Not 9 anymore, but still an erroneous character.

    Read the article

  • C#, string replace russian to english

    - by Fabio Beoni
    Hello, I have a strange problem replacing chars in string... I read a .txt file containing russian text, and starting from a list of letters russian to english (ru=en), I loop the list and I WOULD like to replace russian characters with english characters. The problem is: I can see in the debug the right reading of the russian and the right reading of the english, but using myWord = myWord.Replace(ruChar, enChar), the string is not replaced. My txt file is a UTF-8 encoding. Any suggestions?? Thank you to all...

    Read the article

  • Accessing object property as string and setting its value

    - by ludicco
    Hello there, I have an object in csharp from the class Account each account have a owner, reference, etc. One way I can access an accounts properties is through accessors like account.Reference; but I would like to be able to access it using dynamic string selectors like: account["PropertyName"]; just like in javascript. so I would have account["Reference"] which would return the value...but I also would like to be able to sign a new value after that like: account["Reference"] = "124ds4EE2s"; I've noticed I can use DataBinder.Eval(account,"Reference") to get a property based on a string, but using this I can't sign a value to the property. Any idea on how I could do that? Thanks a lot

    Read the article

  • jQuery AJAX converting variable string to html styled text

    - by sadmicrowave
    I've got an AJAX transmission of a variable string in my primary coding language (Visual FoxPro 9) that looks like this: AjaxResponse = CREATEOBJECT("Custom") lcMessage = "<li class='hello'>Hello</li>" AjaxResponse.AddProperty("Reply", lcMessage) Response.ContentType = "text/html" Response.Write(AjaxResponse.Reply) While using the jQuery function .ajax() I've created a success: function that looks like this: $.ajax({ url: 'index?Proc=GetUuserHistory', dataType: "html", success: function(data){ $("div#history-text").text(data); }; }); My problem is that the text inserting into 'div#history-text' is unformatted and contains the li tags still. I've tried substituting the .text for .prepend, .append, and .html with no luck...is there a way to convert this string back to html format after its been received using Ajax?

    Read the article

  • Removing a character from a string

    - by Prasanth Madhavan
    i have a string. I want to delete the last character of the string if it is a space. i tried the following code, str.erase(remove_if(str.begin(), str.end(), isspace), str.end()); but my g++ compiler gives me an error saying: error: no matching function for call to ‘remove_if(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unresolved overloaded function type>)’ please help.

    Read the article

  • connection string reading data from excel in asp.net

    - by Greg
    Hello, I am trying to read data from excel file in asp.net. I have added the connection string to webConfig file: <add name="xls" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=HPM_DB.xls;Extended Properties=Excel 8.0"/> But it shows me an errormessage when I run this query: string query = "Select * from [IO_Definition$]"; IO_Definition is the name of the spreadsheet in my excel file. I also added the excel file to the App_Data folder of the website. The error is: The Microsoft Jet database engine could not find the object 'IO_Definition$'. Make sure the object exists and that you spell its name and the path name correctly. The thing is, when I write the absolute path of the excel file in the connectionString it does work. Is there anyway I can make it work without writing the absolute path? Thanks, Greg

    Read the article

  • Copying non null-terminated unsigned char array to std::string

    - by karlphillip
    If the array was null-terminated this would be pretty straight forward: unsigned char u_array[4] = { 'a', 's', 'd', '\0' }; std::string str = reinterpret_cast<char*>(u_array); std::cout << "-> " << str << std::endl; However, I wonder what is the most appropriate way to copy a non null-terminated unsigned char array, like the following: unsigned char u_array[4] = { 'a', 's', 'd', 'f' }; into a std::string. Is there any way to do it without iterating over the unsigned char array? Thank you all.

    Read the article

  • Sybase ODBC connection String with .net

    - by nitinkhanna
    Hi, I am having SYBASE 12.5 install on my server as well as my PC, I am unable to get the correct connection string. I have used the connectionstrings.com but unable to get the correct one. After runnig and making the connection Driver={Sybase ASE ODBC Driver};srvr=server_name;database=database_name;UID=user_name;PWD=pass; and some other combination of thic connection string I am getting the Datasource ="" Driver ="" DataBase="" ServerVersion = Invalid Operation. Connection is closed What am I suppose to correct in that. Please help. Thanks

    Read the article

  • Lua Programming for PSP: Sending a string, then spliting that string

    - by Trey Andrews
    How do I send a string between 2 PSPs? Here is a test script: Script A Adhoc.init() Adhoc.connect() data1 = "Trey777" data2 = "This is a test!!..." Outdata = "Name"..data1.."text"..data2 function senddata() Adhoc.send(Outdata) end While true do screen.waitVblankStart() screen:flip() end Script B red = Color.new(255,0,0) Adhoc.init() Adhoc.connect() function recevmsg() data = Adhoc.recv() ----What do I here to split the text? ----print name to line '0,10' ----print text to line'0,20' end While true do screen.waitVblankStart() screen:flip() end Each script will be loaded onto a different PSP. One will send and one will receive. I need to know how does it split a string? string.find and sub return numbers, not text

    Read the article

  • Java String Replace and null characters

    - by praspa
    Testing out someone elses code (of course it was ...) , I noticed a few JSP pages printing funky non-ascii characters. Taking a dip into the source I found this tidbit. // remove any periods from first name e.g. Mr. John --> Mr John firstName = firstName.trim().replace('.','\0'); Does replacing a character in a String with a null character even work in Java? I know that '\0' will terminate a c-string. Would this be the culprit to the funky characters? Thanks PR

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >