Search This Blog

2017/06/21

Git command line memo

VirtualBox: Can't support 64bits OS

Try using VirtualBox to setup a 64bits Linux server, but there's an error said it can't support 64bits OS but 32bits. In VirtualBox system settings, only 32bits OSs are availabled.

Solution: Enable the virtualization technology in motherboard BIOS.

Example: hp notebook
Before boot OS > Key[Esc] > BIOS setup > Advanced > check virtualization.

VirtualBox quick key

Default [host key] is Right Ctrl.

Display
Full screen on/off: [host key] + F
Scale screen on/off: [host key] + C

Menu
Call menu: [host key] + home

2017/06/16

IE: js only working in debug mode

I happened to an issue that js function is working in Chrome, Firefox and IE's debug mode. ONLY IN DEBUG MODE.

In stackoverflow, most answer are "Don't use 'console.log'". Because console object exists in scope only in debug mode after IE9.
Or use codes likes below to avoid console's problem.
if(!('console' in window)){
    window.console ={};
    window.console.log=function(string){
        return string;
    };
}

But it's not working on my issue, and try to catch the error is non-help at all.
window.onerror = function(msg, url, line) {
    alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+line);
    return true;
}

Maybe it is cached that set to true somewhere, so I tried to set it to false.
$.ajax({
    type: "GET",
    url: "/" + filename,
    dataType: "xml",
    cache: false,
    success: function(xml){ /* code */ }
});

Success. Issue closed.

2017/06/13

Setting NLS_LANG Oracle in Non-English Environment

Develop in No-English Environment, setting the NLS_LANG environment variable for Oracle databases.

1. Determine the NLS_LANG
SELECT * FROM V$NLS_PARAMETERS
The NLS_LANG will be in format [NLS_LANGUAGE]_[NLS_TERRITORY].[NLS_CHARACTERSET]

2. For Windows
Control Panel > System: Advanced tab: Environment Variables
New in System variable section. Variable Name: NLS_LANG.

3. For UNIX
SETENV NLS_LANG [NLS_LANG]
If data is 7-bit or 8-bit ASCII it will be NLS_LANG: [NLS_LANGUAGE]_[NLS_TERRITORY].WE8ISO8859P1

4. Reboot machine.

[NLS_LANGUAGE]_[NLS_TERRITORY].[NLS_CHARACTERSET]:
American_America.UTF8
Japanese_Japan.JA16SJISTILDE

2017/06/12

Create and download file by JavaScript

Code:
<script>
function download(fileName, content){
    var file = document.createElement('a');
    file.download = fileName;
    file.href = 'data:application/octet-stream,'+encodeURIComponent(content);
    file.click();
}
</script>
Html:
<button onclick="download('test.txt','test text.');"/>

2017/06/02

VBA: Unhide all sheets in Excel

Code:
Sub UnhideAllSheets()
    Dim ws as Worksheet
    For Each ws In ActiveWorkbook.Worksheets
        ws.Visible = xlSheetVisible
    Next ws
End Sub