Show class methods in objective c - xcode

In java if you write myInstance.(list of methods here) you get a list of all methods, but in objective c you write [myInstance (method)] and you have to write a character to see all methods who starts with this character.
It is possible to show all methods without writing the first character? like [myInstance (list of methods here)]
Thanks!

Yes, it is possible, but you have to write in this way
[myInstance *]
instead of *, you have to press Esc key....

Xcode does have intellisense. Just hit the ESC key after a space and it will display all the methods.

Related

Stuck with rdoc: Any way to add indentation to call-seq?

I know I should use YARD. Not an option in this environment.
So I'm using rdoc and call-seq is generally been great, but I want to add indentation for a call-seq that is always used in a block/yield style, something like:
call-seq:
someFunc {
example1(..)
example2(..)
}
But call-seq: removes any indentation and it becomes:
someFunc {
example1(..)
example2(..)
}
Which is sad. I know I could use a separate code block as an example, but this is really part of the general API for how this should be called, and it would be nice if I could use call-seq (instead of the ugly inverted colors of a code block).
I am guessing this isn't possible with the limitations of rdoc, but I thought I'd ask. Any thoughts?
I think you are confused about what the purpose of the calling sequence is, but the name unfortunately is really confusing. Normally, I would assume that it was designed by a non-native speaker, but if I remember my history correctly, RDoc was designed by David Thomas and Andy Hunt for their book Programming Ruby in 2000.
Anyway, calling sequence is not for documenting a sequence of calls, as one might surmise, i.e. it is not for documenting multiple lines of code.
It is for documenting what we could all in other languages multiple overloads of the method. Note that the syntax that is used for each overload is not even legal Ruby syntax (because of the →), so treating it as executable code that is to be indented does not make much sense:
inject(initial, sym) → obj
inject(sym) → obj
inject(initial) { |memo, obj| block } → obj
inject { |memo, obj| block } → obj
What this tells us is that the Enumerable#inject method has four different "overloads", 2×2 combinations: with or without initial value and specifying the binary operation either as a block or as a Symbol.
Hence why it is not possible to format code inside the calling sequence.

Sublime Text 3 Multiline Method Folding

SO...
Sublime Text has the built in ability to fold methods, but as soon as the method declaration spans multiple lines it loses this ability. Does anyone know about a plugin or a way to make this work? Specifically I am running into this with ruby (and my team adheres to a strict style guide regarding line length), but the language shouldn't matter.
Instead of clicking on the down arrow that appears in the gutter next to the first line of the function definition, all you need to do is put your cursor on one of the function's indented lines (not the indented function parameters, but in the function definition itself) and use the CtrlShift[ key binding (on OS X use ⌘Alt[) to fold the function and its parameters. Use CtrlShift] (⌘Alt] on OS X) to unfold, or you can click the sideways arrow next to the def line.
So, this:
becomes this:
Try this formatting
def example( # <--- folds parameters here
param,
param
) # <--- folds method body here
foo
bar
qux
end
The language does matter as far as I know, method folding is part of the language specific configuration. At least it used to be in previous versions.

Is it possible to have 2 variables point to the same address in memory

Is it possible in Visual Foxpro to have 2 variables that point to the same address in memory. Such that if the value of one of the variables is changed then the other is also changed. I understand that when passing arguments to functions they can be passed by value or reference but I want to know if this is possible in straight code. I think in other languages such as C this is called a pointer but I don't believe VFP has pointers. So if one writes the following code it will output the number 4.
a=4
b=a
a=6
? b && answer 4
But could one write code such as the following where the answer could be 6?
a=4
b=*a && note the inclusion of the asterisk (pointer?) here which won't compile in VFP
a=6
? b
No. There are no pointers or references in Foxpro; as you note, the closest thing to it is passing parameters by reference to functions. You might be able to try to kludge something together (as Jerry mentions) with objects using Access/Assign methods, but even then, all that gets passed to the Assign method is the value being assigned - nothing about whether it was originally another variable, a literal value, an object's property, etc.
You could simulate it by using an array or a table. The variables would contain only the array index or record number (or other index) as a reference, and you'd have to get the actual value from the array or table.
Take a look at the Visual Foxpro Access and Assign Methods. These methods can be used to execute code when querying a property or trying to change the value of a property. Below is a link that shows an example:
Access and Assign Example
You could do something like this:
a=4
b='a'
a=6
?&b

Mathematica - can I define a block of code using a single variable?

It has been a while since I've used Mathematica, and I looked all throughout the help menu. I think one problem I'm having is that I do not know what exactly to look up. I have a block of code, with things like appending lists and doing basic math, that I want to define as a single variable.
My goal is to loop through a sequence and when needed I wanted to call a block of code that I will be using several times throughout the loop. I am guessing I should just put it all in a loop anyway, but I would like to be able to define it all as one function.
It seems like this should be an easy and straightforward procedure. Am I missing something simple?
This is the basic format for a function definition in Mathematica.
myFunc[par1_,par2_]:=Module[{localVar1,localVar2},
statement1; statement2; returnStatement ]
Your question is not entirely clear, but I interpret that you want something like this:
facRand[] :=
({b, x} = Last#FactorInteger[RandomInteger[1*^12]]; Print[b])
Now every time facRand[] is called a new random integer is factored, global variables b and x are assigned, and the value of b is printed. This could also be done with Function:
Clear[facRand]
facRand =
({b, x} = Last#FactorInteger[RandomInteger[1*^12]]; Print[b]) &
This is also called with facRand[]. This form is standard, and allows addressing or passing the symbol facRand without triggering evaluation.

Groovy DSL using parenthesis?

I have a groovy DSL script like this:
entity(attribute1:"one", attribute2:"two")
so far so good. I run the script and set the script's delegate to a class where entity's defined, and the class handles everything.
Now I want to do this:
entity(attibute1:(subattribute1:"one", subattribute2:"two"))
Is this somehow syntactically possible? Since (subattribute1:"one", subattribute2:"two") itself doesn't mean anything, I'm assuming not, though I'm wondering if there are some Groovy magic that I'm not aware of that allows this.
And I don't want to do
entity(attibute1:[subattribute1:"one", subattribute2:"two"])
even though I know that works. Just a syntax preference.
No, you have to use the square brace (as you have said you don't want).
The first example:
entity(attribute1:"one", attribute2:"two")
is a shortcut for actually calling:
entity( [ attribute1:"one", attribute2:"two" ] )
So, you would either need the square braces, (to signify the attribute1 key contains a map, or you would need to prefix the brace with another method name such as:
entity(attibute1:attribute(subattribute1:"one", subattribute2:"two"))

Resources