Which of these setTimeout format is better?
Which of these constructs is better and why setTimeout(function() { $('#secret').hide(); }, 5000); setTimeout( "$('#secret').hide();", 5000); $('#secret').show(5000, function(){ this.hide(xxx)} ); ...
Which of these constructs is better and why setTimeout(function() { $('#secret').hide(); }, 5000); setTimeout( "$('#secret').hide();", 5000); $('#secret').show(5000, function(){ this.hide(xxx)} ); ...
I would like to read a little more about the + that is usually put in front of a hashref that helps to disambiguate from a code block. When was it first introduced? Who first introduced it (recommended it)? How did people go around the issue before this was introduced? Any trivia or notes that comes to mind while using this syntax? ...
C# has generator functions which have syntax like: IEnumerable<int> GetNats(int max) { for (int i=0; i < max; ++i) yield return i; } A feature I am interested in for my programming language (a simple object-oriented programming similar to Java, Scala, ActionScript, and C#) are generator expressions. These are essentially syn...
Hi im working on a system with inputfields. Normaly i put the input field on one line but now i have made it like this below <input type='text' name='alg_persoonsgegevens_achternaam' id='alg_persoonsgegevens_achternaam' class='text dontprintinput' value='xxxxxxx' maxlength='50' size='20' /> I was wonderdering if ALL browser...
Hi, perl -MO=Concise,-exec myprog.pl should do it but it only prints the syntax of the lines that are outside any procedures, and the main package itself. It does not print the syntax tree of packages and functions used in myprog and imported. Could someone tell me how to tell "B::Concise" to print all functions in myprog.pl. ...
in PHP you can call a function. by not calling all parameters by using these statement. function test($t1 ='test1',$t2 ='test2',$t3 ='test3') { echo "$t1, $t2, $t3"; } and you can just use the function like this test(); lets just say I want the last one to be different but not the others. the only way i know is by doing this with n...
I am working on a 4 x 4 bit multiplier and am getting this error message, "Error (10500): VHDL syntax error at lab_6.vhd(33) near text "after"; expecting ")", or ","" twenty times. The problem is I have a ")" or a "," after the after statement. Here is the code: library ieee; use ieee.std_logic_1164.all; entity lab_6 is port(x, y...
I can assign a tuple as follows: var (min, max) = (1, 2) But I cannot then re-assign as follows (min, max) = (1, 3) //compiler error: ';' expected but '=' found Instead I seem to have to do: min = 1 max = 3 Why does the latter work whereas the former does not? ...
i'm an objective-c newcomer. im trying to compare a core data entity attribute value and having trouble with the syntax. i just want to know the best way way to write the if statement to compare values. in this example, the someAttribute attribute is a boolean, and its default is NO. NSString *myValue = [NSString stringWithFormat:@"%...
Hi, I'm building some simple validation rules in php and my IDE (phped) is complaining about the syntax. Can anyone tell me what is wrong with the following? function notBlank($str) { (strlen($str) == 0) ? return false : return true; } phped complains of 'unexpected return' Any advice appreciated. Thanks. ...
Update 2: examples removed, because they were misleading. The ones below are more relevant. My question: Is there a programming language with such a construct? Update: Now when I think about it, Prolog has something similar. I even allows defining operations at definition line. (forget about backtracking and relations - think about ...
We have received some JavaScript from an agency that looks wrong, but works. For some reason they are adding [square brackets] around variables, thus: var some_variable = 'to=' + [other_variable]; This works, but the square brackets seem completely superfluous. Is there a purpose to this syntax or is it technically incorrect, but ig...
I've been using Markdown recently. One of my biggest problems with Markdown is that Markdown has no syntax for including files within a document (vs., say, the listings package for LaTeX). I'd like to extend Markdown to support including whole and partial files as code snippets. For instance, it could look like this: ![:include src/fo...
This is a syntax question. I was looking at some open source files and I met some syntax that I cannot recognize and I was hoping you could clear it up for me. (This is taken from the Main.java in the Rhino debugger here) public static String[] processOptions(String args[]) { String usageError; goodUsage: for (int...
Summary Can you explain the reasoning behind the syntax for encapsulated anonymous functions in JavaScript? Why does this work: (function(){})(); but this doesn't: function(){}();? What I know In JavaScript, one creates a named function like this: function twoPlusTwo(){ alert(2 + 2); } twoPlusTwo(); You can also create an ano...
Hello all, i'm a newbie to PHP and i don't like to write my code in notepad-like editors. Is there an editor like VS for PHP? Also, if you could give me a reference to a good introductory PHP eBook (one that covers simple concepts like declaring and using classes in PHP) that would be great. Thanks in advance! ...
Is there any way to do some kind of while() for each post variable and session it up... like in mysql while($row=mysql_fetch_array($result)){ echo($row['name']; } But to get this result with the $_POST while($_POST){ $_SESSION['BLA'] = $_POST['BLA']; } Thanks in advanced :) ...
This works: Tweener.addTween( [ _fee, _fye, _fum ] , { alpna:1, time:10 }); But this does not: var _myArray:Array = new Array( [ _fee, _fye, _fum ] ); Tweener.addTween( _myArray , { alpna:1, time:10 }); How can I pass the an array straight into the tweener? ...
I'm trying to merge these 2 arrays $arr1 = array('a' => "1", 'b' => "2", 'c' => "3"); $arr2 = array('a' => "9", 'b' => "8", 'd' => "7"); into an array that looks like this $arr1 = array( 'a' => array("1", "9"), 'b' => array("2", "8"), 'c' => array("3", ""), 'd' => array("", "7") ); The tricky part is the blanks. I...
how come this java switch statement keeps telling me my statements are not statements public void setConstant(float inNumGrade) { this.yourNumberGrade = inNumGrade; switch (this.yourLetterGrade) { case 'A': this.yourNumberGrade >= 0.90; break; case 'B': this.yourNumberGra...