[svn] svn works with proxy in ubuntu

Background : svn checkout project under ubuntu using proxy

With natif configuration of svn (which is installed by apt-get), svn checkout return an error :


svn co --username your_username https://your_svn_url/
svn: OPTIONS of 'your_svn_url': Could not resolve hostname ... : Host not found

The solution is to add proxy to the defaut configuration of svn.

Edit : ~/.subversion/servers by adding :

http-proxy-host = your_proxy_host
http-proxy-port = your_proxy_port (3128 or 8080 etc)
http-proxy-username = your_proxy_username
http-proxy-password = your_proxy_password

 

 

 

[JS Practice] execute multiple functions successively on a value

Title :

Execute multiple functions successively on a value

Description:

Write a generic function chainer that takes a starting value, and an array of functions to execute on it. Return the final value after execution is complete.

Example

function add(num) { 
   return num + 1 
} 

function mult(num) { 
   return num * 30 
} 

chain(2, [add, mult]); // returns 90;

Continue reading

[AngularJS] Solution for Main page not display

Background : Angularjs application (angularjs version 1.3.15)
Problem : main page display nothing

Demo code (with a small small error but serious):

In app.js

angular.module('myApp', [
  'ngCookies',
  'ngResource',
  'ngSanitize',
  'ngRoute'
])
  .config(function($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });
  });

In main.js

console.log('Before main controller');
var app = angular.module('myApp', []);
app.controller('MainCtrl', function ($scope) {
    console.log('In main controller');
});
console.log('After main controller');

In my console, it displays only :

Before main controller
After main controller

What’s wrong ??
Continue reading

[AngularJS] solution for jsonp not working

I got to try a http jsonp call an external url in AngularJS :

$http.jsonp('http://localhost/myJsonfile?callback=JSON_CALLBACK')
    .success(function(data){
       console.log('success');
    })
    .error(function () {
      console.log('error')
    });

Using jsonp and adding the “callback=JSON_CALLBACK” to the end of the url allows me to call an external url.
NB. Calling an external url by $http.get will return an “Cross-Origin Request Blocked” error.

My json file in /var/www is like this (only for test):

[{"id": "1"},
 {"id": "2"},
 {"id": "3"}
]

But the call always return an error :(
Continue reading