Search Results

Search found 4616 results on 185 pages for 'c strings'.

Page 92/185 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • Serialization of an object

    - by sandhya
    Hi I am Serialing an object using GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("string1",subobject1); info.AddValue("string2",subobject2); } what will be stored in stream? do the strings also store?

    Read the article

  • Pass parameters to Windows Service to fire method

    - by Sam Youtsey
    Hi there, I'm attempting to build a Windows Service which will execute some method when a user clicks a button in a WinForms application. I'd like to be able to pass in a few strings when the user presses the GUI button which will have the service consume them and processes a specific method. What's the best way to do this? Thanks for help.

    Read the article

  • Can you help with regular expressions in Java?

    - by Matt
    I have a bunch of strings which may of may not have random symbols and numbers in them. Some examples are: contains(reserved[j])){ close(); i++){ letters[20]=word I want to find any character that is NOT a letter, and replace it with a white space, so the above examples look like: contains reserved j close i letters word What is the best way to do this?

    Read the article

  • ASP.NET MVC routing and paths is js files

    - by HiveHicks
    Hello, we're facing a problem now. We have a pretty big page with a loooong inline script, which does all the work. We now want to obfuscate it and use it as a separate .js file. But the problem is that we have paths which are generated by Url helper (Url.Content()). So what is the best way to separate js file from the page and not using hard-coded path strings?

    Read the article

  • Why would someone use WHERE 1=1 AND <conditions> in a SQL clause?

    - by Bogdan Maxim
    Why would someone use WHERE 1=1 AND <conditions> in a SQL clause (Either SQL obtained through concatenated strings, either view definition) I've seen somewhere that this would be used to protect against SQL Injection, but it seems very weird. If there is injection WHERE 1 = 1 AND injected OR 1=1 would have the same result as injected OR 1=1. Later edit: What about the usage in a view definition?

    Read the article

  • C# modify a config file for a windows service

    - by Jim Beam
    I have a windows service that reads from a config file. I need to modify this config file prior to the application starting. How can I create a GUI that would handle the changes to the config file. I know that a service does not have a GUI per se, but I really just need something to modify some strings in the config file and then start the service.

    Read the article

  • C# Dictionary<> and mutable keys

    - by Pierreten
    I was told that one of the many reasons strings were made immutable in the C# spec was to avoid the issue of HashTables having keys changed when references to the string keys altered their content. The Dictionary< type allows reference types to be used as a key. How does the dictionary avoid the issue of altered keys that lead to "misplaced" values? Is there a memberwise clone made of an object when used as a key?

    Read the article

  • fastest way to upload an xls file into a database

    - by shmichael
    I have an xls file with ~60 sheets of data. I would like to move them into a database (postgres) such that each sheet's data is stored in a different table. What is the fastest way of creating these tables? I don't care about naming or proper typing of columns. The columns could all be strings for that matter. I don't want to run 60 different csv uploads.

    Read the article

  • C++ error message output format

    - by sub
    If I want to trigger an error in my interpreter I call this function: Error( ErrorType type, ErrorSeverity severity, const char* msg, int line ); However, with that I can only output Name error: Undefined variable in line 1 instead of Name error: Undefined variable 'someVariableName' in line 1 I'm working entirely with strings (except for the error messages as they all are constant at the moment), so sprintf won't work. What is the best way to create an efficient error function that can output a constant message combined with a string that describes which object, e.g.: a non-existing variable, triggered the error?

    Read the article

  • Strange (Undefined?) Behavior of Free in C

    - by Chris Cirefice
    This is really strange... and I can't debug it (tried for about two hours, debugger starts going haywire after a while...). Anyway, I'm trying to do something really simple: Free an array of strings. The array is in the form: char **myStrings. The array elements are initialized as: myString[index] = malloc(strlen(word)); myString[index] = word; and I'm calling a function like this: free_memory(myStrings, size); where size is the length of the array (I know this is not the problem, I tested it extensively and everything except this function is working). free_memory looks like this: void free_memory(char **list, int size) { for (int i = 0; i < size; i ++) { free(list[i]); } free(list); } Now here comes the weird part. if (size> strlen(list[i])) then the program crashes. For example, imagine that I have a list of strings that looks something like this: myStrings[0] = "Some"; myStrings[1] = "random"; myStrings[2] = "strings"; And thus the length of this array is 3. If I pass this to my free_memory function, strlen(myStrings[0]) > 3 (4 3), and the program crashes. However, if I change myStrings[0] to be "So" instead, then strlen(myStrings[0]) < 3 (2 < 3) and the program does not crash. So it seems to me that free(list[i]) is actually going through the char[] that is at that location and trying to free each character, which I imagine is undefined behavior. The only reason I say this is because I can play around with the size of the first element of myStrings and make the program crash whenever I feel like it, so I'm assuming that this is the problem area. Note: I did try to debug this by stepping through the function that calls free_memory, noting any weird values and such, but the moment I step into the free_memory function, the debugger crashes, so I'm not really sure what is going on. Nothing is out of the ordinary until I enter the function, then the world explodes. Another note: I also posted the shortened version of the source for this program (not too long; Pastebin) here. I am compiling on MinGW with the c99 flag on. PS - I just thought of this. I am indeed passing numUniqueWords to the free function, and I know that this does not actually free the entire piece of memory that I allocated. I've called it both ways, that's not the issue. And I left it how I did because that is the way that I will be calling it after I get it to work in the first place, I need to revise some of my logic in that function. Source, as per request (on-site): #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include "words.h" int getNumUniqueWords(char text[], int size); int main(int argc, char* argv[]) { setvbuf(stdout, NULL, 4, _IONBF); // For Eclipse... stupid bug. --> does NOT affect the program, just the output to console! int nbr_words; char text[] = "Some - \"text, a stdin\". We'll have! also repeat? We'll also have a repeat!"; int length = sizeof(text); nbr_words = getNumUniqueWords(text, length); return 0; } void free_memory(char **list, int size) { for (int i = 0; i < size; i ++) { // You can see that printing the values is fine, as long as free is not called. // When free is called, the program will crash if (size > strlen(list[i])) //printf("Wanna free value %d w/len of %d: %s\n", i, strlen(list[i]), list[i]); free(list[i]); } free(list); } int getNumUniqueWords(char text[], int length) { int numTotalWords = 0; char *word; printf("Length: %d characters\n", length); char totalWords[length]; strcpy(totalWords, text); word = strtok(totalWords, " ,.-!?()\"0123456789"); while (word != NULL) { numTotalWords ++; printf("%s\n", word); word = strtok(NULL, " ,.-!?()\"0123456789"); } printf("Looks like we counted %d total words\n\n", numTotalWords); char *uniqueWords[numTotalWords]; char *tempWord; int wordAlreadyExists = 0; int numUniqueWords = 0; char totalWordsCopy[length]; strcpy(totalWordsCopy, text); for (int i = 0; i < numTotalWords; i++) { uniqueWords[i] = NULL; } // Tokenize until all the text is consumed. word = strtok(totalWordsCopy, " ,.-!?()\"0123456789"); while (word != NULL) { // Look through the word list for the current token. for (int j = 0; j < numTotalWords; j ++) { // Just for clarity, no real meaning. tempWord = uniqueWords[j]; // The word list is either empty or the current token is not in the list. if (tempWord == NULL) { break; } //printf("Comparing (%s) with (%s)\n", tempWord, word); // If the current token is the same as the current element in the word list, mark and break if (strcmp(tempWord, word) == 0) { printf("\nDuplicate: (%s)\n\n", word); wordAlreadyExists = 1; break; } } // Word does not exist, add it to the array. if (!wordAlreadyExists) { uniqueWords[numUniqueWords] = malloc(strlen(word)); uniqueWords[numUniqueWords] = word; numUniqueWords ++; printf("Unique: %s\n", word); } // Reset flags and continue. wordAlreadyExists = 0; word = strtok(NULL, " ,.-!?()\"0123456789"); } // Print out the array just for funsies - make sure it's working properly. for (int x = 0; x <numUniqueWords; x++) { printf("Unique list %d: %s\n", x, uniqueWords[x]); } printf("\nNumber of unique words: %d\n\n", numUniqueWords); // Right below is where things start to suck. free_memory(uniqueWords, numUniqueWords); return numUniqueWords; }

    Read the article

  • MS SQL 2005: Why would a delete from a temp table hang forever?

    - by Dr. Zim
    DELETE FROM #tItem_ID WHERE #tItem_ID.Item_ID NOT IN ( SELECT DISTINCT Item_ID FROM Item_Keyword JOIN Keyword ON Item_Keyword.Keyword_ID = Keyword.Record_ID WHERE Keyword LIKE @tmpKW) The Keyword is %macaroni%. Both temp tables are 3300 items long. The inner select executes in under a second. All strings are nvarchar(249). All IDs are int. Any ideas? I executed it (it's in a stored proc) for over 12 minutes without it finishing.

    Read the article

  • win32 read java preference from c++ code

    - by Jayan
    One of our program writes program information(window title, memory etc) in Java Preferences. On windows this is available under registry. How can I read the values written by Java program using c (or c++). Looks like API I should use is RegGetValue. Is this guaranteed to work on Windows XP 32 bit? The String written by java is UTF-8 encoded. How do I read such strings in windows (win32 or vc++) Cheers, Jayan

    Read the article

  • asp.net Javascript serialiser

    - by nuubee
    Hi Im having trouble getting the Javascript serialiser to convert this Json string to alist of strings {'Roles':['Role1','Role2','Role3','Role4']}"; (new JavaScriptSerializer()).Deserialize< List<String> >( strInput ) it returns an empty list

    Read the article

  • How do I escape backslashes in JSON?

    - by peteb
    I am using Firefox's native JSON.parse() to parse some JSON strings that include regular expressions as values, for example: var test = JSON.parse('{"regex":"/\\d+/"}'); The '\d' in the above throws an exception with JSON.parse(), but works fine when I use eval (which is what I'm trying to avoid). What I want is to preserve the '\' in the regex - is there some other JSON-friendly way to escape it?

    Read the article

  • Is there a way for a user to disable an AlertDialog completely?

    - by NewGuyChris
    In the app I'm making, I have an "if" statement where if two strings are saved to a certain string, an AlertDialog pops up. These strings will stay the same for some users, thus having this AlertDialog constantly pop up whenever they launch the activity where the ALertDialog is set to appear. Code (I have no setNegativeButton as of yet): private void SetWarning() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Warning!"); alert.setMessage(R.string.Warning); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //No action needed; just close the AlertDialog. } }); alert.show(); } Here is a segment of my code that makes this AlertDialog appear: SharedPreferences sharedPreferences = getSharedPreferences("MY_PREF", MODE_PRIVATE); String s = sharedPreferences2.getString("MEM1", ""); String s2 = sharedPreferences2.getString("MEM2", ""); if(s.equals("String1") && s2.equals("String2")) SetWarning(); Is there a way to make an "alert.setNegativeButton" method where if the user clicks it, the AlertDialog will NEVER appear again? I'm thinking of maybe somehow implementing another SavedPreferences somehow so it saves the users selection and will then prevent the AlertDialog from ever appearing again. So far, to no luck. I've searched to find nothing, other than people asking how to disable buttons in an AlertDialog. Thank you! New updated code: alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //set sharedpreferences boolean called DONTSHOWAGAIN to true; SharedPreferences sharedPreferences2 = getSharedPreferences("MY_PREF", MODE_PRIVATE); Boolean dontShowAgain = sharedPreferences2.getBoolean("dontShowAgain ", false); SharedPreferences.Editor ed = sharedPreferences2.edit(); ed.putBoolean("dontShowAgain", true); ed.commit(); } }); alert.show(); } private void StringWarning() { SharedPreferences sharedPreferences2 = getSharedPreferences("MY_PREF", MODE_PRIVATE); String s = sharedPreferences2.getString("MEM1", ""); String s2 = sharedPreferences2.getString("MEM2", ""); if(s.equals("String1") && s2.equals("String2")){ if(!dontShowAgain){ SetWarningExamConflict(); } }

    Read the article

  • How to get the exact string within the brackets in mysql

    - by sreenath
    In my mysql table a field values are as follows: table name - "clients" field name - "accent" values are - "Eastern(Northern,Southern),Scottish(East Coast)" "Eastern(South,North,Southern),Scottish(East Coast)" If I give select accent from clients where accent like '%north%' if more than 100 records not in the same order. Strings with in the brackets are not in the same order means. It will give above two values. How should i get only second value? Please help me, thanks.

    Read the article

  • In elisp is there a difference between the regex [\\]documentclass and \\documentclass?

    - by mcheema
    I was playing around with the rx function for generating regular expressions from sexps in ELISP but couldn't figure out how to generate the regular expression "\\documentclass" for use in org-export-latex-classes: (rx "\\documentclass") (rx "\\" "documentclass") (rx (char "\\") "documentclass") Which when evaluated give respectively the following outputs: "\\\\documentclass" "\\\\documentclass" "[\\]documentclass" Is "\\documentclass" equivalent to "[\\]documentclass"?---I think it is, but am not sure. Can I generate the former using rx? Edit: Whilst the question was valid I realize my motivation was not; because org-export-latex-classes use strings not regular expressions.

    Read the article

  • How can I obfuscate JavaScript?

    - by Teifion
    I want to make a JavaScript application that's not open source, and thus have two questions: What's the best way to obfuscate the code? What's the best way to obfuscate the strings themselves within the application (assuming that the answer to #1 does not handle this)?

    Read the article

  • How to access values of previous page at client-side?

    - by Gaurav
    I have a page and clicked on the button there it will open a new page containing some text boxes, user fill all the text boxes and clicked the button now first page open again and the question is : How can I get the vales of text boxes on the current page using both server-side and client-side There is a restrictions to use of : - Cross-paging - Cookies - Sessions - Query strings

    Read the article

  • C# Extension Method for String Data Type

    - by Jimbo
    My web application deals with strings that need to be converted to numbers alot - users often put commas, currency symbols etc. in these fields so what I want to do is create a string extension method that cleans the field up and converts it to a decimal. For example: decimal myNumber = "$1,250.85".ToDecimal(); Can anyone help with this? Thanks!

    Read the article

  • a problem with char** in c

    - by sagi
    hello i have an char** arr which is an array of strings and i want to erase the 2 last cell of the array or maybe to create a new char** but without those last 2 cells thank you very much.

    Read the article

  • Localization problems in iPhone

    - by user193545
    Hi I have been trying to localize my iPhone app in two languages - english and german I have created two folders en.lproj and de.lproj each containing Localizable.strings file for respective language. I have included these files in my resources folder, changed the encoding of these files to UTF-16. I have tried cleaning the project and building it again, deleting folder at path: Library/Application Support/iPhone Simulator/User But the problem is still there. Anybody having an idea please help.

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >