Best place to bootstrap a startup

The university

Where I live every couple of weeks a new entrepreneurship hub is opening its gates, promising a quiet place, free wifi, free coffee and best of all a place where you’ll keep your creative juices flowing, hey, after all being in an environment that drives innovation forward got to be a good place.

But as we all know for startups everything comes down to money (sorry, that’s the harsh reality), these places cost couple of bucks that can be spent wisely in different places (pizza for example), so the university sounds like a perfect place… it’s free.

I know, I know, many would prefer to be ran over by a bus then to go back to the university, but it’s a simple common sense, you have free wifi (in most universities where I live), cheap coffee and food (after all these are students, probably in worse condition than me) , white boards, desks and above all the wonderful feeling of innovations and cutting edge that universities has.

So why not ?


Leave a comment

Filed under Uncategorized

Using any Java paas solution for the time being locks you down

After reading this paas comparison and some others about various paas solutions currently on the market I want to clarify an important point regarding portability of AWS based applications (CloudBees and Beanstalk).

If your application uses a standard rational database and a standard ec2 instance then you are fine and your application is probably highly portable, however the moment you want to use features like nosql, blob/static storage and messaging then you have to use proprietary api.

  • CloudBees in case of nosql DB has support for MongoDB and couchDB via external support, however Beanstalk has a proprietary nosql db called simpleDB.
  • In case of static storage both platforms support S3 which has its own api.
  • and in case of messaging you have sqs which again has its own api.

Any java paas solution today locks you down somehow, I do agree that the lack of full Java EE/SE stack on app engine is worse than the above mentioned, but it’s important to remember that all paas solutions require some kind of proprietary api.

1 Comment

Filed under Uncategorized

Android SDK under command line environment

I have a dedicated server as a build machine running Ubuntu server edition. I want to run my Android builds and for doing that I need the android SDK.

As you all know in order to download the various packages you need GUI interface, so how do you install them if you use CLI only.

Do the following:

  1.  Download the android SDK from
  2. tar xvzf <tgz file>
  3. Add to your path …/<android_dir>/tools
  4. run ‘android update sdk -u’ and everything will be downloaded to your computer.

Leave a comment

Filed under Building

Using atom feed to read mails in Gmail

I wanted to read my emails from Gmail using an atom feed. Gmail supports it, for the entire procedure you are welcomed to read however one thing that is missing from the explanation is the final part, i.e. how do I fetch using the access code that I just received.

At the beginning I tried to append ?access_token=YOUR_ACCESS_TOKEN to my oauth address ( in our case), it didn’t work, I always got 401 access denied.

Guess what, Gmail only supports  the Authorization: Bearer <access_token> header  so your request should be something like

GET /m8/feeds/contacts/default/full HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN

Hope it will save you some frustration.


Filed under API

Real time Facebook notification from app engine

It’s hard  to find a good example for Facebook authentication on app engine using java.

I’ll try to do the following:

  1. Explain the general flow for achieving  Real time notification on app engine.
  2. Show some code snippets for implementing the above flow.

General Flow + Code

Step 1

Use the callback mechanism of Facebook to start the authentication process.<client_id&gt; &display=touch&scope=offline_access,read_stream&redirect_uri=<callback_url>

I’m calling to this URL from a mobile app,therefore I use display=touch, in addition pay attention that I’m asking from the user to grant me offline access, I’m assuming that I’ll update the user long after the authentication token will expire.

Step 2

I’ve prepared a callback get method on my app engine. Facebook calls my callback url passing to it a code. The code means the user granted me permissions.

Map<String, String[]> parameters = req.getParameterMap();
if (parameters.containsKey("code")) {
facebookAuthCode = ... // Get 'code' value

Pay attention that the code is not the access token (which is the holly grail), the access token will allow us to act on behalf of the user.

You need to call another url with the code you extracted, the response will be the access token.

String facebookAuthUrl = String.format("",
							Constants.FACEBOOK_APP_CODE, reconstructedURL,
							Constants.FACEBOOK_APP_SECRET, facebookAuthCode);
URL localUrl = new URL(facebookAuthUrl);
URLConnection conn = localUrl.openConnection();
BufferedReader rd = null;
try {
	// Get the response
	rd = new BufferedReader(
	new InputStreamReader(conn.getInputStream()));

The easiest way to build a valid callback url is to use the request object.

URL baseURL = new URL(req.getScheme(), req.getServerName(),req.getRequestURI());

Now we register for real time notification.

Step 3

We need to post our data to Facebook with the appropriate parameters. They should include:

  • object – To which object in the social graph we want to listen to.
  • fields – Special fields that make up the object.
  • callback_url – Call this URL with post. In our case it is baseURL we used above.
  • verify_token – A token that will be sent back during hub mode.
  • access_token – built from facebook_app_code|facebook_app_secret . You should get these two values from your Facebook account. Pay attention to ‘|’.
// Use String builder instead of just regular string.
String data = URLEncoder.encode("object", "UTF-8") + "="
				+ URLEncoder.encode("user", "UTF-8");
data += "&" + URLEncoder.encode("fields", "UTF-8") + "="
				+ URLEncoder.encode("home", "UTF-8");
// Send real time updates to this URL.
data += "&" + URLEncoder.encode("callback_url", "UTF-8") + "="
				+ URLEncoder.encode(reconstructedURL.toString(), "UTF-8");
// A token used to verify that it is actually me who is running the
// verification process.
data += "&" + URLEncoder.encode("verify_token", "UTF-8") + "="
				+ URLEncoder.encode(Constants.FACEBOOK_VERIFY_TOKEN, "UTF-8");
data += "&" + URLEncoder.encode("access_token", "UTF-8") + "="
				+ Constants.FACEBOOK_APP_CODE + "|"
				+ Constants.FACEBOOK_APP_SECRET;
// Subscribe by doing a post.
URL url = new URL(String.format(
				Constants.FACEBOOK_APP_CODE, accessToken));

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());


Almost done here the final stage is the hub mode.

Step 4

Facebook is using hub mode to do a final verification of the process. You will receive back a verification token that you sent during your registration process (step 3), you will have to make sure it is equal to what you sent and then response with a challenge string that Facebook sent.

String verifyToken = (String) parameters.get("hub.verify_token")[0];
if (verifyToken.equals(Constants.FACEBOOK_VERIFY_TOKEN)) {"hub.mode test is valid");

That’s it you are done you are now registered.


Filed under Uncategorized

Make your app social

Using a neat little feature you can make your app social using 5 lines of code.

The idea is to launch an intent of type ACTION_SEND which will pop up an Android dialog box for sharing. Every activity that binds itself to this activity will be displayed. Usually activities that have sharing capabilities (like Linkedin, Twitter and Facebook) will show up in that list.

Share using SEND_TO

Use the following code:

Intent intent=new Intent(android.content.Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");

intent.putExtra(Intent.EXTRA_TEXT, "Description");
activity.startActivity(Intent.createChooser(intent, "Dialog caption"));

Ain’t that simple ?

In case you want specific activities to handle your request then make sure to change the type, usually most social apps will listen to text/plain.

Leave a comment

Filed under API

Live from google extended event TLV

Started gathering here Google fanatics at around 19:00. Look at these beautiful capcakes.

image image

The chrome os laptop was announced, it will be a great solution for corporate users, mom and dad that just need web connectivity. It will be priceless for healthcare users that already use a lot of web like apps.

Say cheese extended participants. Waiting for Android session


To sum it up, it was a really fun extended event (my first time), pizza and bear made my day. See you next time.

Leave a comment

Filed under Uncategorized