I have a html file that I want to trim. I want to remove a section from the beginning all the way to a given string, and from another string to the end. How do I do that, preferably using sed?
Hi everybody,
I have tried to find a good introduction on chainable OOP objects in PHP, but without any good result yet.
How can something like this be done?
$this->className->add('1','value');
$this->className->type('string');
$this->classname->doStuff();
Or even: $this->className->add('1','value')->type('string')->doStuff();
Thanks a lot!
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)"
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 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)
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?
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
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?
is there an activerecord (any similar SQL-wrapper) for python? which is good for:
used in a server-side python script
light-weight
supports MySQL
what I need to do:
insert (filename, file size, file md5, the file itself) into (string, int, string, BLOB) columns
if the same file (checksum + filename) does not exist in db
thx
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
i have an string like this format in my case i need to extract only the characters from string
case
1)12AB
2)SD12
3)1WE4
output
1)AB
2)SD
3)WE
i need to extract only the characters
i am using this expresion in the dervied column in SSIS package
SUBSTRING(MediaIDCode,1,2)
but this expresssion works for only this condition
1)12AB
i need to get an expressioin that works for all the conditions above
any help would be great
Thanks
Prince
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?
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. Or in java: (Math.pow(x,2)) + (x * 5) + 10The 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?
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 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.
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
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 have a string (R(46 - 9900)) AND ( NOT (R(48 - 9900))) where R denotes Range . If you evaluate the expression it results in R(46-47) , considering the logical operators (AND,NOT).
I have a requirement where I need to parse such a string and evaluate it to a correct result . I have to use C++ as a programming tool to achieve this result .
Can anyone suggest a few guide lines as to how do I proceed on this ?
I can't figure out why I get a Object reference not set to an instance of an object. error if I use a ternary operator in my LINQ query.
var courses = from d in somesource
orderby d.SourceName, d.SourceType
select new
{
ID = d.InternalCode,
Name = string.Format("{0} - {1}{2}", d.InternalCode, d.SourceName, (d.SourceType.Length > 0 ? ", " + d.SourceType : string.Empty))
};
Any thoughts?
Hello,
I am using SimpleDateFormat to display a Calendar like this :
public String getDate()
{
String DATE_FORMAT = "EEEE, dd/MM/yyyy HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
System.err.println(date.getTime().getMonth());
return sdf.format(date.getTime());
}
The shell returns 6 and the display : mardi, 06/07/2010 12:44:52
It can't be possible ? Why ?
Thanks
hi everybody...
I need a javascript code that split a string like below:
Input string: "a=aa| b=b||b | c=cc"
Output:
a=>aa
b=>b||b
c=>cc
I'd written different codes like:
split(/ \ | /)
or
Split(/ \| (?! \ |) /)
but didn't work.
please help me...
I really need it fast.
What is the best way of inserting a datetime value using a dynamic sql string, whilst at the same time being able to handle the possibility of the value being null?
The current statement inserts into a table from a select statement built using a string. The datetime value is stored in a parameter and the parameter is used in the select.
Like so:
set @execsql = 'Insert into ( start_date )
SELECT ( ''' + CAST(start_date as VARCHAR) + ''' + ')'
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