Monday, March 31, 2014

run ASP .net in WIndows 7





ASP .net in WIndows
http://www.w3schools.com/asp/asp_install.asp

Stop Apache if any
Control panel ->Programs ->Programs and Features ->Turn Windows features on or off
Check  Internet Information Services and click OK, it will take a few minutes.

Run localhost to check
http://localhost/
Open Windows Update by clicking the Start button Picture of the Start button, clicking All Programs, and then clicking Windows Update.
Under
C:\inetpub\wwwroot
add write permission for C:\inetpub\wwwroot for you
create mydir/test1.asp
<!DOCTYPE html>
<html>
<body>
<%
response.write("Hello World!")
%>
</body>
</html> 

http://localhost/mydir/test1.asp
error message
Detailed Error Information
Module    StaticFileModule
Notification    ExecuteRequestHandler
Handler    StaticFile
Error Code    0x80070032
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
Under command prompt, run as  administrator.
C:\Windows\system32>cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -i
Microsoft (R) ASP.NET RegIIS version 4.0.30319.18408
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation.  All rights reserved.
Start installing ASP.NET (4.0.30319.18408).
..........
Finished installing ASP.NET (4.0.30319.18408).

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>
Bug fixed: need to check ASP ASP.NET under development features as follows:


Finalize department database




Department database:
http://localhost/ubc_surgery_pub/demosite/index.php

C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\ubc_surgery_pub\scripts\manage\index.php
remove some links.

Sunday, March 30, 2014

Introduction and download NetBeans IDE




NetBeans IDE is FREE, open source IDE and can be used quickly and easily develop desktop, mobile and web applications with Java, HTML5, PHP, C/C++ and more. Netbeans can work in Windows, Linux and Mac OS.

NetBeans can be downloaded from:
https://netbeans.org/

Javascript tutorial playlist and how to embed Youtube playlist




embed playlist source code
<iframe src="http://www.youtube.com/embed/videoseries?list=PL46F0A159EC02DF82" 
width="100%" height="500" frameborder="0"></iframe>
 Change PL46F0A159EC02DF82 to your list ID.
Video:  Javascript tutorial playlist


Difference between Apache TOmcat and Apache http server




Apache is a general-purpose http server, which supports a number of advanced options that Tomcat doesn't.  Apache Tomcat is used to deploy your Java Servlets and JavaServer Pages (JSP).
JSP is similar to PHP, but it uses the Java programming language.

Saturday, March 29, 2014

LMS review




LMS review:
http://www.academia.edu/459487/Learning_Management_Systems_Review
Migration from blackboard to moodle
http://ijcir.org/volume6-number2/article4.pdf
programming language, blackboard LMS

Thursday, March 20, 2014

Free anti virus software - Micrsoft security essential




Free anti virus software - Micrsoft security essential can be downloaded from:
 http://windows.microsoft.com/en-CA/windows/security-essentials-download

Setup ad hoc network for Windows 7 or Macs





If you have wireless adapter in your computers, you can setup  computer to computer network using ad hoc network without using router. The wireless signal will be created by one computer and received by another computer, without using external wireless. This is useful when you are in travel or you have only one external  network  wire plug in.
In Windows 7,
start->Control Panel-> Network Sharing Center->Setup new connection or network -> Set up a wireless ad hoc (computer-to-computer) network , click next

In Mac:
 Airport- or click wifi icon>Create Network->Create computer-to-computer network.

Self assign IP: 169.254.*.*


Remote desktop sharing for Mac and Windows 7




You can use  Microsoft Remote Desktop Connection Client to start remote desktop connection to Windows 7 in Mac.
Microsoft Remote Desktop Connection Client  can be downloaded from HERE:
 http://www.microsoft.com/en-us/download/details.aspx?id=18140
You can also get it from Microsoft Office 2011 for Mac,

For remote desktop connections  between Mac, you can use screen sharing features in Mac
Difference between screen sharing and remote desktop, you can see the the mouse moving from remote site in screen sharing..

For remote desktop connections  between Windows,  the application is built in Windows.

Wednesday, March 19, 2014

Router configuration inside subnet




192.168.1.1 to configure router, for example:
WPA2 encryption, MAC address filtering, guest network, port forwarding, restrict internet access such as only Monday allow to access, block centain website, filter some keywords.

Both the Windows and Mac computers can take  an Internet connection through their Ethernet ports, and then creating a Wi-Fi network that your other devices can connect to.

But when you put the wireless router in the another subnet with 191.168.*.*, you may need to change the wirelss router IP to, such as 192.168.10.1 to avoid the overlap with original router 192.168.1.1.
And you restart the wireless router after you change its IP. 

Radius and AAA




Radius and AAA
Remote Authentication Dial In User Service (RADIUS) is a networking protocol that provides centralized Authentication, Authorization, and Accounting (AAA) management for users that connect and use a network service. RADIUS was developed by Livingston Enterprises, Inc.
http://en.wikipedia.org/wiki/RADIUS

Tuesday, March 18, 2014

Update member directory




Three files:
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_acs1111\_templates\member_directory.tmpl.php
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_acs1111\_lib\member_directory_tools.inc.php
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_acs1111\member_directory\index.php

Wednesday, March 12, 2014

Git tutorial





 Git is a distributed version control system (no central server)
On Ubuntu and similar systems:

sudo apt-get install git 
 
On Fedora, Red Hat and similar systems

yum install git 
 
 
 The working tree status
git status

 Add file in staging
git add .

Commit to git repository
git commit -m "add a file index.php"

Show git log for change
git log

remove a file
git rm index.php
git commit -m "remove file index.php"


For collaborative work flow
My flow:
> git checkout  master
>git  fetch
>git merge origin/master
now create another branch  test_website, better directly working o9n master branch
>git checkout b  test_website
//modify index.php and put in staging
>git add index.php
//then put in git repository
>git commit -m "add contact in index.php"
>git fetch
>git push -u origin test_website


GIt remote:


$ git remote add origin git://github.com/paulboone/ticgit.git
$ git remote -v


My collaborator flow
> git checkout  master
>git  fetch
 >git merge origin/master
check out my work
>git checkout -b  test_website  origin/test_website
check out what I did
> git log
He make some change on the code and commit
>git commit -am "add jiansen in contact.php"
make sure the local code up-to-date using fetch 
>git fetch
push the code in remote
>git push

Back to my flow
>git fetch 
>git log -p test_website..origin/test_website
sync my local test_website
>git merge origin/test_website
go back master branch
>git checkout master 
>git  fetch
 >git merge origin/master
merge in branch test_website in master
>git merge test_website 
update remote
>git push

Reference:
http://www.vogella.com/tutorials/Git/article.html

"Unusual traffic from your computer network" from blogger




I have long time not access my blog
  http://job-vancouver.blogspot.ca/
Today I receive message:

About this page
Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot


To continue, please type the characters below:
And I typed the characters, the problems is fixed.
I checked my iphone, it is fine. The message is auto-generated.

When Google detects that a computer or phone on your network may be sending automated traffic to Google we may show the following message: "Our systems have detected unusual traffic from your computer network."

As my college has the same IP address with me, I guess this is caused by their computers. According to the instruction if unusual traffic stop, the block will be disable shortly.

After I waited one hour and my colleague left, I can access my bloggers and the problem is solved. 

 More information:

https://support.google.com/websearch/answer/86640?hl=en
 https://support.google.com/websearch/contact/ban

Tuesday, March 11, 2014

Json in Python 3.3




Example1.py: Json in Python 3.3
import json
data = [ { 'a':'A', 'b':(2, 4), 'c':3.0 } ]
data_string = json.dumps(data)
print(data_string)

data_load = json.loads(data_string)
print(data_load)
print(data_load[0]['a'])

return:
 [{"a": "A", "b": [2, 4], "c": 3.0}]
[{'a': 'A', 'c': 3.0, 'b': [2, 4]}]
A

Reference:
http://pymotw.com/2/json/

#http://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php
#past 30days M4.5 earthquake
#http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.geojson

import urllib.request
import json

geourl = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.geojson"
response = urllib.request.urlopen(geourl)
content = response.read()
data = json.loads(content.decode("utf8"))
print(data)
print(data['type'])
 

D3.js example





D3.js example
<!DOCTYPE html>
<html>
<head>
    <title>d3.js example 1</title>
    <script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<h1>d3.js example 1</h1>
<script>
 d3.select("body").append("p").text("hello word");
 d3.select("body").append("svg").attr("width", 50).attr("height", 50).
 append("circle").attr("cx", 25).attr("cy", 25).attr("r", 25).style("fill", "purple");
   
</script>
                  
</body>
</html>

Result:


SVG in HTML




SVG stands for Scalable Vector Graphics.
SVG in HTML tutorial:
http://www.w3schools.com/svg/
Example code:
<!DOCTYPE html>
<html>
<body>
<h1> SVG Example</h1>
<svg width="250" height="250">
   <circle cx="100" cy="100" r="80" stroke="red" stroke-width="10" fill="green" />
   Sorry, your browser does not support inline SVG.
</svg>
</body>
</html>

Result:


Sorry, your browser does not support inline SVG.

Monday, March 10, 2014

Visulization software: processing, D3.js, statistics R and matplotlib




Processing is a programming language, development environment, and online community. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology.
http://processing.org/

D3.js is a JavaScript library for manipulating documents based on data.
 http://d3js.org/

 matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms
http://matplotlib.org/ 

R is a free software environment for statistical computing and graphics.
http://www.r-project.org/

Set Windows path command line




Set Windows path command line. Under command prompt, using setx
setx PATH "c:\python27"
This will set python path.
But you need to close command prompt Windows first and reopen it.

Saturday, March 8, 2014

Fork a repository in Gist or Github in Github




 Sign in my GIthub account
Go to gist ( Gist is a simple way to share snippets and pastes with others)
 https://gist.github.com/jrmoran/3938567
at right top, click  fork
Now it is cloned to my account
https://gist.github.com/jiansenlu/9443876
Now in gist, click user name still in gist,. Switch back to Github,
click github  at the top right menu,
now back to github, click use name, now you can see you gitnub repository, not gist, for example
 https://github.com/jiansenlu
We can also fork a git hub (not gist) repository, for example
https://github.com/segmentio/metalsmith
click fork at right top, then it will be shown
https://github.com/jiansenlu/metalsmith

Note: it is shown  under repositories, not contribution




load Json data in AngularJS




 AngularJS is an open-source JavaScript framework, maintained by Google.
 AngularJS directives allow the developer to specify custom and reusable HTML tags.
  AngularJS directives used below:
ng-app
Declares an element as a root element of the application allowing behavior to be modified through custom HTML tags.
<html ng-app="App" >
In JS, we call  module function 
var App = angular.module('App', []);
ng-controller
Specifies a JavaScript controller class that evaluates HTML expressions. In HTML
<body ng-controller="TodoCtrl">
In JS we call
App.controller('TodoCtrl', function($scope, $http) {
ng-repeat
Instantiate an element once per item from a collection. In HTML
  <li ng-repeat="todo in todos">
{{todo.text}} - <em>{{todo.done}}</em>
</li>
Example: load Json data in ANgularJS
index.html
<!doctype html>
<html ng-app="App" >
<head>
<meta charset="utf-8">
<title>Todos $http</title>
<link rel="stylesheet" href="style.css">
<script>document.write("<base href=\"" + document.location + "\" />");</script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="TodoCtrl">
<ul>
<li ng-repeat="todo in todos">
{{todo.text}} - <em>{{todo.done}}</em>
</li>
</ul>
</body>
</html>
 
app.js
var App = angular.module('App', []);
App.controller('TodoCtrl', function($scope, $http) {
$http.get('todos.json')
.then(function(res){
$scope.todos = res.data;
});
});
todos.json
[{ "text":"learn angular", "done":true },
{ "text":"build an angular app", "done":false},
{ "text":"something", "done":false },
{ "text":"another todo", "done":true }]
Reference:
 http://en.wikipedia.org/wiki/AngularJS
http://stackoverflow.com/questions/13020821/how-to-load-json-into-my-angular-js-ng-model

Friday, March 7, 2014

Amazon web serive





 Amazon web serive
 http://aws.amazon.com/

AWS SDK for PHP
http://aws.amazon.com/sdkforphp/

Thursday, March 6, 2014

Moodle and Totara LMS





 Totara is a custom distribution of Moodle, the world's most
popular learning management platform, for the corporate sector.
http://www.totaralms.com/

Moodle LMS
https://moodle.org/

Install Moodle plug-in
http://docs.moodle.org/23/en/Installing_plugins

update moodle using git
http://docs.moodle.org/23/en/Git_for_Administrators 

moodle upgrading
http://docs.moodle.org/23/en/Upgrading 

moodle developer guide, such as add a new plugin etc
http://docs.moodle.org/dev/Developer_documentation 
Upgrade Moodle 2.2.3 to 2.6.
Move moodle directly to moodle2.23
As I already have PHP and MySQl, I only need moodle and moodledata  directories when I  downloaded moodle Windows version. I do not need XAMPP
new directories moodle contains moodle and moodledata directories,
run my server, for example http://localhost:8087
it will go to install.php, following step by step, moodle 2.2.3. willbe updraded to moodle 2.6, mainly database is updated as I already  moodle 2.2.3 to another  directory.

Two warning message:
intl should be installed and enabled for best results
Intl extension is used to improve internationalization support, such as locale aware sorting.

MS Windows

To enable this extension add the following line to your php.ini file usually found in /php:
extension=php_intl.dll
And then set the intl.default_locale and intl.error_level directives in your php.ini file.
[intl]
intl.default_locale = en_utf8
intl.error_level = E_WARNING 

 opcache.enable
PHP setting should be changed.
PHP opcode caching improves performance and lowers memory requirements, OPcache extension is recommended and fully supported.
PHP.ini settings:
[opcache]
opcache.enable = 1
opcache.memory_consumption = 128
opcache.max_accelerated_files = 4000
opcache.revalidate_freq = 60
 
; Required for Moodle
opcache.use_cwd = 1
opcache.validate_timestamps = 1
opcache.save_comments = 1
opcache.enable_file_override = 0


upgrade my php form 5.3 to 5.5
download it from for Windows
http://windows.php.net/download/
download thread-safe
"A Thread Safe version should be used if you install PHP as an Apache module. The Non Thread Safe version should be used if you install PHP as a CGI binary."

The reason is that  when we use Apache http server, we normally use mod-php. The PHP is loaded into Apache as threads. So we need thread safe  PHP  for Apache.
in httpd.conf, line 835 change
LoadModule php5_module "C:\php\php5apache2_2.dll"
to
LoadModule php5_module "C:\php\php5apache2_4.dll"
somehow apache failed. Need to check

Moodle does not have video streaming, discussion can be found:
https://moodle.org/mod/forum/discuss.php?d=25640
Atutor also  do not have  video streaming, discussion can be found:
http://atutor.ca/view/2/10253/1.html
Optinal solution to Flash media server, using Video Vista Streaming Software:
http://www.vista.it/ing_index.php

SASS:

Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.

Tuesday, March 4, 2014

Example of Git in colloborator mode




 Git is a free and open source distributed version control system
Git can be downloaded from:
http://git-scm.com/
Self git host
gitosis
https://github.com/tv42/gitosis
gitolite
https://github.com/sitaramc/gitolite
For collaborative work flow
My flow:
> git checkout  master
>git  fetch
>git merge origin/master
now create another branch  test_website, better directly working o9n master branch
>git checkout b  test_website
//modify index.php and put in staging
>git add index.php
//then put in git repository
>git commit -m "add contact in index.php"
>git fetch
>git push -u origin test_website


My collaborator flow
> git checkout  master
>git  fetch
 >git merge origin/master
check out my work
>git checkout -b  test_website  origin/test_website
check out what I did
> git log
He make some change on the code and commit
>git commit -am "add jiansen in contact.php"
make sure the local code up-to-date using fetch 
>git fetch
push the code in remote
>git push

Back to my flow
>git fetch 
>git log -p test_website..origin/test_website
sync my local test_website
>git merge origin/test_website
go back master branch
>git checkout master 
>git  fetch
 >git merge origin/master
merge in branch test_website in master
>git merge test_website 
update remote
>git push

dirname(__FILE__) in PHP




dirnameReturns parent directory's path
 __FILE__   is current file (note is double _), so
dirname(__FILE__) returns directory of current included file.

For example in config.php
require_once(dirname(__FILE__) . '/lib/setup.php');
then /lib/ should be in the same directory as config.php


stdClass in PHP




stdClass is php's generic empty class. It is auto casted.
For example, moodle LMS used stdclass in its config.php

 unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'root';

$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbsocket' => 0,
);

Monday, March 3, 2014

Remark on domiain name




bcsimulation.ca showed under construction, the reason is DNS->A record
host bcsimulation.ca point to wrong IP.

cesei, URL point to empty (standard) home directory pointed to /public_html/ (default, doses not matter)  as DNS->A record already pointed the url to correct IP.
For  pointer
pointer mode to stealth mode, creates an invisible frame set, which will
go to web address, but without any sub directory for example no /index.php /login.php
For IP without port, it can be fixed DNS->A record.
For the web address with port, as DNS->A record can not point to port, only point to IP,
using stealth mode can not see the full URL for web set in the port others than 80.
For standard mode
go to IP address

Another correct config: can-health.ca, in host with default port 80
pointer set stealth point to  the IP
DNS-A record
point can-health.ca to that IP
point * to that IP.
point www to that IP (not necessory, as cesei did not has this entry)

WCAG Guideline







Web Content Accessibility Guidelines (WCAG) Overviewhttp://www.w3.org/WAI/intro/wcag

Sunday, March 2, 2014

AngularJS framework




AngularJS can be downloaded from
http://angularjs.org/
AngularJS is great for static document, but falter for dynamic view.
More about AngularJS:
http://en.wikipedia.org/wiki/AngularJS

Saturday, March 1, 2014

JSON: JavaScript Object Notation.




Similar to XML, JSON is used to store message in JavaScript.   But JSON is smaller than XML and easy to parse.
JSON format:
a name followed by colon, followed by a value, such as
"fruit":"apple"
i.e fruit = "apple"
JSON object using curly bracket
var  temp={"fruit":"apple", "juice":"orange"}
To access JSON object value:
temp.fruit, temp,juice
JSON array using square bracket:
var JSONarray= {
"food":[
{"fruit":"apple", "juice":"orange"},
{"fruit":"banana", "juice":"watermelon"}
]
}

To access the value  fruit in array
JSONarray.food[0].fruit