2019年10月21日 星期一

jekyll blog 建置

1. jekyll 套件有blog template,可見置static blog, 發佈到github,使用https://csjou-hwu.github.io/


Ref: https://ithelp.ithome.com.tw/articles/10198964



2. Windows 10 x64 @ ASUS DM6660

3. https://jekyllrb.com/docs/installation/windows/

Install Ruby @ Windows 10

    3-1 download https://rubyinstaller.org/downloads/
Ruby+Devkit 2.6.5-1 (x64)  132MB

    3-2 Install


    3-3 Enable Linux sub System

    3-3 Download/Install Ubuntu 18.04 LTS


    sudo apt-get update -y && sudo apt-get upgrade -y       //很久
    sudo apt-add-repository ppa:brightbox/ruby-ng
    sudo apt-get update
    sudo apt-get install ruby2.5 ruby2.5-dev build-essential dh-autoreconf
    sudo gem update
    sudo gem install jekyll bundler
--- Takes longer time far more than what I was expected.
4. jekyll new myblog1

5. cd blog

6. bundle exec jekyll serve --host=0.0.0.0





git clone https://github.com/csjou-hwu/csjou-hwu.github.io.git




2019年10月13日 星期日

helixtoolkit 3D基本元件

ASUS X450J @ Windows 10 x64/ VS2017

<h:HelixViewport3D>
            <h:HelixViewport3D.Camera>
                <PerspectiveCamera Position="0 0 50"
                                   LookDirection="0 0 -1"
                                   UpDirection="0 1 0"/>
            </h:HelixViewport3D.Camera>
            <h:DefaultLights/>
            <!-- 3D Model -->
<h:HelixViewport3D>

1.  <h:BillboardVisual3D Position="1 1 40" Width="240" Height="140"></h:BillboardVisual3D>
2. <h:BillboardTextVisual3D Position="1 1 40" Text="周重石" FontSize="60"/>

3. <h:ArrowVisual3D Point1="-20 7 0" Point2="1 1 40" Diameter="1" Direction="1 1 0"></h:ArrowVisual3D>
4. <h:BoxVisual3D Center="1 1 30" Width="2" Height="2" Length="2"  Fill="Green" />
5. <h:CubeVisual3D Center="1 1 30" SideLength="2"  >
6. <h:EllipsoidVisual3D Center="1 1 30" PhiDiv="3" RadiusX="2" RadiusY="2" RadiusZ="3">

7. <h:HelixVisual3D  Diameter="3" Fill="GreenYellow" Length="25" Radius="1">
8. <h:LinesVisual3D Color="Black" Thickness="15"  Points="0 0 0 5 5 0">
9. <h:PieSliceVisual3D Center="0 -10 0" Fill="Red" EndAngle="120" StartAngle="0" OuterRadius="20" InnerRadius="5">
10. <h:RectangleVisual3D Length="5"    LengthDirection="1 1 1" Width="2">
11. <h:PipeVisual3D Diameter="10" Fill="Yellow" InnerDiameter="5" Point1="0 0 0" Point2="-10 -10 0"  >
12.<h:SphereVisual3D Radius="5" Center="-10 0 0"/>
13. <h:TubeVisual3D AddCaps="True" Angles="45" Diameter="8" Fill="Aqua" Path="0 0 0 -10 10 10 -10 10 -10">




2019年10月6日 星期日

System.Speech vs Microsoft.Speech

Ref: https://www.wpf-tutorial.com/audio-video/speech-recognition-making-wpf-listen/
        Kinect SDK 1.8 SpeechBasic-WPF
1-1. ASUS X450J @ Windows 10 x64 Edu
1-2. Kinect SDK 1.8
1-3. Visual Studio 2017

2 Ex from https://www.wpf-tutorial.com/audio-video/speech-recognition-making-wpf-listen/
2-1 New WPF Project
2-2 Add System.Speech.DLL
2-3 using System.Speech.Recognition;
2-4
SpeechRecognitionEngine speechRecognizer = new SpeechRecognitionEngine();
        public MainWindow()
        {
            InitializeComponent();
            speechRecognizer.SpeechRecognized += SpeechRecognizer_SpeechRecognized;

            GrammarBuilder grammarBuilder = new GrammarBuilder();
            Choices commandChoices = new Choices("weight", "color", "size", "顏色");
            grammarBuilder.Append(commandChoices);

            Choices valueChoices = new Choices();
            valueChoices.Add("normal", "bold");
            valueChoices.Add("red", "green", "blue");
            valueChoices.Add("small", "medium", "large");
            valueChoices.Add("紅色", "黑色", "白色");
            grammarBuilder.Append(valueChoices);

            speechRecognizer.LoadGrammar(new Grammar(grammarBuilder));
            speechRecognizer.SetInputToDefaultAudioDevice();
            speechRecognizer.RecognizeAsync(RecognizeMode.Multiple);
        }
    private void SpeechRecognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            this.Content = e.Result.Text;
            //string command = e.Result.Words[0].Text.ToLower();
            //string value = e.Result.Words[1].Text.ToLower();
          }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            speechRecognizer.RecognizeAsyncStop();
            speechRecognizer.Dispose();
        }

3. Ref : SpeechBasic-WPF and ex2 Notes: The default CultureInfo is zh-TW
     @ Microsoft.Speech ==> without zh-TW.
3-1 Add Ref
C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Speech\11.0.0.0__31bf3856ad364e35\Microsoft.Speech.dll
3-2 using Microsoft.Speech.Recognition;
3-3
public partial class MainWindow : Window
    {
        SpeechRecognitionEngine speechRecognizer = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));
        public MainWindow()
        {
            InitializeComponent();
            speechRecognizer.SpeechRecognized += SpeechRecognizer_SpeechRecognized;

            GrammarBuilder grammarBuilder = new GrammarBuilder();
            grammarBuilder.Culture = new System.Globalization.CultureInfo("en-US"); 
           // System.Threading.Thread.CurrentThread.CurrentCulture;
            Choices commandChoices = new Choices("weight", "color", "size");
            grammarBuilder.Append(commandChoices);

            Choices valueChoices = new Choices();
            valueChoices.Add("normal", "bold");
            valueChoices.Add("red", "green", "blue");
            valueChoices.Add("small", "medium", "large");
            //valueChoices.Add("紅色", "黑色", "白色");
            grammarBuilder.Append(valueChoices);

            speechRecognizer.LoadGrammar(new Grammar(grammarBuilder));
            speechRecognizer.SetInputToDefaultAudioDevice();
            speechRecognizer.RecognizeAsync(RecognizeMode.Multiple);
        }
   
    private void SpeechRecognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            this.Content = e.Result.Text;
            string command = e.Result.Words[0].Text.ToLower();
            string value = e.Result.Words[1].Text.ToLower();
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            speechRecognizer.RecognizeAsyncStop();
            speechRecognizer.Dispose();
        }