syntax

rebol parse problem

simple parse example: ab: charset "ab" parse "aaa" [some ab] ; == true if i wanted one-liner (define ab in place), how do i do it? parse "aaa" [some [charset "ab"]] ; ** Script Error: Invalid argument: ?function? parse "aaa" [some (charset "ab")] ; (INTERPRETER HANGS UP) i use REBOL 2.7.7.4.2 UPDATE in rebol 3: parse "aaa" [s...

Where is the documentation for the behavior of @array->[4] or %hash->{key} in Perl?

A recent question used a sigil invariant syntax %hash->{key} = 1; for hash access, which seems to work fine, but I would have thought it would be a syntax error. It seems to work for arrays as well: my @array; @array->[3] = 6; Is this behavior documented somewhere? I don't remember reading it, but may have overlooked it. It seems ...

Tweet meta syntax for ODLs

Hi, I am interested in the idea of using Tweets/SMS/Identica or other short text status update systems to track Observations of Daily Living (or ODLs). The basic notion is that you send status updates to Twitter or Identi.ca or perhaps just an SMS message or whatever in a format that can be later mined to show patterns. You could us...

Why does C# require parens around conditionals?

I was just reading an SO question on Python, and noticed the lack of parentheses in a for-loop. Looked nice to me, then I wondered: why does C# require them? For example, I currently need to write: if (thing == stuff) { } and foreach (var beyonce in allthesingleladies) { } So I am wondering why I can't write: if thing == stuff {...

What does ">>" operator in C# do?

I ran into this statement in a piece of code: Int32 medianIndex = colorList.Count >> 1; colorList is a list of class System.Drawing.Color. Now the statement is supposed to retrieve the median index of the list .. like the half point of it .. but I can't understand how that >> symbol works and how the "1" is supposed to give the media...

Why do programming languages use commas to separate function parameters?

It seems like all programming languages use commas (,) to separate function parameters. Why don't they use just spaces instead? ...

What tricks do you use to avoid being tripped up by python whitespace syntax?

I'm an experienced programmer, but still a little green at python. I just got caught by an error in indentation, which cost me a significant amount of debugging time. I was wondering what experienced python programmers do to avoid creating such problems in the first place. Here's the code (Part of a much larger program) : class Wizvar(...

JavaScript Syntax Error

I am getting a syntax error on line 13... line 13: "c001": {type:"tool", id: "webconference", name:"Web Conference Tool"}, // web conference Can you help me fix this? :) Thanks. //assuming jquery exists /* notes: a lot of the functions need to either return jQuery or jQuery.ib, and if jQuery.ib then I need a .stop() function th...

Oracle SQL syntax between Standard/enterprise and Express

I have a question in different Oracle versions. In their download page, there is Standard/Enterprise, and there is Express. Other than performance and other infrastructure tools, do the two different versions support the same set of SQL script keywords? For example, if I generate DDL tables from standard, is there a chance it may not wor...

MySQL syntax error (in SELECT query)

I have two MySQL tables: Group(gr_id, gr_name, gr_description, parent_id) Group_has_User(User_id, Group_id) I'm trying to execute the query: SELECT group.gr_id, group.gr_name, group.gr_description, group.parent_id FROM group, Group_has_User AS gu WHERE (group.gr_id = gu.Group_id) AND gu.User_id = 1 It gives an error: You have an err...

beginner question: add/subtract to value rather than just be that value

Hello! Using the Openframeworks library in C++, I have the radius of a glow (max_distance) that is determined by the stretch of the mouse dragging across the screen (mouseDragX). It works fine. But rather than every time I resize it (by dragging the mouse), I want it not to start at 0 and follow the mouse drag directly. max_distance =...

What does the colon mean in a constructor?

Possible Duplicates: C++ weird constructor syntax Variables After the Colon in a Constructor What does a colon ( : ) following a C++ constructor name do? For the C++ function below: cross(vector<int> &L_, vector<bool> &backref_, vector< vector<int> > &res_) : L(L_), c(L.size(), 0), res(res_), backref(backref_) { ...

How do I check with jQuery if an element has at least one class, from a list of specified classes?

Example html: <div class="red"></div> <div class="green"></div> <div class="blue"></div> <div class="apple"></div> I want to loop through the divs and filter them out if they don't have a class of either 'red', 'green', or 'blue.' var onlyColorDivs = $('div').hasClass( ____ ); Is there a way to fillin the blank in the previous line...

PHP Syntax Help - Unexpected T_STRING

I am making an image morphing function, however I am encountering problems. I have an unexpected T_STRING at the commented line, which I'm sure is an embarrassingly simple error... What's wrong? How can I avoid this in the future? Thanks. function morph($img) { $tempImg = $img; $size = getimagesize($tempImg); $width = $size[0...

fill array with values without loop in php

I'm wondering is there any method (that doesn't use loop or recursion) to create and fill with values an array. To be precise I want to have an effect of $t = array(); for($i = 0; $i < $n; $i){ $t[] = "val"; } But simpler. ...

Is something wrong with this MySQL query?

I'm writing stored procedures for the first time, and it's not working. The trouble is I can't see a reason for it not to work. I'm running it through phpmyadmin 2.8.2.4. My MySQL version is 5.1. Here is the first part of the query: create procedure under_user_type (in original_post int, out user_type int, out user_id longtext) begin ...

If-Else Statement in T-SQL

I'm trying to alter the results of a Transact-SQL (MS SQL Server) report that is currently showing: CompanyA DVCE3 CompanyB DVCE2 CompanyC DVCE3 CompanyD NULL CompanyE DVCE3 and I would like it instead to show: CompanyA 36 CompanyB 24 CompanyC 36 CompanyD CompanyE 36 I'm sure the answer to...

Non-spaced method definition style

Hi, people. I study Obj-C and Cocoa now, and I was wondering: why everybody writes method definitions/implementations like this: - (void)translateOriginToPoint:(NSPoint)newOrigin{ - all together, no spaces. For me, it's way more clean to write everything with spaced like this: - (void) translateOriginToPoint: (NSPoint) newOrigin { ...

How to read this kind of pointer in c++?

CUnknown* (*)( LPUNKNOWN pUnk, HRESULT* phr ); Seems I've always been in trouble reading such complicated pointers.. How do you read it? what if the expression even longer? ...

Use PHP alternate syntax with WAMP

Is it possible to use PHP alternate syntax (as described in the CodeIgniter user guide), on WAMP? ...