2019年5月26日 星期日

ASUS ZE552KL Android 8.0 Joystick安裝

一、準備工具



二、Magisk Manager設定 & 模組安裝

  1. 打開Magisk Manager後,設置 -> 隱藏Magisk Manager
  2. 在打開Magisk Manager,點選Magisk hidden,選擇你忽略的程式(Google Play必勾)
  3. Magisk Manager -> 模組 點+,選擇terminal_systemizer-68.zip,重開機
  4. Magisk Manager -> 下載,找busybox 下載,重開機
  5. Google Play -> 下載Terminal Emulator for Android


三、安裝joystick與設定

  1. 打開檔案管理安裝gpsjoystick-unlocked-arm64-v8a.apk完後,生成另一個名稱的App,這邊我生成的GOGOGOMYMAP
  2. 這時原本的joystick就可以砍了
  3. 打開Terminal Emulator for Android,下指令打su請求最高權限(允許)
  4. 在下指令systemize,請現選項選 1
  5. loading完後,看列出來的清單你生成的GOGOGOMYMAP編號是多少就打多少,假設是4就打4
  6. 打完後,在打2,打完後在打y,重開機


四、參考連結

流程設定:https://www.kocpc.com.tw/archives/231872
流程設定-1:https://tedliou.com/archives/pokemon-go-android89/

ASUS ZE552KL Android 8.0 重新安裝

一、手機差點變磚的過程

  1. 我裝Magisk-v14.zip,發現ZE552KL Android 8.0裝下去,開不到桌面,差點變磚
  2. 只要Magisk不對就要重裝
  3. 還有裝錯作業系統的版本


二、準備工具



三、刷回原廠清單

  1. 我解壓縮在D:\platform-tools,在將UL-ASUS_Z012D-WW-15.0410.1807.72-user.zip、boot.img & recovery.img丟到D:\platform-tools
  2. 打開電腦的cmd,cd到D:\platform-tools
  3. 下指令fastboot flash boot boot.img
  4. 下指令fastboot flash recovery recovery.img
  5. 下指令fastboot reboot,此時同時手機點下 Power + (volume -),手出會出現選單,點選recovery,就會回到原廠清單了
  6. 手機清單先選擇wipe data/factory reset(比如升級不需要點)
  7. 手機清單在選擇apply update from adb
  8. 電腦cmd下adb sideload UL-ASUS_Z012D-WW-15.0410.1807.72-user.zip,安裝完restart即可
四、參考連結

重灌流程:https://www.asus.com/zentalk/tw/thread-318634-1-1.html
還原清單:https://www.asus.com/zentalk/tw/thread-297129-1-1.html

ASUS ZE552KL Android 8.0 解鎖 + Magisk

一、準備工具


硬體部分請準備一個SD卡裝在手機裡面,主要把ZE552KL_SIGNED_UnlockTool_9.1.0.7_180912_fulldpi.apk、MagiskManager-v7.0.0.apk、Magisk-v18.1.zip都丟進去

二、安裝ZE552KL_SIGNED_UnlockTool_9.1.0.7_180912_fulldpi

進ASUS桌面打開檔案管理直接開啟SD卡的ZE552KL_SIGNED_UnlockTool_9.1.0.7_180912_fulldpi,參考連結

三、platform-tools解壓縮 & twrp-3.1.1-0-Z012-20170826.img

我解壓縮在D:\platform-tools,在將twrp-3.1.1-0-Z012-20170826.img丟到D:\platform-tools

四、手機安裝twrp-3.1.1-0-Z012-20170826.img

手機請跟電腦用USB連線
後來,手機 設定 -> 關於手機 -> 軟體資訊 -> 版本號碼,一直點點到你是開發者人員
在去 手機 設定 -> 系統 -> 開發人員選項,把USB偵錯打勾即可

  1. 手機請點 Power + (volume +),就會進bootloader
  2. 打開電腦的cmd,cd到D:\platform-tools
  3. 下指令fastboot flash recovery twrp-3.1.1-0-Z012-20170826.img
  4. 下指令fastboot reboot,此時同時手機點下 Power + (volume -),手出會出現選單,點選recovery
  5. 後面會出現twrp,下面的Bar從左移到右,看到Install,選SD卡裡面的Magisk-v18.1.zip安裝後重開機
  6. 手機重開機完後到桌面,打開檔案管理安裝MagiskManager-v7.0.0.apk


五、參考連結

twrp版本:https://www.asus.com/zentalk/tw/thread-274158-1-1.html
Magisk版本:https://sourceforge.net/projects/magiskfiles/files/module-uploads/
Magisk版本-2:https://github.com/Magisk-Modules-Repo/terminal_systemizer/
MagiskManager版本:https://github.com/topjohnwu/Magisk/releases/

2018年6月21日 星期四

JSP/Servlet 圖片顯示

1.網頁直接瀏覽圖片的寫法

HttpServletResponse  response = this.getResponse(); 
File imageFile = new File("C://image.jpg");
try {
 ServletOutputStream myOut = response.getOutputStream();
 FileInputStream input = new FileInputStream(imageFile);
 BufferedInputStream buf = new BufferedInputStream(input);
 response.setContentType("image/jpeg");
 response.addHeader("Content-Disposition","inline; filename="+name);
 int readBytes = 0;
 while ((readBytes = buf.read()) != -1) {
  myOut.write(readBytes);
 }
 buf.close();
 input.close();
 myOut.close();
}catch (Exception e) {
 // TODO: handle exception
 e.printStackTrace();
}

2018年3月17日 星期六

Java apns for iOS + .p12檔案申請及產生

一、申請.p12:

首先要準備一個iOS 開發者帳號,後來進Apple developer登入,請到Certificates, Identifiers & Profiles->Identifiers->App IDs


點Edit,移到Push Notifications
1. Development SSL Certificate(開發時用)
2. Production SSL Certificate(上線後用)
在點Create Certificate...


這裡我們要先產生CertificateSigningRequest.certSigningRequest
去Launchpad 找 Key Access,點開,新增完存在你要存的地方




在回到Apple Developer上傳CertificateSigningRequest.certSigningRequest,在下載aps_development.cer,這邊我是選擇 Development

下載完後aps_development.cer點兩下,去Key Access,產生.p12檔(這個檔還不是push server要用),並將檔案輸出,密碼請記下來,這邊我把檔案命名deveploer.p12

目前有三個檔案

請打開終端機,以下三個指令產生檔案,請確認是否有裝openssl
openssl x509 -in aps_development.cer -inform der -out aps.pem
openssl pkcs12 -nocerts -out key.pem -in push.p12
openssl pkcs12 -export -in aps.pem -inkey key.pem -name "push" -out push.p12
就是push server需要的push.p12

二、Swift 4 Code:

以下是需要在你App新增的程式碼AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
    
        let center = UNUserNotificationCenter.current()
        center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
            // Enable or disable features based on authorization.
        }
        application.registerForRemoteNotifications()

        
        return true
    }
    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        
        let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
        print(deviceTokenString)
        
        
    }
    func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
        
        print("i am not available in simulator \(error)")
        
    }


四、Javanps:

import java.util.ArrayList;
import java.util.List;

import org.json.JSONException;

import javapns.communication.exceptions.CommunicationException;
import javapns.communication.exceptions.KeystoreException;
import javapns.devices.Device;
import javapns.devices.exceptions.InvalidDeviceTokenFormatException;
import javapns.devices.implementations.basic.BasicDevice;
import javapns.notification.AppleNotificationServerBasicImpl;
import javapns.notification.PushNotificationManager;
import javapns.notification.PushNotificationPayload;
import javapns.notification.PushedNotification;

public class Main {
 
 public static void main(String[] args) throws JSONException, CommunicationException, KeystoreException, InvalidDeviceTokenFormatException {
  int badge = 1; 
        String sound = "default";
        String msgCertificatePassword = "123456";
                            //90fb73e94659a1822caa51ca079734de6a7e60e44f260a1bfd1326bb4648d734
        String deviceToken = "31A7DA03C54A9AAE77E9E0CA01F4B138ABDFDE9712C2FC56738AD92E614B90FE"; 
        String message = "test push message to ios device11111111111";

        List tokens = new ArrayList();
        tokens.add(deviceToken);

        String certificatePath = "C:\\\\push.p12";
        boolean sendCount = true;

        PushNotificationPayload payload = new PushNotificationPayload();
        payload.addAlert(message); 
        payload.addBadge(badge);


        //payload.addCustomAlertBody(msgEX);
        if (null == sound || "".equals(sound)) {
            payload.addSound(sound);
        }

        PushNotificationManager pushManager = new PushNotificationManager();
        pushManager.initializeConnection(new AppleNotificationServerBasicImpl(
                certificatePath, msgCertificatePassword, false));
        List notifications = new ArrayList();

        if (sendCount) {
            Device device = new BasicDevice();
            device.setToken(deviceToken);
            PushedNotification notification = pushManager.sendNotification(
                    device, payload, true);
            notifications.add(notification);
        } else {
            List devices = new ArrayList();
            for (String token : tokens) {
                devices.add(new BasicDevice(token));
            }
            notifications = pushManager.sendNotifications(payload, devices);
        }

        List failedNotification = PushedNotification
                .findFailedNotifications(notifications);
        List successfulNotification = PushedNotification
                .findSuccessfulNotifications(notifications);
        int failed = failedNotification.size();
        int successful = successfulNotification.size();
        System.out.println("zsl=1¡G" + successful);
        System.out.println("zsl=2¡G" + failed);
        pushManager.stopConnection();
        System.out.println("zsl=3");

 }
 
}

2016年8月15日 星期一

Xcode 7.2 安裝CocoaPods

安裝CocoaPods

打開Terminal(終端機),打以下的的指令:
$ sudo gem install cocoapods


1. 用Xcode新增一個專案
2. 用Terminal(終端機),cd .../專案/,打以下的指令
$ pod init
3. 在打上
$ pod install
4. 以上指令跑完後,會新增 專案.xcworkspace,以後就直接開.xcworkspace的檔案