2017年7月27日 星期四

[ServiceNow] Sending Survey Invitation to caller after an incident was closed

Login ServiceNow

To view existing surveys, go to [Survey] > [View Surveys]

To create a new survey, go to [Survey] > [Survey Designer]

After a survey is created, go to [Survey] > [View Surveys] and open the survey.

Tick the checkbox "Send Notifications" > Save

Now, we need to create an email notification.


Go to [Survey] > [Administration] > [Trigger Conditions] > [New]

* Assessment = name of survey
User field = Caller
* Table = choose a table (e.g. Incident)
* Condition = condition to send this survey invitation


e.g. Incident state is "Closed"

Click "Save"

A business rule called "Auto assessment business rule" will be created automatically.


To view the email template,


[System Notification] > [Email] > [Notifications]

Search "Survey User Invite"

Testing


When the state of an incident changed to "Closed", an email titled "Survey invitation: New survey on Incident Solution Feedback" will be sent to the incident caller.

2017年7月25日 星期二

Java Get Html Source Using SSL

package com;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;

import javax.net.ssl.URLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

public class HttpsExample
{
   
   
    public static void main(String[] args)
    {
        new HttpsExample();
       
    }
   
    public HttpsExample()
    {
        run();
    }
   
    public void run()
    {
        try
        {
            // Create a new trust manager that trust all certificates
            //*
            TrustManager[] trustAllCerts = new TrustManager[]{
                new X509TrustManager() {
                    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                        return null;
                    }
                    public void checkClientTrusted(
                        java.security.cert.X509Certificate[] certs, String authType) {
                    }
                    public void checkServerTrusted(
                        java.security.cert.X509Certificate[] certs, String authType) {
                    }
                }
            };

            // Activate the new trust manager
           
            try {
                SSLContext sc = SSLContext.getInstance("TLS");
                sc.init(null, trustAllCerts, new java.security.SecureRandom());
                HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
            } catch (Exception e) {
            }
            //*/
           
           
            URL url = new URL("https://portal.cuhk.edu.hk/psp/epprd/?cmd=login&languageCd=ENG&");
            //System.out.println(url.openConnection().getClass());
            URLConnection connection = url.openConnection();
            InputStream is = connection.getInputStream();
            BufferedReader br = new BufferedReader( new InputStreamReader( new BufferedInputStream( is ) ) );
            String tmp;
            while(true)
            {
                tmp = br.readLine();
                if(tmp==null)
                {
                    break;
                }
                System.out.println(tmp);
            }
            br.close();
            is.close();

        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}

2017年7月11日 星期二

Install EGIT for Eclipse

Open Eclipse > Help > Install New Software

Enter http://download.eclipse.org/egit/updates for URL

Select all items to install

Wait until finish...


To download a project from GitHub


Open Eclipse > Window > Show View > Git Repositories

Right click > Paste Repository Path or URI

Enter github project url

e.g. https://github.com/tamhonwa/sakatsuku.git

Next > Enter a path for GitHub to download the source code, the folder must be empty.

Right click the repository > Import Projects... > Select the project you want to download

2017年7月10日 星期一

javascript draw rotating circle

delta y
delta x
radiu y
radiu x