text stringlengths 1 330k |
|---|
Darlene B. |
Darlene B. |
San Diego |
Since May 2011 |
My Favorite Finds |
Francesca's Collections |
Flag as Inappropriate |
Francesca's Collections is a chain of gift stores with locations across the United States. The Cranston Francesca's Collection is located inside Garden City and sells women's clothing and accessories such as dresses, vests, tunics, sweaters, pants, cardigans, coats, leggings, belts, scarves, hand bags, quilts, wallets,... |
175 Hillside Rd, Cranston, RI 02920 |
(401) 270-3257 |
• Accessible: yes |
Share a review or post about this business. |
Posts awaiting your approval 0 |
Who wants to be the first to post? |
Pritzker's Prize |
A Hyatt Hotels scion goes heavy on the camp for his first resort venture. |
Pritzker's Prize |
Yoga alfresco at Carmel Valley Ranch. |
Pritzker's Prize |
In recounting his childhood summers at Camp Horseshoe in Rhinelander, Wisconsin, John Pritzker has an impressively detailed memory. “Let’s see…Pioneer, Woodsman, Forester, Guide, Ranger,” he says softly, rattling off the names of the various cabins he inhabited there, his voice tinged with sentimentality. “I was a camp... |
Forty years later, the son of Hyatt Hotels founder Jay Pritzker (and cousin to politico Penny Pritzker) is back at camp, or at least his own, grown-up version of it. Last summer his investment firm, Geolo Capital, purchased Carmel Valley Ranch, a 490-acre resort a few miles outside of Carmel, California. Tucked amid th... |
Known as the only member of his family who actually knew how to check a guest into a hotel, the 57-year-old Pritzker joined the Hyatt company at 16, where his first task was painting the boiler room at the Hyatt Regency O’Hare. Evidently he did a decent job of it, and promotions from busboy to banquet manager ultimatel... |
John Priztker |
John Pritzker near the yoga pavilion. |
So when Pritzker learned that Carmel Valley Ranch was for sale, he traveled the 120 miles from San Francisco (where he lives with his wife and raised his three sons) to check it out. “I remember thinking when I drove in, Oh, this is pretty. Then I kept driving through and thought, This is really nice. The next morning ... |
What they did was install an 11,000- square-foot spa, a hilltop yoga platform, a two-acre organic garden (where guests can pick ingredients for their next meal), a five-acre lavender field and beehives (whose by-products will be used both in meals and spa treatments). They also planted a vineyard and will eventually us... |
Pritzker hopes the makeover, which will be unveiled late this summer, will impart to Carmel Valley Ranch visitors that same sense of wonder he felt at Horseshoe all those years ago. “It’s summer camp,” he says, “without the discipline.” |
• Yoga: Amanda Marsalis; Pritzker: Hiroyo Kaneko |
Tags fitness, Who, yoga |
Take the tour × |
Whenever I need to create a new NSString variable I always alloc and init it. It seems that there are times when you don't want to do this. How do you know when to alloc and init an NSString and when not to? |
share|improve this question |
Your question makes little sense. Show us some examples. – Mike Abdullah Sep 27 '10 at 11:33 |
Creating a new NSString via [[NSString alloc] init]; is one of the most pointless things you could do in Cocoa. The resulting string is immutable and empty. – Dave DeLong Sep 27 '10 at 15:58 |
add comment |
4 Answers |
up vote 9 down vote accepted |
No, that doesn't make sense. |
The variable exists from the moment the program encounters the point where you declare it: |
NSString *myString; |
This variable is not an NSString. It is storage for a pointer to an NSString. That's what the * indicates: That this variable holds a pointer. |
The NSString object exists only from the moment you create one: |
[[NSString alloc] init]; |
and the pointer to that object is only in the variable from the moment you assign it there: |
myString = [[NSString alloc] init]; |
//Or, initializing the variable in its declaration: |
NSString *myString = [[NSString alloc] init]; |
Thus, if you're going to get a string object from somewhere else (e.g., substringWithRange:), you can skip creating a new, empty one, because you're just going to replace the pointer to the empty string with the pointer to the other one. |
Sometimes you do want to create an empty string; for example, if you're going to obtain a bunch of strings one at a time (e.g., from an NSScanner) and want to concatenate some or all of them into one big string, you can create an empty mutable string (using alloc and init) and send it appendString: messages to do the c... |
You also need to release any object you create by alloc. This is one of the rules in the Memory Management Programming Guide. |
share|improve this answer |
Reminder: Ignore the part about release when building your app under ARC. Also, if you want to self-document instantiating an empty string (as opposed to the nil pointer described in this answer), use this convenience class method: NSString* myString = [NSString string]; – Basil Bourque Oct 14 at 23:22 |
@BasilBourque: Even more idiomatic would be @"", although that isn't guaranteed to be a new string (though neither is [[NSString alloc] init], which may return a constant string). – Peter Hosey Oct 15 at 0:46 |
[NSString string] seems more self-documenting to me as this absolutely means "I want a non-nil empty string". @"" has some ambiguity – did the author merely forget to fill in the intended string literal? (I've seen that happen when indecision hovered over the choice of exact wording.) On the other hand, if indeed you m... |
add comment |
If you want to initialise it to a known value, there is little point in using alloc, you can just use a string literal: |
NSString* myStr = @"Some value"; |
If you want to initialise it with a format or whatever, but don't need it to stick around beyond the current autorelease pool lifetime, it's a bit neater to use the class convenience methods: |
NSString* myTempStr = [NSString stringWithFormat:@"%d", myIntVar]; |
If you need its lifetime to go beyond that, either alloc/init or else add a retain to the previous call. I tend to slightly prefer the latter, but the two are pretty much equivalent. Either way you will need a balancing release later. |
Note that, since NSString is not mutable, this sort of thing is not only unnecessary but actively wrong: |
// don't do this! |
NSString* myStr = [[NSString alloc] initWithString:@""]; |
myStr = someOtherStr; |
since it leaks the initial placeholder value. |
share|improve this answer |
How do you know what the current autorelease pool lifetime is? – node ninja Sep 28 '10 at 10:00 |
@awakeFromNib By reading the relevant section of the memory management docs. Commonly you can think of an autoreleased object as lasting until you let it out of your sight, and then just a teensy bit longer (ie, long enough to be a valid return value). If you are creating stuff in a loop you may want to manage an autor... |
add comment |
I'm guessing that you are referring to using StringWithString or similar instead of initWithString? StringWithString alloc and inits for you under the hood and then returns an autoreleased string. |
If you don't need to do any string manipulation other than to have the string, you can use NSString *str = @"string"; |
In general with iOS, the tighter you manage your memory the better. This means that if you don't need to return a string from a method, you should alloc init and then release it. |
If you need to return a string, of course you'll need to return an autoreleased string. I don't think its any more complicated than that. |
share|improve this answer |
Nope. He's referring to this: stackoverflow.com/questions/3796312/… – Peter Hosey Sep 27 '10 at 8:02 |
add comment |
I can't think of any time when I would want to alloc/init a NSString. Since NSStringgs are immutable, you pretty much always create new strings by one of: |
• convenience class method e.g. |
NSString* foo = [NSString stringWithFormat:...]; |
• literal |
NSString* foo = @"literal"; |
• NSString instance method |
NSString* foo = [bar uppercaseString]; |
• copy from mutable string |
NSString* foo = [mutableBar copy]; // foo needs to be released or autoreleased in this case |
share|improve this answer |
You might want to read a file and stash it in an instance variable, in which case you'd use initWithContentsOfFile:encoding:error:. (Or stringWith… and retain, but that's no more efficient for you or the program.) – Peter Hosey Sep 27 '10 at 17:40 |
@Peter Hosey: I'd use the convenience class method in that case. – JeremyP Sep 28 '10 at 8:23 |
add comment |
Your Answer |
The Fifteen Decisive Battles of the World/Chapter IX |
From Wikisource |
Jump to: navigation, search |
The Fifteen Decisive Battles of the World by Edward Shepherd Creasy |
Chapter IX |
Chapter IX. |
"The eyes of all Europe were turned towards this scene; where, it was reasonably supposed, the French were to make their last stand for maintaining the independence of their monarchy and the rights of their; sovereign"--Hume. |
Seldom has the extinction of a a nation's independence appeared more inevitable than was the case in France, when the English invaders completed their lines round Orleans, four hundred and twenty-three years ago. A series of dreadful defeats had thinned the chivalry of France, and daunted the spirits of her soldiers. A... |
"In sooth, the estate of France was then most miserable. There appeared nothing but a horrible face, confusion, poverty, desolation, solitarinesse, and feare. The lean and bare labourers in the country did terrifie even theeves themselves, who had nothing left them to spoile but the carkasses of these poore miserable c... |
In the autumn of 1428, the English, who were already masters of all France north of the Loire, prepared their forces for the conquest of the southern provinces, which yet adhered to the cause of the Dauphin. The city of Orleans, on the banks of that river, was looked upon as the last stronghold of the French national p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.