發表文章

Python 環境安裝 一. 到Anaconda官網下載並安裝 1.添加系統環境變數       (安裝路徑)\Anaconda2       (安裝路徑)\Anaconda2\Scripts 二.設定envs 1.開啟cmd.exe 2.> conda create --name py27 python=2 結果: 新增 D:\Tool\Anaconda2\envs\py27 3.> activate py27 結果: >where python ...\Anaconda2\env\py27\python.exe 4.(py27) >conda install [numpy/其他套件] 結果: 下載套件到 D:\Tool\Anaconda2\envs\py27\Lib\site-packages\numpy 5.(py27) > conda update [conda/anaconda-navigator/其他] //最後 (py27) >deactivate >anaconda-navigator -> 開啟 anaconda-navigator Anaconda 指令: anaconda login => 輸入 account / password activate [py27] conda install conda info //-------------------------------------------------------------------------------------------------- IPython HelloWorld 1.開啟cmd.exe (console1)>jupter qtconsole (console2)>vim hello  ...
Python import import [module] (as X) import [Package].[Module] (as X) import [Package].[Module].[Class] (錯誤) from [Module] import [Class] (as X) from [Package].[Module] import [Class] (as X) from [Package] import [Module].[Class] (as X) EX 假設一個package有 __init__.py _cmeans.py 兩個檔案,而且_cmeans.py有函式 cmeans, cmeans_predict __init__.py 內容: __all__ = ['cmeans',            'cmeans_predict',            ] from ._cmeans import cmeans, cmeans_predict
Rasberry Pi 2 初次 設定 硬體需求:1.Rasberry Pi 2                   2.Micro SD Card                  3.PC/NB                  4.USB轉SD Card 轉接頭 軟體需求:1.PI的OS: Rasbian/其他 步驟:    將Rasbian的image檔由 Win32DoskImager 燒入到SDCard上    設定config.txt 符合連接PI顯示器

C#

C#  [**] static 方法 只能存取外部的static 變數 //Example.cs namespace TetrisServer {     class Program     {         static private string ip;         private int port;         static void Main(string[] args)         {             ip = "XXX"; //OK             port = 57; // fail         }     } } 字串處理 1. string str = "asdaa asd qwe"; string str1 = str.Substring(0,str.IndexOf(" ")); //=> "asdaa" string str2 = str.Substring(str.IndexOf(" ")+1); //=> "asd" 2. string str = "asdqwe asd sad"; string[] strr = str.Split(new char[] { ' ' }); //=> strr = "asdqwe","asd","sad" ------------------------------------------------------------...

C# Program 常見錯誤

沒有實體 1.new 物件陣列 ,每個element還是 null 2. new 物件,每個member還是null public class subClass { public int i; }; public class myclass {public int i; public subClass s;} public class Program{           static public T [] CreateInitializedArray < T >( int size ) where T : new () { var arr = new T [ size ]; for ( int i = 0 ; i < size ; i ++) arr [ i ] = new T (); return arr ; }         static void Main()         {            myclass[] c = new myclass[5];             //錯誤1             c[0].i = 5;// c[0] is null !!               //修正1.1            for(int i=0; i<5; ++i)                c[i] = new myclass();     ...

C# DataStructure2

class 成員 的 get set class Pet { public string Name { get ; set ; } public int Age { get ; set ; } } public static void Ex1() { Pet[] pets = { new Pet { Name= "Barley" , Age=8 }, new Pet { Name= "Boots" , Age=4 }, new Pet { Name= "Whiskers" , Age=1 } }; } Array 長度 int[] a = new int[5]; int l = a.Length; => l=5

C# DataStructure

1.List<T>.OrderBy() 用法 ---------------------------------------------------- 原型: public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>( this IEnumerable<TSource> source, //不用理他 Func<TSource, TKey> keySelector //! ) ---------------------------------------------------- class Pet { public string Name { get ; set ; } public int Age { get ; set ; } } public static void OrderByEx1() { Pet[] pets = { new Pet { Name= "Barley" , Age=8 }, new Pet { Name= "Boots" , Age=4 }, new Pet { Name= "Whiskers" , Age=1 } }; IEnumerable<Pet> query = pets.OrderBy(pet => pet.Age); //指定 keyseletor foreach (Pet pet in query) { Console.WriteLine( "{0} - {1}" , pet.Name, pet.Age); } } ========================================================================================= http://ithelp.ithome.com.tw/articles/10100451 2...