[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', [
  .config(function($routeProvider) {
      .when('/', {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl'
        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 :

    .error(function () {

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:

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  

[ubuntu] WARNING gnome-keyring in lubuntu

If you have met the same problem, this maybe help.

Background :

I installed phpunit in my ubuntu 12.04(the os is lubuntu), the installation passed quite well, but when I launch the command in termianl, I got always this warning :

$ phpunit --version
WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-xAGrk8/pkcs11: No such file or directory
PHPUnit 4.4.5 by Sebastian Bergmann.

Continue reading

[Install PHPUnit] Installing PEAR and PHPUnit on WAMP and Windows 7 (no longer maintained from PHPUnit 3.7)

First of all, thanks to @Sebastian Bergmann for reminding and sorry for my careless about this reblog because End of Life for PEAR Installation Method to PHPUnit from github and The package PHPUnit is not maintained anymore and has been superseded. Package has moved to channel pear.phpunit.de, package PHPUnit from pear.php.net.

So this blog should be a reblog of installing PHPUnit(<3.7) in Windows7 from http://thecancerus.com/ and I found it was still useful for understanding the theory of configuration of php(in wamp) and the environment variables.

The newest manual installation of PHPUnit in windows can be found its documentation.

Continue reading