[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

[Yeoman] reblog – Install yeoman in Ubuntu 14.04

If you got the problem of installation yeoman in ubuntu 14, it’s better to read this blog:
http://zuperdev.blogspot.fr/2014/07/install-yo-yeoman-in-ubuntu-1404.html

By Andreas Vlachos :
In Ubuntu 14.04 (actually starting from 13.10) versions 0.10.x of nodejs are present in the official repositories. So in order to install nodejs package manager just type:

sudo apt-get install npm nodejs-legacy

npm alone is not sufficient to install Yeoman, since the latter depends on ‘node’ legacy binary during installation, hence nodejs-legacy package is also required.
Install global npm packages as a regular user.
npm installs packages under a ‘prefix’ configuration variable, which defaults to /usr/lib in Ubuntu 14.04. In order to avoid using sudo for every npm-install command, you may configure ‘prefix’ variable to point into a user local directory.

sudo npm set prefix '$HOME/[your_npm_directory]' --global

Verify that setting has been set using; defaults to /usr/lib

sudo npm get prefix

Update your $PATH variable to include the location npm installs binaries,

echo "export PATH=$PATH:$HOME/dev/npm/bin" >> $HOME/.profile

and restart your terminal session.
Install Yeoman :

npm install -g yo

as mentioned in the official site.
AngularJS scaffolding
Install angularJS generator

npm install -g generator-angular

Generate angularJS application

yo angular

Invoke grunt to build the application grunt serve (or python -m SimpleHTTPServer) to preview the application.

[ubuntu] Change OpenJDK/OpenJRE to SunJDK/SunJRE

Here is very good article about how to change OpenJDK/OpenJRE to SunJDK/SunJRE

I list several commands for me :

Installing Sun Java on Newer versions of Ubuntu (10.04 an above)
Open the terminal and type the following:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update   
sudo apt-get upgrade   
sudo apt-get install oracle-java7-installer

That should install the Sun Java version on your system. To change to it simply do the following in case you have other java alternatives:

sudo update-java-alternatives -s java-7-oracle