2015年9月24日 星期四

How to make a self extracting archive that launches your installer after extraction


source : http://ntsblog.homedev.com.au/index.php/2015/05/14/self-extracting-archive-runs-setup-exe-7zip-sfx-switch/



It is actually quite simple to do if you follow these easy steps.

Step 1 – Setup your installation folder

To make this easy create a folder c:\Install. This is where we will copy all the required files.

Step 2 – 7Zip your installers

  1. Go to the folder that has your msi and your setup.exe
  2. Select both the .msi and the setup.exe
  3. Right-Click and choose 7Zip –> “Add to Archive”
  4. Name your archive “Installer.7z” (or a name of your choice)
  5. Click Ok
  6. You should now have “Installer.7z”.
  7. Copy this .7z file to your c:\Install directory

Step 3 – Get the 7z-Extra sfx extension module

You need to download the 7z-Extra.
  1. Follow this link to go to 7zip download.
  2. You need to download the 9.20 version (as @ May-2015) as the beta does not contain the correct files.
  3. direct download link.
  4. Extract the 7zip extra files
  5. Copy the file “7zS.sfx” to c:\Install

Step 4 – Setup your config.txt

I would recommend using NotePad++ to edit this text file as you will need to encode in UTF-8, the following instructions are using notepad++.
  1. Using windows explorer go to c:\Install
  2. right-click and choose “New Text File” and name it config.txt
  3. right-click and choose “Edit with NotePad++
  4. Click the “Encoding Menu” and choose “Encode in UTF-8”
  5. Enter something like this:
    1
    2
    3
    4
    5
    ;!@Install@!UTF-8!
    Title="SOFTWARE v1.0.0.0"
    BeginPrompt="Do you want to install SOFTWARE v1.0.0.0?"
    RunProgram="setup.exe"
    ;!@InstallEnd@!
Edit this replacing [SOFTWARE v1.0.0.0] with your product name.
Notes on the parameters and options for the setup file are here

CheckPoint

You should now have a folder “c:\Install” with the following 3 files:
  1. Installer.7z
  2. 7zS.sfx
  3. config.txt

Step 5 – Create the archive

These instructions I found on the web but nowhere did it explain any of the 4 steps above.
  1. Open a cmd window, Window + R –> cmd –> press enter
  2. In the command window type the following
    1
    2
    3
    cd \
    cd Install
    copy /b 7zS.sfx + config.txt + Installer.7z MyInstaller.exe
  3. Look in c:\Install and you will now see you have a MyInstaller.exe
  4. You are finished

    Run the installer

    Double click on MyInstaller.exe and it will prompt with your message. Click OK and the setup.exe will run.
    Everything is easy… once you know how. :-)

    P.S. Note on Automation

    Now that you have this working in your c:\Install directory I would create an “Install.bat” file and put the copy script in it.
    1
    copy /b 7zS.sfx + config.txt + Installer.7z MyInstaller.exe
    Now you can just edit and run the Install.bat every time you need to rebuild a new version of you deployment package.

2015年9月17日 星期四

drag and drop html


http://hmkcode.com/java-servlet-jquery-file-upload/

http://www.java2s.com/Code/Jar/j/Downloadjavaxservlet30jar.htm

http://html5demos.com/dnd-upload


http://jsfiddle.net/danielzen/utp7j/


https://www.youtube.com/watch?v=hqSlVvKvvjQ


/******************************************************************/

<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<title>Drag & Drop Uploading </title>
<link rel="stylesheet" href="global.css">
</head>
<body>
<div id='uploads'><div>
<div class='dropzone' id='dropzone'>Drop files here to upload</div>
<script>
(function (){var dropzone=document.getElementById('dropzone');
var upload=function(files){
//console.log(files);
var formData=new FormData();
xhr=new XMLHttpRequest(),x;
for (x=0;x<files.length;x=x+1){
formData.append('file[]',files[x]);
}

xhr.onload=function(){
var data=this.responseText;
console.log(data);
}
xhr.open('post','upload.php')
xhr.send(formData);

}
dropzone.ondrop=function(e){
e.preventDefault();
this.className='dropzone';
console.log(e.dataTransfer.files);
var files = e.target.files || e.dataTransfer.files;
for (var i = 0, file; file = files[i]; i++) {
alert(file.webkitRelativePath+' '+file.name);
}
//alert(e.dataTransfer.files);
//upload(e.dataTransfer.files);
}

dropzone.ondragover=function(){
this.className='dropzone dragover'; 
return false;
}
dropzone.ondragleave=function(){
this.className='dropzone'; 
return false;
}
}())
</script>
</body>
</html>