syntax

Java: system.out.println concatenating something within a string (really easy question)

I want my output to be Candy[1]. counterInt = 1 But my compiler isn't taking this code: System.out.println("Candy["+counterInt"]"); What can I do to have this variable appear within the string Candy[]? Candy[] is not an array, it's a string. ...

MySQL - SELECT WHERE date < X

How do I do this in MySQL? SELECT * FROM MyTable WHERE MyDateCol < TODAY() I googled a lot on the subject and didn't really find anything except "look in the MySQL date ref" which does not explain the above easily enough. I know I can do the following which is kinda indirect: SELECT * FROM MyTable WHERE MyDateCol BETWEEN (0000-00-0...

Ruby 1.9 hash with a dash in a key

In ruby 1.9 there is a way to define this hash with the new syntax? irb> { a: 2 } => {:a=>2} irb> { a-b: 2 } SyntaxError: (irb):5: syntax error, unexpected tLABEL { a-b: 2 } ^ with the old one, it's working: irb> { :"a-b" => 2 } => {:"a-b"=>2} ...

Java Hiding: Any Way for Client Classes to Call `super`?

Aside from adding a method explicitly on the subclass to call a super method, is there anyway to "unhide" it temporarily? I would like to call the super.blah() method on a Test2 instance. Must I use a method like originalBlah, or is there another way? public class TestingHiding { public static void main(String[] args) { Test...

How to reuse CSS selector?

I have the following CSS: .foo .bar { background: red; } Which works fine for the following HTML: <div class="foo"> <div class="bar">I have a red background</div> </div> But I can't seem to find a way to reuse the CSS definition when I'm not in a parent/child relationship. For example, how could I apply the same CSS to the f...

Why does my jQuery "complete" callback break in Chrome & Safari but work fine in FF?

I have some problem with this jQuery code. I'm new at this but it works in FF and yet breaks in Chrome and Safari. Grateful for suggestions in any way. $('#level1nav ul li a:last').click(function () { $(lastBlock).animate({height:"400px"}, {queue:false, duration:500, complete: function() $(line).animate({width:"0px"}, ...

Heredocs - Using same name twice? Why name them at all?

Toying with heredocs in PHP, I realized the name of the heredoc does not have to be unique. Thus: $a = <<<EOD Some string EOD; $b = <<<EOD A different string EOD; is correct and behaves exactly as you would expect. Is this bad practice for any reason? Why does a heredoc need a name/label (EOD above) at all, since you can't referen...

quotes issue (ruby)

any idea how I can pass correct argument to xpath? There must be something about how to use single/double quotes. When I use variable parser_xpath_identificator = "'//table/tbody[@id=\"threadbits_forum_251\"]/tr'" gives me an incorrect value or parser_xpath_identificator = "'//table/tbody[@id="threadbits_forum_251"]/tr'" gives me an ...

Bugzilla templates: what's the difference between [% and [%+

Code in Bugzilla templates is usually delimited by [% and %]. But sometimes I see [%+ and [%-. Can someone explain the difference or point me at suitable documentation? Google has failed me on this occasion. For example: [%- event.value.subject FILTER html %] or [%+ END %] ...

how to use a procedure in a SQL script?

If i run every block of this script in mysql-query-browser, it works. If i run it as mysql db < script.sql it gives me an error[1] that the documentation says it's for using reserved keywords. Already tried to use ; everywhere. -- table CREATE TABLE `days` ( `day` date NOT NULL, PRIMARY KEY (`day`) ) ENGINE=MyISAM DEFAULT CHARSE...

How do I make vim syntax highlight a whole line?

I'd like to have vim highlight entire lines that match certain patterns. I can get all the text in a line to highlight (by doing syn match MyMatch "^.*text-to-match.*$"), but it always stops at the end of the text. I'd like to to continue to the end of the term, like highlighting CursorLine. I've tried replacing $ with a \n^, hoping t...

PHP constructor invocation syntax

Usually I create a new object invocating his constructor the usual way: $instance= new Class(); Lately, I'm reading a lot of code with an alternative syntax (without the parentesys): $instance= new Class; There are substantial differences between the two methods or are they equivalent? I haven't found references on this topic 'til...

How to make Ruby variable that will evaluate to false in conditional expressions

I want to make my variable (a proxy object) evaluate to false when used in conditional sentences. I know I can use .nil? and even var == nil but I think that's not good enough. What I am trying go do is to: if myproxy # not only myprroxy.nil? or myproxy == nil, but just that # myproxy's backend object is not nil else # myproxy's bac...

what is the meaning of '=='..in C?

What is the meaning of == and how does it differ from =? How do I know which one to use? And how can I type the two vertical lines for the OR logical operator? ...

Is it possible to use Column Properties in Expressions in Powerbuilder?

Say I have a field on a datawindow that is the value of a database column ("Insert > Column). It has conditions in which it needs to be protected (Properties>General>Protect). I want to have the field background grey when it's protect. At the moment, the only way I can work out how to do this is to copy the protect conditional, no matte...

Does EOL == EOS in any other language besides BASIC?

BASIC and its variants Visual Basic and VB.NET are the only programming languages I know of that treat the end of line character as a statement terminator (I'm excluding batch files and command scripts from the domain of programming languages). I'm curious: is there any other language that uses this convention, or does BASIC stand alone...

What's broken about exceptions in Perl?

A discussion in another thread got me wondering: what do other programming languages' exception systems have that Perl's lacks? Perl's built-in exceptions are a bit ad-hoc in that they were, like the Perl 5 object system, sort-of bolted on as an afterthought, and they overload other keywords (eval and die) which are not dedicated specif...

How do I get the VIM matchit plugin working with ColdFusion and HTML?

I've been attempting to follow the instructions on the Vim wiki to get the matchit plugin working with ColdFusion (*.cfm) files containing both ColdFusion and HTML tags running on MacVim. I've got the syntax file for ColdFusion (cf.vim) installed in $HOME/.vim/syntax/cf.vim, the latest version of matchit installed in .vim/plugin/matchit...

F#: Why do I have to explicitly specify 'unit' for functions taking no arguments?

So I've just about finished my first F# program, with my only functional background being a little bit of knowledge of Haskell (read: Haven't really produced any programs in it). After experiencing some boggling behavior, I came to realize that F# makes a differentiation between: prepareDeck = allSuits |> List.collect generateCards |> ...

MySQL Brackets?

Latelly I've seen a lot of PHP/MySQL questions that enclose SQL values within {}, for instance: SELECT * FROM table WHERE field LIKE '{$value}'; What's up with that? Is it even valid? Why do so many people use this weird (at least for me) syntax? ...