Include script files in one script file

Friday, 15. September 2017

The power of computing is to load a program from another program. Just like booting up the computer. To load an HTML page with many scripts files can be loaded with one script file.

After a few research, I found the following techniques:

1. create this master js file:
var tobeadded = document.createElement(’script’);//start script
tobeadded.src = ‘/script1.js’;//script src
document.head.appendChild(tobeadded);//close script
tobeadded = document.createElement(’script’);// repeat until all done
tobeadded.src = ‘/script2.js’;
tobeadded = document.createElement(’script’);// repeat until all done
tobeadded.src = ‘/script3.js’;

Save this file called master.js and enter this into the HTML file:
<script type=”text/javascript” src=”/master.js”></script>

The problem is that all the scripts will be loaded asynchronously, that is, you have no control which is loaded first. When one of the script depends on the other to be loaded first, you will experience error when scripts are executed “onload”.

2. Same problem as #1. You can need to add a script file first before adding this master file because of the reason mention before:
<script type=”text/javascript” src=”/jquery.js”></script>
It is because jquery.js is needed for all scripts in the master.js
Here is a different master.js file:
function include(file){
var script = document.createElement(’script’);
script.src = file;
script.type = ‘text/javascript’;
script.defer = true;
/* include any js files here */
This master.js is creating a function called include to ease the repetition.

3. This is what I prefer as I can control the order of the scripts loaded. Here is the inorder master.js file:
var scriptMap =["/jquery.js","/script1.js", "/script2.js", "/script3.js"];// list of to be loaded script in an array
var order = 0;
function loadScriptInOrder(){
if(order == scriptMap.length) {
var JSLink = scriptMap[order];
var JSElement = document.createElement(’script’);
JSElement.src = JSLink;
JSElement.onload = callback;

function callback(){
loadScriptInOrder();//load the script in a recursive manner

This way I will not need to load jquery.js in HTML file and then inlude the master.js file. It will be one once and for all. That’s perfect!


Friday, 28. July 2017





Monday, 10. July 2017







Microsoft Multi-media All-in-one keyboard

Tuesday, 23. May 2017

Not documented information for additional functions for this wireless all in one keyboard from Microsoft:

Fn-Lock: Fn + Caps Lock (inverts the way Fn works with the F1-F12 keys)
Home: Fn + Left arrow
End: Fn + Right arrow
Page Up: Fn + Up arrow
Page Down: Fn + Down arrow
Print Screen (full screen): Fn + Windows Key + Space
Print Screen (current window) Fn + Alt + Space

+ means hit all keys at the same time

fatcow ftp and microsoft movie maker

Friday, 19. May 2017

I have experienced a very weird problem when uploading a video file through filezilla ftp to fatcow’s ftp account.

As I upload one video file called flower.mp4 to my mp4 folder, this file will be removed as the upload is completed. I have tried many times, possibly ten times or more and with some testings. Call fatcow support but in vein. They cannot tell. Once they said the file is corrupted but I can open it locally without problem.

I tried to rename and and upload, same problem. I tried to upload to another folder, still the same.

Very frustrated. It took at least 10 minutes to upload a file of that size and it disappeared. Exists for just a minute or so.

I tried upload a converted file in ogg format and it will be fine. The file will remain there and same for other video file. Just this one, OMG, why?

After several tests like convert it to various size using Microsoft Movie Maker and upload. This problem hold true except when I convert the file using VLN with various format like youtube, android etc even though the file still in mp4 format, as it is a video container. The converter possibly the same for both video and audio.

I cannot tell the problem is fatcow problem and possibly it is the main culprit. Microsoft Movie Maker conversion will have something to do with this situation.

Very likely after the upload, fatcow scans the file and determines corruption in file and removes it. This is one of many that I do not like