Tuesday, April 14, 2015

POODLE Attack!

Save a binary file using REQUEST module in Node the right way

I was trying to save some PDF from an output of a request, and I always got a corrupted file.

Initially I found that I saved my file as UTF-8 while it was ascii (took almost double), so I added the ASCII encoding to the file fs,fileWrite command, this helped a bit but still corrupted.

Eventually I read some more about the request module and identified that i was missing the "encoding: 'binary'" in the options!

This is the final code:

Monday, February 16, 2015

Running KIBANA 4 as a service on windows

Currently to run Kibana, you need to run .\bin\kibana.bat from command line. But I needed a more robust way that doesn't require me to do anything manually every time

There are many solutions on how to run a batch file as a service, such as "scheduled task" but in this case I decided to use a more "managed" way using NSSM

The process is very easy

  1. Just download NSSM from their site or like me use the chocolatery way ("choco install nssm")
  2. Install the service using "nssm install Kibana"
  3. In the GUI select the running folder as the bin folder and command line as the kibana.bat
  4. I chose the defaults
Simple tweak that does the trick till now

Wednesday, January 28, 2015

Facebook - getting user's friends - mission impossible

Assuming you application would like to get all the user's friends, so that you can send them message with a nice selection - you probably used FB.API('/user/friends') to get list of all friends

Above solution is great and will work ONLY for V1.0 of facebook, If you are using V2.0 and above the behavior was changed, and now it will return ONLY friends who logged into the application!

So you might be saying, no worries I will just continue using V1.0 API - Sorry the following constrains and terms applies:

  1. Application who were created after April/2014 MUST use v2.0+
  2. V1.0 API is deprecated and will be removed on April/2015 (so Enjoy your last few months)
Facebook is offering , invitable_friends API but this is ONLY allowed for application that are marked as GAME and include CANVAS (e.g. run under Facebook).
If you think of marking your app as Facebook and than in the website put script that will change location and kill the IFRAME - Don't, since this is yet another violation of term!

You can use taggable_friends API but you can only get names and pictures - and can ONLY TAG the friends and not do anything else with their ID, Additionally to be able to use this edge - FaceBook must review and approve your app :(

So as it seems you are stuck with share/write on user feed only!

Sunday, January 25, 2015

Google rejected simple ionic app and I just don't understand why ?

Why would google reject hybrid app which is pretty simple UI that shows list of video from a channel and than shows the video in embedded iframe ( all using the google API v3 and NO tweaks )

Google sent an email saying that:

REASON FOR REMOVAL: Violation of section 4.4 of the Developer Distribution Agreement.

After a regular review, we have determined that your app downloads, monetizes, or otherwise accesses YouTube videos in violation of the YouTube Terms of Service or YouTube API Terms of Service. Accessing content, a product, or service in an unauthorized manner is a violation of the Developer Distribution Agreement, and is not allowed on Google Play.

Even trying to appeal got reply that the review has the same results without clearly providing what actually wrong ...

The app is VERY simple and is using API key to get channel content, so I don't really understand what's wrong ( it is authenticated but without client user )...

Anyone can provide me some more info ?

Monday, December 29, 2014

angular-google-api-wrapper - My first contribution to the community :)

Today is a very exciting day, I contributed my first project to the community of AngularJS :)
I created angular-google-api-wrapper to help the task of consumption of Google Client API.

I must say, that I expected this library to have default adapter for Angular since it was created by Google, but till than feel free to use and enhance.

This is a very first version (0.0.1) and I am going to update it soon with:

  1. Unit testing
  2. Support for authentication (currently only public API is supported)
Would love to get feedback

Sunday, December 28, 2014

Twitter and the crazy limit on API calls

First time I developed a code that integrate with twitter API, was OK but I was surprised to see that the limit on the API calls when using app authentication ( e.g. don't force end user to login to twitter ) is crazy low !

For example of I make a mobile app that allows you to see the timeline of a user and use my app to authenticate , I get 300 calls per 15 min limit

Now let's assume that my app was downloaded 20k times , the risk of reaching the limit is 100%

Which means that I have to switch to user authentication and force my users to login , while there is benefit, this is still annoying

Check limits here

Saturday, December 27, 2014

Will Surface pro 3 be accepted by open source developers?

I bought surface pro 3 i5 few months back, and currently I use it for everything. Its a very good device ( other than heating issues which are related to software issues ) .
I am running windows 8.1 ( nice but not more than that), Ubuntu on virtual box ( like it but not 100% optimized so a bit slow)

On every YouTube video or conference that include new startups or open source developers + DevOPs you never see anyone using surface but actually majority of them use Mac

Why is that ?

Maybe now that .net is going open source, things will change ....

Writing HTML faster

Everyone that knows me, knows that I am constantly trying to reduce the coding time, well now I found a cool plugin called Emmet which allows me to write a quick CSS like syntax and by pressing TAB, it will automatically generate the HTML that correspond to it

So by writing the following: #header>h1.header_1{Main page}+ul#MyList>(li.myItem>a{item $})*10
Will produce:
<div id="header">
<h1 class="header_1">Main page</h1>
<ul id="MyList">
<li class="myItem"><a href="">item 1</a></li>
<li class="myItem"><a href="">item 2</a></li>
<li class="myItem"><a href="">item 3</a></li>
<li class="myItem"><a href="">item 4</a></li>
<li class="myItem"><a href="">item 5</a></li>
<li class="myItem"><a href="">item 6</a></li>
<li class="myItem"><a href="">item 7</a></li>
<li class="myItem"><a href="">item 8</a></li>
<li class="myItem"><a href="">item 9</a></li>
<li class="myItem"><a href="">item 10</a></li>

The syntax is easy to learn and require few minutes, and it return the invest during the first day

This plugin exist for majority of the editor including brackets (which I currently use)