2018年1月1日 星期一

電腦是Private IP設定遠端連線

Data source : https://support.microsoft.com/en-us/help/4028379/windows-10-how-to-use-remote-desktop
Use Remote Desktop on your Windows 10 PC or on your Windows, Android, or iOS device to connect to a PC from afar.
  • First, you'll need to set up the remote PC to allow remote connections. On the remote PC, open Settings  and select System > About. Note the PC name. You'll need this later. Then, under Related settings, select System info.
  • In the left pane of the System window, select Advanced system settings
  • On the Remote tab of the System Properties dialog box, under Remote Desktop, select Allow remote connections to this computer, and then selectOK.
  • Next, in Settings , select System > Power & sleep and check to make sure Sleep is set to Never.
  • Do one of the following:
    • On your local Windows 10 PC: In the search box on the taskbar, type Remote Desktop Connection, and then select Remote Desktop Connection. In Remote Desktop Connection, type the full name of the remote PC, and select Connect.
    • On your Windows, Android, or iOS device: Open the Remote Desktop app (available for free from Microsoft Store, Google Play, or the Mac App Store), and add your remote PC.  Select the remote PC, and then wait for the connection to complete.

2017年9月18日 星期一

[Unity 3D] Vuforia鏡頭自動對焦

選擇vuforia資料夾 > Scripts > DefaultTrackableEventHandler

加入黃框內的程式碼

2017年6月8日 星期四

[Android] 讓畫面支援不同螢幕大小的手機

在AndroidManifest.xml裡加入以下語法︰

<supports-screens android:resizeable=["true"| "false"]

                  android:smallScreens=["true" | "false"]
                  android:normalScreens=["true" | "false"]
                  android:largeScreens=["true" | "false"]
                  android:xlargeScreens=["true" | "false"]
                  android:anyDensity=["true" | "false"]
                  android:requiresSmallestWidthDp="integer"
                  android:compatibleWidthLimitDp="integer"
                  android:largestWidthLimitDp="integer"/>


data source: https://developer.android.com/guide/topics/manifest/supports-screens-element.html

2017年1月14日 星期六

[WPF] 抓取網頁資料

Step 1: 工具 > NuGet封裝管理員 > 管理方案的NuGet套件

Step 2: 瀏覽 > 搜尋HtmlAgilityPack > 安裝HtmlAgilityPack

*xpath是使用HAPXPathFinder v0.9軟體來尋找出來的,範例檔有提供

Step 3: Coding
using HtmlAgilityPack;
using System.Net;
using System.IO;

string url = "http://www.just-the-word.com/main.pl?word=hello";
string xpath = "/html[1]/body[1]/div[1]/div[3]/div[1]";  //xpath是使用HAPXPathFinder v0.9軟體來尋找出來的

HttpWebRequest httpWebRequest = WebRequest.Create(url) as HttpWebRequest;
try
{
    HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse;

     Stream stream = httpWebResponse.GetResponseStream();
     StreamReader reader = new StreamReader(stream, Encoding.UTF8);
     string s = reader.ReadToEnd();
     reader.Close();
     stream.Close();
     httpWebResponse.Close();

     HtmlDocument htmlDoc = new HtmlDocument();

     htmlDoc.LoadHtml(s);
     //16GB 32GB 64GB 的運送時間XPATH
     HtmlNode anchors = htmlDoc.DocumentNode.SelectSingleNode(xpath);
     //HtmlNode anchors32 = htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[2]/div[3]/div/div[2]/div[2]/div[3]/ul/li[2]/label/span/span[3]/span");
     //HtmlNode anchors64 = htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[2]/div[3]/div/div[2]/div[2]/div[3]/ul/li[3]/label/span/span[3]/span");

     //output
     //set RichTextBox
     richTextBox.Document.Blocks.Add(new Paragraph(new Run(anchors.InnerText)));
     //get RichTextBox
     //string richText = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd).Text;
}
catch (WebException web)
{
     //error message
}

完成

參考資料:
http://www.just-the-word.com/main.pl?word=walk&mode=combinations#N N*

範例檔下載

2017年1月9日 星期一

[Unity 3D] Text放大不失焦和調整AR拍攝距離

Text放大不失焦

調整AR拍攝距離
AR Camera > Camera > 調整屬性Field of View的數值

[Unity 3D] Image元件和Toggle按鈕(複選題)

從屬性欄位設定Image Source,顯示圖片
Step 1:

Step 2:

Toggle按鈕(複選題)
Step 1:
Step 2:
Step 3:

[Unity 3D] Keeping the object on the screen even when the target is lost


讓AR Camera 偵測到目標物後,產生的虛擬物件不會消失的方法有兩種:

The first one : 設定屬性
Step 1 : 要把ImageTarget 放到 ARCamera階層下.
Step 2 : Enable Extended Tracking 的選項打勾.

The Second one : 修改腳本
The script that handles what happens when tracking is lost is called DefaultTrackableEventHandler.cs and is found in Assets > Vuforia > Scripts. 
In that file you will find a function OnTrackingLost() This function disables all the renderComponents and colliderComponents for each of the children of the ImageTarget. If you want your object to stay visible comment out the following foreach loops like so:
private void OnTrackingLost()  //當目標物遺失就執行這方法
{
    Renderer[] rendererComponents = GetComponentsInChildren(true);
    Collider[] colliderComponents = GetComponentsInChildren(true);
    /*
    // Disable rendering:
    foreach (Renderer component in rendererComponents)
    {
        component.enabled = false;  //把false改成true,當目標物遺失虛擬物件不會跟著消失
    }

    // Disable colliders:
    foreach (Collider component in colliderComponents)
    {
        component.enabled = false;   //把false改成true,當目標物遺失虛擬物件不會跟著消失

    }
    */
    Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost");
}