News for hackers. Stuff that matters.
Re:Not Hotdog App by pkulak on Tuesday May 16, 2017 @01:36AM (#14347595)
It was written in Objective C?
Re:Not Hotdog App by timanglade on Tuesday May 16, 2017 @01:47AM (#14347640)
It's actually written in React Native with a fair bit of C++ (TensorFlow), and some Objective-C++ to glue the two. One cool thing we added on top of React Native was a hack to let us inject new versions of our deep learning model on the fly without going through an App Store review. If you thought injecting JavaScript to change the behavior of your app was cool, you need to try injecting neural nets, it's quite a feeling :D
Re:Not Hotdog App by tomduncalf on Tuesday May 16, 2017 @03:21AM (#14347929)
This looks great, haha! Shame I can't access it from the UK.

It would be really interesting to read more about your thoughts on working with RN and C++ and perhaps how you did some of it. I'm currently doing the same (but with a C++ audio engine rather than image processing stuff) and I think it's an incredibly powerful combination - but I do feel like I'm making up some interop patterns as I go and there might be better ways, so would love to hear how other people use it!

Broadly, I've created a "repository" singleton that stores a reference to both the React Native module instance (which gets set when I call its setup method from JS) and the C++ main class instance (which gets set when it starts up), so they can get a handle on each other (I bet there are better ways to do this, but I'm new to C++/ObjC and couldn't work out a better way to get a reference to the RN module).

I'm then using RCT_EXPORT_METHOD to provide hooks for JS to call into C++ via an ObjC bridge (in an RCT_EXPORT_MODULE class), and using the event emitter to communicate back to JS (so the C++ can get the RN module instance from the singleton and call methods which emit events).

I've not done anything that really pushes the bridge performance to a point where I've seen any noticeable latency/slow down caused by the interop - have you had any issues here?

Like I say, I'm finding a really cool way to build apps that need the power of native code but still with the ease of RN as the GUI and some logic, and I actually quite like the separation it enforces with the communication boundary.

Re:Not Hotdog App by timanglade on Tuesday May 16, 2017 @09:40AM (#14349456)
Sounds like you're further ahead than I was with the React Native part! Not Hotdog is very simple so I just wrote a simple Native module around my TensorFlow code and let the chips fall where they may performance-wise. The snap/analyze/display sequence is slow enough that I don't need to worry about fps or anything like that. As much as I enjoyed using RN for this app, I would probably move to native code if I needed to be able to tune performance.
Re:Not Hotdog App by 1zee on Tuesday May 16, 2017 @11:03AM (#14350120)
Can you explain to a noob how you wrote the Native module around TensorFlow? My main area of focus is in python, but I feel hindered when I think I'm ready to start developing for mobile apps. I'm looking into RN, but still not sure how that plays with TF and other python modules.
Re:Not Hotdog App by timanglade on Tuesday May 16, 2017 @12:41PM (#14350978)
It was honestly just maybe 10 lines of code, but I was very confused about it before I got it done. The message passing is a bit counterintuitive at first. I'll try to share example code in my blogpost!
Re:Not Hotdog App by 1zee on Wednesday May 17, 2017 @10:42AM (#14358867)
awesome, what's your blog?
Re:Not Hotdog App by j_s on Tuesday May 16, 2017 @02:06PM (#14351819)
See this sub-discussion re:performance (+serialization/marshalling) in today's React Native discussion:

https://news.ycombinator.com/item?id=14349426

Re:Not Hotdog App by codesternews on Tuesday May 16, 2017 @02:38AM (#14347794)
can you please open source it. It would be great if you open source it.
Re:Not Hotdog App by peterjlee on Tuesday May 16, 2017 @01:42PM (#14351593)
So what you're saying is you can update the neural net to do dick or not dick without going through the App Store review?
Re:Not Hotdog App by porker on Tuesday May 16, 2017 @12:34PM (#14350896)
Nice! I'd never known that C++ could be used in an iOS app; learned something new today thanks.
Re:Not Hotdog App by dustedrob on Tuesday May 16, 2017 @09:52AM (#14349553)
It would be relatively easy to port to Android. Please open source it!
Re:Not Hotdog App by cedobbs10 on Wednesday May 17, 2017 @05:16PM (#14362860)
Hey guys, how would I be able to add characters to an account for injustice and then disable the anti-cheat. I want to basically make it so that i cant get banned for using characters I added to my account.
Re:Not Hotdog App by kgc on Tuesday May 16, 2017 @02:39AM (#14347799)
What was the hack?
Re:Not Hotdog App by asadlionpk on Tuesday May 16, 2017 @02:48AM (#14347828)
When using React Native (and also storing your network in JS) you can choose to push updates and fixes to JS part of your code without going through store again.

Check: http://microsoft.github.io/code-push/

Re:Not Hotdog App by timanglade on Tuesday May 16, 2017 @03:03AM (#14347872)
Yup that's basically it. The hack was just in getting Tensorflow to accept/load its neural network definition from the JS bundle (what CodePush distributes for you) rather than from the main Cocoa bundle.
Re:Not Hotdog App by joncrocks on Tuesday May 16, 2017 @04:19AM (#14348138)
Just as a note, people/developers have had messages from Apple telling them that they need to remove code which allows them to update their app outside of the app update/review process.

See https://news.ycombinator.com/item?id=13817557 for some more detail/discussion.

[edit: Apart from in Apple-approved manners]

Re:Not Hotdog App by Kiro on Tuesday May 16, 2017 @04:47AM (#14348237)
https://developer.apple.com/programs/ios/information/iOS_Pro...

> 3.3.2 […] The only exception to the foregoing is scripts and code downloaded and run by Apple’s built-in WebKit framework or JavascriptCore […]

Re:Not Hotdog App by B1FF_PSUVM on Tuesday May 16, 2017 @04:35AM (#14348186)
Well, that's not gonna fly with the "code is data, data is code" crowd ...

If the newspaper apps get to load fresh front page images, why should a poor neural net be discriminated in its quest for fresh coefficients?

(Raw oppression and injustice there, get yer indignation reservoir topped up.)

Re:Not Hotdog App by Grustaf on Tuesday May 16, 2017 @04:00AM (#14348055)
Really cool stuff! I didn't even realise you've switched jobs, but that explains why I didn't see you when we popped in at Townsend the other day! Keep up the good work.
Re:Not Hotdog App by wcummings on Tuesday May 16, 2017 @03:39PM (#14352589)
I'm surprised Apple allows this, I thought they hated this kind of thing.
Re:Not Hotdog App by had2makeanacct on Tuesday May 16, 2017 @05:02AM (#14348294)
I really have no idea what any of that means, no Android then?