Saturday, July 7, 2012

crxify - dafuq this is a weird name!

You have probably seen my posts about developing on a Chromebook. To cut a long story short everything is possible, but it's only comfortable for JavaScript developers.

The advantage for JavaScript developers is the number of available online IDEs - c9.io and Eclipse Orion to name the most popular. These are perfect for developing JavaScript for websites or server, but they lack functionality for local JavaScript applications, like Chrome Extensions. Why? Because you're developing in the cloud, therefore your code is in the cloud too - so how do you get it to execute locally (e.g. in Chrome)? Normally you would use something like git to fetch the code and then run it. Chrome OS doesn't ship with git installed, so you have to get the code otherwise (download zipball from GitHub, for example).

Anyway, I found this process to be too complicated (especially if you're making lots of small changes in a short time) so I built crxify: a web app which packs your code from GitHub into a .crx-file. Below is a video describing the process.

  1. find the zipball URL for your repository and the branch / tag to be packed
    • the URL usually looks something like this: https://github.com/USER/REPOSITORY/zipball/BRANCHorTAG
    • for example: https://github.com/TomTasche/Announcify.js/zipball/0.2 or https://github.com/TomTasche/Announcify.js/zipball/experimental
  2. go to crxify.tomtasche.at
  3. insert the zipball URL and press the button
  4. wait a few seconds (usually under 30 seconds)
  5. download the .crx
  6. go to chrome://extensions
  7. drag and drop the .crx-file onto the page
I hope this provides some real world value for someone. :) Let me know if you need more features!

Thursday, July 5, 2012

Google Apps Script: hands-on

Update: You can find a "benchmark" at the end of this post.

Thinking about using Google Apps Script for your next project? Think again.

I have spent the last three days tinkering with Google Apps Script, and eventually came to the conclusion that it's not a good fit for "real" (?) developers. Of course, it's really easy to use: 'GmailApp.getInboxThreads()' and you have an array of all the threads in your inbox. Similar usage for other Google APIs like Calendar, Drive, etc...

However, pretty much every operation is slow. Displaying a simple form (containing a textbox and a button)? Takes a few seconds, because every single bit of code is sandboxed a thousand times (yes, I like security too, but not if it's slowing you down). Moreover, everything is overly complicated because they mostly reinvented the wheel in the first place (especially for UI).

One more thing that really turns me off of this is the Authorization screen:
The authorization screen for all Google Apps Scripts accessing sensitive data

Not only that it looks like a really bad phishing attack, I doubt that anyone actually reads the text (to be honest, I think I never made it past the bold text myself). No, I'm not able to customize this page in any way. (see update at the end of this post)

Borrowed from n8tip.com
Oh, and, like one of my professors always told us, to provide "good" feedback using the feedback-sandwich-method lastly one more thing that's awesome about Google Apps Script: the editor is really easy and intuitive to use (despite some minor quirks). Give it a try!

Keeping all these facts in mind, I wouldn't suggest you to use Google Apps Script if you're already familiar with things like Eclipse, Java, JavaScript, ... In case you aren't: go and give Apps Script a try! Even if you are familiar with the mentioned tools, you should give GAS a try. I mean, who the hell cares what I think, anyway? :D

Update: +Nikhil Singhal told me to use the recently introduced HTML service in order to build faster UIs. The problem is, that I've already been using it, but the time it takes to load the above mentioned form is still too long. Let's take a look at the HTML:

<html>
  <script>
    function onSuccess(result) {
      console.log(result);
     
      document.getElementById('result').innerText = result;
    }
  </script>
 
  <body>
    <form id='search'>
      <input type='text' name='address' />
      <input type='button' value='Search uss!'
      onclick='google.script.run.withSuccessHandler(onSuccess).processForm(this.parentNode)' />
    </form>
   
    <div id='result'>
    </div>
  </body>
</html>

That's it. So, how long does it take to load this "website" (of course, without the authorization process)?  10 seconds. Is it just me? Try it yourself here.

Moreover, Nikhil assured me that they're working to make the authorization screen "better/cleaner/simpler". I take you by your word! ;)