syntax

why include instead of require in php cms?

I see php CMS using include instead of require for their important files. SHouldn't this files such as header.php be required? THe script continues if the file is unable to be opened! ...

can we pass arrays as arguments to functions by this syntax, under upcoming c++0x standards ?

suppose we have following function: void someFunction(int * araye){ for (int i=0;i<5;i++) cout <<araye[i]<<' '; cout <<'\n'; } can we pass an array to this function by following syntax, under upcoming c++0x standards? : someFunction({1,2,3,4,5}); if that's true, will we even be able to use this syntax in any case in which, arra...

Pygments in wxPython?

Is it at all possible to use Pygments inside of wxPython to provide syntax highlighting? ...

C# Regex Replace weird behavior with multiple captures and matching at the end of string?

I'm trying to write something that format Brazilian phone numbers, but I want it to do it matching from the end of the string, and not the beginning, so it would turn input strings according to the following pattern: "5135554444" -> "(51) 3555-4444" "35554444" -> "3555-4444" "5554444" -> "555-4444" Since the begining portion is what u...

When were non-capturing parentheses added to Perl's regular expressions?

I am having a hard time figuring out the earliest version of perl where non-capturing parentheses are supported in regex patterns? Can I take this feature for granted for all versions of Perl5? ...

Number in python - 010

When using the interactive shell: print 010 I get back an 8. I started playing around using other numbers having zeroes before (0110 = 72, 013 = 11) but I could not figure it out... What is going on here? ...

Haskell Error: parse error on input `='

Specs GHC 6.12.1 Mac OS X 10.6.4 x64 MacBook Pro Problem I'm having trouble using let syntax. The following code refuses to compile: module Main where main = let x = 1 y = 2 z = 3 in putStrLn $ "X = " ++ show x ++ "\nY = " ++ show y ++ "\nZ = " ++ show z I tried tabbing in y = 2 and z = 3 even more. No dice. ...

Xcode gives 3 syntax errors dealing with Stray '\342' in program

Hello, I am working on a simple project in Objective-C in Xcode and I'm getting some stray/ errors about the following line of code: if(celsius < −273.15) { NSLog(@"It is impossible to convert temperatures less than −273.15 degrees Celsius, because this is absolute zero, the coldest possible temperature."); } It's actually...

Processing data by reference or by value in python

Consider the following session. How are the differences explained? I thought that a += b is a syntactical sugar of (and thus equivalent to) a = a + b. Obviously I'm wrong. >>> import numpy as np >>> a = np.arange(24.).reshape(4,6) >>> print a [[ 0. 1. 2. 3. 4. 5.] [ 6. 7. 8. 9. 10. 11.] [ 12. 13. 14. 15. 16. ...

Learning jQuery: if & else statements, is this valid?

At the moment I'm learning jQuery and I hit the topic about if/else statements. As I have no background in programming this topic is something that I need to practice a bit more to get a thorough understanding of it. The book I'm studying gave me the advice of just writing different blocks of if/else statements. I just had an idea and ...

What is :: (double colon) in Python?

I know I can use something like string[3:4] to get a substring in Python, but what is the is something[::3]? Sorry but it's hard to search for this on Google. ...

What is the purpose of the '@' symbol in CSS?

I just stumbled across this question and I noticed the user is using some notation I've never seen before: @font-face { /* CSS HERE */ } So is this '@' symbol something new in CSS3, or something old that I've somehow overlooked? Is this something like where with an ID you use '#', and with a class you use '.'? Google didn't give me...

Proper syntax in RoR for time in datetime comparison

I am trying to attribute the time param with .to_date to generate the proper comparison Organization.find(1140).events.all(:conditions => ["time < ?", Time.now.beginning_of_day]).blank? How would I do that? I tried this : Organization.find(1140).events.all(:conditions => [time.to_date < ?, Time.now.beginning_of_day]).blank? And tha...

sqlite3 update row syntax

Hi all, From the sqlite3 docs it looks like I should be able to use the following syntax to update a row in a database on my iPhone: NSString *dbFile = [[NSBundle mainBundle] pathForResource:@"database" ofType:@"db"]; sqlite3 *database = NULL; if (sqlite3_open([dbFile UTF8String], sqlite3_exec(database, [sql UTF8String], MyCallba...

Invalid syntax error in simple Python-3 program

from TurtleWorld import * import math bob = Turtle() print(bob) draw_circle(turtle, r): d = r*2 c = d*math.pi degrees = 360/25 length = c // 25 for i in range(25): fd(turtle, length) rt(turtle, degrees) draw_circle(bob, 25) wait_for_user() The problem in on line 7: draw_circle(turtle, r): ...

Be my human compiler: What is wrong with this Python 2.5 code?

My framework is raising a syntax error when I try to execute this code: from django.template import Template, TemplateSyntaxError try: Template(value) except TemplateSyntaxError as error: raise forms.ValidationError(error) return value And here's the error: from template_field import TemplateTextFi...

Why can't I declare bitfields as automatic variables?

I want to declare a bitfield with the size specified using the a colon (I can't remember what the syntax is called). I want to write this: void myFunction() { unsigned int thing : 12; ... } But GCC says it's a syntax error (it thinks I'm trying to write a nested function). I have no problem doing this though: struct thingStru...

Syntax-aware substring replacement

I have a string containing a valid Clojure form. I want to replace a part of it, just like with assoc-in, but processing the whole string as tokens. => (assoc-in [:a [:b :c]] [1 0] :new) [:a [:new :c]] => (assoc-in [:a [:b,, :c]] [1 0] :new) [:a [:new :c]] => (string-assoc-in "[:a [:b,, :c]]" [1...

Static variable inheritance in Python

I'm writing Python scripts for Blender for a project, but I'm pretty new to the language. Something I am confused about is the usage of static variables. Here is the piece of code I am currently working on: class panelToggle(bpy.types.Operator): active = False def invoke(self, context, event): self.active = not self.act...

PHP Syntax issue with headers

Can't seem to get it right with the syntax: <?php if isset $_POST['tutorial'] { header('Location: /phonebooks?tutorial=1b'); } else { header('Location: /phonebooks?phonebook_created=1'); }; ?> What am I doing wrong?? ...