PIXNET Logo登入

彥霖 實驗筆記

跳到主文

個人筆記...

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 1月 12 週一 201514:32
  • Java FX 入門教學:文字區域

PrtScr capture

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(523)

  • 個人分類:[程式語言] Java
▲top
  • 1月 12 週一 201514:09
  • Java FX 入門教學:顯示文字


import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(862)

  • 個人分類:[程式語言] Java
▲top
  • 1月 04 週日 201511:56
  • Unity 入門教學:使用指針 Unsafe

預設 Unity C# 使用 Unsafe 會報錯,所以我們必須在 Unity 專案的 Assets 資料夾中建立 .rsp 文件,以更改編譯設定
每個腳本語言使用的 rsp 文件都不同,請依造您的需求參考以下表格來修改,例如 C# 就是 gmcs.rsp ....等等



語言
檔案名稱 & 路徑


C#
<Project Path>/Assets/smcs.rsp


C# - Editor Scripts
<Project Path>/Assets/gmcs.rsp


UnityScript
<Project Path>/Assets/us.rsp


Boo
<Project Path>/Assets/boo.rsp


(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(1,078)

  • 個人分類:[遊戲設計] Unity
▲top
  • 12月 23 週二 201413:56
  • Unity 入門教學:字串切割

using UnityEngine;
using System.Collections;
using System.Text.RegularExpressions;
public class Test : MonoBehaviour {
    void Awake () {
        string[] array = Regex.Split("AAA123BBB123CCC123", "123", RegexOptions.IgnoreCase);
        foreach(string s in array){
            print (s);
        }
    }
}
-----------------------------------------------------------------------
輸出結果:
AAA
BBB
CCC

(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(1,401)

  • 個人分類:[遊戲設計] Unity
▲top
  • 12月 11 週四 201415:24
  • JavaScript 替換全部字串

var s = s.replace(/\被替換的字串/g,"新字串");
例如:
var s = "AAA,BBB,CCC";
s = s.replace(/\,/g,"<br>");
輸出:
AAA<br>BBB<br>CCC
(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(131)

  • 個人分類:[程式語言] JavaScript
▲top
  • 12月 09 週二 201420:10
  • JavaScript 取得網址列參數

 
function getParameter(name) {
   name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(566)

  • 個人分類:[程式語言] JavaScript
▲top
  • 12月 09 週二 201410:43
  • JavaScript 入門教學:解析 Json 字串

<script>
 
    var jsontext = '{"name":"Loli","age":"12","phone":["091314520","021314520"]}';
(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(2,171)

  • 個人分類:[程式語言] JavaScript
▲top
  • 12月 05 週五 201419:25
  • Unity 入門教學:使用 httpWebRequest 上傳檔案

using UnityEngine;
using System.Collections;
using System;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Threading;
public class NewBehaviourScript : MonoBehaviour {
    string url = "http://219.85.250.149:8080/UploadFile"; // 伺服器上傳網址  
    string filePath = "/Users/Loli/Desktop/Easy Download/23-121026161100.jpg"; // 檔案路徑
    void Start () {
        UploadFilesToRemoteUrl (url, filePath);
    }
    private string UploadFilesToRemoteUrl(string url, string file)
    {
        // Create a boundry
        string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x");
        
        // Create the web request
        HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
        httpWebRequest.ContentType = "multipart/form-data; boundary=" + boundary;
        httpWebRequest.Method = "POST";
        httpWebRequest.KeepAlive = true;
        httpWebRequest.AllowWriteStreamBuffering = false;
        
        httpWebRequest.Credentials =
            System.Net.CredentialCache.DefaultCredentials;
        
        // Get the boundry in bytes
        byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
        
        // Get the header for the file upload
        string headerTemplate = "Content-Disposition: form-data; name=\"{0}\";filename=\"{1}\"\r\n Content-Type: application/octet-stream\r\n\r\n";
        
        // Add the filename to the header
        string header = string.Format(headerTemplate, "file", file);
        
        //convert the header to a byte array
        byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
        
        // Add all of the content up.
        httpWebRequest.ContentLength = new FileInfo(file).Length + headerbytes.Length + (boundarybytes.Length * 2) + 2;
        
        // Get the output stream
        Stream requestStream = httpWebRequest.GetRequestStream();
        
        // Write out the starting boundry
        requestStream.Write(boundarybytes, 0, boundarybytes.Length);
        
        // Write the header including the filename.
        requestStream.Write(headerbytes, 0, headerbytes.Length);
        
        // Open up a filestream.
        FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read);
        
        // Use 4096 for the buffer
        byte[] buffer = new byte[4096];
        
        int bytesRead = 0;
        // Loop through whole file uploading parts in a stream.
        while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
        {
            requestStream.Write(buffer, 0, bytesRead);
            requestStream.Flush();
        }
        
        boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
        
        // Write out the trailing boundry
        requestStream.Write(boundarybytes, 0, boundarybytes.Length);
        
        // Close the request and file stream
        requestStream.Close();
        fileStream.Close();
        
        WebResponse webResponse = httpWebRequest.GetResponse();
        
        Stream responseStream = webResponse.GetResponseStream();
        StreamReader responseReader = new StreamReader(responseStream);
        
        string responseString = responseReader.ReadToEnd();
        
        // Close response object.
        webResponse.Close();
        
        return responseString;
    }
}
(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(1) 人氣(2,782)

  • 個人分類:[遊戲設計] Unity
▲top
  • 12月 04 週四 201416:30
  • 嵌入式 Jetty 獲取目錄下所有檔案 ( 圖片之類的...

這裡提供兩種方法,但經過我的測試是 ResourceHandler 客戶端不能下載大檔案 (例如 > 5 MB) 會發生例外
而 WebAppContext 就沒這個問題,如果要使用大檔案建議使用 WebAppContext 來做會比較好
使用 WebAppContext 實作:
import org.eclipse.jetty.server.Server;
(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(78)

  • 個人分類:[程式語言] Java
▲top
  • 11月 25 週二 201419:15
  • Unity 入門教學:[模組化] 點擊物體後進入指定場景

螢幕快照 2014-11-25 下午7.32.47
這是一個用下拉式選單選擇場景,當遊戲運行後,玩家點擊物體(按鈕)就會依造選擇的場景地進入指定場景
還有如果按下 Esc 鍵,或手機的 Back 鍵也會觸發進入到指定的場景中,
這可以使用 UseBack 來控制是否要啟用這個功能
可以設定啟用 Click (滑鼠點擊),或 Back (按 Esc 鍵、按手機的 Back 鍵)
下拉選單:選擇要進入的場景
 
(繼續閱讀...)
文章標籤

黃彥霖 發表在 痞客邦 留言(0) 人氣(3,000)

  • 個人分類:[遊戲設計] Unity
▲top
«1...14151646»

實驗人員

黃彥霖
暱稱:
黃彥霖
分類:
數位生活
好友:
累積中
地區:

文章分類

  • [遊戲設計] Unity (100)
  • [程式語言] Java (91)
  • [程式語言] Go (31)
  • [程式語言] C # (15)
  • [程式語言] Python 3 (11)
  • [程式語言] Erlang (2)
  • [程式語言] Python 2 (2)
  • [程式語言] C++ (10)
  • [程式語言] C (8)
  • [程式語言] Node.js (5)
  • [程式語言] JavaScript (8)
  • [程式語言] Java-Android (2)
  • [資料庫] PostgreSQL (28)
  • [資料庫] Hadoop (2)
  • [作業系統] Linux (23)
  • [作業系統] Windows (3)
  • [作業系統] FreeRTOS (1)
  • [單晶片] Arduino (19)
  • [單晶片] ARM-STM32-F4 (15)
  • [單晶片] ARM-STM32-F1 (13)
  • [單晶片] ARM-LPC1114 (1)
  • [單晶片] PIC33FJ128MC804 (4)
  • [硬體設計] 常用IC (1)
  • [硬體設計] 3D 印表機 (3)
  • [硬體設計] 其他 (4)
  • [數學+程式語言] Matlab (4)
  • [數學] 應用數學 (2)
  • [論壇架設] Discuz! (1)
  • [科技新聞] 機器人 (3)
  • [轉碼工具] FFMPEG (1)
  • [檔案格式] 3D 檔案 (1)
  • [程式語言] 程式設計經驗談 (2)
  • [伺服器] GlassFish 筆記 (1)
  • [網頁] HTML 教學 (5)
  • [網頁] CSS 語法 (1)
  • [網頁] JSP / Servlet (7)
  • [網路監控] SmartSniff (1)
  • [虛擬機器] VirtualBox (1)
  • [電腦安全] 開發者 (1)
  • [美術設計] 繪畫 (0)
  • [3D設計] Blender 教學 (2)
  • [3D設計] Blender 外掛設計 (1)
  • [2D設計] GIMP Python (2)
  • [3D設計] Shroud Studio (3)
  • [展示] 作品、比賽、專題 (4)
  • [人類語言] 希伯來語 (1)
  • [金融] 外匯 (1)
  • 未分類文章 (1)

FB 粉絲頁

最新留言

  • [24/05/04] 訪客 於文章「Arduino 入門教學:讀取 ADXL...」留言:
    我想問一下關於ADXL345的問題,我在ARDUINO上測量...
  • [23/01/14] 訪客 於文章「Arduino 入門教學:Timer 使...」留言:
    如果我的callfunction是需要帶參數的 那t.ev...
  • [21/10/21] 陳霖 於文章「Arduino 入門教學:讀取 LSM3...」留言:
    不好意思不知道您還看不看的到,想請問您,你抓出的加速度器資料...
  • [21/07/23] wjb5741 於文章「Arduino 入門教學:讀取 ADXL...」發表了一則私密留言
  • [21/07/23] wjb5741 於文章「Arduino 入門教學:讀取 ADXL...」發表了一則私密留言
  • [20/10/27] 蔡金龍 於文章「STM32F1 入門教學:UART 接收...」發表了一則私密留言
  • [20/09/17] 秋本 嵐 於文章「Unity 入門教學:使用攝影機...」留言:
    您好,我最近在做Unity與Webcam相關的東西。 我想...
  • [20/08/09] 訪客 於文章「STM32F4 入門教學:SysTick...」留言:
    謝謝分享 ~ : )...
  • [20/07/24] 楊昇逸 於文章「C++ ( Qt 5 ) 入門範例:各種...」發表了一則私密留言
  • [20/03/04] 訪客 於文章「Java Json 教學:使用 org....」留言:
    <script>alert('hello');</scrip...

參觀人氣

  • 本日人氣:
  • 累積人氣: