Hey there - simple query:
var q = (from SomeObject o in container
where
o.SomeInt > 8
&& o.SomeString != null //Null Ref here
select o;
I always get a null reference exception.
If I use String.IsNullOrEmpty(o.SomeString) the query takes about 100 times as long, as if I use && o.SomeString != "" (which is way faster, but o...
Allowed characters are (at least) A-Z, a-z, 0-9, ö, Ö, ä, ä, å, Å and german, latvian, estonian (if any) special chars? Is there ready-made method or do i have to make blacklist (non-allowed chars) and regular expressions IsMatch? If no ready-made how to use blacklist?
Cheers & BR -Matti
...
Hi,
I have a mySql database i want to display only 10 words from its body field which contain html codes, How i can do that, is there any php function to do that.
...
Disclaimer: I realize the totally obvious answer to this question is HashSet<string>. It is absurdly fast, it is unordered, and its values are unique.
But I'm just wondering, because HashSet<T> is a mutable class, so it has Add, Remove, etc.; and so I am not sure if the underlying data structure that makes these operations possible make...
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...
I would like to make a list of strings in MATLAB using the example below:
x = ['fun', 'today', 'sunny']
I want to be able to call x(1) and have it return 'fun', but instead I keep getting 'f'.
Also, is there a way to add a string to a list without getting the list giving back a number where the string should be? I have tried using st...
In Perl, is it appropriate to use a string as a byte array containing 8-bit data? All the documentation I can find on this subject focuses on 7-bit strings.
For instance, if I read some data from a binary file into $data
my $data;
open FILE, "<", $filepath;
binmode FILE;
read FILE $data 1024;
and I want to get the first byte out, is...
Hello. I'm having a bit of a problem. I am trying to create an IRC bot, which has an ampersand in its password. However, I'm having trouble putting the ampersand in a string. For example...
<?php
$var = "g&abc123";
echo $var;
?>
I believe this should print g&abc123. However it's printing g.
I have tried this as well:
<?php
$arr =...
In javascript I am used to just being able to pick any character from a string like "exm[2]" and it would return to me the third character in a string. In C is there a way to do that or something without a function that requires a buffer?
...
I would like to generate a random string (or a series of random strings, repetitions allowed) of length between 1 and n characters from some (finite) alphabet. Each string should be equally likely (in other words, the strings should be uniformly distributed).
The uniformity requirement means that an algorithm like this doesn't work:
al...
I am from a Java background and is learning C++. I encountered the following C++ code:
String source = String::New("'Hello' + ', World'");
As what I understand so far, this should be a call to static member function 'New' of class 'String'. But, I've searched through the whole header file defining 'String', there is not any static me...
I'd like to know the difference between string and StringBuilder and also need some examples for understanding.
...
Lot of questions has been already asked about the differences between string and string builder and most of the people suggest that string builder is faster than string. I am curious to know if string builder is too good so why string is there? Moreover, can some body give me an example where string will be more usefull than string build...
Hi,
I wan't to compare two strings in a SQL request so I can retrieve the best match, the aim is to propose to an operator the best zip code possible.
For example, in France, we have Integer Zip code, so I made an easy request :
SELECT *
FROM myTable
ORDER BY abs(zip_code - 75000)
This request returns first the data closest of Paris....
My value is stored within a string inside (). I need to return this value to check if it's empty.
$variable = "<a href=\"http://www.link-url.ext\">My Link</a> (55)";
$value = "55"; // how do I get the value?
if($value < 1) {
// no link
} else {
// show link
}
This code would be used to show links with no posts in them in ...
I would like to know the best way to sort a long list of strings wrt the time and space efficiency. I prefer time efficiency over space efficiency.
The strings can be numeric, alpha, alphanumeric etc. I am not interested in the sort behavior like alphanumeric sort v/s alphabetic sort just the sort itself.
Some ways below that I can t...
I have been having problems with converting a CGPoint to a string. I have tried various methods, but this seems like the most promising but it still won't work. Any suggestions?
Here is my code:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
coord = [touch lo...
Hello all.
I have this class that I want to persist with NHibernate. It has one collection, an IList, aggregating strings, rather than class instances, called DestinationCountryCodes.
public class RoutingRule
{
public virtual long Id { get; set; }
public virtual MessageType MessageType { get; set; }
public vi...
I need to find out how much percentage or chars does one string contains into another string.
I've tried Levenshtein Distance but that algorithm returns how much char's are needed to be change for the strings to be equal.
Can some one help?
I need it in c# but that's not so important.
The answer code:
public double LongestCommonSubs...
How would I do this?
To bring it into some better context, I'm having a value from an XML attribute and I want each individual value to be added to an array of strings and each of those values is separated by commas
...