本篇來簡單示範如何讓一個底線活潑的動起來,讓使用者直接感受到切換的感覺

// 由於是要同時移動以及縮放,所以用一個animatorSet包起來
var animatorSet = AnimatorSet()
//設定兩種動畫: 移動translationX, 縮放:scaleX
animatorSet.playTogether(

Chris 發表在 痞客邦 留言(0) 人氣()


今天對一隻程式進行壓力測試的時候,跑一個晚上發現Python 拋出這樣一個Exception:
 IOError: [Errno 24] Too many open files:

這樣的問題很有可能就是某個地方沒有正確的釋放file handle

這時候如果可以知道當下握住哪些檔案就可以很容易知道是哪段程式碼有問題了

在此紀錄兩款方便的小工具

Chris 發表在 痞客邦 留言(0) 人氣()

在看開源碼的時候,很容易看到像這樣的function parameter,附帶一個星號的參數 *args ,或是附帶兩個星號的參數 **kwargs,這是python 裡面很常用的語法,可以讓python接收任意數量的參數

def foo(param1, *args, **kwargs): # 順序不可對調!!
     pass

*args : 可變的參數串列(positional arguments),所謂的"可變",也就代表著呼叫該function時,我們可以完全忽略他,不帶任何參數;亦或者是一次給他多個參數。

def foo(param1, *args):

Chris 發表在 痞客邦 留言(1) 人氣()

曾經學過C++的,回頭過來看Python,可能就會誤認為Python 也有pass-by-value, pass by reference的概念就怕會不會因此在參數傳遞時產生大量不必要的運算量而拖慢了系統效能
但其實Python主要背後運作都是基於pass by reference的作法去實現的,其背後意涵有兩個
1. Python 都是傳遞物件的參照,但是傳過去說穿了也只是複製參照的數值,如實的傳進method當中,並且這個數值同樣指向相同的物件
2. 有些資料型態是可變的(mutable),反之有些則是不可變的(immutable)
也就是說:

Chris 發表在 痞客邦 留言(1) 人氣()

#include <stdio.h>
#include <future>
using namespace std;
int main()
{

Chris 發表在 痞客邦 留言(0) 人氣()

語法(Syntax) :


static_cast < new_type > ( expression )

Returns a value of type new_type.


1.  可用在很多種情況 但是無法去除(constness or volatility. ),最常見的是implicit conversition

例如將float 轉型成 int

Chris 發表在 痞客邦 留言(0) 人氣()

現在要來看一下map()函式的用法!!

簡單看一下官方文件的簽名:


  • map(function, iterable, ...)

  • Apply function to every item of iterable and return a list of the results. If additional iterable arguments are passed, function must take that many arguments and is applied to the items from all iterables in parallel. If one iterable is shorter than another it is assumed to be extended with None items. If function is None, the identity function is assumed; if there are multiple arguments, map() returns a list consisting of tuples containing the corresponding items from all iterables (a kind of transpose operation). The iterable arguments may be a sequence or any iterable object; the result is always a list.
  • Chris 發表在 痞客邦 留言(1) 人氣()

    在C# 裡面有提供內建的排序方法,內部使用Quicksort algorithm,這邊介紹三種解法對不同的需求進行排序。

  • Primitive types

  • Custom types using delegate

  • Custom type using ICompareable

  • Array.Sort()

    Chris 發表在 痞客邦 留言(0) 人氣()

    Arduino Yun是一個非常強大的開發版,人人都會用~!

    但是總是透過C#來取得傳出來的資訊就絕對不是人人都曉得囉
    這裡要來介紹怎麼樣使用 C# 來取得 Arduino 使用Serial.print() 傳出來的資料

    Chris 發表在 痞客邦 留言(0) 人氣()


    在原生的Visual 2013並沒辦法直接開始XNA的專案,不曉得是什麼原因,難道是因為XNA要被放棄了嗎?

    網路上還是有許多不同的方式能夠讓Visaul2013/2015使用XNA

    很幸運地已經有人寫出一個腳本,

    輕輕鬆鬆滑鼠左鍵按兩下,等它安裝完後就可以讓你的Visaul2013/2015操控XNA囉~!!!    
    >> 點我下載

    Chris 發表在 痞客邦 留言(0) 人氣()


    這邊要來講解如何使用DrawingBrush來畫出棋盤格/地板

    今天預計的成果要達到這樣↓↓↓

    學會了之後就可以做點小小修改,再搭配3D的渲染,就可以畫出地板的模樣,看起來是不是還不錯呢?

    如果你也想要做出上面那張圖的效果,可能就讓您小失望啦~!這篇並不會說到如何使用3D來作畫...

    接下來開始進入正文囉~!!

    Chris 發表在 痞客邦 留言(0) 人氣()

    在WPF中如果需要用到Timer 則可以使用DispatcherTimer。

    透過這個Timer,可以直接改變視窗上資料呈現,若使用其他種Timer的話則要進一步使用Dispatcher才能夠實現囉!!

    講到Timer,.NET裡面有一大堆各式各樣不同的Timer可以使用,詳細用法之後有空再補囉^^!!!

    用法如下

    using System.Windows.Threading;

    Chris 發表在 痞客邦 留言(0) 人氣()

    1 2
    Blog Stats
    ⚠️

    成人內容提醒

    本部落格內容僅限年滿十八歲者瀏覽。
    若您未滿十八歲,請立即離開。

    已滿十八歲者,亦請勿將內容提供給未成年人士。