input:
string1=this is a joke.this is not life.
string 2=this is not a joke. this is life.
by comparing string1&string 2 we found
output:
pos8 deleted 4 chars " not"
pos28 inserted 4 chars " not"
Hi, say I have a string like so
Testing
How could I have it remove all spaces before the first letter, and all spaces after the last letter in the string.
Thanks!
Hi, I need to create a bash shell script starting with a day and then loop through each subsequent day formatting that output as %Y_%m_d
I figure i can submit a start day and then another param for the number of days.
My issue/question is how to set a DATE (that is not now) and then add a day.
so my input would be 2010_04_01 6
my output would be
2010_04_01
2010_04_02
2010_04_03
2010_04_04
2010_04_05
2010_04_06
Thanks
What I mean is like have to user input a string with multiple variables and get the value of those variable. Like a simple quadratic formula: x^2 + 5x + 10. The user would then enter that and then the program would solve for x. I will be using the BeanShell Interpreter class to interpret the string as an equation. But how would I solve for x?
I am tryingv the following
foreach (DataRow dr in dt.Rows)
{
if (dr["TABLE_NAME"].ToString().Contains(sheetName))
{
tableName = dr["TABLE_NAME"].ToString();
}
}
by using lambda like
string tableName = "";
DataTableExtensions.AsEnumerable(dt).ToList().ForEach(i =>
{
tableName = i["TABLE_NAME"].ToString().Contains(sheetName);
}
);
but getting compile time error "cannot implicitly bool to string". So how to achieve the same.?
Thanks(C#3.0)
Hi I am completely new to Java, so sorry if my question may sound a bit stupid.
I am following a tutorial on hibernate and i am trying to get the context definition files from the file system.
ApplicationContext ctx = new FileSystemXmlApplicationContext(
new String[] { "conf/rssWebApplication-services.xml",
"conf/rssWebApplication-data-hibernate.xml" });
But i get the following error:
found : org.springframework.context.support.FileSystemXmlApplicationContext
required: org.jboss.weld.context.ApplicationContext
ApplicationContext ctx = new FileSystemXmlApplicationContext(
new String[] { "conf/rssWebApplication-services.xml",
Any idea what is the problem?
Thanks
We've got the following repository method
public IList<Foo> GetItems(int fooId, int pageIndex, int pageSize
, string sortField, string sortDir, out int totalItems)
{
// Some code
}
My question is: is it ok to use out in this way. I'm somewhat uncomfortable with out, but can't come up with a better way to write this as a single call.
I'm trying to figure out how to instantiate a case class object with reflection. Is there any support for this? The closest I've come is looking at scala.reflect.Invocation, but this seems more for executing methods that are a part of an object.
case class MyClass(id:Long, name:String)
def instantiate[T](className:String)(args:Any*) : T = { //your code here }
Is close to the API I'm looking for.
Any help would be appreciated.
In C#, can you use a boolean predicate on its own as the parameter for an if statement?
eg:
string str = "HELLO";
if (str.Equals("HELLO"))
{
Console.WriteLine("HELLO");
}
Will this code output "HELLO", or does it need to be:
string str = "HELLO";
if (str.Equals("HELLO") == true)
{
Console.WriteLine("HELLO");
}
If there is anything else wrong with the above code segments, please point it out.
I need to obtain the String for the file that is being uploaded from forms to store in the database.
I am using the usual form input file element
input type="file" name="some_name"
I found a couple JS scripts that allow me to do useless things like display the string in a dialog box, etc.
I need this as an element on the request object or as a hidden field on my page when the form is posted.
Hi Folks
<amount currency="USD">1000500</amount>
while parsing above string i am getting only attribute value .when i try to get node value null pointer exception
for getting node value using
NodeList amountList= estimateElement.getElementsByTagName("amount");
Element amtElement= (Element)amountList.item(0);
String amount=amtElement.getFirstChild().getnodevalue()
Thanks in advance
Aswan
Here's what I do:
double x = 7.0;
System.out.printf("%.2f", x);
Eclipse gives me this error "The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, double)"
Hi,
I am new to Google App Engine,
I have this entites User class -
user_id - integer
user_name - string
password - string
I want to do auto increment for the user_id,How I can do this?
I have used the preg_replace_callback as
$string = preg_replace_callback($pattern,'CreateTemplatesController::callbackhandler',$string );
I have called the callbackhandler function with the class name as this function is a private static function.
Problem is "callbackhandler" function is not getting called.
Please post if any one know the reason for the same. Thanks in Advance
I am binding some data to control, but want to limit the number of character of a specific field to a 30 first characters.
I want to do it, if it's possible, on aspx page.
I tried this:
Text='<%# String.Format("{0}", Eval("Title")).Substring(0,30) %> '
But got this error:
Index and length must refer to a
location within the string. Parameter
name: length
Is there any function in Objective-C to print a list of elements as unordered HTML elements. For ex - [@"a--b-c---d" htmlList: @"--"] returns @ "ab-c-d"
the "--" is the delimiter to seperate the string of elements. I have used NSSArray to store the input string and function componentsSeperatedByString:@"--" to get the elements. How do I go ahead in adding the HTML tags li and /li between elements and ul and /ul at the end of the entire list?
Please help, Im a beginner in objective -C
I need NSRange objects for the position of each uppercase letter in a given NSString for input into a method for a custom attributed string class.
There are of course quite a few ways to accomplish this such as rangeOfString:options: with NSRegularExpressionSearch or using RegexKitLite to get each match separately while walking the string.
What would be the fastest performing approach to accomplish this task?
Hello world!
Using the following code:
Function GetSetting(Of T)(ByVal SettingName As String, ByRef DefaultVal As T) As T
Return If(Configuration.ContainsKey(SettingName), CType(Configuration(SettingName), T), DefaultVal)
End Function
Yields the following error:
Value of type 'String' cannot be converted to 'T'.
Any way I could specify that in all cases, the conversion will indeed be possible (I'm basically getting integers, booleans, doubles and strings).
Thanks!
Hi all,
Boost serialization doc's assert that the way to serialize/deserialize items is using a binary/text archive with a stream on the underlying structure. This works fine if I wan't to use the serialized data as an std::string, but my intention is to convert it directly to a char* buffer. How can I achieve this without creating a temporary string?
private class CompAdvertisements : IComparer<Advertisements>
{
private string OrderBy { get; set; }
public CompAdvertisements(string orderBy)
{
OrderBy = orderBy;
}
#region IComparer<Advertisements> Members
public int Compare(Advertisements x, Advertisements y)
{
return x.Country.Name.CompareTo(y.Country.Name);
Can i also user x.Name.CompareTo(y.Name); in comparer that i will compare with two elements lik order by something and order by something2
string time = "Job started: donderdag 6 mei 2010 at 20:00:02"
var filterReg = new Regex(@".*:", RegexOptions.Compiled);
time = filterReg.Replace(time, String.Empty);
Is it possible to stop after the first occurence? so at the first ":".
I need to break apart a string that always looks like this: something -- something_else. I need to put "something_else" in another input field. Currently, this string example is being added to an HTML table row on the fly like this:
tRow.append($('<td>').text($('[id$=txtEntry2]').val()));
I figure "split" is the way to go but there is very little documentation that I can find yet.
Assume that I have a pickle dump - either as a file or just as a string - how can I determine the protocol that was used to create the pickle dump automatically?
And if so, do I need to read the entire dump to figure out the protocol or can this be achieved in O(1)? By O(1) I think about some header information at the beginning of the pickle string or file whose read out does not require processing the whole dump.
Thanks a lot!
Hi,
I want to copy a substring of a string using PHP.
The regex for the first pattern is
/\d\|\d\w0:/
The regex for the second pattern is:
/\d\w\w\d+:\s-\s:/
Is it possible combining preg_match with strpos to get the exact positions from start to end and then copy it with
substr( $string, $firstPos,$secPos ) ?
If I'm letting Visual Studio take care of adding an SQL Server database to an existing project, it adds the connection string to app.config. How can I use use THAT connection string to make my own connections and datasets?