Sunday, December 20, 2015

Microsoft Family Windows 10 Parental Controls Screen time not working and swtich to Norton family

I have windows 8,  later upgraded to  Windows 10. Parental Controls Screen time is not working anymore after upgrading. First screen time does not show correctly.  My hourly rule and block all days are not working.  I checked the solution by google.   was told that On the Start screen, right click and the find run and click, and  type C:\ProgramData\Microsoft\Windows\Parental Controls and press Enter. 
 Delete all contents of the Parental Controls folder.  "
This will delete any corrupt files. Your settings will be downloaded again from the next time you sign in."
I did find settings.bin, but inside almost empty, only "{}".

I think there is a problem in Microsoft family Windows 10 parental control. Finally I switched to Norton Family.  Norton Family has  same feature Microsoft family has, but has more, although I need to pay small money each year.

Norton family premier link:

There is 30 days free trial. I am quite satisfied Norton family during trial.

Sunday, June 21, 2015

Set up a child account and set screen time limit in Windows 8

1) To set up a child account in Windows 8:
a) Click start menu and click control panel
b) Click User Account, click manage another account
c) Add a new account
d) Click add a child account with email or with email account
e) Click mange family safety online or directly go to your Microsoft account online

2)Set screen time limit for child account under parental control
a) Go to your microsoft account
b)click family and click screen time and select maximum time per day your child can use computer.
you can also choose which kind of websites, apps and games your child can access.
Video: Set up a child account and set screen time limit in Windows 8

Wednesday, June 10, 2015

MySQL data type timestamp auto-initialized and auto-updated

When we set MySQL data type timestamp, the default is auto-initialized. It is set to the current timestamp for inserted rows. This can be used in a column such as creation date. In PHPMyAdmin,
the attribute is empty.

When we set the attributes "on update current_timestamp" and type 'timestamp' in PHPMyAdmin,  the column is auto-updated. It is automatically updated to the current timestamp when the value of any other column in the row is changed from its current value. The column remains unchanged if all other columns are set to their current values. This can be used in a column such as modification date.

ALTER TABLE `max_term_default_ttr_lut` ADD `CreateDate` TIMESTAMP NULL DEFAULT NULL ,

Parse JSON in JavaScript

In PHP, I used
        $message['success'] = "Personal Information Updated";
        echo json_encode($message);

to pass $message to Javascript .post
    $.post('stakeholderInfo.php', $(".box#stakeholderInfo div #editInfoForm").serialize(), function(jsonMessage) {       
                            obj = JSON.parse(jsonMessage);

 Here I used JSON.parse to  parse JSON in JavaScript, then display message   alert(obj['success']);

Monday, June 8, 2015

phpexcel toggle expand and hide column in EXCEL and summary

 PHP has built-in feature to read and write CSV files. PHPExcel extends this feature and allow you to write to and read from different spreadsheet file formats, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's OpenXML standard and PHP.

PHPExcel can be downloaded from:

To start PHPExcel, PHPExcel library path should be included first, for example installed in _classes
                 include_once "./_classes/PHPExcel.php";
                include_once './_classes/PHPExcel/Writer/Excel2007.php';

                $objPHPExcel = new PHPExcel();

                //choose the first page
                $objSheet = $objPHPExcel->getActiveSheet();

Toggle expand and hide columns A to C default expand:
                foreach (range('A','C') as $column) {

Toggle expand and hide columns A to C default hide:
                foreach (range('A','C') as $column) {


Toggle expand and hide row 1

 Set autosize
                foreach (range('A','Z') as $column) {

Set font size
Set font bold
Set column A1 header  value
              $objSheet->SetCellValue('A1', 'faculty');
Set cell column 1 row 2 value '4'
   $objSheet->setCellValueByColumnAndRow(1, 2, '2');
Set number 1 as 0001 instead of 1
Set alignment left

Set column width
Set cell background color lightgreen
         'fill' => array(
            'type' => PHPExcel_Style_Fill::FILL_SOLID,
            'color' => array('rgb' => 'C3FDB8')

Set  line break using double quote to parse \n in PHP
    $objSheet->SetCellValue('N1', "Instr\n contact \n hrs");
Write out EXCEL file
            header("Pragma: public");
            header("Expires: 0");
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            header("Content-Type: application/force-download");
            header("Content-Type: application/octet-stream");
            //the folowing two lines make sure it is saved as a xls file
             header('Content-type: application/');
                //set the course offered id as page name
              $filename = " Export_".date("Ymd").".xls";
              header('Content-Disposition: attachment; filename= "'.$filename.'"');
             header("Content-Transfer-Encoding: binary");
              $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');

Sunday, May 31, 2015

jQuery autocomplete in PHP and force to pickup

jQuery autocomplete introduction 

 My example: autocomplete data from php
Input box values force to come from autocomplete dropdown

Two files:  jquery_autocomplete.php, tags.php
<!doctype html>
<html lang="en">
  <meta charset="utf-8">
  <title>jQuery UI Autocomplete - Default functionality</title>
  <link rel="stylesheet" href="//">
  <script src="//"></script>
  <script src="//"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  $(function() {

    $( "#tags" ).autocomplete({
      source: 'tags.php',
      minLength : 0,

      select : function(event, ui) {
             newname = ui.item.label; 
             var url = '';
             $.post(url, ui.item.label, function(data) {
      change : function() {    
            curname = $("#tags").val();
            if(curname.trim()!= newname) {
              alert("You need to pick a tag from the tag list.");

 <form onsubmit="return false" id="editContractInfo">
<div class="ui-widget">
  <label for="tags">Tags: </label>
  <input type="text" id="tags" name="tags">


$availableTags = array(
     array("label"=>".Tbd", "value"=>".Tbd"),
     array("label"=>"ActionScript", "value"=>"ActionScript"),
     array("label"=>"AppleScript", "value"=>"AppleScript"),
     array("label"=>"Asp", "value"=>"Asp")    
echo json_encode($availableTags);

Video: jQuery autocomplete in PHP and force to pickup

Saturday, May 30, 2015

Bootstrap Modal Dialog Example in PHP

This article is to show how to popup a dialog in Modal and post in PHP.
Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.  Bootstrap can be downloaded from:
Two files for this demo:
 modal_dialog.php, mydialogexample.js
<!DOCTYPE html>
<html lang="en">
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="">
  <script src=""></script>
  <script src=""></script>
  <script src="mydialogexample.js"></script>
<div class="container">
  <h2>Modal Dialog Example</h2>
  <!-- Universal Modal -->
 <h4>Student Number: <input type="text" name="student_number">
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal" id="searchBtn_studentNum">Search Student</button> </h4>
<div class="modal fade" id="universalModal" tabindex="-1" role="dialog" aria-labelledby="universalModalLabel" aria-hidden="true">
  <div class="modal-dialog" style="width:1000px;">                                     
    <div class="modal-content">
      <form role="form" id="universalModalForm">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only"> Close</span></button>
          <h4 class="modal-title"><span class="glyphicon glyphicon-pencil"></span> Edit<span class="modal-title">.model-title</span></h4>
        <div class="alert alert-danger fade in" id="universalModal-alert" style="display: none;">
          <span class="alert-body"></span>
        <div class="modal-body">.modal-body</div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
          <button type="submit" class="btn btn-primary" id="submitBtn"></button>
<!-- Result Modal-->
<textarea id="searchResultForm" style="display:none">
  <table class="table table-striped table-hover" >
            <td><b>Last Name: </b></td>
            <td> <input type="text" name="lname">

            <td><b>First Name:</b> </td>
            <td> <input type="text" name="fname"></td>
        </tr>   </tr>
  <!-- Trigger the modal with a button -->


    $('#universalModal form').submit(function (event){

        var formObj = {};
        var inputs = $(this).serializeArray();
        var url = '';
        $.each(inputs, function(i, input) {
            formObj[] = input.value;
        var len = inputs.length;
        var  dataObj = {};
        for (i=0; i<len; i++) {
                 dataObj[inputs[i].name] = inputs[i].value;
                     $.post(url, inputs, function(data) {
        var student_num = $('input[name="student_number"]').val();
        $('#universalModal .modal-title').html('<b>Enter Student Info</b>');
        $('#universalModal .modal-body').html($('#searchResultForm').val());
        $('#universalModal .modal-footer button#submitBtn').html('Save and Exit');

Video:Bootstrap Modal Dialog Example in PHP

Monday, April 6, 2015

Daily backup MySQL database to another computer

Assume MySQL server is, I want to dump MySQL database test to daily.
 1) In PHPMyAdmin, click Users, add new user jiansenbk and  host and  database test
grant all
2) In
create (no line break below)
mysqldump  -h -u jiansenbk -pPass2 test
| gzip >/home/jiansen/mysqldump/MySQLDB_`date +"%Y%m%d"`.sql.gz

3) chmod +x

4) crontab -e
and enter (no linebreak, chnage server and user name password and database to yours)
45 23 * * * /home/jiansen/mysqldump/ 2>&1>>/home/jiansen/mysqldump/mysqlbackup.log

Every night 11:45. MySQL database test is dump to /home/jiansen/mysqldump with different timestamps
Video: Daily backup MySQL database to another computer

Add login screen and second user login in PHPMyAdmin

1) Default  PHPMyAdmin without login screen. To add  login screen:
Go to Users, find root@localhost and edit privileges and change password. Use same password in XAMPP configuration

2) Under xampp/phpMyAdmin/
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'test';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

3) To add second name and password in login scrren:
Go to Users tab in PHPMyAdmin, Add new User, type username and password, select host as localhost and check all and click go.

Video: Add login screen and second user login  in PHPMyAdmin

Sunday, February 8, 2015

Install XAMPP 5.6.3 in Windows 8

XAMPP is an easy to install Apache  distribution containing MySQL, PHP, and Perl.
To install XAMPP 5.6.3 in Windows 8:
1) Go to
2) save exe file and run
3) Ignore anti-virus warning,
4) For UAC control warning, change install directory not in
under C:\Program files or Program files (x86)
5) Finish XAMPP installation and run XAMPP control panel, start Apache and MySQL
6) type localhost and click English, click PhpMyAdmin to see your MySQL database
7) Go to htdocs under XAMPP installation directory, create a folder (for example jinasentest) and a file test.php under jiansentest   and run test.php under localhost/jiansentest/test.php

echo "This is a test";

Video: Install XAMPP 5.6.3 in Windows 8

Open Google homepage instead of Yahoo in new tab in Firefox

In Firefox, when you open a new tab, you may find the default is yahoo website while you want to set it as Google homepage. To set the default address for new tab, the following steps should be followed:
 1. type  about:config in web address
2. Accept warning
3. type newtab in search box
4. Double-click the browser.newtab.url,
change address from Yahoo to

Video:  Open Google homepage instead of Yahoo in new tab in Firefox

Saturday, January 31, 2015

PHP and JavaScript, check a string contains a substring

In PHP, we  use strpos to check if a string contains a substring.
strpos function— Find the position of the first occurrence of a substring in a string, it  may return 0 as it's index value.
 If you do a == compare that will not work, you will need to do a ===.
A == sign is a comparison and tests whether the variable / expression / constant to the left has the same value as the variable / expression / constant to the right.
A === sign is a comparison to see whether two variables / expressions / constants are equal AND have the same type - i.e. both are strings or both are integers.

1) to check $contract string contains "Sessional" substring in PHP
if(strpos($contract, 'Sessional') ! = = false)
2) to check $contract string does not contain "Sessional" substring in PHP
if(strpos($contract, 'Sessional') = = = false)

 In  JavaScript, we use indexOf function
The indexOf() method returns the position of the first occurrence of a specified value in a string.
This method returns -1 if the value to search for never occurs.

 1) to check contract string contains "Sessional" substring in JS
if( contract.indexOf("Sessional")!=-1)

 2) to check contract string does not contain "Sessional" substring in JS
if( contract.indexOf("Sessional") = = -1)

More about string operation in Javascript
In JavaScript, To get  the the first character of string contract, we use

To get a substring of a string for example
where 0 is start position, and 4 is end position, but not included.
To trim a string for example term
or using jQuery

Similarly in PHP we have substr function,
for example
echo substr('abcdefg', 0, 4);
return abcd, also not including end position.

Sunday, January 25, 2015

Remove ads agent and improve Internet security in FireFox

You may not notice there are some background ads agent running when you use Firefox even you installed Anti-virus. In the worst case, your personal information may be posted to other websites and stolen.

To check and remove  suspicious programs in your computer:

1. In Firefox, go to menu and click Add-ons, go to Extension,
enable anti-virus, go to plugins, select "never activate" or
remove suspicious programs.

2. Go to control panel,  go to programs and features, uninstall programs in Windows,  find suspicious programs installed lately (click installed on to sort by installation date)  and remove.

3. In Firefox,  go to or other address,  go to Firefox menu, click developer and click network and reload, find if your data are posted to some suspicious websites.

Video: Remove  ads agent and improve Internet security in Fire Fox