Hi everyone
I want to make a quiz, I want to have to output an array of questions after a form is submitted.
I know to use a bean I think but how would I do this?
Thanks
The conversion of a char data type to a DateTime data type resulted in an out-of-range DateTime value.
The statement has been terminated.
Please give me most possible answers
ALTER PROCEDURE [dbo].[attendance_updatebyemployee_id]
@Employee_id int,
@AtDate datetime,
@FNLogged bit,
@ANLogged bit,
@LogTime varchar(10),
@LogOuttime varchar(10)
AS
BEGIN
SET NOCOUNT ON;
update Mst_Attendance set FNLogged=@FNLogged,
ANLogged=@ANLogged,LogTime=@LogTime,LogOuttime=@LogOuttime
where EmployeeId=@Employee_id and Atdate= @AtDate
END
Hi every body
I have an audit table that have data for insert, update and delete operations. I am writing a report that will display data in the order of Insert, Update and Delete. I don't think the order by clause will help. any help?
I have a lotus view that stores a number. I need to perform some math against the value, but I am having a lot of problems getting the types to match up.
doc.numOfGold = numGold
and CInt(doc.numOfGold) = numGold
and CInt(doc.numOfGold) = CInt(numGold)
and doc.numOfGold = CInt(numGold)
all return type mismatch. I've tried changing the column properties to treat it as a decimal, with no better luck.
Any thoughts?
Thanks!
I have a php variable that comes from a form that needs tidying up. I hope you can help.
The variable contains a list of items (possibly two or three word items with a space in between words).
I want to convert it to a comma separated list with no superfluous white space. I want the divisions to fall only at commas, semi-colons or new-lines. Blank cannot be an item.
Here's a comprehensive example (with a deliberately messy input):
Variable In: "dog, cat ,car,tea pot,, ,,, ;;(++NEW LINE++)fly, cake"
Variable Out "dog,cat,car,tea pot,fly,cake"
Can anyone help?
I'm building an 'add new row' function for product variations, and I'm struggling with the regex required to match the form attribute keys. So, I'm basically cloning rows, then incrementing the keys, like this (coffeescript):
newrow = oldrow.find('select, input, textarea').each ->
this.name = this.name.replace(/\[(\d+)\]/, (str, p1) ->
"[" + (parseInt(p1, 10) + 1) + "]"
)
this.id = this.id.replace(/\_(\d+)\_/, (str, p1) ->
"_" + (parseInt(p1, 10) + 1) + "_"
)
.end()
This correctly increments a field with a name of product[variations][1][name], turning it into product[variations][2][name]
BUT Each variation can have multiple options (eg, color can be red, blue, green), so I need to be able turn this product[variations][1][options][2][name] into product[variations][1][options][3][name], leaving the variation key alone. What regex do I need to match only the last occurrence of a key (the options key)?
I've been using C++ for quite a long time now but nevertheless I tend to fall back on scanf when I have to parse simple text files. For example given a config like this (also assuming that the order of the fields could vary):
foo: [3 4 5]
baz: 3.0
I would write something like:
char line[SOME_SIZE];
while (fgets(line, SOME_SIZE, file)) {
int x, y, z;
if (3 == sscanf(line, "foo: [%d %d %d]", &x, &y, &z)) {
continue;
}
float w;
if (1 == sscanf(line, "baz: %f", &w)) {
continue;
}
}
What's the most concise way to achieve this in C++? Whenever I try I end up with a lot of scaffolding code.
In actionscript an object's property can be accesses in this way:
object["propertyname"]
Is something like this possible in c#, without using reflection?
In the code below, Pages is defined as
public SortedDictionary<DateTime, float[]> Pages { get; set; }
I am trying to dynamically increase the size of this array. Can anyone tell how to increase the sized of the innermost float[]?
var tt = currentContainer.Pages[dateTime];
Array.Resize<float>(ref tt, currentContainer.Pages.Count + 1);
Fail 1
I tried the following code and get index out of range exception
SortedDictionary<DateTime, float[]> Pages = new SortedDictionary<DateTime,float[]>();
float[] xx = new float[1];
xx[0] = 1;
DateTime tempTime = DateTime.UtcNow;
Pages.Add(tempTime, xx);
var tt = Pages[tempTime];
Array.Resize<float>(ref tt, Pages.Count + 1);
Pages[tempTime][1] = 2;
Fail 2
The following gives a compile time error (property, index, or dynamic member can't be used as a ref value)
SortedDictionary<DateTime, float[]> Pages = new SortedDictionary<DateTime,float[]>();
float[] xx = new float[1];
xx[0] = 1;
DateTime tempTime = DateTime.UtcNow;
Pages.Add(tempTime, xx);
var tt = Pages[tempTime];
// The line below is different from Fail 1 above ... compile time error
Array.Resize<float>(ref Pages[tempTime], Pages.Count + 1);
Pages[tempTime][1] = 2;
Question
What is the most performant answer to resize this array?
Would the answer change if it's likely that the final size will be 100-200 floats or 700-900 floats?
What if I change my allocation size from +1 to +128? .. or larger?
I'm using Python to read and write SAS datasets, using pyodbc and the SAS ODBC drivers. I can load the data perfectly well, but when I save the data, using something like:
cursor.execute('insert into dataset.test VALUES (?)', u'testing')
... I get a pyodbc.Error: ('HY004', '[HY004] [Microsoft][ODBC Driver Manager] SQL data type out of range (0) (SQLBindParameter)') error.
The problem seems to be the fact I'm passing a unicode string; what do I need to do to handle this?
I using php's str_replace function to replace some text. Example below.
str_replace("{x+{\$v}}", "{x-{\$v}}", $this->introtext);
str_replace('{x+{\$v}}', '{x-{\$v}}', $this->introtext);
In first case it replace text, but in second case it is not doing so. What is difference between two?
I'm having a coloumn name with varchar field that holds some folder path like "C:\Program Files\Internet Explorer\en-US" .I need to update the root folder name(Program files to profilesNew).Can anyone please help.
I tried with a query
declare @val as varchar(100)
set @val='C:\Program Files\Internet Explorer\en-US'
select substring(@val,charindex(':\',@val),charindex('\',@val))
but not getting the exact answer
C:\Program FilesNew\Internet Explorer\en-US
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
NSString *araci2 = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];
[dbarray addObject:araci2];
NSLog(@"DB ITEMS: %@",dbarray);
}
First of all, I try to get a description longer than a line from db. While part of the value appears meaningful, some of the characters of those values are absurd like "00fu". How can I print them in proper fashion ?
I am trying to add a .html suffix at the end of all strings supplied by the user before it is entered into the database. Here's my code so far:
strtolower(str_replace(" ", "_", $postTitle));
The above takes the title of the post the user it trying to make, turns it to lower case, replaces all white spaces with underscores and makes it ready to be entered into a database column called post_url.
I just need it to do one more thing and that's to add a .html at the end of each post url. What is the function to do this?
Strings in JavaScript are immutable. Across the web and here on Stack Overflow as well, I came across the Array approach to concatenate strings:
var a = [];
a.push(arg1,arg,2....);
console.log(a.join(''));
I know that this approach is better than the simple
console.log(arg1 + arg2 +.....);
for reasons of skipping creating intermediate objects but how does it fair better against :
arg1.concat(arg2,arg3.....);
Hi my question
Need to get the 10 word before and 10 words after for the given text . i mean need to start the 10 words before the keyword and end with 10 word after the key word.
Given text : "Twenty-three"
The main trick : content having some html tags etc .. tags need to keep that tag with this content only . need to display the words from 10before - 10after
content is bellow :
removed
Thank you
I am reading Effective C# by Bill Wagner. In Item 14 - Minimize Duplicate Initialization Logic, he shows the following example of using the new optional parameters feature in a constructor:
public MyClass(int initialCount = 0, string name = "")
Notice that he used "" instead of string.Empty. He comments:
You'll note [in an example above] that the second constructor specified "" for the default value on the name parameter, rather than the more customary string.Empty. That's because string.Empty is not a compile-time constant. It is a static property defined in the string class. Because it is not a compile constant, you cannot use it for the default value for a parameter.
If we cannot use the string.Empty static in all situations, then doesn't that defeat the purpose of it? I thought that we would use it to be sure that we have a system-independent means of referring to the empty string. Is my understanding wrong? Thanks.
My send mail task works fine for email ids like [email protected] but it throws error for email ids like [email protected].
is there any way i can make it work for such ids also?
Thanks.
I have a page create-quote.aspx. I want to open this page in different modes, depending on whether a querystring parameter is present or not.
My question is at which event should I check, If I have a querystring parameter or not.
I think, it should be preinit, what do you say.
Hi,
NSString *newValue = @"#xyz";
but the following searchPreidate is not finding that. pls let me know how to solve this
self.searchPredicate = [NSPredicate predicateWithFormat:@"(value contains[c] %@) OR (title contains[c] %@)",newValue, newValue];
A field in my table can have arbitrary strings. On the UI, there is a drop down having options like
All, Value1, Value2
And the results were filtered by the selected option value. So far this is easy and adding new filters to the UI is not a problem. Needs no changes in my stored procedure. Now I want to have an "Others" option here as well, which will return rows not having the column value as Value1 or Value2.
Apparently this will require a "not in" operator in my query, and will make maintenance difficult, as the list of values is likely to change
Any suggestions, design tips?
Hi. First I have to say: Happy Christmas to All!
I'm starting learning classes in PHP. I coded that:
class User {
function getFbId($authtoken) {
}
function getFbFirstName ($authtoken) {
}
}
What I want to do is something like that: $user=new User($authtoken); And pass the $authtoken to the class. It's possible to define that when starting the class. It's possible to retrive that value inside a function of that class?
Hi there,
I need to write a script that takes the current path (%~dp0), transforms backslashes into forward slashes and passes it further to some command.
Due to the environment I'm working in the only option that I have is windows shell (not Powershell where the issue would not a problem).
Is it even possible to do that?
how do you append an additional url parameter to a link in your google search results? is it possible to do this within the style sheet?
for example i have domain.com/result.htm - i want to change the link to domain.com/result.htm?param=1
thank you