What does the & symbol mean in Objective-C? I am currently looking at data constucts and am getting really confused by it.
I have looked around the web for it but have not found an answer at all. I know this is possibly a basic Objective-C concept, but I just can't get my head around it.
For example:
int *pIntData = (int *)&incomingPa...
Hello everybody,
I stumbled across this problem in F#. Suppose, I want to declare two types that reference each other:
type firstType =
| T1 of secondType
//................
type secondType =
| T1 of firstType
//................
How do I do that, so the compiler does not generate an error?
...
Have a look here:
In the following code, what would be the type of b?
struct A {
A (int i) {}
};
struct B {
B (A a) {}
};
int main () {
int i = 1;
B b(A(i)); // what would be the type of b
return 0;
}
I'll appreciate it if anybody could explain to me thoroughly why would such syntax exist :)
Thanks.
...
Just noticed in ByteArrayOutputStream, the toByteArray() is declared as,
public synchronized byte toByteArray()[];
What's the difference between this declaration and the following one?
public synchronized byte[] toByteArray();
...
I have looked at quite a few places online and can't seem to find a good explanation as to why we should append an F or L after a value assigned to a C++ constant. For example:
const long double MYCONSTANT = 3.0000000L;
Can anyone explain why that is necessary? Doesn't the type declaration imply the value assigned to MYCONSTANT is a l...
Which one below is correct? First code has no quotes in the $_GET array and the second one does, I know you are supposed to have them when it is a string of text but in this case it is a variable, also what about if the key is a number?
no quotes
function arg_p($name, $default = null) {
return (isset($_GET[$name])) ? $_GET[$name] : ...
Hi,
Is there a good way in C# to mimic the following python syntax:
mydict = {}
mydict["bc"] = {}
mydict["bc"]["de"] = "123"; # <-- This line
mydict["te"] = "5"; # <-- While also allowing this line
In other words, I'd like something with [] style access that can return either another dictionary or a string type, depending o...
In perl I can write
($var1, $var2, $var3) = split(/:/, "foo:bar:blarg")
to split a string by colon and assign each array element to $var1, $var2 and $var3. Is there a similar syntax for this in php? I have to use the variables in a lot of my code so I want them to have meaningful names, and writing variable assignment code like
$arra...
I've seen people writing the following query
SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
written like this
SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name2.column_name =table_name1.column_name
does it actually make any difference?
...
Where is the default location for the folder ~/.vim/syntax/ on a linux system? I am trying to add a python addon. Thanks.
...
Anybody knows where the "://" or the "//" comes from in most URIs syntaxes?
For instance, why isn't it written like "http:www.example.com"?
...
In C# (and Java) a string is little more than a char array with a stored length and a few methods tacked on. Likewise, (reference vs. value stuff aside) objects are little more than glorified structs with inheritance and interfaces added.
On one level, these additions feel like clear features and enhancements unto themselves. On another...
Is there anyway I can modify this code example
#include <stdlib.h>
#include <iostream>
class Base {
public:
Base() {
if(!m_initialized) {
static_constructor();
m_initialized = true;
}
}
protected:
virtual void static_constructor() {
std::cout << "Base::static_constructor()\n";...
Why wouldn't the following line of code work in a method?
return (count > 0) ? true : false;
It works perfectly fine if I do:
bool ret = (count > 0) ? true : false;
return ret;
Bonus Question: Is it really faster or more effective than the standard if statement?
bool return = false;
if(count > 0)
{
ret = true;
}
return ret;
...
When writing the following code in scala
var m = Map((0,1) -> "a")
m += ((0,2), "b") // compilation error
I'm getting the error
type mismatch;
found : Int(0)
required: (Int, Int)
However the changing the syntax of the tuple from (X,Y) to (X -> Y) works
var m = Map((0,1) -> 'a)
m += ((0,2) -> 'b) // compiles file
Even though...
Xcode's syntax colouring is poor at best and textmate's looks great, but I like Xcode, since I program in C++, too. I'd like to keep everything in one place and take advantage of other Xcode features.
Has anyone already done this or is there an easy way to do it?
...
simple problem baffling me...
i have a function:
function spitHTML() {
$html = '
<div>This is my title</div>\n
<div>This is a second div</div>';
return $html
}
echo $spitHTML();
Why is this actually spitting out the \n's?
...
Possible Duplicate:
PHP: different quotes?
Simple question:
What is the difference between ' and " in php? When should I use either?
...
Hello,
is it possible to initialize a List with other List's in C#? Say I've got these to lists:
List<int> set1 = new List<int>() {1, 2, 3};
List<int> set2 = new List<int>() {4, 5, 6};
What I'd like to have is a shorthand for this code:
List<int> fullSet = new List<int>();
fullSet.AddRange(set1);
fullSet.AddRange(set2);
Thanks in...
My ISPs PHP server is now returning
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
On what I thought was valid php, i.e.
if ( $_REQUEST[ 'some_data' ] == null )
{
echo "<p>No data</p>";
}
else
{
echo "<p>Some data</p>";
}
I have tried turning on error reporting ...