Easy Way to Install Nodejs on Ubuntu 16.04(Useful!!!!)

There are many methods to install on Ubuntu, such as NVM, n, PPA, complie, But if just want to install specific version, it would be easily. Just do as follow.

Read More

Make Koala Works on Ubuntu

Koala is my favorite GUI tools to complie sass and less file, when I switch the OS from Windows 7 to Ubuntu, it not works again. Why?

First of all, I thought it's Ruby's error, maybe there is no Ruby in my system, and run the command:

ruby --version

it outputs

ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

so it's not Ruby's fault, and then google it I find the solution

32bit:

$ cd /lib/i386-linux-gnu/ or $cd /usr/lib/

64bit:

$ cd /lib/x86_64-linux-gnu/ or $cd /usr/lib64/

run the command

sudo ln -s libudev.so.1 libudev.so.0

it works :-)

VimWordpress - A New Plugin For Vim to Write Wordpress and Typecho

VimWordpress is new Plugin for using vim to write blog, it's simple and powerful.

Read More

CSS3 first-child not work

For some reason, I tried to use CSS3 selector :first-child, but it not works in my project.

Read More

Date.parse() method not work in IOS

Maybe it's a big bug that I had experienced recently, when I use JavaScript method Date.parse('2016-10-24 18:36'), two different outputs in Android and IOS. In Android it output the right timestamp which i need, but in IOS, it can not get the timestamp.

Read More

Inject jQuery into Any Webpage

Even MVVM framework is more and more popular in the web front developments, but the strength of jQuery cannot be replaceable. Sometimes, we need the jQuery's useful APIs to achieve some complex actions, but many webpages give up jQuery, so some skills is needed to inject the jQuery into the webpages which had abandon the jQuery library.

Read More

ES6 Tips in Chrome (2016-08-08)

Nowadays ES6 is more and more popular in front end development, so I plan to learn and practice it via Chrome browser. Why is Chrome? Because it can support most of ES6 features(Nearly 97% until 2016-08-08), but I also find a few method that it can't support.

  1. .at() method
  2. .padStart() method
  3. .padEnd() method
  4. .values() method

If I find other features not support in Chrome, I would write it here again.

PHP Cross-domain Setting

In the previous article 《jQuery $.ajax Method Ignored the Undefined Values》, I send a request to the server's php file, maybe you would get a cross-domain error.

XMLHttpRequest cannot load http://127.0.0.1/jq-undefined.php?para1=1&para2=2. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Read More

jQuery $.ajax Method Ignored the Undefined Values

Recently, I used jQuery to get the data from the server client via $.ajax method. As we known that, we should send the request with some parameters. The code as follow.

$(document).ready(function(){
  $.ajax({
    url:'http://127.0.0.1/jq-undefined.php',
    data:{
      para1 : 1,
      para2 : 2,
      para3 : undefined
    },
    success:function(data){
      alert(data);
    },
  });  
});

According to Chrome DevTools, I get the result:

Yep, jQuery is smart, it can ignore the undefined values and avoid a lot of server errors. If you must send a undefined value, you can write like this

$(document).ready(function(){
  $.ajax({
    url:'http://127.0.0.1/jq-undefined.php?para3=undefined',
    data:{
      para1 : 1,
      para2 : 2
    },
    success:function(data){
      alert(data);
    },
  });  
});
sitemap