Here's the query
INSERT INTO test_bans( ip, Expiration )
VALUES (
"0.0.0.0", DateAdd(
"d", 1, Date( )
)
)
Here's the table creation query
CREATE TABLE test_bans (
ID smallint(6) NOT NULL AUTO_INCREMENT,
IP text NOT NULL,
Expiration DATETIME NOT NULL,
PRIMARY KEY (ID)
) TYPE=MyISAM;
And here's the error
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')))' at line 1
Please help.
int Size(struct node* node)
{
if(node == NULL)
{
return 0;
}
else if(node != NULL)
{
return (Size(node->left) + 1 + Size(node->right));
}
}
Hi, Can Anybody please post the stack trace for the following piece of code.
Lets say if we insert the values 2, 1, 10, 5...
Then what could be the stack representation during the recursion process.. Please, its very urgent, and its very confusing too...
Hi
I want to have a drop down menu where a user can select from several predefined options but i also want to give him the option of inserting a user specific value, i was thinking having one of the options as "user specific" which will in turn allow the user to insert a user specif entry in a text box that appears or is editable when user selects the "user specific" option. any one have any ideas how i can implement this is HTML and Javascript?
thank you
I was reading Robert Rossney's entry on "What's the most unsound program you've had to maintain?" found at: (What's the most unsound program you've had to maintain?) when I realized that I had inadvertently developed a near-identical application!
The app consists of an HTTPListener object that grabs incoming POST requests. Based on the information in the header, I pass the body of the request to SQL Server to perform the appropriate transaction.
The requests look like:
<InvoiceCreate Control="389>
<Invoice>
<CustomerNumber>5555</CustomerNumber>
<Total>300.00</Total>
<RushOrder>1</RushOrder>
</Invoice>
</InvoiceCreate>
Once it's received by the HTTPListener object, I perform the required INSERT to the Invoice table using SQL Server's built-in XML handling functionality via a stored procedure:
INSERT INTO Invoice (InvoiceNumber, CustomerNumber, Total, RushOrder)
SELECT @NEW_INVOICE_NUMBER,
@XML.value('(InvoiceCreate/Invoice/CustomerNumber)[1]', 'varchar(10)'),
@XML.value('(InvoiceCreate/Invoice/Total)[1]', 'varchar(10)'),
@XML.value('(InvoiceCreate/Invoice/Total)[1]', 'varchar(10)')
I then use another SELECT statement in the same stored procedure to return the value of the new Invoice Number that was inserted into the Invoices table:
SELECT @NEW_INVOICE_NUMBER FOR XML PATH 'InvoiceCreateAck'
I then read the generated XML using a SQL data reader object in C# and use it as the response of the HTTPListener object.
My issue is, I'm noticing that Robert is indeed correct. All of my application logic exists inside the stored procedure, so I find myself having to do a lot of error-checking (i.e. validating the customer number and invoicenumber values) inside the stored procedure.
I'm still a midlevel developer, and as such, am looking to improve. Given the original post, and my current architecture, what could I have done differently to improve the application? Are there any patterns or best practices that I could refer to? What approach would you have taken? I'm open to any and all criticism, as I'd like to do my part to reduce the amount of "unsound programming" in the world.
Hi guys.
I want to update a part of a page by PPR.
This is the part of page that i want to update:
<h:panelGroup id="aggiungiAuto"
rendered="#{!autoBean.operazioneOk}">
<ui:include src="../component/aggiungi_auto.xhtml"/>
</h:panelGroup>
While this is the commandButton present in aggiungi_auto.xhtml
<p:commandButton value="Submit"
update="growl aggiungiAuto aggiungiFoto"
actionListener="#{autoBean.insert}"/>
Any Idea?
I need to create a page that has a listbox with databound items. Upon clicking an entry in the listbox, the page will postback and insert an entry into a listview.
The listview should have the item's name, and a textbox allowing the user to edit the value for each. I don't want the listview to be in "edit" mode. I just want the user to be able to update the value. Is this possible?
I am exploring a possibility to write a kind of a notebook analogue that would reproduce the look and feel of using a traditional notebook, but with the added benefit of customizing the page in ways you can't do on paper - ask the program to lay ruled paper here, grid paper there, paste an image, insert a recording from the built-in camera, try to do handwriting recognition on the tablet input, insert some latex for neat formulas and so on. I'm pretty interested in developing it just to see if writing notes on computer can come anywhere close to the comfort plain paper + pencil offer (hard to do IMO) and can always turn it in as a university C++ project, so double gain there.
Coming from the type of project there are certain requirements for the user interface:
the user will be able to zoom, move and rotate the notebook as he wishes and I think it's pretty sensible delegate it to OpenGL, so the prospective GUI needs to work well with OGL (preferably being rendered in it)
the interface should be navigable with as little of keyboard input as user wishes (incorporating some sort of gestures maybe) up to limiting the keyboard keys as modifiers to the pen movements and taps; this includes tablet and possible multitouch support
the interface should keep out of the way where not needed and come up where needed and be easily layerable
the notebook sheet itself will be a container for objects representing the notebook blurbs, so it would be nice if the GUI would be able to overlay some frames over the exact parts of the OpenGL-drawn sheet to signify what can be done with given part (like moving, rotating, deleting, copying, editing etc.) and it's extents
In terms of interface it's probably going to end up similar to Alias' Sketch Book Pro: [picture][http://1.bp.blogspot.com/_GGxlzvZW-CY/SeKYA_oBdSI/AAAAAAAAErE/J6A0kyXiuqA/s400/Autodesk_Alias_SketchBook_Pro_2.jpg]
As far as toolkits go I'm considering Qt and nui, but I'm not really aware how well would they match up the requirements and how well would they handle such an application.
As far as I know you can somehow coerce Qt into doing widget drawing with OpenGL, but on the other hand I heard voices it's slot-signal framework isn't exactly optimal and requires it's own preprocessor and I don't know how hard would be to do all the custom widgets I would need (say color-wheel, ruler, blurb frames, blurb selection, tablet-targeted pop-up menu etc.) in the constraints of Qt. Also quite a few Qt programs I've had on my machine seemed really sluggish, but it may be attributed to me having old PC or programmers using Qt suboptimally rather to the framework itself.
As for [nui][http://www.libnui.net/] I know it's also cross-platform and all of the basic things you would require of a GUI toolkit and what is the biggest plus it is OpenGL-enabled from the start, but I don't know how it is with custom widgets and other facets and it certainly has smaller userbase and less elaborate documentation than Qt.
The question goes as this:
Does any of these toolkits fulfill (preferably all of) the requirements or there is a well fitting toolkit I haven't come across or maybe I should just roll up my sleeves, get SFML (or maybe Clutter would be more suited to this?) and something like FastDelegates or libsigc++ and program the GUI framework from the ground up myself?
I would be very glad if anyone had experience with a similar GUI project and can offer some comments on how well these toolkits hold up or is it worthwhile to pursue own GUI toolkit in this case.
Sorry for longwindedness, duh.
Hello,
Is there any way to load an existing index into an instance of MemoryIndex?. I have an application which uses Hibernate Search so I can use index() in FullTextEntityManager instance to index an object. I'd like to recover back the created index and insert it into a MemoryIndex instance to execute several queries over it.
Is it possible?
Thanks.
I want to run a javascript snippet inside the <head> tag. Is that possible to do that in Selenium RC+Java?
I understood that if I use getEval or runScript that will insert the code inside the HTML body.
Any Ideas?
Thanks
My situation is explained in the code below.
I need to send via a socket NSString drawn from a TextBox
Thank you very much
NSString *string = fieldTesto.txt;
// I Find an istruction for insert s string in to the CFSocketSend
UInt8 message[] = "Hello world";
CFDataRef data =
CFDataCreate(NULL, message, sizeof(message));
CFSocketSendData(s, NULL, data, 0);
CFRelease(data);
I have a requirement to copy whatever data is getting inserted or updated to a log table to show who updated and when. I was thinking of using triggers for the same. The reason being the insert needed not be only stored procedure but can also be packages. Can I use extended events for the same ?.
I have a table with 42 million records. 32 million have a null value and I would like to generate a new guid for each one. Should I do this in batches?
Also, going forward, I would like a new guid added to the field on the insert of a new record. What is the best way to do this?
The field is not the primary key, which is an auto-incrementing integer.
Is there anything that stops the DateTime AddDays() method that doesn't run within a while loop. I have this simple bit of code;
DateTime last_day = monthCalendar2.SelectionRange.End;
DateTime first_day = new DateTime(year, month, day);
//Insert dates into vector
while (first_day != last_day)
{
dates.Add(first_day);
first_day.AddDays(1);
}
I step through the program and first_day never changes, anyone know why?!
Follow up to this question
This (similar version from old link) works in SQL Server 2008, however, Oracle is giving me trouble:
MERGE INTO wdm_test
USING ( select '10000000000000000000000000000000' Guid from DUAL ) val
ON ( wdm_test.Guid = val.Guid )
WHEN MATCHED THEN UPDATE SET test_column = null
WHEN NOT MATCHED THEN
INSERT (Guid, test_column)
VALUES ('10000000000000000000000000000000', null)
OUTPUT $action;
SQL Error: ORA-00933: SQL command not properly ended
Does Oracle not support OUTPUT $action;? If not, is there an alternative?
Lets suppose that $(document).height() is 1000. Then i insert a new div at the bottom of the page with height=100. The $(document).height() should be 1100 but it keeps throwing 1000 to me.
How can i get the new $(document).height() dynamically?
Thank!
Here is my Code
def printList(stringlist):
empty = []
if stringlist is None:
print empty
else:
print stringlist
def add (stringlist, string):
string = [] if string is None else string
if stringlist is not None:
stringlist.insert(0, string)
else:
stringlist.append(1)
it somehow appears "AttributeError: 'NoneType' object has no attribute 'append'"
I was originally looking for the code to be run like this:
>>> myList = None
>>> printList(myList)
[]
>>> for word in ['laundry','homework','cooking','cleaning']:
myList = add(myList, word)
printList(myList)
[laundry]
[homework, laundry]
[cooking, homework, laundry]
[cleaning, cooking, homework, laundry]
The line cmd.ExecuteNonQuery();
cmd.CommandText
CREATE TRIGGER subscription_trig_0 ON subscription AFTER INSERT AS UPDATE user_data SET msg_count=msg_count+1 FROM user_data
JOIN INSERTED ON user_data.id = INSERTED.recipient;
The exception:
Incorrect syntax near the keyword 'TRIGGER'.
Then using VS 2010, connected to the very same file (a mdf file) i run the query above and i get a success message. WTF!
Using logparser to import IIS logs to a db results in one column that has the date value and a second field for time:
2010-05-25 00:00:00.000 2010-01-01 11:11:58.000
I'd like to code an INSERT AFTER trigger that combines the 2 fields.
I'm creating a page that's a search result...
When you're viewing one of the results, at the bottom of the page, I need to insert "Next result" and "Previous result" links, like a pagination... But from [I think] a saved search, right?
How you people would do this?
Obs.: I'll use CakePHP (PHP) and MySQL
Hello All,
I dont know how to copy table data from
one server - database - table
TO
other sever - database - table.
If it is with in the same server and different databases, i have used the following
SELECT * INTO DB1..TBL1 FROM DB2..TBL1 (to copy with table structure and data)
INSERT INTO DB1..TBL1(F1, F2) SELECT F1, F2 FROM DB2..TBL1 (copy only data)
Now my question is copy the data from SERVER1 -- DB1-- TBL1 to SERVER2 -- DB2 --TBL2
Thanks in advance!
Hello,
In my tables, i have selected id column to be of type int (4 bytes). The answer i want to know is how will any database handle it once it's limits are reached? Will the database refuse to insert any more records in table? or what exactly will happen? Also how should i tackle this type of problem (if the database doesn't handle it by itself)?
Here's the query:
INSERT INTO jobemails (jobid, to, subject, message, headers, datesent) VALUES ('340', '[email protected]', 'We\'ve received your request for a photo shoot called \'another\'.', 'message', 'headers', '2010-04-22 15:55:06')
The datatypes are all correct, it always fails at the subject, so it must be how I'm escaping the values, I assume.
I'm sure one of you will see my idiot mistake right away. A little help?