text:
Q: Foundation Objective-c: Dictionary with array; dict with dict Suppose I have a NSDictionary with two sub collections of a NSArray and a NSDictionary:
NSMutableDictionary *mkDict(void){
    NSMutableDictionary *dict=[NSMutableDictionary dictionary];
    NSMutableDictionary *sub=[NSMutableDictionary dictionary];
    NSMutableArray *array= [NSMutableArray array];
    [dict setObject:array forKey:@"array_key"];
    [dict setObject:sub forKey:@"dict_key"];
    return dict;
}

There are a multitude of ways to access a single element of the sub-collection, and I choose to time three of them.
The first way is to indirectly access the subelements by accessing the key of the parent:
void KVC1(NSMutableDictionary *dict, int count){

    for(int i=0; i<count; i++){
        char buf1[40], buf2[sizeof buf1];
        snprintf(buf1,sizeof(buf1),"element %i", i);
        snprintf(buf2, sizeof buf2, "key %i", i);

        [[dict objectForKey:@"array_key"]
          addObject:
             [NSString stringWithUTF8String:buf1]];
        [[dict objectForKey:@"dict_key"]
          setObject:[NSString stringWithUTF8String:buf1]
          forKey:[NSString stringWithUTF8String:buf2]];
    }
}

The second is to use KeyPath access:
void KVC2(NSMutableDictionary *dict, int count){

    for(int i=0; i<count; i++){
        char buf1[40], buf2[sizeof buf1], buf3[sizeof buf1];
        snprintf(buf1,sizeof(buf1),"element %i", i);
        snprintf(buf2, sizeof buf2, "key %i", i);
        snprintf(buf3, sizeof buf3, "dict_key.key %i",i);

        [dict insertValue:
             [NSString stringWithUTF8String:buf1]
            atIndex:i inPropertyWithKey:@"array_key"];
        [dict setValue:
             [NSString stringWithUTF8String:buf1]
            forKeyPath:
             [NSString stringWithUTF8String:buf3]];
    }
}

And the third, similar to the first, is to access a pointer to the sub element, then use that pointer:
void KVC3(NSMutableDictionary *dict, int count){

    NSMutableArray *subArray = [dict objectForKey:@"array_key"];
    NSMutableDictionary *subDict = [dict objectForKey:@"dict_key"];

    for(int i=0; i<count; i++){
        char buf1[40], buf2[sizeof buf1];
        snprintf(buf1,sizeof(buf1),"element %i", i);
        snprintf(buf2, sizeof buf2, "key %i", i);

        [subArray addObject:[NSString stringWithUTF8String:buf1]];
        [subDict
           setObject:
            [NSString stringWithUTF8String:buf1]
           forKey:
            [NSString stringWithUTF8String:buf2]];
    }
}

Here is the timing code:
#import <Foundation/Foundation.h>
#import <mach/mach_time.h>

// KVC1, KVC2 and KVC3 from above...

#define TIME_THIS(func,times) \
({\
mach_timebase_info_data_t info; \
mach_timebase_info(&info); \
uint64_t start = mach_absolute_time(); \
for(int i=0; i<(int)times; i++) \
func ; \
uint64_t duration = mach_absolute_time() - start; \
duration *= info.numer; \
duration /= info.denom; \
duration /= 1000000; \
NSLog(@"%i executions of line %i took %lld milliseconds", times, __LINE__, duration); \
});

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSMutableDictionary *dict=mkDict();
    NSMutableDictionary *dict2=mkDict();
    NSMutableDictionary *dict3=mkDict();

    TIME_THIS(KVC1(dict,1000),10);
    TIME_THIS(KVC2(dict2,1000),10);
    TIME_THIS(KVC3(dict3,1000),10);

    if([dict isEqualToDictionary:dict2])
        NSLog(@"And they are the same...");
    [pool drain];
    return 0;
}

Here are the results:
10 executions of line 256 took 57 milliseconds
10 executions of line 257 took 7930 milliseconds
10 executions of line 258 took 46 milliseconds
And they are the same...

Question: Why is the OS X Snow Leopard / Lion suggested method of using KeyPaths so stinking slow? If you increase the size of count to 10,000 or more, KVC2 becomes infinitely slow where the other two methods increase linearly.
Am I doing something wrong? Is there a better idiom to access a single element of a sub collection in a dictionary?

A: In KVC2(), you send
[dict insertValue:[NSString stringWithUTF8String:buf1]
          atIndex:i
inPropertyWithKey:@"array_key"];

The documentation for that method states the following:

The method insertIn<Key>:atIndex: is invoked if it exists. If no corresponding scripting-KVC-compliant method (insertIn<Key>:atIndex:) is found, this method invokes mutableArrayValueForKey: and mutates the result.

Since the message is being sent to dict, an instance of NSDictionary, there is no -insertIn<Key>:atIndex: method, hence -mutableArrayValueForKey: is sent. The documentation for this method states the following:

Return Value
  A mutable array proxy that provides read-write access to the ordered to-many relationship specified by key.
Discussion
  Objects added to the mutable array become related to the receiver, and objects removed from the mutable array become unrelated. The default implementation recognizes the same simple accessor methods and array accessor methods as valueForKey:, and follows the same direct instance variable access policies, but always returns a mutable collection proxy object instead of the immutable collection that valueForKey: would return.

So what's happening is that at each iteration:

*

*A proxy mutable array is created as a mutable copy of the original array;

*An object is added to the proxy array;

*The proxy array adds the same object to the original array.

If you use Instruments to profile your program, you'll notice that about 50% of the processing time is spent on -[NSKeyValueSlowMutableArray insertObject:atIndex:] — I think it's safe to assume that NSKeyValueSlowMutableArray is the proxy array and its name should be a clue of its performance.

A: Because the framework needs to figure out how to get to the elements given a string access path: parsing of strings, error checking, creating more string instances and freeing them.
It is a preferred way because of key-value-observing, binding etc so that Cocoa can make a lot of its magic for you. And slow is relative: it may be slowlier than direct access, but is it too slow? Only profiling an real use-case can show you if it gets too slow and if you need to optimize. If you set a few variables using keypath on the UI then you probably won't notice the lack of speed, if you try to process a lot of data then keypath is probably not a best solution. As I said: profile you use case.
You have to make a compromise between ease of code, having access to all of the goodies Cocoa KVC provides and speed and you'll know the answer only when you see your code as part of the bigger picture.

A: 1st and 3rd implementations have a "static" reference to the subelements which is definitely not evaluated a second time at the 3rd implementation. The variability of the 2nd implementation at accessing the subelements is probably causing the time issues... And [NSDictionary insertValue: atIndex: forPropertyKey:] has the issue of random access insertion in a not statically evaluated element (NSMutableArray) and is also a KVO procedure which might invoke a number of unknown side-effects... Try again without the KVO scripting insertValue:atIndex:forPropertyWithKey: and see if keyPath is that slow, I bet it is slower than the others but in different scales


It's about time I posted a new casserole recipe. For whatever reason I don't talk about this much, but I love me a good casserole. They're so versatile and make the best leftovers.
Since we all love casseroles, and we all love turkey tacos, why not make a turkey taco casserole?! I love it, I love it, I love it!
This recipe is great because you make the "taco meat" all in one pan before transferring it over to combine with some rice then sprinkle with cheese and you're done-zo.
I hope you find this comforting meal as delicious as I do. It would be a great meal to bring to a friend, or to make ahead of time before a new baby comes. Dig in!
An easy and versatile meal made with ground turkey, spices, beans and rice for a delicious weeknight meal.
Preheat the oven to 375 degrees. Heat a large skillet over medium/high heat. Add the oil, ground turkey, salt, pepper, chili powder, garlic powder and cumin. Break up the meat and cook for about 5-7 minutes until meat is cooked through.
Add the frozen corn, fire roasted tomatoes, green chilies, black beans and salsa and cook for 3-5 minutes until warmed. Add the cilantro and the juice of 1 lime and stir to combine.
Transfer mixture to a large bowl and stir in the cooked rice until mixture is well combined. Pour the entire mixture into a 13×9 baking dish and top with shredded cheese.
Bake for 20-25 minutes until cheese is melted and bubbly. Serve with desired toppings, a squeeze of fresh lime juice and enjoy!
Is the 2.5 cups of rice measured before or after it's cooked?


Discussion in 'World Building' started by DAGUIGZ, May 16, 2018.
Hi does anyone have a problem with ProBuilder selection? When making a New Poly Shape it is automatically unselected and i can't draw it.
Hi, can you give us a bit more info?
3- Any red errors in the console?
Edit : Creating a new project solved the problem.
Thanks for the update! Very strange. I've been trying a few things to repro, can't yet.
"I discovered a stupid workaround: delete the Library folder."
Ok, interesting! Sounds like something went wrong in the project. Deleting library will force re-import of EVERYTHING, so it could take awhile, but might clear up odd issues, sure.
Sorry, I still can't repro it at all over here, I'll keep an eye out for it though!
Same thing happened to me. Not sure what caused it but deleting the Library folder did fix it.
I'm having the same problem but deleting the Library folder did not fix it. I was able to reproduce this in an empty project.
I didn't get any red errors in Console, but I did get this warning (not sure if it's related to ProBuilder).
I have an update on this issue: the problem only occurs with one of my own custom Unity Editor layouts I've defined. When I select one of my other editor layouts (either a built in layout or a different custom layout I have) ProBuilder works fine. I don't know what the difference is between the working layouts and the broken layout.
@gabrielw_unity The broken layout file is attached to the bug.
Hi! Thanks for the detailed info, and for filing the bug report, that's a big help!
I don't know what the difference is between the working layouts and the broken layout.
I think I now know what the difference is.
My theory is that somehow this leads to ProBuilder getting borked. I have no idea why though.
I have this same problem, some weird layout-dependent breaking of polyshape tool.
I don't think this is an issue with just Pro Builder. I have a custom editor that uses the UnityEditor Handles utilities that is also having the same problem. I am guessing that the Poly Shape tool is going through the same process. I started a thread on the Unity 2018 beta board, I'm not sure if that's the most appropriate location to raise that issue though.
Unity responded to my bug submission. My problem was due to a locked inspector. As a workaround, you can unlock the inspector. They said they are going to fix this bug asap.
sand_lantern and gabrielw_unity like this.
Thanks for passing on the update here!
Do you have more information than that? It doesn't seem to be as simple as that for getting it to work in my inspector. I still need to switch to a simpler layout to get it to work than my primary one.
What about a link to your bug report? It could be helpful to me.
Same problem here. Deleting the library won't solve it though.
I posted it before, but here's a link so you don't have to search for it.
I have same problem with Unity 2018 3.2f1 running on Windows10. Japanese Version one.
DX11 on NVidia Geforece GTX 1050Ti oc 4G.
I deleted contents in Library folder, that cannot solve it.
As far as I see, it seems to be caused by Null Exeception. Because instance of new poly shape couldnt be created by something.
But New Poly shape can work by first clicking on a object..I noticed it.
then secound click and 3rd ...so on.. are able work as you thought.
i mean, you can click on any point on the view after have done 1st click on a object.
you don't need click on a object anymore.


How to Update Your Fall Wardrobe in a Flash!
Wow, how time flies! We were enjoying the warm summer breezes & now we're experiencing the cool air of fall. So I'm sure you're wondering, how can I update for fall with the least amount of fallout? The easiest way is to update your accessories! You can transition from summer to fall by embracing the bold jewel tones that are in this season.
Here's a great piece for day or night. It's a beautiful pearl stretch bracelet in cream & gold (also available in white & silver). Only $18!
For example, this beauty is a cascading bib necklace & earring set with royal blue crystals & gold beads. It's modestly priced at $29. A great look with your maxi dress & a denim jacket or paired with a corporate suit for the office!
Another great trend? Camo! If you haven't hopped onto this trend, it's not too late. And it's a win-win! Not only are you showing support of our ladies & gents in the armed forces, but you're rocking it like a boss as well!
Crystal & pearl stretch bracelets, only $15!!
If you'd like to order any of these, comment below or use the contact page. Orders are processed same day & are received in 7-10 days. Credit, debit & PayPal accepted. Happy Shopping!
Enjoy The Jewelry Lady's Giveaway tomorrow!
Hi everyone! I wanted to give you an update in case you haven't seen it on my FB page. Tomorrow, I'll be showcased at the Professional Women's Network Fall Business Expo! YAAAAY! It's a great opportunity to meet new people & reconnect with old friends. So I wanted to let you know about that & introduce you to some of the other fabulous ladies that will be there as well! To visit their site, just click the pic.
First, meet the president of PWN, Nishaka Proctor. She's an event coordinator extraordinaire! Whether for a corporate event or a wedding, she's the one to call for an event with excellence!
Next is the VP, Susan Harding, owner of The Next Step: Integrative Health Coach. She helps women take time to pause & then successfully navigate the mountains in life. If you have a mountain that just won't move & is too hard to climb, call Susan!
Cheryl Hucks is the owner of Casual Elegance by Cheryl (soon to be Cheryl Hucks Interior Design). Casual Elegance by Cheryl is a full service interior decorating firm, offering personal, professional service and custom design for both Commercial and Residential. If your home or commercial property needs an update, call Cheryl!
Lucy Wellmaker will be attending as a member of PWN, a representative of the host Women's Resource Center & of her own business, Words of Wisdom! Lucy has a vast knowledge of service & has devoted her career to helping women. If you know a woman who needs help or are a woman who needs help, contact the Women's Resource Center at http://www.womenscentergso.org!
There will also be representatives from Mary Kay, Trains and Things, The Reilly Group, Ameriprise Financial & many more tomorrow, so come enjoy all they have to offer! There will be door prizes, a beautiful breakfast & a guest speaker who is sure to blow you away with her wealth of knowledge. The event is free & open to the public.
Fall Fashion Newsflash! Here Are the Top 25 Brilliant Baubles!
Can you believe it? Fall is just around the corner! To get you ready to fall in love with fall, we've pulled out no stops! This season is all about the jewel tones. Beautiful bordeauxs, enchanting emeralds, radiant royal blues & perfect plums will grace the necks, wrists & fingers of fashion mavens everywhere! So dive into this treasure trove of beauty & purloin your faves! Enjoy these statement necklaces, J. Crew inspired neck candy & ravishing rings & earrings!
For more info or to place an order, visit my FB page or comment below!
Animal jewelry is on the rise & I can't say I don't love it myself! I went into the archives and found these fun & furry fashions just for you. So have fun & add one or more of these to your collection. Take a walk on the wild side!
Would you like to follow me? Use the tab at the top for RSS or use the box to your right to follow. You can also follow me on Bloglovin'! Follow my blog with Bloglovin.
Have you hit my BIG SALE yet?
Right now on my FB page, I'm having a great sale! Find necklaces, bracelets, rings & more marked down for super savings! Here are some of the items available.
Mention you saw this post to receive free shipping! That's a $4 value!


text:
from django.template.defaulttags import register

@register.filter
def get_item(dictionary, key):
    return dictionary.get(key)

redpajama_set_name: RedPajamaGithub


Adventure Now offers a range of thrilling outdoor activities. With sites in Sheffield and Manchester, activities ranging from Quad Bikes and Axe Throwing to Bushcraft, we're sure we'll have something you'll love!
We run outdoor activities in Sheffield at the Kenwood Hall Hotel and in Eccles, Manchester in Botany Bay Woods, a few miles from the Trafford Centre.
Activity days and parties available for Stags, Hens, Kids and Corporate Groups.
We also can offer discounts for other large groups.
Our package deals offer great value when combining multiple activities.


text:
Chaetopyrena poae är en svampart som först beskrevs av Niessl, och fick sitt nu gällande namn av Pier Andrea Saccardo 1883. Chaetopyrena poae ingår i släktet Chaetopyrena, divisionen sporsäcksvampar och riket svampar.   Inga underarter finns listade i Catalogue of Life.

Källor

Sporsäcksvampar
poae

redpajama_set_name: RedPajamaWikipedia


(A) 03/12/19 5:00 PM vs Malvern Preparatory School .
(H) 03/23/19 5:00 PM vs Southern Lehigh HS 13 - 12 .
(H) 03/26/19 7:00 PM vs Bethlehem Catholic HS 17 - 2 .
(H) 03/28/19 7:00 PM vs Central Catholic 11 - 10 .
(A) 03/30/19 11:00 AM vs Wilson West Lawn 10 - 5 .
Senior Night 17 - 0 .
(A) 04/04/19 5:30 PM vs Pleasant Valley 14 - 3 .
(H) 04/06/19 12:30 PM vs Nazareth Area HS 15 - 8 .
(H) 04/09/19 7:00 PM vs Freedom HS 18 - 3 .
(A) 04/11/19 4:00 PM vs Easton 11 - 5 .
(H) 04/13/19 11:00 AM vs Cumberland Valley 11 - 5 .
(A) 04/15/19 4:15 PM vs Northampton Area HS 16 - 1 .
(H) 04/16/19 7:00 PM vs Upper Dublin HS 6 - 4 .
(H) 04/17/19 7:00 PM vs Emmaus Postponed .
Youth Night 9 - 8 .
(H) 04/25/19 7:00 PM vs Easton .
(A) 04/30/19 7:30 PM vs Central Catholic Muhlenberg College .
(A) 05/02/19 4:00 PM vs Freedom HS .
(A) 05/06/19 6:30 PM vs Emmaus .
Get key announcements and game updates from the official Parkland High School athletic calendar!