Can javascript simulate a button click?

A button may be always clicked programmatically. For example you may have a page with a form like this: <form> <input type=”text” /> <button>Do something</button> <input type=”submit”> </form> then it is possible just to open debug console and type document.getElementsByTagName(‘button’)[0].click(); which will click the button, or document.getElementsByTagName(‘input’)[1].click(); which will click the submit button of the … Read more

Can I comment multi-line macros?

There is no way to use // comments in a macro except the last line of the macro. As Paul R suggests, the /* comment */ does work and seems to be the only option: #define SOME_BIG_MACRO(input)\ SOME_FUNCTION_CALL() /* this does… */ \ SOME_OTHER_FUNCTION_CALL() The reason is the following. Standard for Programming Language C ++ … Read more

What can you do with Lisp macros that you can’t do with first-class functions?

First of all Lisp has first-class functions too, so you could as well ask: “Why do I need macros in Lisp if I already have first-class functions”. The answer to that is that first-class functions don’t allow you to play with syntax. On a cosmetic level, first-class functions allow you to write f(filename, some_function) or … Read more

What’s the easiest way to use reify (get an AST of) an expression in Scala?

A lot of things previously defined in package scala.reflect.mirror have moved to scala.reflect.runtime.universe: scala> import scala.reflect.runtime.{universe => u} import scala.reflect.runtime.{universe=>u} scala> val expr = u reify { 1 to 3 map (_+1) } expr: reflect.runtime.universe.Expr[scala.collection.immutable.IndexedSeq[Int]] = Expr[scala.collection.immutable.IndexedSeq[Int]](scala.this.Predef.intWrapper(1).to(3).map(((x$1) => x$1.$plus(1)))(immutable.this.IndexedSeq.canBuildFrom)) scala> u show expr.tree res57: String = scala.this.Predef.intWrapper(1).to(3).map(((x$1) => x$1.$plus(1)))(immutable.this.IndexedSeq.canBuildFrom) scala> u showRaw expr.tree res58: String … Read more

C macro: #if check for equality

Another way to write your code uses chained #elif directives: #if choice == 3 … #elif choice == 4 … #else #error Unsupported choice setting #endif Note that if choice is not #defined, the compiler (preprocessor) treats it as having the value 0.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)