06/06/2016

[JS]Drag and drop

<!DOCTYPE html>
<html>
<head>
<script>
// Check for the various File API support.
if (window.File && window.FileReader && window.FileList && window.Blob) {
  // Great success! All the File APIs are supported.
} else {
  alert('The File APIs are not fully supported in this browser.');
}
</script>

<div id="drop_zone">Drop files here</div>
<output id="list"></output>

<script>
  function handleFileSelect(evt) {
    evt.stopPropagation();
    evt.preventDefault();

    var files = evt.dataTransfer.files; // FileList object.

    // files is a FileList of File objects. List some properties.
    var output = [];
    for (var i = 0, f; f = files[i]; i++) {
      output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',
                  f.size, ' bytes, last modified: ',
                  f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
                  '</li>');
    }
    document.getElementById('list').innerHTML = '<ul>' + output.join('') + '</ul>';
  }

  function handleDragOver(evt) {
    evt.stopPropagation();
    evt.preventDefault();
    evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
  }

  // Setup the dnd listeners.
  var dropZone = document.getElementById('drop_zone');
  dropZone.addEventListener('dragover', handleDragOver, false);
  dropZone.addEventListener('drop', handleFileSelect, false);
</script>

</head>
</html>

24/02/2016

[VBS]IE fill form and submit

Option Explicit
Dim ie, ipf

Set ie = CreateObject("InternetExplorer.Applicati­on")

On Error Resume Next

Sub WaitForLoad
Do While IE.Busy
WScript.Sleep 500
Loop
End Sub

Sub Find(x)
Set ipf = ie.Document.All.Item(x)
End Sub

ie.Left = 0
ie.Top = 0
ie.Toolbar = 0
ie.StatusBar = 0
ie.Height = 120
ie.Width = 1020
ie.Resizable = 0

ie.Navigate "https://www.facebook.com/"

Call WaitForLoad

ie.Visible = True

Call Find("email")
ipf.Value = "EMAIL GOES HERE"
Call Find("pass")
ipf.Value = "PASSWORD GOES HERE"
Call Find("login_form")
ipf.Submit

Call WaitForLoad
ie.Height = 700
________________________________________­______________

Know the Basics:
----------------------------------------­----------------------------------------­----------
Set ie = CreateObject("InternetExplorer.Applicati­on")

ie.Document.All.Item("INPUT ID").Value = "what you want"
ie.Document.All.Item("FORM ID).Submit
----------------------------------------­----------------------------------------­----------

22/02/2016

[JS]keycode

document.onkeydown = function(){
var x = event.keyCode;
        if(x==112){
            datamart_js();
}
}

f1 112
f2 113
f3 114
f4 115
f5 116
f6 117
f7 118
f8 119
f9 120
f10 121
f11 122
f12 123

13/02/2016

[SAS]Macro


options symbolgen mprint;


/*symbolgen -> macro variale ( ) resolves to ( )*/

/*mprint -> output is written to the SAS log:*/


options nosymbolgen nomprint;

07/02/2016

[SAS]Comment and fix error

/* '; * "; */;
quit;
run;


   *---------------------------------------*
   |  This uses one comment statement      |
   |           to draw a box.              |
   *---------------------------------------*;

[SAS]Proc SQL

proc sql; /* required */
create table mytable as select ...; /* 1 - new table */
create view myview as select ...; /* 2 - new view */
select ...; /* 3 - powerful query tool */
alter table mytable ...; /* 4 - new table structure */
update table mytable ...; /* 5 - update table content */
insert table mytable ...; /* 6 - update table content */
delete from table mytable ...; /* 7 - delete table content */
drop table mytable; /* 8 - delete table */
quit; /* required */

03/02/2016

[DOS command]Dan

@ECHO off

echo ████      ███    █       █
echo █    █    █     █   ██     █
echo █     █   █     █   █ █    █
echo █     █   █     █   █  █   █
echo █     █   █████  █   █  █
echo █     █   █     █   █    █ █
echo █    █    █     █   █     ██
echo ████    █     █   █       █

@PAUSE


16/01/2016

[VBS]Network Object

ServerShare = "\\192.168.3.56\d$"
UserName = "domain\username"
Password = "password"

Set NetworkObject = CreateObject("WScript.Network")
Set FSO = CreateObject("Scripting.FileSystemObject")

NetworkObject.MapNetworkDrive "", ServerShare, False, UserName, Password

Set Directory = FSO.GetFolder(ServerShare)
For Each FileName In Directory.Files
    WScript.Echo FileName.Name
Next

Set FileName = Nothing
Set Directory = Nothing
Set FSO = Nothing

NetworkObject.RemoveNetworkDrive ServerShare, True, False

Set ShellObject = Nothing
Set NetworkObject = Nothing

02/01/2016

[R]Vectors and assignment

function c()
x <- c(10.4, 5.6, 3.1, 6.4, 21.7)
assign("x", c(10.4, 5.6, 3.1, 6.4, 21.7))
y <- c(x, 0, x) #create a vector y with 11 entries