syntax

Need some help understanding the MATLAB `cat` command in high dimensions

The commands a = magic(3); b = pascal(3); c = cat(4,a,b); produce a 3-by-3-by-1-by-2 array. Why is the result 3-3-1-2 when the dimension is 4? ...

error in mysql syntax

while executing the following query, i get an error that there's an error in the syntax near line 9. since i'm using mysql workbench, i can't really figure out what could be wrong: CREATE TABLE IF NOT EXISTS `proquotes`.`thquotes` ( `idQuotes` INT NOT NULL AUTO_INCREMENT , `vAuthorID` VARCHAR(8) CHARACTER SET 'utf8' NOT NULL , ...

Kohana ORM syntax question

I'm using the "join_table" function with Kohana's ORM to build a query. The following works: $category = ORM::factory('category')->join_table('product'); But this doesn't: $category = ORM::factory('category'); $category->join_table('product'); The documentation uses the second as an example, but it returns 0 while the first example...

jQuery fn.extend ({bla: function(){}} vs. jQuery.fn.bla

OK I think I get http://stackoverflow.com/questions/1991126/difference-jquery-extend-and-jquery-fn-extend in that the general extend can extend any object, and that fn.extend is for plugin functions that can be invoked straight off the jquery object with some internal jquery voodoo. So it appears one would invoke them differently. ...

Parsing WordPress XML, slash:comments syntax?

This is really just a syntax question. I have a PHP script that parses my WordPress feed and returns the latest posts. I also want my script to parse the # of comments, but the WordPress feed XML object for number of comments has a colon in it (slash:comments). It causes the following error: Parse error: syntax error, unexpected ...

What's the best short cut for this in MATLAB?

padColor = [bgColor bgColor bgColor]; padColor = reshape(padColor,1,1,3); How to do the above in a more compact way(less code/replication)? ...

mysql query - syntax error - cannot find out why

Hi all, im tearing my hair out over this one. A query is throwing an error: 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 'FROM, SUBJECT, DATE, READ, MAIL ) VALUES ( 'EJackson', 'dfdf', '1270974101', 'fa' at line 1 I printed out the query to see...

Need help understanding several MATLAB statement

All are from this post. What does these statement mean: error(nargchk(5, 6, nargin)); plot(p(:,1), p(:,2), '.-'), axis equal And what's this kinda syntax which I haven't quite often seen: if nargin<6, steps = 36; end ...

the error "invalid literal for int() with base 10:" keeps coming up

I'm trying to write a very simple program, I want to print out the sum of all the multiples of 3 and 5 below 100, but, an error keeps accuring, saying "invalid literal for int() with base 10:" my program is as follows: sum = "" sum_int = int(sum) for i in range(1, 101): if i % 5 == 0: sum += i elif i % 3 == 0: s...

Syntax choice for type parameter variance in C# and VB

In both C# and VB, type parameter modifiers are used to express the variance of type parameters. For example, the C# version looks like: interface Foo<in X, out Y> { } and the VB version looks like: Interface Foo(Of In X, Out Y) End Interface Since variance specifications basically restrict where and how a type parameter can be us...

Java syntax of +

Why is the following syntax correct: x = y+++y; Where it means y++ + y or y + ++y which means y * 2 + 1 (not sure about this, though: very ambiguous) But this syntax is incorrect: x = y+++++y; Which should mean y++ + ++y, which means y * 2 + 2 Is there a reason for the incorrectness of this syntax? (Edit: thank you for ex...

Why do I see MS jQuery samples use `$(domReady); `?

I don't know if anyone ELSE has noticed this, but I noticed the jQuery samples I see on MS tend to use a different format: <script type="text/javascript"> $( domReady ); function domReady() { $('#btn').click( showMessage ); } function showMessage() { $('#message').fadeIn('slow'); } </script> Isn...

Python dictionary: add or increment entry

Hi everyone, I'm currently re-engaging with Python after a long absence and loving it. However, I find myself coming across a pattern over and over. I keep thinking that there must be a better way to express what I want and that I'm probably doing it the wrong way. The code that I'm writing is in the following form: # foo is a diction...

Static method invocation

Can we call a static method without mentioning the class name in Java? ...

Python integer incrementing with ++

Possible Duplicate: Python: Behaviour of increment and decrement operators I've always laughed to myself when I looked back at my VB6 days, "What modern language doesn't allow incrementing with double plus signs?": number++ To my surprise I can't find anything about this in the Python docs. Must I really subject myself to n...

Iterate over enum?

I'm trying to iterate over an enum, and call a method using each of its values as a parameter. There has to be a better way to do it than what I have now: foreach (string gameObjectType in Enum.GetNames(typeof(GameObjectType))) { GameObjectType kind = (GameObjectType) Enum.Parse(typeof (GameObjectType), gameObjectType); IDicti...

Basic Objective-C syntax: "%@"?

Hi, I'm working through the Stanford iPhone podcasts and have some basic questions. The first: why is there no easy string concatenation? (or am I just missing it?) I needed help with the NSLog below, and have no idea what it's currently doing (the %@ part). Do you just substitute those in wherever you need concatenation, and then comm...

What is wrong with this null check for data reader

c.Open() r = x.ExecuteReader If Not r("filename").IsDbnull Then imagepath = "<img src='images/'" & getimage(r("filename")) & " border='0' align='absmiddle'" End If c.Close() r.Close() I have also tried; If r("filename") Is DBNull.Value Then ...

How to do this in a pythonic way?

Consider this Python snippet: for a in range(10): if a == 7: pass if a == 8: pass if a == 9: pass else: print "yes" How can it be written shorter? #Like this or... if a ?????[7,8,9]: pass ...

How to convert hex string to integer in Python ?

How to convert x = "0x000000001" # hex number string to y = "1" ...