syntax

mysql syntax error when dealing with negative numbers

The MySQL Syntax Used INSERT INTO friend_locations (user_id, lat, long) VALUES ('82441', '28.665899', '-81.359756') The MySQL Error Returned You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'long) VALUES ('82441', '28.665899', '-81.359756')' at lin...

What are the precise rules for when you can omit parenthesis, dots, braces, = (functions) etc?

What are the precise rules for when you can omit (omit) parentheses, dots, braces, = (functions) etc? For example (service.findAllPresentations.get.first.votes.size) must be equalTo(2) service is my object def findAllPresentations:Option[List[Presentation]] votes returns List[Vote] must and be are both functions of specs Why can't I...

How to interpret the syntax of the jQuery Autocomplete plugin's parse function

I use the jQuery Autocomplete plugin to display user info in the search box and I can't quite figure out the meaning of the syntax of the following parse function: $("#UserSearchBox").autocomplete('FindUser.ashx', { minChars: 2, width: 400, max: 5, parse: function(data) { return $.map(eval(data), function(row) { ...

Get array element after performing a function on it??

Hey all, I'm looking to see if there is some PHP syntax that I'm missing that will allow me to grab the contents of the array I just manipulated using a function.. Good example: $firstElement = sort($myArray)[0]; Where normally I would have to do this: $myArray = sort($myArray); $firstElement = $myArray[0]; Any clean way of doing...

Do I need to escape a semicolon in a Perl regular expression literal?

Someone is telling me I need to escape a semicolon in a Perl regular expression literal. That is, to match a line containing a semicolon, I should use /\;/ and not /;/. From what I've read, the semicolon has no special meaning in a regular expression literal, so escaping it seems unnecessary. I've done some experiments and /;/ seems to ...

DELPHI: how to use "break" outside of loop or case?

consider the following delphi pascal code: var tc: TComponent begin { do something to get tc } repeat if(tc is TDBEdit)then begin if(check_something_about_edit(tc))then break; do_something_else_edit(tc); break; end else if(tc is TBMemo) then begin if(check_something_about_memo(tc))then break; do_something_else_...

php syntax issue?

value="<?=$file_source?>"> it will show the >"> at my browser but if value="<?php echo $file_source?>"> it will show correctly in browser. Is it due to php versioning? Also I realize some php classes written by others (which I download online), doesn't use <?php ?> , it directly use <? ?> But when I run it locally at xampp, I n...

NoReverseMatch Exception help in Django

Hi--I'm fairly new to python and following along with part 4 of the tutorial for the Django framework here. I'm trying to implement generic views for the polls app--my code seems correct (as far as I can tell), but when I try to vote, I get a NoReverseMatch Exception that states: Reverse for 'polls/poll_results' with arguments '(1L,...

C# delegate and attributes syntax question

I have a dictionary which is of type Dictionary [string,handler_func] where handler_func is a delegate of type public delegate void HANDLER_FUNC(object obj, TcpClient client); now I have an attribute class like so [AttributeUsage(AttributeTargets.Method)] public class MessageHandlerAttribute : Attribute { public MessageHandlerAt...

How do I do a case sensitive comparison in sql?

Hi Just started a tutorial in SQL for beginners. I'm doing some exercises now and I would like to know how to change the title. If you look at here: you'll see that I have made firstname, lastname, title, age and salary. And I wrote the letters in small letter. How can I change it to capital letter? http://tinypic.com/r/amtpgm/3 I...

Simplify jQuery Selector

I have a selector, "td > a.leftmenuitem:last, div > a.leftmenuitem:last", and I'd like to simplify it a little. I've tried "* > a.leftmenuitem:last", "td, div > a.leftmenuitem:last", and "(td, div) > a.leftmenuitem:last", none of which work the way the first selector does. Is this kind of thing just not possible in the selector syntax wi...

Make a query Count() return 0 instead of empty

I have a report that tracks how long certain items have been in the database, and does so by tracking it over a series of age ranges (20-44, 45-60, 61-90, 91-180, 180+). I have the following query as the data source of the report: SELECT DISTINCT Source.ItemName, Count(SELECT Source.DateAdded FROM Source WHERE Int(Date()-Source.DateAd...

Mysql Datevalue()=Date()

I'm trying to split a table in two views depending on whether the field "Date" is today or not. I have tried using WHERE DATEVALUE(table.Date)=DATE(), but I get an error at saving saying that the last ) has wrong syntax. I tried adding a group by, but apparently everything after the ) gives me the same message about wrong syntax) Am I ty...

What does map(&:name) mean in Ruby?

...

Syntax error in resource file. I don't understand.

Hi all! I have a .rc file: #include "MainWindowResource.h" MAINWINDOW_MENU MENU DISCARDABLE BEGIN POPUP "&File" BEGIN MENUITEM "&New\tCtrl+N", MAINWINDOW_MENU_FILE_NEW MENUITEM "&Open\tCtrl+O", MAINWINDOW_MENU_FILE_OPEN MENUITEM "&Save\tCtrl+S", ...

Conditional statement in WHERE clause

I need to write a conditional statement in my where clause that uses different operators based on the parameter passed into the procedure. I can't seem to find the syntax that will work. My example is as follows: @DateValue datetime select * from table where field1 = 'x' and field2 = 'y' and if @DateValue = '1/1/1900' then field...

mysql insert syntax for blob data through Stored procedure

Hi All, I want to insert an img file in mysql database, can anyone provide normal insert statement for inserting blob into mysql database. How i can do it as if i specify the path it stores the path only not the img ...

In Perl, why do I get a syntax error when I try to use string eval?

Why isn't this working? eval "$response = $ua->request($r);" print "$@"; gives: syntax error at (eval 8) line 1, near "=" ...

Objective C - Which syntax?

What syntax do you think is better/more readable? if(!myViewController.view.superview) or: if(myViewController.view.superview == nil) Thanks!! ...

I get these weird characters when I try to print out a vector element!

I'm using Netbeans. When I run the program below, I get this as output [I@de6ced! How come? import java.util.Arrays; import java.util.Vector; public class Test { public static void main (String[] args) { int[] a = new int[1]; a[0] = 5; Vector<Integer> a1 = new Vector(Arrays.asList(a)); System.out.println(a1.element...