Skip to main content

Posts

Showing posts from October, 2018

PowerShell : Moodleroom API update idnumber field

# 24.Oct.2018 09:50AM  # To Run => powershell -ExecutionPolicy Bypass -File "C:\BizTalk_Zone\PowerShellScripts\Learn_idnumber_update.ps1" $theDomain = " https://learn.sm.ph " $theToken = "0f90b7ad55ed7d123bcf173ded79b843" # $theDomain = " https://sm-sandbox.ph " # $theToken = "18c0b4b7as2caeaca23bfww9aoc7ee40" $generic_headers = @{ Authorization = $generic_BasicAuthValue } function getUrl() {     return  $theDomain + "/webservice/rest/server.php?wstoken=" + $theToken } function updateIdNumber($id, $idNumber)  {     $urlBase = getUrl      $uri = $urlBase + "&wsfunction=core_user_update_users&moodlewsrestformat=xml&users[0][id]=$id&users[0][idnumber]=$idNumber"     $uri     return  Invoke-RestMethod -Method 'Post' -Uri $uri } function getDetails($key, $value)  {     $urlBase = getUrl      $uri = $urlBase + "&wsfunction=core_user_get_users&moodlewsrestformat=xml&criteria[0][ke

Progressive Web Apps : Enabling PWA on Chrome

url => chrome://flags/

SUBLIME Text : Insert Date/Time Stamp on F5

FIRST, install the package manager (tools install package manager) then in Preferences - Browse Packages - User (folder), make a file called whatever.py and paste the following 6 lines into it: import sublime, sublime_plugin, time class InsertDatetimeCommand(sublime_plugin.TextCommand): def run(self, edit): sel = self.view.sel(); for s in sel: self.view.replace(edit, s, time.strftime( '%Y.%m.%d %H:%Y' )) NOW in preferences - keybindings - User, add this line: { "keys": ["f5"], "command": "insert_datetime"} Now in sublime text you can hit F5 to autoinsert the date and time just like notepad on Windows.

Google Suites - Update Google Sheet Column with Fusion Table Column Using Google App Scripts

function GETLatestValue() {   var sheet = SpreadsheetApp.getActiveSheet();   var data = sheet.getDataRange().getValues();   for (var i = 1; i < data.length; i++) {     Logger.log('PN: ' + data[i][0]);     //Logger.log('Product number: ' + data[i][1]);     var sql = 'SELECT * FROM 1Ynn6Jt34YaPV7ojdJNrp9sXoHTqLWRCIBaOKbpCZ WHERE PN_ID = ' + data[i][0] + ' LIMIT 1';     Logger.log(sql);     var result = FusionTables.Query.sqlGet(sql, {       hdrs: false     });     Logger.log(result.rows);     if (result.rows) {       //data(i,1).setValue(evento[i]);       Logger.log('rows[0][2]: %s', result.rows[0][2]);       Logger.log('rows[0][3]: %s', result.rows[0][3]);       //data[i][1] result.rows[0][2];      sheet.getRange(i+1,2).setValue(result.rows[0][2]);      sheet.getRange(i+1,3).setValue(result.rows[0][3]);     }   }        /*   var sql = 'SELECT * FROM 1Ynn6Jt34YaPV7ojdJNrp9sXoHTqLWRCIBaOKbpCZ WHERE LIMIT 1000';   Logger.log(sql);