I really need someone to help me. I'm trying to learn Object C. But I don't understand the asterisk movement. I will explain myself:  NSDate *date = [NSDate date]   Here  we ask to the date method to create an NSdate instance and stored in date. Is that correct?  If I'm in the @interface and I do:  @interface Gretter : NSObject {  NSString  *greetings }   Here we declare  Gretter subclass belonging to the NSObject superclass and we add the method greetings to the subclass greeting Is that correct?  What i really don't understand is:  NSString* greeting = @"hello"   Why is the asterisk attach to the NSString* here??  This are 3 separate example and not part of the same program. I just want to understand why the asterisk* change position   Thank you very much  CL
123257
Is it true, that the Asterisk always means "Hey, that is a pointer!" And an Pointer always holds an memory adress?  (Yes I know for the exception that a * is used for math operation)  For Example:   NSString* myString;   or  SomeClass* thatClass;   or  (*somePointerToAStruct).myStructComponent = 5;   I feel that there is more I need to know about the Asterirsk (*) than that I use it when defining an Variable that is a pointer to a class.  Because sometimes I already say in the declaration of an parameter that the Parameter variable is a pointer, and still I have to use the Asterisk in front of the Variable in order to access the value. That recently happened after I wanted to pass a pointer of an struct to a method in a way like [myObj myMethod:&amp;myStruct], I could not access a component value from that structure even though my method declaration already said that there is a parameter (DemoStruct*)myVar which indeed should be already known as a pointer to that demostruct, still I had always to say: "Man, compiler. Listen! It IIISSS a pointer:" and write: (*myVar).myStructComponentX = 5;  I really really really do not understand why I have to say that twice. And only in this case.  When I use the Asterisk in context of an NSString* myString then I can just access myString however I like, without telling the compiler each time that it's a pointer. i.e. like using *myString = @"yep".  It just makes no sense to me.
22301
I just came across an interesting situation in JavaScript.  I have a class with a method that defines several objects using object-literal notation.  Inside those objects, the this pointer is being used.  From the behavior of the program, I have deduced that the this pointer is referring to the class on which the method was invoked, and not the object being created by the literal.    This seems arbitrary, though it is the way I would expect it to work.  Is this defined behavior?  Is it cross-browser safe?  Is there any reasoning underlying why it is the way it is beyond "the spec says so" (for instance, is it a consequence of some broader design decision/philosophy)?  Pared-down code example:  // inside class definition, itself an object literal, we have this function: onRender: function() {      this.menuItems = this.menuItems.concat([         {             text: 'Group by Module',             rptletdiv: this         },         {             text: 'Group by Status',             rptletdiv: this         }]);     // etc }
63275
I'm code reviewing a change one of my co-workers just did, and he added a bunch of calls to Date.toMonth(), Date.toYear() and other deprecated Date methods.  All these methods were deprecated in JDK 1.1, but he insists that it's ok to use them because they haven't gone away yet (we're using JDK 1.5) and I'm saying they might go away any day now and he should use Calendar methods.  Has Sun/Oracle actually said when these things are going away, or does @deprecated just mean you lose style points?
109596
As a Java developer who is reading Apple's Objective-C 2.0 documentation: I wonder what "sending a message to nil" means - let alone how it is actually useful.  Taking an excerpt from the documentation:     There are several patterns in Cocoa   that take advantage of this fact. The   value returned from a message to nil   may also be valid:         If the method returns an object, any pointer type, any integer scalar   of size less than or equal to   sizeof(void*), a float, a double, a   long double, or a long long, then a   message sent to nil returns 0.   If the method returns a struct, as defined by the Mac OS X ABI Function   Call Guide to be returned in   registers, then a message sent to nil   returns 0.0 for every field in the   data structure. Other struct data   types will not be filled with zeros.   If the method returns anything other than the aforementioned value   types the return value of a message   sent to nil is undefined.      Has Java rendered my brain incapable of grokking the explanation above?  Or is there something that I am missing that would make this as clear as glass?  I do get the idea of messages/receivers in Objective-C, I am simply confused about a receiver that happens to be nil.
37382
I'm a C++ guy learning Java. I'm reading Effective Java and something confused me. It says never to write code like this:  String s = new String("silly");   Because it creates unnecessary String objects. But instead it should be written like this:  String s = "No longer silly";   Ok fine so far...However, given this class:  public final class CaseInsensitiveString {     private String s;     public CaseInsensitiveString(String s) {         if (s == null) {             throw new NullPointerException();         }         this.s = s;     }     :     : }  CaseInsensitiveString cis = new CaseInsensitiveString("Polish"); String s = "polish";    Why is the first statement ok? Shouldn't it be   CaseInsensitiveString cis = "Polish"; How do I make CaseInsensitiveString behave like String so the above statement is OK (with and without extending String)? What is it about String that makes it OK to just be able to pass it a literal like that? From my understanding there is no "copy constructor" concept in Java?
13332
I am trying to use a  as input and then creating a query with it - so I need a .    I was surprised to find that it couldn't do the conversion implicitly or explicitly - but I don't even know how I would do this, as the Java API is still fairly new to me.
76488
I have heard/read the term but don't quite understand what it means.  When should I use this technique and how would I use it? Can anyone provide a good code sample?
97660
I am trying to have a dynamic Date in my SMS, called PaymentDueDate. The date is in a DE, that will be the source of the journey that I am using.  The code that I am using when building the message is:  %%[  SET @id = [_subscriberkey]  SET @date = Lookup('payment_reminder_teste','PaymentDueDate','ContactId', @id)  ]%%   %%=Format(@date, "MM/dd/yyyy")=%%   But, when I send it, it doesnt appear any Date. If I use only the PaymentDueDate dynamic word, the date that appears is the modifying date of the message and not the date that is in the PaymentDueDate field.
70095
I want to be able to debug C structures without having to explicitly type every property that they consist of.  i.e. I want to be able to do something like this:  CGPoint cgPoint = CGPointMake(0,0); NSLog(@"%@",cgPoint);   Obviously the '%@' won't work, hence the question.
46378
Can someone explained, as detailed as possible, the differences between the following types?  List List&lt;Object&gt; List&lt;?&gt;   Let me make this more specific. When would I want to use  // 1  public void CanYouGiveMeAnAnswer(List l) { }  // 2 public void CanYouGiveMeAnAnswer(List&lt;Object&gt; l) { }  // 3 public void CanYouGiveMeAnAnswer(List&lt;?&gt; l) { }
62037
Where such a term would reference the location/time of an object, almost like it was of a property of the object. That is to say, if a duck is red, blue, yellow etc, we describe it has having a certain colour. If it's a nanometre, or 10km big, then it's property of size.  Now I know that where/when an object exists an object isn't a property of an object, but it is something unique to that object, so I think it would be useful to have a shorthand for 'geographical location', and 'time of existence'.  There are terms describing both time and location, such an event, or rendezvous (which I think is used to describe the when and where of a meeting between two humans) but I wan't a term that just describes one of each.
53471
Now that it's clear , there is an associated concept that I use all the time without knowing what it really means.   I suppose everybody made once a mistake with parenthesis, resulting  in an "object is not callable" exception. What's more, using __init__ and __new__ lead to wonder what this bloody __call__ can be used for.  Could you give me some explanations, including examples with the magic method ?
57334
I'm just beginning to work on iPhone apps.  How do I know when I should be putting stuff in AppDelegate versus a custom class?  Is there a rule or any type of analogy with another programming language like Python or PHP that uses an AppDelegate like pattern?
2130
I have the following example class:  Test.h:  @interface Test : UIButton {     NSString *value; } - (id)initWithValue:(NSString *)newValue; @property(copy) NSString *value;   Test.m:  @implementation Test @synthesize value; - (id)initWithValue:(NSString *)newValue {     [super init];        NSLog(@"before nil value has retain count of %d", [value retainCount]);     value = nil;     NSLog(@"on nil value has retain count of %d", [value retainCount]);     value = newValue;     NSLog(@"after init value has retain count of %d", [value retainCount]);     return self; }   Which produces the following output:  2008-12-31 09:31:41.755 Concentration[18604:20b] before nil value has retain count of 0 2008-12-31 09:31:41.756 Concentration[18604:20b] on nil value has retain count of 0 2008-12-31 09:31:41.757 Concentration[18604:20b] after init value has retain count of 2147483647   I am calling it like:  Test *test = [[Test alloc] initWithValue:@"some text"];   Shouldn't value have a retain count of 1?  What am I missing?    Thanks for your help.
46765
Take the below code:  private void anEvent(object sender, EventArgs e) {     //some code }     What is the difference between the following ?  [object].[event] += anEvent;  //and  [object].[event] += new EventHandler(anEvent);   [UPDATE]  Apparently, there is no difference between the two...the former is just syntactic sugar of the latter.
47168
I was trying to understand something with pointers, so I wrote this code:  #include &lt;stdio.h&gt;  int main(void) {     char s[] = "asd";     char **p = &amp;s;      printf("The value of s is: %p\n", s);     printf("The direction of s is: %p\n", &amp;s);      printf("The value of p is: %p\n", p);     printf("The direction of p is: %p\n", &amp;p);      printf("The direction of s[0] is: %p\n", &amp;s[0]);     printf("The direction of s[1] is: %p\n", &amp;s[1]);     printf("The direction of s[2] is: %p\n", &amp;s[2]);      return 0; }   When compiling it with gcc I get these warnings:  $ gcc main.c -o main-bin -ansi -pedantic -Wall -lm main.c: In function ‘main’: main.c:6: warning: initialization from incompatible pointer type main.c:9: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char (*)[4]’ main.c:11: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char **’ main.c:12: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char ***’   (The flags for gcc are because I must be C89)  Why incompatible types of pointer? Isn't the name of an array a pointer to it's first element? So if s is a pointer to 'a', &amp;s must be a char **, no? And why do I get the other warnings? Do I have to cast the pointers with (void *) in order to print them?   And when running I get something like this:  $ ./main-bin The value of s is: 0xbfb7c860 The direction of s is: 0xbfb7c860 The value of p is: 0xbfb7c860 The direction of p is: 0xbfb7c85c The direction of s[0] is: 0xbfb7c860 The direction of s[1] is: 0xbfb7c861 The direction of s[2] is: 0xbfb7c862   How can the value of s and it's direction (and of course the value of p) be the same?
67471
Consider the following code:  void Handler(object o, EventArgs e) {    // I swear o is a string    string s = (string)o; // 1    //-OR-    string s = o as string; // 2    // -OR-    string s = o.ToString(); // 3 }   What is the difference between the three types of casting (okay, the 3rd one is not a casting, but you get the intent). Which one should be preferred?