string

MySQL - Is using TEXT for potentially small strings overkill?

One of the things that always worries me in MySQL is that my string fields will not be large enough for the data that need to be stored. The PHP project I'm currently working on will need to store strings, the lengths of which may vary wildly. Not being familiar with how MySQL stores string data, I'm wondering if it would be overkill to...

Flex binary String to ByteArray

On the server side, I have an array of objects. Each object has 3 integer fields and 2 binary fields. I've utf encoded the binary data and json encoded the array & sent it to Flex client side. On the client side, decoding data, I've got a String representing the binary data (utf decoded). Now, how can I convert this String to ByteArray...

Aren't String objects in Java immutable?

String s = ...; s = s.substring(1); Is this possible? I thought you can't change a String object in Java. ...

string = string + int: What's behind the scene? (C#)

In C# you can implicite concat string and let's say, an integer: string sth = "something" + 0; My questions are: Why, by assuming fact you can implicite concat string and int, C# disallow initializing string as: string sth = 0; // Error: Cannot convert source type 'int' to target type 'string' How C# casts 0 as string. Is it 0.ToSt...

Howto check if a char* points to a string literal in C

I have a struct struct request { int code; char *message; }; that I'd like to free properly. I have the following function to do that: void free_request(struct request *req) { if (req->message != NULL) { free(req->message); } free(req); req = NULL; } The problem is that I get an "free(): invalid pointer"/segfaul...

ASP.NET MVC FileContentResult SLOW

We are using it to return a file for an export. When we run this export on a lot of records, it takes close to 10 minutes to run. Here is a code snippet of the code that actually calls the File() method and returns the result. Public Function Export(ByVal ID As Integer) As FileContentResult Dim str As String = String.Empty Dim data(...

Optimization of F# string manipulation

Hello, I am just learning F# and have been converting a library of C# extension methods to F#. I am currently working on implementing a function called ConvertFirstLetterToUppercase based on the C# implementation below: public static string ConvertFirstLetterToUppercase(this string value) { if (string.IsNullOrEmpty(value)) return v...

[Rails] Encrypt/Decrypt String

Hey everyone, I have a simple problem for that I'd like to hear your thoughts: I have this URL in Rails http://example.com/hosts/show/somehost I'm getting the 'somehost' part via params[:id]. I'm calling URI.encode on 'somehost' but this does not encode '.' characters. Rails won't recognize ID parts with points in it so I tried to rep...

How do I put color on a virtual string tree node?

Is it possible for a virtual string tree to look like this? i really need help on this since i'm new in delphi.. ...

Selecting text from between two separate strings + php

Hi there, I've got a string of data, and I want to remove the content between two blocks of text using PHP. Here's an example: "dataset123" The text I want is here. "endfile" I want everything between those two quoted values. The values won't change, so they can be hard coded. Any ideas? I've tried searching for something like this...

Objective-C Pasting

Hi, I want to write a copy and paste function, however I'd like to know how to paste something. I don't want to paste from the clipboard, I want to paste a string. Any idea how to do this? Help is much appreciated ...

Retrieve all keys in a hash table into a string

Hi Guys, The coding language is C#3.0 What is the most optimum method to retrieve all hashtable keys into string separated by a delimiter "," Is the for loop or the foreach loop the only option? Update: the keys are already strings Regards, naveenj ...

Assign the contents of a blob field to combobox items

Hi I have list of country names or other strings in a text blob field. When I read the field, I get a string back with LfCr between the words or phrases. Is there an easy way to assign this string to the Items property of a TComboBox? I'm using TADOQuery on a FireBird 2.1 Database. Regards, Pieter ...

Extracting relevant information from a long string of ffmpeg data

Hello there, I'm aware later versions of ffmpeg seem to present this information in a more accessible form, but my application is running on an old version for many reasons right now. Is it possible to extract Format: flv (located after Input #0, ) Duration: 00:05:23.20 (located after Duration: ) Bitrate: N/A (located after bitrate: ...

Bizzare System.out.println() in Java Program

String messageFile = ... // Assume messageFile SHOULD have the string "MESSAGE" System.out.println("The messageFile is: " + messageFile + "!!"); Normally, one would expect the above command to output: The messageFile is: MESSAGE!!!! However, I am receiving this instead: !!e messageFile is: MESSAGE See how the above statement, the...

What's the advantage of a String be Immutable?

Once I studied about the advantage of a string be immutable because of something to improve performace in memory.. Can anybody explain me this please? I can't find in Internet. Thanks a lot. ...

How Can i convert string to Date Format

Hi my string is as follows string s ="20000101"; I would like to convert to Date format. How can i ...

vb.net replace characters in string with values

i have a string which is a paragraph written on the aspx side. So its goes like this. The new student, {student_name} has the following grades - Maths - {math_grade} Science - {Science_grade} ... and so on. I need to get values from database, and replace {student_name} with "Joe Smith", {Math_grade} wth A or B+ etc. how can i do this?...

What is the difference between StringIO and io.StringIO in Python2.7?

Besides the obvious (one is a type, the other a class)? What should be preferred? Any notable difference in use cases, perhaps? ...

Get x number of unique words on each side of a word in a string?

Hi, I'm trying to get x number of unique words on each side of a word in a string in C#. for example, the method GetUniqueWords("she sells seashells, by the seashore. the shells she sells, are surely seashells.", "seashore", 3) (The first parameter is the sentence string. The second parameter is the word that will be used to get wo...