syntax

Syntax question on accessing properties of objects stored in a NSMutableArray

Could someone explain why the second syntax of the same expression does not work? If you need some background, manyViews is a pointer to an NSMutableArray loaded with UIView objects. [[manyViews objectAtIndex:0] setFrame:CGRectMake(30,30,100,20)]; // works as intended [manyViews objectAtIndex:0].frame = CGRectMake(30,30,100,20); ...

how to execute command line .exe file in java

i want to convert an avi file to 3gp using java program. For this i am using "E.M. Total Video Converter Command Line 2.43" and the command for it is "C:\E.M. TVCC>TVCC -f E:\TestVideo\01.avi -o E:\OutputFiles\target.3gp" I got a program to execute command line exe file on site http://www.rgagnon.com/javadetails/java-0014.html which is:...

What's the difference between . and # in a css file?

In css examples, I've seen rules defined starting with a . and some starting with # - sometimes these are mixed in the same file. What is the difference between these rules: h1 { font-size:18pt;} .new-alerts { font-size:11pt; font-weight:bold;} #old-alerts { position:relative; font-size:10pt; } Are they referenced differently on t...

Null check in an enhanced for loop

What is the best way to guard against null in a for loop in Java? This seems ugly : if (someList != null) { for (Object object : someList) { // do whatever } } Or if (someList == null) { return; // Or throw ex } for (Object object : someList) { // do whatever } There might not be any other way. Should they...

Basic ruby question: the { } vs do/end construct for blocks.

Possible Duplicates: Using do block vs brackets {} What is the difference or value of these block coding styles in Ruby? Why does: test = [1, 1, 1].collect do |te| te + 10 end puts test Works, but not: puts test = [1, 1, 1].collect do |te| te + 10 end And yet this works: puts test = [1, 1, 1].collect { |te| ...

LaTeX: dollar sign vs \( \)

Is there any reason to prefer the syntax \(myformula\) to the usual $myformula$ in LaTeX? ...

conditional execution (&& and ||) in powershell

Hello! There's already question addressing my issue (http://stackoverflow.com/questions/563600/can-i-get-to-work-in-powershell), but with one difference. I need an OUTPUT from both commands. See, if I just run: (command1 -arg1 -arg2) -and (command2 -arg1) I won't see any output, but stderr messages. And, as expected, just typing: com...

Can you use multiple columns for a not in query?

I recently saw someone post this as part of an answer to an SO query question: SELECT DISTINCT a, b, c FROM t1 WHERE (a,b,c) NOT IN ( SELECT DISTINCT a,b,c FROM t2 ) I'm a bit confused, as I always thought that you can't use multiple columns for "NOT IN" ("where(a,b,c)", etc.). Is this correct SQL syntax? And how about MySQL? ...

in C# sharp, how you pronounce 'T?'

How do you pronounce 'bool?', 'int?' and their ilk? I've been mulling over options like "nullable of T", "T hook", "T huh", "T what" and "T" with a rising inflection. I'm not particularly satisfied with these as they seem either cumbersome or affected or both. ...

Merging Dictionaries in Python

I am intrigued by the following python expression: d3 = dict(d1, **d2) The task is to merge 2 dictionaries into a third one, and the above expression accomplishes the task just fine. I am interested in the ** operator and what exactly is it doing to the expression. I thought that ** was the power operator and haven't seen it used in t...

Why is the resulting type of a division of short integers in Java not a short integer?

Consider this code: public class ShortDivision { public static void main(String[] args) { short i = 2; short j = 1; short k = i/j; } } Compiling this produces the error ShortDivision.java:5: possible loss of precision found : int required: short short k = i/j; because the type of the expres...

Why does PHP have a $ sign in front of variables?

In PHP and some other scripting languages have the $var syntax while Java and other languages we can do just var. Is there any theory behind it? Does it help them to parse. If not why would they choose to tack on an extra character in front? ...

Operators and methods in Ruby

Most things that look like operators are methods in Ruby; 1 + 2 is syntactic sugar for 1.+(2). Even though + and * are methods that a program can redefine, Ruby has special magic to evaluate 1 + 2 * 3 as 1.+(2.*(3)) instead of 1.+(2).*(3). I wonder where this special magic lives in Ruby--if it is hard-wired into the interpreter. Ari. ...

Proper syntax usage in a professional enviroment.

As I am about to be finish with school here and starting out as a basement coder my syntax usage of various languages is 'Unique' at best. I was curious if professionally I should relearn a better way or just keep trucking. I doubt someone will not hire someone because say in perl while ($loopcounter < 10) { is used instead of while...

emacs lisp skip-syntax-forward help

hello I am trying to implement function which moves to the next blank/whitespace character. I have read manual, and it seems I can use skip-syntax functions. However, I cannot figure out how to use them correctly. Here is what I have: (skip-syntax-forward " ") However, this does not seem to work. If I use "^ " it works, but if point ...

What are the pros and cons of Ruby's general delimited input? (percent syntax)

I don't understand why some people use the percentage syntax a lot in ruby. For instance, I'm reading through the ruby plugin guide and it uses code such as: %w{ models controllers }.each do |dir| path = File.join(File.dirname(__FILE__), 'app', dir) $LOAD_PATH << path ActiveSupport::Dependencies.load_paths << path ActiveSupport...

What does `~` mean in Haskell?

Hey Haskellers, Right now I'm studying the mtl library, trying to do some MonadTransformers of my own. I was checking the Control.Monad.State.StateT declaration, and across all the code, I see this syntax: execStateT :: (Monad m) => StateT s m a -> s -> m s execStateT m s = do ~(_, s') <- runStateT m s return s' I'm wondering, wh...

Problems with Xcode Syntax Highlighting

In Xcode 3.2.1 I have this problem where it stops highlighting Objects in purple, and such. For example: In that example, NSAutoreleasePool, pool, img, size, width and height should be highlighted, however, they are not. Here is a screenshot of what that looks like. Anyone know how to fix this? Edit: Also, code sense isn't showing c...

Javascript/ JQuery syntax not too intuitive?

Is it just me or do you feel the same? I find JavaScript and JQuery (especially the classical JavaScript) syntax very hard to follow, despite using these for a while. However, I do find PHP, C syntax very easy to follow and understand. Do you feel the same? ...

A question about ; in PHP

exit() is valid,but exit() echo 1; Will fail. Why? ...