Posts

C# decompiler

Download ILSpy_Master_2.3.1.1855_Binaries

7z unzip command

unzip archive.zip and preserve directory structures in archives. 7z x archive.zip Reference 7z commnd example  7z download  7z command download

show a browse folder dialog to select all files in a specified directory recursively in JavaScript

I think I can get the folder name from the browse folder dialog. But I can't do that because of a security reason . So how can I get the folder name. You can create the folder's tar file by 7z command . Then fire the browse folder dialog. Now, you can get the folder's tar file name from the input element. <html> <head> <title>show a browse folder dialog to select all files in a specified directory recursively in JavaScript</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> </head> <body style="background:lightgray"> <p>Click the button to test:</p> <input type="file" id="fileUpload" directory webkitdirectory multiple> </br> <textarea id="edit" style="height:200px;width:240px"> Click the select file button to select files, then show the select file names. </textarea> <script> $...

show a open old file dialog to select files in JavaScript

<html> <head> <title>show a open old file dialog to select files in JavaScript</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> </head> <body style="background:lightgray"> <p>Click the button to test:</p> <input type="file" id="fileUpload" multiple> </br> <textarea id="edit" style="height:200px;width:240px"> this is a test </textarea> <script> $('input[type=file]').change(function () { var text=""; for(var i=0;i<this.files.length;i++){ text+=this.files[i].name+"\n"; } $('#edit').val(text) }) </script> </body> </html>

capitalize the first letter of string in JavaScript

<html> <head> <title>capitalize the first letter of string in JavaScript</title> </head> <body style="background:lightgray"> <p>Click the button to test:</p> <button onclick="test()">Capitalize the first letter of string</button> </br> <textarea id="edit" style="height:200px;width:240px"> this is a test </textarea> <script> function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } function test() { var text=document.getElementById("edit").value; document.getElementById("edit").value=capitalizeFirstLetter(text); } </script> </body> </html>

an array contains a object using javascript

<html> <head> <title>an array contains a object using javascript</title> </head> <body style="background:lightgray"> <p>Click the button to test:</p> <button onclick="test()">clear array</button> </br> <input id="item" type="text" value="a"/> </br> <textarea id="edit" style="height:200px;width:240px"> </textarea> <script> var arr=["a","b","c"]; function test() { var val=document.getElementById("item").value; var text=""; if(contains(arr,val)){ text="["+arr+"] contains "+val; }else{ text="["+arr+"] not contains "+val; } document.getElementById("edit").value+='\n'+text; } function contains(arr,item) { return arr.indexOf(item)>-1; } document.getElemen...

clear an array using javascript

<html> <head> <title>clear an array using javascript</title> </head> <body style="background:lightgray"> <p>Click the button to test:</p> <button onclick="test()">clear array</button> </br> <textarea id="edit" style="height:200px;width:240px"> </textarea> <script> var arr=[1,2,3]; function test() { clearArray(arr); document.getElementById("edit").value=arr; } function clearArray(arr) { arr.length=0; } document.getElementById("edit").value=arr; </script> </body> </html>