Sabtu, 10 Desember 2016

gogle form trigger on submit

//==============================================
/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

function myFunction() {
  var triggers = ScriptApp.getProjectTriggers();
  for(var i in triggers) {
    ScriptApp.deleteTrigger(triggers[i]);
  }
  ScriptApp.newTrigger("SendHold")
  .forForm(FormApp.getActiveForm())
  .onFormSubmit()
  .create();
}

//=========================================================

function SendHold(e)
{
  try
  {
    //====== MSA LALALU
    var message = "";
    var s = FormApp.getActiveForm().getResponses();
    var items = s[s.length-1].getItemResponses();
    for (var j = 0; j < items.length; j++) {
      var item = items[j];
      message+= item.getItem().getTitle() + "=" + item.getResponse()+ "\n";
      Logger.log('Response #%s to the question "%s" was "%s"',(s.length).toString(),item.getItem().getTitle(),item.getResponse());
    }
    //====== MSA LALALU
    /*
    var s = FormApp.getActiveForm().getResponses();
    var message = "";
    for (var i = 0; i < s.length; i++) {
     
      message='';
      var items = s[i].getItemResponses();
      for (var j = 0; j < items.length; j++) {
        var item = items[j];
        message+= item.getItem().getTitle() + "=" + item.getResponse()+ "\n";
         Logger.log('Response #%s to the question "%s" was "%s"',(i + 1).toString(),item.getItem().getTitle(),item.getResponse());
      }
    }
    */
    GmailApp.sendEmail("xxxxx@gmail.com", "form test","isi" + "\n" +message,{name: 'Form Layanan Desa'})
 
  } catch (e) {
    Logger.log(e.toString());
    MailApp.sendEmail("xxxxx@gmail.com","err log",e.toString() + '\n' + msg);
  }
}

//===================================================

Jumat, 25 November 2016

vb.net Codedom

'
'Create Class from String
'

Dim sDom As String = _
            "Public Class tabelturunan" & vbNewLine & _
            "        Inherits this.parentoff" & vbNewLine & _
            "        Sub New()" & vbNewLine & _
            "            MyBase.New()" & vbNewLine & _
            "        End Sub" & vbNewLine & _
            "        Sub New(ByVal s As String)" & vbNewLine & _
            "            MyBase.New(s)" & vbNewLine & _
            "        End Sub" & vbNewLine & _
            "    End Class"
'
' We create object of the compiler 
'
Dim objCodeCompiler As CodeDom.Compiler.CodeDomProvider = CodeDom.Compiler.CodeDomProvider.CreateProvider("VB")
'
' Pass parameters into the compiler.
'
Dim objCompilerParameters As New CodeDom.Compiler.CompilerParameters
objCompilerParameters.ReferencedAssemblies.Add("System.dll")
objCompilerParameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
objCompilerParameters.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")

objCompilerParameters.ReferencedAssemblies.Add("System.Data.dll")
objCompilerParameters.ReferencedAssemblies.Add("System.XML.dll")

objCompilerParameters.ReferencedAssemblies.Add("kependudukan.exe")
objCompilerParameters.GenerateInMemory = True
'
' Get te source code and compile it.
'
  Dim objCompileResults As CodeDom.Compiler.CompilerResults = objCodeCompiler.CompileAssemblyFromSource(objCompilerParameters, line)
'
' Check for compiler errors.
'
If objCompileResults.Errors.HasErrors Then
    MsgBox("Error: Line>" & objCompileResults.Errors(0).Line.ToString & ", " & objCompileResults.Errors(0).ErrorText)
    End
End If

Senin, 07 November 2016

mysql_fetch_field

<?php
$conn 
= mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!
$conn) {
    die(
'Could not connect: ' . mysql_error());
}
mysql_select_db('database');$result = mysql_query('select * from table');
if (!
$result) {
    die(
'Query failed: ' . mysql_error());
}
/* get column metadata */$i = 0;
while (
$i < mysql_num_fields($result)) {
    echo 
"Information for column $i:<br />\n";
    
$meta = mysql_fetch_field($result, $i);
    if (!
$meta) {
        echo 
"No information available<br />\n";
    }
    echo 
"<pre>
blob:         
$meta->blob
max_length:   
$meta->max_length
multiple_key: 
$meta->multiple_key
name:         
$meta->name
not_null:     
$meta->not_null
numeric:      
$meta->numeric
primary_key:  
$meta->primary_key
table:        
$meta->table
type:         
$meta->type
unique_key:   
$meta->unique_key
unsigned:     
$meta->unsigned
zerofill:     
$meta->zerofill
</pre>"
;
    
$i++;
}
mysql_free_result($result);?>

source: http://php.net/manual/en/function.mysql-num-fields.php

Rabu, 28 September 2016

FastR3port for .NET

Report1.Dictionary.Connections(0).ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
        Application.StartupPath & "\keuangan.mdb;User ID=Admin;Jet OLEDB:Database Password=+"
        Report1.Preview = PreviewControl1
        Report1.Show()

Senin, 05 September 2016

OpenWRT Raspberry

Mount Storage

opkg update
opkg install kmod-usb-storage block-mount block-hotplug kmod-fs-ext4 kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
mkdir -p /home
mount -t vfat /dev/sda1 /home

vi /etc/config/fstab
config mount
        option target   '/home'
        option device   '/dev/sda1'
        option fstype   'vfat'
        option enabled  '1'
 option options  'rw,sync'
        option enabled_fsck '0'
/etc/init.d/fstab enable
/etc/init.d/fstab start
reboot
mount














Senin, 22 Agustus 2016

OLEDB acces vb.net

   Dim cnn As New _
            OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
                      this.appDir & "\data\keuangan.mdb;Jet OLEDB:Database Password=ppp;")
 '   OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
         '             this.appDir & "\data\keuangan.mdb;Jet OLEDB:Database Password=ppp;")
       
            Dim cmd As New OleDb.OleDbCommand
            cmd.Connection = cnn
            cmd.CommandType = CommandType.Text
            cmd.CommandText = "delete * from trx_spp where `nospp` = '" & e.Link.Split("|")(1) & "' and " & this.sFilter
            Using cnn
                cnn.open()
                cmd.ExecuteNonQuery()
                cnn.Close()
            End Using
=======================

               'Friend koneksi As New _
        '         Odbc.OdbcConnection("Driver={Microsoft Access Driver (*.mdb)};dbq=" & _
        '         this.appDir & "\data\keuangan.mdb;defaultdir=D:\;Uid=Admin;Pwd=-+--+;")
        'Friend koneksi As New _
        '            OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
        '                      this.appDir & "\data\keuangan.mdb;Jet OLEDB:Database Password=-+--;")
        Friend koneksi As New _
                   OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
                             this.appDir & "\data\keuangan.mdb;Persist Security Info=False;Jet OLEDB:Database Password=-+;")
       

Rabu, 17 Agustus 2016

Redirect using .htaccess


Redirect include subfolder

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^layanankilat\.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www\.layanankilat\.com$
  RewriteRule (.*)$ http://prosides.magelangsoft.com/$1 [R=301,L]
</IfModule>
Redirect without subfolder

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^situsdesa\.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www\.situsdesa\.com$
  RewriteRule (.*)$ http://www.zheol.com/ [R=301,L]
</IfModule>
Redirect to root folder

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^.+$ / [R=301,NC,L]
</IfModule>



# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Redirect non to https


RewriteCond %{HTTP_HOST} ^pastioke\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://pastioke.com/$1 [R,L]


sumber : cholar.com/blog/redirect-an-old-domain-to-a-new-domain-with-htaccess/