syntax

MySQL Syntax Error on Table Creation

心已入冬 提交于 2020-01-02 06:26:05
问题 I am trying to use this query in a Filemaker -> MySQL transition script. The table creation steps are taken directly from a phpMyAdmin export, and I added in the DROP statements. DROP TABLE IF EXISTS artifacts; CREATE TABLE IF NOT EXISTS `artifacts` ( `aid` INT(11) UNSIGNED NOT NULL auto_increment, `accession number` TEXT NOT NULL, `name` TEXT NOT NULL, `period 1` TEXT NOT NULL, `period 3 date` TEXT NOT NULL, `visual description` TEXT NOT NULL, `religion 1` TEXT NOT NULL, `dimen 1 number`

How to compare values for last and second last entry in table?

北城以北 提交于 2020-01-02 05:27:11
问题 I have a table in Oracle called quotes with two columns: date and value . I would like to compare values for last entry and second last entry in the table. In this example I would like to get dates for 13.1 and 11.1 in one line and the difference between the values for each date (10-5=5). Quotes Table: Date - Value 13.1.2010 - 10 11.1.2010 - 5 10.1.2010 - 2 8.10.2010 - 1 Edit: I would like to have more complex table with one more column companyId . I need to get items for each company. Table

Writing a simple syntax parser

北慕城南 提交于 2020-01-02 05:21:07
问题 Here's what I'd like to do - in Php: given a string, have a result like this: (a()?b|c) a is a function that returns true of false. This should give b or c after calling a() (a()?(b()?d|e)|c) . Same principle. The final result should be d , e or c (a()?(b()?d|e)|(c()?f|g)) . Same principle. The final result should be d , e , f or g The problem I'm facing is that a (in my previous examples) can be an expression too, like this: ((h() ? a | i) ? (b() ? d | e) | (c() ? f | g)) I'm trying to use a

Benford's Law in Java - how to make a math function into Java

南楼画角 提交于 2020-01-02 05:18:13
问题 I have a quick question. I am trying to make a fraud detection app in java, the app will be primarily based on Benford's law. Benford's law is super cool, it basically can be interpreted to say that in a real financial transaction the first digit is commonly a 1, 2, or 3 and very rarely an 8, 9. I haven't been able to get the Benford formula translated into code that can be run in Java. http://www.mathpages.com/home/kmath302/kmath302.htm This link has more information about what the Benford

What the difference between (*T)(nil) and &T{}/new(T)? Golang

给你一囗甜甜゛ 提交于 2020-01-02 04:27:11
问题 Could anybody explain what the subtle difference between these two notations: (*T)(nil)/new(T) and &T{} . type Struct struct { Field int } func main() { test1 := &Struct{} test2 := new(Struct) test3 := (*Struct)(nil) fmt.Printf("%#v, %#v, %#v \n", test1, test2, test3) //&main.Struct{Field:0}, &main.Struct{Field:0}, (*main.Struct)(nil) } Seems like the only difference of this one (*T)(nil) from other is that it returns nil pointer or no pointer, but still allocates memory for all fields of the

clearTimeout() not working

ぃ、小莉子 提交于 2020-01-02 04:06:10
问题 In the following code the clearTimeout() function doesn't seem to clear the timer. Please note: I've stripped the code down a bit to show the relevent parts. Any ideas? var Gallery = { next: function() { // does stuff }, close: function() { Gallery.slideshow("off"); }, slideshow: function(sw) { if (sw == "off") {clearTimeout(timer);} var timer = setTimeout(function() {Gallery.next();Gallery.slideshow();}, 1000); }, }; FULL CODE: <!doctype html> <html> <head> <meta charset="utf-8"> <title

clearTimeout() not working

谁说胖子不能爱 提交于 2020-01-02 04:06:06
问题 In the following code the clearTimeout() function doesn't seem to clear the timer. Please note: I've stripped the code down a bit to show the relevent parts. Any ideas? var Gallery = { next: function() { // does stuff }, close: function() { Gallery.slideshow("off"); }, slideshow: function(sw) { if (sw == "off") {clearTimeout(timer);} var timer = setTimeout(function() {Gallery.next();Gallery.slideshow();}, 1000); }, }; FULL CODE: <!doctype html> <html> <head> <meta charset="utf-8"> <title

Semi-colon after a case valid in a PHP switch statement?

北战南征 提交于 2020-01-02 03:51:11
问题 I'm debugging some code for a client and found the following syntax: switch ($i) { case 0; echo "i equals 0"; break; case 1; echo "i equals 1"; break; case 2; echo "i equals 2"; break; } The case statements end in semi-colons rather than colons. Turns out this does compile, but is it legit? I've never seen that syntax before. 回答1: From the documentation: It's possible to use a semicolon instead of a colon after a case like: switch($beer) { case 'tuborg'; case 'carlsberg'; case 'heineken';

int(int, int) style template function type syntax

老子叫甜甜 提交于 2020-01-02 03:36:08
问题 I remember that when using Boost.Spirit and for the std::function addition to C++0x, you specify the function type by using a syntax that doesn't use pointers, like in defining std::function<bool(int)> fn , whereas you would cast a pointer like (bool(*)(int))fn . Can anyone tell me the name of this new syntax or any references on this, or how to use it? It seems like a polymorphic function type syntax that applies for functors as well, but I don't really know how to use it. 回答1: bool(int) is

Syntax error on token “;”, { expected after this token in Random string creator

隐身守侯 提交于 2020-01-02 03:13:09
问题 I am writing code to generate a random 3 letter strings using the letters a, b, and c. I am getting the error message "Syntax error on token ";", { expected after this token" after the line where i create the random variable (Random rand = new Random();). I do not know why I am getting this error when it looks fine to me. I am also getting the error message: Syntax error, insert "}" to complete ClassBody, after the last bracket in the program. I am almost postive all my closing brackets match