syntax

Syntax error in CSET library

I am using CSET, a library for Unicode character classes for Javascript. It loads fine in Firefox, IE8, and Opera, but fails in Google Chrome and Safari 4 with a syntax error. Strangely enough, the syntax errors are different. From cset_production.js: Safari SyntaxError: Parse error (line 255) CSET=function(){ // ... var g=this ret...

How to make Ruby's N ends look better?

As I write some scripts, I usually reach a point where my code looks like this : end end end end end end I don't know about you, but this look very ugly to me. Can something be done about this? ...

use object created in class constructor in class methods

Hi. Is it possible to use an object that was created during a class' construction within the member methods of that class? Ex <?php include ('AClass.php'); class Auto_Cart { function Auto_Cart() { $aclass = new AClass(); } function DoSomething() { $aclass->amemberfunction(); } } ?> When I call DoSo...

Haskell: Can I use a where clause after a block with bind operators (>>=)?

I have a very simple question. I'd like to use a where clause after a bloc of code that uses bind operators but I get a compilation error. Here is a simple example: main = putStrLn "where clause test:" >> return [1..10] >>= \list -> print list' where list' = reverse list -- test1.hs:5:28: Not in scope: `list' I ca...

Programming languages with python-like syntax but native code generation

Can anyone point to programming language which has python-like syntax, but from the very beginning was designed to generate native code? I'm aware of Boo only, but it uses .net, not native code generation. Well, if nothing else than python-like languages which generate .net/java bytecode are fine too. ...

How do I pass parameters to a subroutine?

Hello friends, I have encountered a difficulty in understanding the subroutine syntax. using the following code: sub build_dyne_file{ open(DYNAP, "+>$veri_dir/$dyna_para") or die $!; for (keys %hash){ print DYNAP "#define ",$_," ",$hash{$_}->[$i],"\n"; } close(DYNAP); } for (my $i = 0 ; $i <$TEST_QUOTA ; $i++){ b...

backport function modifiers to python2.1

I have some code I developed in python 2.4++ and you bet, I have to backport it to python 2.1! function decorators were so attractive that I have used @classmethod at a few spots, without taking notice of the fact that it is only available starting at version 2.4. the same functionality is offered by function modifiers but these appear...

PHP if else Request URI help.....

I tried doing this but then it is not working <?php if ($_SERVER['SERVER_NAME']=='http://www.testground.idghosting.com/idi' && $_SERVER['REQUEST_URI'] == 'our-production/') { echo '<div id="services"> <h1>Our services</h1> <a href="<?php bloginfo(\'url\'); ?>" id="serv_productions" title="Our Productions"><span>Our Producti...

problem finding file w/ php

I have a database which is tied to a server of pictures. In the case that a pic isn't uploaded I want to place an "unavailable" photo in its place. Each pic is in numerical order based on the primary key from the database $row['Item_ID']. My script below searches for the file but can't find any pics, so it uses the "unavailable" for e...

.NET Placement New

Is there a placement new in .NET (like C++)? In other words if I allocate some memory in VB.NET Dim Foo(64) as Byte I want to instance BarClass in the Foo memory (something like...) Dim Bar as New BarClass(Foo) However, I don't see any syntax to do this. Instead I have to do something like: Dim Foo(1) as BarClass Foo(0) = new...

Why is reassigning Object.prototype not working?

Why this is not working? // this one works as I expected, when objSayHello() Object.prototype.objSayHello = function(){alert('Hello,from OBJECT prototype')}; // NOT working ! Object.prototype ={objSayHello: function(){alert('Hello,from OBJECT prototype')}}; objSayHello(); ...

DB2 cascade delete command?

Is there a special syntax to execute a cascade delete on DB2 or is it only possible to create "cascadable" tables by defining them with the "ON DELETE CASCADE" option? What I am trying to achieve is delete other table rows based on a same foreign key when I delete that key, but this is done on an already existing and data-filled databas...

Does the img tag's alt attribute require encoding?

In html does the text inside the img tag's alt attribute require encoding/escaping? Non encoded example: <img src="myimg.png" alt="image description" /> Encoded example: <img src="myimg.png" alt="image%20description" /> ...

Python: access class property from string

I have a class like the following: class User: def __init__(self): self.data = [] self.other_data = [] def doSomething(self, source): // if source = 'other_data' how to access self.other_data I want to pass a string for the source variable in doSomething and access the class member of the same name. I...

Visual Basic dot operator syntax--no object name

In a former life I wrote some Visual Basic, and today I need to resurrect those skills to write an Excel Macro. While trawling the Internet looking for VBA examples to help we with this Excel macro, I came across this unusual syntax: Set rFound = .Columns(1).Find(What:="Cat", After:=.Cells(1, 1), LookIn:=xlValues, LookAt:= _ xlP...

VBA select not returning any rows

Below query is not returning any rows into the listbox.There is no error message: lstDiff.RowSource = "select TestScenario,TestId from tblTesting where empid= '" & Me.txtEmpId.Value & "' and testid= '" & Me.txtAutoNumber.Value & "'" Could anyone help? ...

where to put break in switch/case statement with blocks

When I use braces around case code block in C++ to localize variables should I put break inside or outside the block? Thanks. ...

Syntax checker for C#

We're looking for a syntax checker for C#, something like Checkstyle for Java. Does anyone have any recommendations for any tools that we can use? Ideally it would have a plugin to Visual Studio 2008. ...

How to do this: a=a+1 in sql server query ?

Hi, how I can do this: a=a+1 in sql server query? Thanks! ...

sp_executesql with a string from db

Hi, how can I retrieve a string (like 'select 1') from a record and pass it to sp_executesql to make it eval it? Thanks ...