October 03 2017

Javascript display money format

Tagged Under :

javascript
Sometimes we need using javascript to display money format in our system but javascript don’t have this kind of function. So we need to write a function to convert number to money format.

October 02 2017

Javascript get compass direction with the two longitude and latitude

Tagged Under : ,

ionic
Just develop a project with IONIC and google map to tracking the transport routing. Because the google map wouldn’t rotate itself when the transport moving. It will confuse the user when they look at the map.

So I need to rotate the map to let navigation always facing to top. It will easy user to understand when they look at the map.

July 18 2017

Yii2 set wraptext on moonlandsoft phpexcel

On phpexcel you are allow to set “setWrapText(true)” property. but on Yii2 plugin moonlandsoft phpexcel it don’t have this property.

To set this property. you need to add extra code on the plugin.
Open Excel.php file. and then scroll to line 387 add the code below.
if (isset($column['wraptext']) &&  $column['wraptext'] == true) {
	$activeSheet->getStyle($col.$row)->getAlignment()->setWrapText(true);
}

March 26 2017

Jquery set focus on last character in input text box

Tagged Under :

javascript
Normally using Jquery or Javascript to set focus on input box it will point to beginning of the text box. But if you want it point to last character in input text box. you may need write a Jquery class to do.

Below is the Jquery function:
(function($){
    $.fn.focusTextToEnd = function(){
        this.focus();
        var $thisVal = this.val();
        this.val('').val($thisVal);
        return this;
    }
}(jQuery));

You may easy to use the function like below
$("#input").focusTextToEnd();

January 04 2017

Cron with wget always created an empty file on server

Tagged Under :

Linux
I am trying to write a cron task to call wget on a url. The cron runs fine, but every time it runs it will creates a cron.php.X file in my home directory. I’ve tried to turn off output using the –quiet option but it’s still outputting a new file with every running.