I think these SQL useful to you. SELECT `firstname` , `gender` , MONTHNAME( `dol` ) AS 'month' FROM `student_details` WHERE `doa` = '2015-03-01' AND `dol` = '2015-06-17' Below SQL give exact result i think. SELECT `firstname` , `gender` , SUBSTRING(MONTHNAME( `dol` ),1,3) AS 'month' FROM `student_details` WHERE `doa` = '2015-03-01'...
Of course ... It calls the newcard.save().then function - thanks @rightfold - which is in the Angular.js promises api. Not immediately obvious out of context of that api which BTW is nicely explained here.
In your example above, C is a protocol. What you're saying in english terms is: I want a class A that subclasses from class B and also conforms to protocol C. A protocol is similar to an abstract class in other languages and usually defines a set of methods and...
python,syntax,machine-learning,scikit-learn
The GaussianNB() implemented in scikit-learn does not allow you to set class prior. If you read the online documentation, you see .class_prior_ is an attribute rather than parameters. Once you fit the GaussianNB(), you can get access to class_prior_ attribute. It is calculated by simply counting the number of different...
{187, 187} and {206, 206} aggregates are valid as an initialization expressions, but not as a general-purpose expressions*. That is why a ternary operator does not allow it. If you are making an initializer for a local constant, you could use CGSizeMake: CGSize const ksizeSmall = SOME_BOOLEAN_VARIABLE ? CGSizeMake(187, 187)...
javascript,arrays,loops,for-loop,syntax
You can chain variable declarations like this var i = 0, foo="bar", hello = "world" Which is close to the same thing as var i = 0; var foo = "bar"; var hello = "world"; So this for(var i = 0, len = keys.length; i < len; i++) Is the...
java,google-app-engine,generics,syntax
The create method accepts generic parameter, so the parameter type was passed. you can read more about generic parameters here...
We can simplify a few: #!/bin/bash servers="server1.... server2...." seconds="3" # value for servers to differ (in seconds) for server in $servers do remote=$(ssh -l root ${server} date +%s ) now=$(date +%s) if [ "$remote" -gt "$now" ] then diff=$(expr $remote - $now) else diff=$(expr $now - $remote) fi echo $diff...
c,syntax,compiler-construction,token,lexical
Your scanner returns NUM when it has found a sequence of digits, not digit. The identifier digit is just used internally in your Flex specification. Then you have another digit defined as a token in your Bison grammar, but it is not connected in any way to the Flex one....
python,syntax,regression,linear
Your last variable, or rather pair of variables, is invalid. Syy/Sxx If that is supposed to be a single variable, know that you cannot have / in your variable name. Python identifiers and keywords Identifiers (also referred to as names) are described by the following lexical definitions: identifier ::= (letter|"_")...
You can't call a column "WHEN", since it is a keyword in sqlite
You can use as to "cast" in Dart. import 'dart:html'; ... if((querySelector('#username') as InputElement).value!="") ...
The specific error you are asking about is because of the missing colon: And card1 cannot be called. if guess==card1() count+=1 Should be if guess==card1: count+=1 There is also a missing closing bracket on the guess: guess = int(input(""" Pick One! 1:'Crown', 2:'Anchor', 3:'Heart', 4:'Diamond', 5:'Club', 6:'Spade', 0:'Quit', """)) ...
The SSRS expressions are based on Visual Basic. Expressions are written in Microsoft Visual Basic, and can use built-in functions, custom code, report and group variables, and user-defined variables. Expressions begin with an equal sign (=). Source: Expression Examples (Report Builder and SSRS) The IIF() function is "inherited" from VB,...
C typedef declarations are understood by analogy with variable declarations. int a, *b; declares the values a of type int and b of type int*. typedef int A, *B; declares the type A equivalent to int and the type B equivalent to int*. So, just think about what the variable...
objective-c,methods,syntax,parameters
The labels are the things before the type. You can omit them (except for the first one, because it is the name of the method). So you are allowed to declare this: - (float) divNum1: (int) a : (int) b; And define it like this: - (float) divNum1: (int) a...
You are using an extended glob but these aren't enabled by default within a script. In order to using them, they must be explicitly enabled. You can do so by adding this before the line: shopt -s extglob To disable them later on in the script, you can use shopt...
The statement starting on line 10 is missing its terminating semi-colon. my $hash_form = { 'KEY' => $key, 'HASH' => $hash, 'action' => $action, } should be my $hash_form = { 'KEY' => $key, 'HASH' => $hash, 'action' => $action, }; ...
I think you're after either this: - foo: 1 bar: - one - two - three - foo: 2 bar: - one1 - two2 - three3 Which gives you this structure: [ { "foo": 1, "bar": [ "one", "two", "three" ] }, { "foo": 2, "bar": [ "one1", "two2", "three3"...
It's a member function definition. const char * is the return type, a pointer to a constant character, by convention the first character of a zero-terminated string array. what is the function name () is an empty parameter list, indicating that the function takes no arguments const qualifies the function,...
Check the code before the print line for errors. This can be caused by an error in a previous line; for example: def x(): y = [ print "hello" x() This produces the following error: File "E:\Python\test.py", line 14 print "hello" ^ SyntaxError: invalid syntax When clearly the error is...
The line getMenuInflater().inflate(R.menu.menu_quiz, menu); is a short form of this: MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_quiz, menu) ...
A literal number needs to have a period or an exponent to be treated as a floating point literal constant. If it doesn't have any of these, it is treated as an integer literal constant.
The use of IEEE.std_logic_1164.all is also required before the entity, like: library IEEE; use IEEE.std_logic_1164.all; entity lab2 is The first IEEE.std_logic_1164.all only applies to the package, and package body of the same package, but not to any other design objects like an entity or package, even if these happens to...
IMHO this line of code causes problem if nums[i] + nums[b] == 0 in case when nums = [1, 2, 3] so length is 3; when i = 2 then b = 3. When b = 3 then nums[b] (nums[3]) is nil. possible solution def two_sum(nums) i = 0 while...
I think you just want two left joins: SELECT e.TO_ADD, e.FROM_ADD, ufrom.USER_FIRST_NAME, uto.USER_FIRST_NAME, e.MESSAGE FROM EMAIL e LEFT JOIN USERS ufrom ON ufrom.USER_ID = e.FROM_ADD LEFT JOIN USERS uto ON uto.USER_ID = e.TO_ADD ORDER BY ufrom.USER_FIRST_NAME DESC; ...
Acutally its \u0061 = a so one and so forth, it is a primitive way to code i think. it is not a nuclear weapon program. :) not all know this.
You can create a map using [ key: value] notation. Since your value is an array of two elements you can simply create it using [element1,element2] notation, and then you can add the object to the map using << operator. So this myMap << [ (object) : [element1,element2]] can do...
haskell,syntax,infix-notation,applicative,infix-operator
Why is f <$> g <$> x equivalent to (f . g) <$> x ...well, this isn't so much a functor-thing as a Haskell-thing. The reason it works is that functions are functors. Both <$> operators work in different functors! f <$> g is in fact the same as...
javascript,jquery,jquery-ui,syntax,jquery-ui-selectmenu
So, i went back to the Jquery Documentation and found the correct syntax to make this work. I also learned a little more about how to use the console tab in developer tools view to track down syntax errors. $(function() { var work = $( "#display" ); $( "#selector" ).selectmenu...
Those would both be syntax errors. It is perhaps an attempt to use Markdown style for bold text (i.e. **text** becomes text). StackOverflow uses Markdown in questions, answers, and comments. It is completely unrelated to JavaScript. However, in this case, the action seems to be intended to make that text...
Your main method located at the top of your class: public static void main(String[] args) { Is never closed, you should do something like this: public static void main(String[] args) { } Now your error should be resolved but without something inside your main method your code will probably not...
You're missing a closing curly brace here: if($count == 0){ $output = 'Keine Ergebnisse gefunden!'; }else{ while($row = mysql_fetch_array($query)) { $Vname = $row['Vorname']; $Nname = $row['Nachname']; $id = $row['id']; $output .= '<div>'.$Vname.' '.$Nname.'</div>'; } Notice how you close the while, but you never close the else. Just add a closing...
In a nutshell, because this is a broad topic: @asyncio.coroutine def foo(): bar = yield from some_async_func() print(bar) asyncio.get_event_loop().run_until_complete(foo()) This defines a coroutine using the asyncio module. foo is a coroutine, and it makes a call to a coroutine some_async_func (because it makes a call to an asynchronous function it...
Partially, but not within the main part of Matlab. If you use MuPAD (type mupad in your Command Window), the engine behind much of the Symbolic Math toolbox, you can display/print results from calculations in your notebook with various levels of formatting. However, it does not appear that one can...
I would use include? to make it more readable: if ([3,5,7].include?a and b == 2 and [5,6].include?c and [8,9,0].include?d) ...
It appears operator() is overloaded for the tyupe of UDefEnerfyH. One way to do this is this solution #include <iostream> using namespace std; struct MJ { void GetLowEdgeEnergy(size_t arg) { cout << "GetLowEdgeEnergy, arg = " << arg << endl; } void operator ()(size_t arg) { cout << "operator (),...
c#,sql,syntax,ms-access-2007,helper
Your column name creditcardNum missing t Command.CommandText = "UPDATE Table1 SET Username='"+textBox10.Text+"' , Email='"+textBox9.Text+"' , FirstName='"+textBox8.Text+ "' , LastName='"+textBox7.Text+"' , CrediCardNum='"+textBox6.Text+"' Where Username='"+m[0]+"'" ; it should be Command.CommandText = "UPDATE Table1 SET Username='"+textBox10.Text+"' , Email='"+textBox9.Text+"' , FirstName='"+textBox8.Text+ "' , LastName='"+textBox7.Text+"' , CreditCardNum='"+textBox6.Text+"' Where Username='"+m[0]+"'" ; Your table definition picture saying...
As @chux said, the \x that VS is displaying to you is an inseparable part of the char representations that VS is presenting to you. It is trying to be helpful by providing a form that can be used directly in C source code as a char literal. For example,...
javascript,for-loop,syntax,decrement
In js, 0 means false, and the other values like 1 are true. why is the iteration statement in the middle for(var i = x; --i; /* optional */ ) ^^ its decrement as well as the condition loop continues until, i is 0 In fact, you can create infinite...
The only way to do exactly what you're asking for is to subclass python build-in class list. This should help....
c,arrays,pointers,multidimensional-array,syntax
Given the declaration int a[3][4]; the following are true: Expression Type Decays to Value ---------- ---- --------- ----- a int [3][4] int (*)[4] Base address of array &a int (*)[3][4] n/a Base address of array *a int [4] int * Base address of first subarray (equivalent to a[0]) a[i] int...
Are you sure you don't want to use a PFObject class instead of an AnyObject? var post :PFObject? post?["caption"] = captionTextView.text https://www.parse.com/apps/quickstart#parse_data/mobile/ios/swift/existing...
The following should work: import java.security.cert.* import javax.net.ssl.* TrustManager[] trustAllCerts = [ [ getAcceptedIssuers: { -> null }, checkClientTrusted: { X509Certificate[] certs, String authType -> }, checkServerTrusted: { X509Certificate[] certs, String authType -> } ] as X509TrustManager ] ...
The character restriction for text on your page and in your markup is defined according to your selected character set. If you don't define a character set, the browser will take a guess or assert its default option (usually, whatever is the least restrictive). The character set is defined by...
sql,oracle,syntax,arguments,substr
SUBSTR(fridge_door_modela_id, 0, INSTR(fridge_door_modela_id, 'EXCR'),1) The above syntax for SUBSTR is incorrect. The correct syntax is: SUBSTR( string, start_position [, length ] ) Also, the index of substr starts from 1 and not 0. Executing it in SQL*Plus shows the exact error clearly, see the following error: SQL> WITH DATA...
. without the parentheses only works in infix position. :t however takes an expression, e.g. a function, and to turn an infix operator symbol into an expression, you need to surround it with parens. Consider: 3 + 4 = (+) 3 4 -- pseudocode and myPlus = (+) which is...
syntax,dart,syntax-error,questionmark
The feature existed at some point in Dart's development, but it was removed again because it caused more complication than it removed, without solving the problem that actually needed solving - forwarding of default parameters. If you have a function foo([x = 42]) and you want a function to...
The syntax is: SELECT uniqueid AS uniqueid_idx, calldate, src, dst, dstchannel, billsec, SUBSTR(CONVERT(IF(LENGTH(dst)>8,cdr.dst,CONCAT('67',cdr.dst)),UNSIGNED INTEGER),1,6) prefixo_normal, IF(LENGTH(dst) < 4, dst, NULL) AS ramal FROM cdr There's no THEN or END when you use the IF function....
You were very close. You need to tell PHP to evaluate the $a alone. Try: <?php $a = 'test'; $test = ['a', 'b']; echo ${$a}[0]; Example...
return AudioSegment.from_file(getFilePath(filename, format="wav") Looks like you're missing a parenthesis. return AudioSegment.from_file(getFilePath(filename), format="wav") ...
There seems to be no need to use enumerate here. Just iterate over strings directly: for s in strings: if findWholeWord(s)(line) != None: print (jd['user_id'], jd['text']) break If you also need the index variable n, then use enumerate: for n, s in enumerate(strings): if findWholeWord(s)(line) != None: # do something...
c,syntax,bit-manipulation,bitwise-operators
Shift operator only only works on integral types. Using << causes implicit integral promotion, type casting b to an int and "protecting" the higher bits. To solve, use temp = ((unsigned char)(b << 4)) >> 4;...
ruby-on-rails,ruby,syntax,favorites
I'm assuming the User can have many Favorites, since you're attempting to single one out via params[:id]. If that's the case, try changing .favorite to .favorites. Hope that solves it!...
Just add an empty body. Like this while( x + ++flips < 8 && board[x + flips][y] == opponent ){}.
python,syntax,list-comprehension
You can use a generator expression: cubed = (x ** 3 for x in range(1, 11)) cube4 = [c for c in cubed if c % 4 == 0] This still iterates over range() only once, but now the x ** 3 expression is calculated just the once as the...
mysql,database,syntax,drop-database
You need backticks: DROP DATABASE `/`; ...
You are using the word "closure" wrong. All functions are closures in Swift. What makes this function special is that is anonymous. That means there is no declaration line — so there needs to be another way of expressing the incoming parameters. Swift's solution is that you put the parameter...
DATABASE is a MySQL reserved word. Use a different name for the table
This was unfortunately removed in Python3. :-( The idea was that this hinders introspection. Instead of figuring out how a function is called by the signature, it would require analyzing bytecode (not the syntax tree)....
_ alone is an anonymous variable. Multiple occurrences in the same clause (or the same read-term) represent different variables. A variable starting with _ but containing further characters is not an anonymous variable. Several occurrences represent the same variable. By convention, many Prolog systems require that variables occurring only once...
In this case you can't use the short variable declarations ":=" for redeclaring the foo variable, according to the spec: Unlike regular variable declarations, a short variable declaration may redeclare variables provided they were originally declared earlier in the same block with the same type, and at least one of...
There is no standard way to change the dataset beign queried after the query starts. This is especially true if FROM is loading from the web. If you can put all the possible graphs in the datasets, you can use GRAPH. if you can't, then your two step approach is...
Remove endif; When you use curly braces you don't need (and cannot use) endif. This: if (true) { echo 'hello'; } else { echo 'goodbye'; } ...is equivalent to this: if (true): echo 'hello'; else: echo 'goodbye'; endif; You cannot mix the two styles....
It's called a label and it's used for naming loops. It's useful when you have nested loops and you want to apply break; (or continue;) to a particular one. For example: outer: for (int i = 0; i < 5; i++) { inner : for (int j = 0; j...
In REPL you have to use fun(...) -> ... end: 1> F = fun(X) -> X end. #Fun<erl_eval.6.80484245> 2> F(42). 42 If you have code in file use c command: 1> c(word_count). {ok,word_count} 2> word_count:word_count([]). 0 ...
java,collections,syntax,java-stream
Did you check the right class and Java version? Java 8's Collection (not Collections) has a stream() default method, which is inherited by ArrayList: /** * Returns a sequential {@code Stream} with this collection as its source. * * <p>This method should be overridden when the {@link #spliterator()} * method...
It is a non-provable operator. See this link to learn more. Basically, it's true if the argument is not provable.
python,vim,syntax,pylint,syntastic
Syntastic stores the errors in the location list window. You can use :lopen to show it, and then use commands like :ll (or <Enter>) to jump to the error under the cursor. Alternatively, you can also navigate through errors via :lnext and related commands. If the corresponding error message did...
There are probably a number of ways to accomplish this, depending on your implementation preferences. My advice is to use the rdf:li special property in place of the arbitrary rdf:_nnn, which is easier to extend. rdf:li is equivalent to rdf:_1, rdf:_2 in order. So the following code blocks are equivalent:...
python,if-statement,syntax,any
As the docs for any say: Return True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to: def any(iterable): for element in iterable: if element: return True return False So, this is equivalent to: for element in (i in string for i...
It fires everytime the getter is called. No way this could be optimized away. You might want to keep a preset colors array in sync with the photos property, i.e. change it directly when setting the photos. I also dislike the tight coupling in that place which seems unnecessary. I...
php,syntax,bison,abstract-syntax-tree
I was able to solve this issue, Two steps need to be taken: Make PHP not parse '#' as comments: Change: <ST_IN_SCRIPTING>"#"|"//" { To <ST_IN_SCRIPTING>"//" { In line 1901 in zend_language_scanner.l Tokenize #a as a variable: Change: simple_variable: T_VARIABLE { $$ = $1; } | '$' '{' expr '}' {...
C has an interesting quirk that it concatenates string literals. If you type "DEBUG %s:%d: " "HELLO %s!" "\n" Then the compiler sees that as one string: "DEBUG %s:%d: HELLO %s!\n". So users can use this macro as if it were simply had printf parameters: debug("HELLO %s", username); //on line...
sql,postgresql,syntax,syntax-error,explain
It should not work - DDL statements has no plan - so EXPLAIN has nothing to show.
ruby-on-rails,ruby,methods,syntax,parameters
Lack of parentheses in this example indicates the problem of parsing such an expression. Generally, in Ruby you can omit them when it is clear "how to pass arguments". Let's consider the following situation - I have add and multi methods defined: def add(*args) args.inject(:+) end def multi(*args) args.inject(:*) end...
Text followed by a colon (:) is called a label. It can be used in the context of control structures (such as loops) to break to or continue at. In this context, although perfectly legal, it's pointless.
Any of the above are allowed. All produce the same bytecode. JLS-10.2 Array Variables says (in part) The [] may appear as part of the type at the beginning of the declaration, or as part of the declarator for a particular variable, or both. ...
You have to do it as you would do with string-based functions : void ErrorCodeToMsg(char buffer[], int code){ buffer = myListOfCodes[code]; } The value will be stored in the buffer using its reference value. It is not possible to return string in Capl. This is why you can't access String...
A for loop can always be translated to a while loop as follows: for(initialization; condition; step) { block; } To initialization; while (condition) { block; step; } So if your condition is i == upperBound, the loop will never run, because the condition doesn't start out as true. <= will...
The answer is not simply "because Go doesn't need parentheses"; see that the following example is a valid Go syntax: j := 9 if (j > 0) { fmt.Println(j) } Go Spec: If statements: IfStmt = "if" [ SimpleStmt ";" ] Expression Block [ "else" ( IfStmt | Block )...
swift,if-statement,syntax,pattern-matching,swift2
All it really means is that if statements now support pattern matching like switch statements already have. For example, the following is now a valid way of using if/else if/else statements to "switch" over the cases of an enum. enum TestEnum { case One case Two case Three } let...
MySQL has its own date functions. Use them. In this case use DATE_FORMAT(). $res = $conn -> query("select sum(food.calories) as total_calories, DATE_FORMAT(log.dates, '%y%m%d') as datum from foods food inner join foodlog log on food.id = log.fooditem where log.user = {$_SESSION['userid']} group by datum order by datum"); ...
Your program exhibits undefined behavior since the member variables size, tail, and head of dlist are not initialized before being used. Use dlist() : dlist(0) {} dlist(int capacity) : cap(capacity), size(0), tail(nullptr), head(nullptr) {} That fixes the segmentation violation problem in my testing. I recommend adding a constructor to node...
php,regex,datetime,syntax,sscanf
Like @LucasTrzesniewski pointed out, that's sscanf() syntax, it has nothing to do with Regex. The format is explained in the sprintf() page. In your pattern "%4d%[^\\n]", the two \\ translate to a single backslash character. So the correct interpretation of the "faulty" pattern is: %4d - Get four digits. %[^\\n]...
ruby,oop,syntax,class-variables
Class instance variables are not inherited, so the line @serializable_attrs = {} Only sets this in Serializable not its subclasses. While you could use the inherited hook to set this on subclassing or change the serialize method to initialize @serializable_attrs I would probably add def self.serializable_attrs @serializable_attrs ||= {} end...
javascript,jquery,plugins,syntax
That translates to: var pluginName; if (window.pluginName) { pluginName = window.pluginName; } else { pluginName = {}; } See for more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators...
The only difference I can see is that c[e[a[1]]] = c[e[a[1]]] || decodeURIComponent(a[2]) is more like var temp = c[e[a[1]]]; if(!temp) { c[e[a[1]]] = decodeURIComponent(a[2]); } else { c[e[a[1]]] = temp; } The apparently-redundant self-assignment c[e[a[1]]] = c[e[a[1]]] is relevant if c[e[a[1]]] = c[e[a[1]]] is defined by an accessor property...
[:some_random_name2] is referring to arguments that you can pass into your rake task. May I suggest checking out this article which can explain in more depth passing arguments to a rake task. When you call rake -T from the command line, you should see: rake example: some_random_name1[some_random_name2] (assuming your namespace...
you can access for empty string as a key and remember that is a array inside, use the item 0 obj[''][0].id ...
php,syntax,designer,highlighting,phpdesigner
Go to: Tools -> Preferences -> Debugger -> Syntax Check And disable the checkbox "highlight warnings and errors" In this page you'll also find all the other options regarding "syntax check for PHP"...
c++,pointers,syntax,reference,variable-assignment
string & ref1 = *it; string & ref2 = *it; Okay, so you create two references to the same string. ++it; // After this line, both ref1 && ref2 evaluates to "a" Right, because they are both references to the same string. This is the way you created them. ref2...
The current SystemVerilog syntax BNF does not allow you to specify a parameter specialization of an interface port. It will acquire the parameterization from the instance that get connected to the port module foo(Foo in, output logic [in.WIDTH-1:0] out); assign out = in.data; endmodule interface Foo #( parameter WIDTH=8 );...