G:\PleskVhosts\stockarbiter.com\httpdocs\karimkameka/wp-content/themes/naya-lite/lib/css/custom-css.css is not writeable.
Copy the generated css from the text area below and paste it in the file above.

Category: AzureMobile

Mobile Services vs. Al a Carte Services

The other day I was chatting with my colleague Nick Pinheiro about possible architectures of mobile solutions with Azure.  As you may or may not know Windows Azure is the Microsoft Cloud.  They provide a bevy of services from Website hosting to API creation, data storage, machine learning and much more.  Nick and I are in the process of building separate mobile applications and we often spit-ball ideas about the architecture of our applications and how we handle certain scenarios as they come up with our applications.   to set the basis of what we have been discussing, Nick’s application started off as a web application (actually, it’s a Facebook app in which Nick  was honored as having one of the top Facebook apps on the planet!).  He is now in the process of making his app a native mobile application.  My application comes from the perspective of building a brand new Azure Mobile Services application.   Both approaches have their own unique pros and cons.   So this lead us to wonder what might be the pros and cons of using Windows Azure Mobile Services vs. building a mobile application using the individual (A la Carte) services offered by Windows Azure.  So that is what we will be discussing in this post.


Submitting a Search by Pressing Enter with #AngularJS

Well I am well on my next chapter of AngularJS for my Stock application (Mogul Match Stocks) which follows the tenets of Rule #1, by Phil Town which I mentioned in my earlier post. BTW just to share a quick win with you, Rule #1 told be to buy Twitter before the huge run up on last Friday,  I was up 20% as of this writing!  Anyway back to the point of this piece.  In building the application I  was in need of a search function which would allow my users to search for a stock by typing in the first few letters of the company name or the first few letters of the ticker symbol.  In the design of site, as you can see in the screenshot below, I was in need of a search box in a few places.  AngularJS handles this scenario really well with directives!  After building out by site with the search boxes as I wanted I began to test.  During my testing of the solution I found my self hitting the enter key when I was done entering the letters for my query.  Of course, I had not told the form to submit for the search box  but only to submit when the little search icon was clicked.  This became annoying and I figured that I would implement as my users might want to do the same.



Creating an Instagram Subscription API with Azure Mobile Services

Windows Azure Mobile Services has been an exciting tool I’ve been using to develop my mobile applications.  One of the key things when building several kinds of mobile applications is integration with several of the big social networks.  Instagram becoming the way to share photos was one of those integration points I needed in my application.  Instagram provides  a “real-time” API service which uses the PubSubHub model,  details about the real-time API can be found on Instagram’s developer site.

My application required the need to have images from Instagram show up in a user’s feed as it was available.  At first I thought about just polling the Instagram feed’s using a Scheduled job (which is a part of the mobile service) however this solution did not scale well due to the limited number of SQL Azure connections in the service.  This lead me to the real-time API to have Instagram tell me when to update my application.  As a part of this I also wanted the user’s to have the ability to specify the tag for which they would like to follow, as well as the username (in many cases their own) they would like to follow as well.  Given these requirements I needed a generic enough API which would allow my application to subscribe to these objects in Instagram and then have them populate in my application by storing in a table.

So enough background let’s get to the code.


Integrate #Google #AdSense with an #AngularJS Web Site

I am currently learning AngularJS by building a web version of an old Stock picking application I previously published on Android and Windows Phone by the name of Stock Arbiter. The web version will have all the great features and follow the principles taught to me by Phil Town in his Best Selling book “Rule #1″ Disclaimer: I am not affiliated with Phil Town or Rule #1 in any way!. The idea of the application is to do much of the homework of finding a good stock for the end-user. The application will be updated and available on all major mobile platforms soon as well as the web!

Back to the topic of this post, in building the web application, I was in need of a revenue stream and figured Google’s AdSense was a good choice. However, I tried just inserting the Google AdSense code to my main Index page as instructed, however the ads were not coming through. After a little research I became obvious that the AngularJS framework was not processing the calls the Google AdSense API. Turns out I had to make this an AngularJS directive. So I figured I would share the steps to create this AngularJS directive with you:


Sending a File Attachment using SendGrid

I was looking to automate the process of downloading an Excel Spreadsheet from a web site and then sending that spreadsheet to one of my many inboxes. This process needed to run hourly. I have also been learning all I can about Windows Azure Mobile Services (WAMS) provided by Azure which come “free”! (I like free, especially when I am learning and dabbling, but especially when I have some real code to get out). Anyway, given my new found knowledge for WAMS and the SendGrid service which is an add on to Azure I thought maybe I could automate this process quickly and freely. So begins my journey. As a part of the AMS service there is a scheduler service, given I need this hourly this is the natural choice.

In developing the script and my newbie status to node.js, I was at a loss for how to get the file. In my case the file was hosted on a third-party web site with a VERY accessible URL Smile. I just wanted to download the file and attach it to my email. Enter SendGrid, SendGrid is a powerful email service which provides a RESTful email API allowing me to send emails from the cloud without having to worry about having an SMTP server at the ready! Awesome since I don’t have an SMTP server hanging around! So begins the adventure.

I look up the sample from the Windows Azure documentation and for a basic send it works great however, in looking up the SendGrid API it turns out there is an “Email” object which will provide me more control over what is sent and the ability to add attachments. One of which methods allows me to set the URL for which the attachment resides and SendGrid takes care of all the leg work regarding downloading the file and attaching it to the email! (AWESOME!!)

Below is what I ended up with after fighting through some syntax errors! All in all this now works to a T and I get my hourly emails for processing like clockwork!

I even used (yet another “free” service) Send to DropBox to send the file to my dropbox account for easy filing!


var sg = require('sendgrid'); 

function myjob_hourly() { 
var theUrl = ""; 
var theemail = ""; 
var currentDate = new Date(); 
var subject = ""; 

var sendgrid = new sg.SendGrid('username', 'password'); 
var email = new sg.Email ({ 
to: theemail, 
from: theemail, 
subject: subject, 
text: '' 
email.addFile({filename: "myfile.xlsx", 
sendgrid.send(email, function(success, message) { 
if (!success) {