syntax

Listing of All Mysql Data Types and Syntax For All Settings

I'm looking for a listing of all MySQL data types and the available settings for each option for each data type. After a bit of googling I couldn't find anything quite like that. ...

How to get rid of Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/a9184872/public_html/test_forum/admin.php on line 158 I get that error when I try to run my script. I read that the error is sometimes caused by lines before the line stated so here are lines 154 - 160. if(strlen($desc) > 255){ echo "The description must be ...

A more natural boost::bind alternative?

Don't get me wrong: Boost's bind() is great. But I do hate to write&read code with it, and I've given up hope my coworkers will ever grok/use it. I end up with code like this: btn.clicked.connect(bind(&BetBar::placeBet, this, bet_id)); animator.eachFrame.connect(bind(&Widget::move, buttons[bet_id])); Which, while logical, is very fa...

OCaml syntax for passing in custom objects as parameters

I'm trying to get a grip on the OCaml language syntax and am having some trouble with applying some OOP structures. My goal with the below code is to have a class bar that inherits from a virtual class foo. The virtual class contains three virtual methods that I hope to take an instance of a "player" object as a parameter. When I compile...

Passing "const" variable to method in Java

Is there an equivalent in Java to the passing on const references in C++? Isn't leaving out the "constness" misleading in regard to the method signature? ...

What are the main syntax changes in Ruby 1.9?

Also, I'm wondering what effect upgrading to Ruby 1.9 would have on legacy code from version 1.86. Is the new version backwards compatible? ...

Begin...End blocks in SQL Server: Is this code right?

I just want to verify that I'm not missing something here... so bear with me. I'm rewriting a lot of old stored procedures and keep seeing IF statements formatted similar to this: begin if @someParameter <> 'ThisType' set @someCode = right(cast(@pYear as varchar(6)),2) + 'THIS' end So the Begin...End block just wraps (but doe...

Why must delegation to a different constructor happen first in a Java constructor?

In a constructor in Java, if you want to call another constructor (or a super constructor), it has to be the first line in the constructor. I assume this is because you shouldn't be allowed to modify any instance variables before the other constructor runs. But why can't you have statements before the constructor delegation, in order t...

Absence of property syntax in Java

C# has syntax for declaring and using properties. For example, one can declare a simple property, like this: public int Size { get; set; } One can also put a bit of logic into the property, like this: public string SizeHex { get { return String.Format("{0:X}", Size); } set { Size = int.Parse(value,...

embedding one kind of syntax inside another: is it kludge or clever?

Background: Recently while looking at a "structured text editor" I noticed they used a trick to change python/perl/c++/java et al. into a "structured" outline by sneaking XML into the comments of the respective languages. I remembered seeing this trick inside a windows bat file once as well. The REM statements of the bat file were used ...

Getting table metadata in MySQL

I'm trying to find out how to get the following constraint information from a table in MySQL 5.0: primary key foreign keys and table references unique columns What is the syntax of the query or queries to do so? I have a feeling I'm close with this, but there is no example. ...

What does this javascript syntax mean?

I am trying to understand a script generated by Asp.Net Ajax Toolkit, which is currently giving an "object expected" (error goes away if I place my PopupControlExtender in an update panel). document.getElementById('ctl00_ValidationSummary1').dispose = function() { Array.remove(Page_ValidationSummaries, document.getElementById('ctl00...

In c++ making a function that always runs when any other function of a class is called

C++ has so much stuff that I don't know. Is there any way to create a function within a class, that will always be called whenever any other function of that class is called? (like making the function attach itself to the first execution path of a function) I know this is tricky but I'm curious. ...

What would your own programming language look like?

What would your own (I assume perfect) programming language look like? Give a small example and explain your novel ideas! I'm really interested in the syntax. ...

Assembly Prototype instruction

I am writing an assignment in MASM32 Assembly and I almost completed it but I have 2 questions I can't seem to answer. First, when I compile I get the message: INVOKE requires prototype for procedure & invalid instruction operands the first is due to this piece of code: .data? Freq DWORD ? Time1 DWORD ? Time2 DWORD...

What does a "CALLBACK" declaration in C do?

I was looking through some code from the SDL library and came across a function declared like this: LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) Now, I'm a Delphi coder. No hablo C muy bien, senor. But I remember enough syntax from my college courses to read it like this: Function name is WndProc. Ar...

Easiest Way to Print Non-Strings in Ruby

I'm constantly doing this puts “The temperature is “ + String(temperature) + “.” in my debugging code, and another option is to use interpolation puts “The temperature is #{temperature}.” is there any less cumbersome way to do this? Edit: This is just for debugging, if that matters. ...

Using the F# pipe symbol with an object constructor

I'm trying to figure out the correct syntax to use the pipe operator |> into the creation of an object. Currently I'm using a static member to create the object and just piping to that. Here is the simplified version. type Shape = val points : Vector[] new (points) = { points = points; } static member create(poi...

Delphi: how to automatically remove unused vars ("Variable 'x' is declared but never used" hint)

Is there any tool (preferably freeware) that can analyze Pascal/Delphi syntax and automatically remove unused vars? In my case, I'm working with a very large Delphi code base, and the compiler hints report over one thousand cases of "Variable 'x' is declared but never used". I would take hours to remove them by hand, and I might make e...

<?php instead of <?

Why should I use <?php instead of <? in my php script? ...