Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Nik L.
Mobile and Web Developer for 8+ years
Tutor Satisfaction Guarantee
PHP Programming
TutorMe
Question:

What will be the output of the following PHP script? $foo = "0"; echo ($foo == "0") ? "foo" : "bar"; echo ($foo == 0) ? "foo" : "bar"; echo ($foo === "0") ? "foo" : "bar"; echo ($foo === 0) ? "foo" : "bar"; echo ($foo) ? "foo" : "bar";

Nik L.
Answer:

The output will be "foofoofoobarbar"

iOS Programming
TutorMe
Question:

You have included a 3rd party library through Cocoapods in your XCode project and subclass one of its controllers. You require additional functionality customization that - among other things - needs to call a private method with a CGFloat (i.e., a non-object) parameter in the class that you subclassed (not defined in the .h file). In other words, you cannot use the performSelector method and simply attempting to call the private method results in a compiler error. How do you call this private method, which you know exists?

Nik L.
Answer:

1) Re-define it in your .m file interface category // MySubclass.m @interface MySubclass ( ) ... - (void)somePrivateMethod:(CGFloat)parameter; ... @end @implementation MySubclass ... - (void)someSubclassMethod { ... CGFloat arg = 10; [self somePrivateMethod:arg]; ... ... @end 2) Use NSInvocation @implementation MySubclass ... - (void)someSubclassMethod { ... SEL selector = NSSelectorFromString(@"somePrivateMethod:"); NSMethodSignature *signature = [self methodSignatureForSelector:selector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; CGFloat arg = 10; [invocation setSelector:selector]; [invocation setArgument:&arg atIndex:2]; // 0 and 1 are reserved [invocation invokeWithTarget:self]; ... } ... @end 3) Redefine and reimplement it verbatim in your subclass. This will get rid of the warning the compiler throw in the first solution, but you run the risk of a future library update changing the implementation, leaving your code at best buggy or failing to compile and at worst crashing unpredictably due to unforeseen deep implementation details and logic flow.

Computer Science (General)
TutorMe
Question:

What are four tasks that a dedicated (NVIDIA/AMD) Graphics Processing Unit (GPU) can be used for today?

Nik L.
Answer:

1. Rendering real-time video game graphics, which require graphics processing and memory capabilities not available in built-in, onboard chipset graphics. 2. Rendering resource-intensive video, images, and 3D graphics in software such as Photoshop, After Effects, and 3Ds Max. 3. Machine learning algorithms 4. Crytocurrency mining

Send a message explaining your
needs and Nik will reply soon.
Contact Nik
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.