Monday, December 1, 2014

Auth0: Configuring facebook error : Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

Configuring the auth0 - facebook access I was getting this error:

"Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains."     

I solved that issue going to the Facebook App page, click "edit App" then click "Advanced" in the left-hand navigation. Then for "Valid OAuth redirect URIs" add the auth0 app domain ie: (jhonapp.auth0.com).

Resources:
http://stackoverflow.com/questions/20910576/how-can-i-add-localhost3000-to-facebook-app-for-development   

Monday, November 24, 2014

Nearpy - Scypy installation error on Mac OS: library dfftpack has Fortran sources but no Fortran compiler found

Run the following commands:

1. install homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


2. Install GCC: GNU Fortran is now provided as part of GCC, and can be installed with: brew install gcc.

brew install gcc

That's it, now try to install Scypy again, everything should work smoothly.

Resources:
http://stackoverflow.com/questions/14821297/scipy-build-install-mac-osx
http://penandpants.com/2012/03/01/install-python-2/

Wednesday, November 12, 2014

Angularjs update migration : getting function parameters from template

Using angular 1.2.0-rc.3 with this code

// html 
...
<div ng-repeat="row in rowdata">
   <a ng-click="getDetailedListing('{{row._id.$oid}}');">Details</a>
</div>
...

//angular js controller
$scope.getDetailedListing = function(listingId) {
        console.log(listingId);
}

When the user clicks the 'a' element, in the console is printed the listingId ie. 54613ed26fb36f26e5ab41a8

But when we upgrade the angular version to 1.2.26, the same code printed {{row._id.$oid}} instead of the listing id. So the fix was changing the a element a little bit:

<a href="javascript:;" ng-init="listingId=row._id.$oid" ng-click="getDetailedListing(listingId);" >Details</a>

Reference
http://stackoverflow.com/questions/18694827/calling-a-scope-function-from-an-ng-include-template-passing-template-value-as-p

Pycharm: exit code 69 trying to run git command

I was getting the error:

exit code of #69 Additional error details: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

I solved it by installing Xcode, running it, accept the user agreement, let it install everything and reload Pycharm.

Source:
http://nielsvanrongen.com/bower-exit-code-of-69/

Sunday, October 19, 2014

python - PIP : ImportError: cannot import name IncompleteRead

I got the error:

ImportError: cannot import name IncompleteRead

The solution was reinstalling pip:

sudo easy_install freeze
sudo apt-get remove python-pip
sudo apt-get autoremove
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py --no-check-certificate
sudo python get-pip.py

Resource:

http://suanfazu.com/discussion/140/pip-install-importerror-cannot-import-name-incompleteread/p1

Angular js: re render directive dinamycally

Here is a great and simple example of how is done:

http://jsfiddle.net/7Waxv/2/

Tuesday, October 7, 2014

Share data among controllers

Use $ rootScope

var app = angular.module('mymodule',[]);
app.controller('Ctrl1', ['$scope','$rootScope',
  function($scope, $rootScope) {
    $rootScope.showBanner = true;
}]);

app.controller('Ctrl2', ['$scope','$rootScope',
  function($scope, $rootScope) {
    $rootScope.showBanner = false;
}]);

Source:
http://stackoverflow.com/questions/20181323/passing-data-between-controllers-in-angular-js



Monday, September 29, 2014

Python nested classes json encoder


Json pickle will do the trick : http://jsonpickle.github.io/

## import lib
import jsonpickle

## create class
class Thing(object):
    def __init__(self, name):
        self.name = name

## create class instance
obj = Thing('Awesome')

## from obj to json string
frozen = jsonpickle.encode(obj)

## from json string to obj
thawed = jsonpickle.decode(frozen)

Thursday, August 21, 2014

Goddady wildcard subdomain url call handling

If I type in the browser www.jhonjairoroa87.com, the blog is shown. But when I type test.jhonjairoroa87.com, there was no page loaded. So iI wabnted to enable the routing from anysubdomain.jhonjairoroa.com to this blog.

So, the solution was:

Go to GoDaddy's DNS Manager, the first table on top should say A(Host), click the button under that first table that says Quick Add. In the first text field, enter an asterisk (*), in the second one, the IP address to redirect to (the same one you have for the @ record on top). Click "Save Zone File" on top-right and confirm.

This creates a catch-all record to anysub.yourdomain.com.

Reference: 

Friday, August 1, 2014

RequireJS: Uncaught Error: Module name "underscore" has not been loaded yet for context: _. Use require([])

I was getting the error

Uncaught Error: Module name "underscore" has not been loaded yet for context: _. Use require([])

Solved it adding the shim values in the require js config:

require.config({
    paths:{
        jquery:'jquery/jquery-min',
        underscore:'underscore/underscore-min',
        backbone:'backbone/backbone-min'
    }, 
    // here
    shim: {
        underscore: {
            exports: '_'
        },
        backbone: {
            deps: ["underscore", "jquery"],
            exports: "Backbone"
        },
        waitSeconds: 15
    }
});

Source: http://stackoverflow.com/questions/16774214/trouble-combining-require-js-and-backbone-js-underscore-js

Tuesday, July 15, 2014

.Net ReportViewer datetime format problem am/pm

I was having troubles formating a datetime parameter with am/pm. No matter the formatting, it was always missing the am/pm .

 - The expression was Parameters!initDate.Value and I got 2014/01/07 12:00:00
I also tried
 -Format(Parameters!initDate.Value,"yyyy/MM/dd hh:mm:ss tt") and I got 2014/01/07 12:00:00

and so on....

So I decided to use an if to evaluate the hour and manually set the am/pm:

=Format(Parameters!initDate.Value,"yyyy/MM/dd hh:mm:ss ") + IIf(Parameters!initDate.Value.Hour > 11, "pm", "am")

Tuesday, June 10, 2014

Python: install pip and Flask on windows 8

Install pip:

> python get-pip.py

Install Flask:

> python -m pip install Flask

Resource:
http://pip.readthedocs.org/en/latest/installing.html


Wednesday, May 28, 2014

PHP: NotORM tutorial

fatfree: error routing about in tutorial

following this tutorial : http://fatfreeframework.com/routing-engine, after adding

$f3->route('GET /about','WebPage->display');

the url localhost/myproject/ works fine, but localhost/myproject/about doesnt work.

To solve the problem, follow these steps:

1. create a file name .htaccess with the following content:

# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]

# Disable ETags
<IfModule mod_headers.c>
Header Unset ETag
FileETag none
</IfModule>

# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A604800
</IfModule>

2. put the .htaccess file in the root of wour project, ie {apacheserverdir}\htdocs\pyproject\.htaccess

The error happens because is missing the .htaccess file in the right place:

\htdocs\myproject
\htdocs\myproject\.htaccess -- add htaccess file here
\htdocs\myproject\index.php
\htdocs\myproject\libs
\htdocs\myproject\libs\fatfree-master
......
\htdocs\myproject\libs\fatfree-master\.htaccess -- here is a htaccess file that is not used at all
......
\htdocs\myproject\libs\fatfree-master\lib
\htdocs\myproject\libs\fatfree-master\lib\audit.php
\htdocs\myproject\libs\fatfree-master\lib\auth.php
\htdocs\myproject\libs\fatfree-master\lib\base.php
......
......
.....

Resource:
https://github.com/bcosca/fatfree/blob/archive/f3-2.1.0-blog.example.zip

Tuesday, May 27, 2014

Java: Convert octal into Decimal number

Here is a simple and elegant way to convert an octal number to the decimal numeric system:

http://www.mycoding.net/2011/03/java-program-to-to-convert-octal-number-into-decimal-number/

Java: convert from decimal to octal

Here is a simple and elegant way to convert a decimal number to the octal numeric system:

http://www.javaforschool.com/332702-program-on-decimal-to-octal-number-conversion/

MySQL Top (N) By Group

Here is a great link what explains how to get top N elements by group in MySQL :  http://www.erikhaselhofer.com/?p=1793

Friday, May 2, 2014

Mysql Replication: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

if you get this error:

Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

Go to the installlation/source folder of mysql and change the guid in the file ./data/auto.cnf. Generate another guid with http://www.famkruithof.net/uuid/uuidgen, copy the generated guid and replace the existing guid:

from:

[auto]
server-uuid=e80f7b10-d242-11e3-9c1a-0800200c9a66

to:

[auto]
server-uuid=839567f0-d245-11e3-9c1a-0800200c9a66

Resource:
http://planet.mysql.com/entry/?id=103096







Friday, February 21, 2014

C# : RestSharp Send Javascript Complex Object

Use

var yourobject = new MyObject{.....................};
var json = JsonConvert.SerializeObject(yourobject);
var client = new RestClient(url);
var request = new RestRequest(actionPath, Method.POST);
request .AddParameter("application/json; charset=utf-8", json, ParameterType.RequestBody);
request .RequestFormat = DataFormat.Json;

Source:
https://github.com/restsharp/RestSharp/issues/435

Tuesday, February 4, 2014