顯示具有 study 標籤的文章。 顯示所有文章
顯示具有 study 標籤的文章。 顯示所有文章

2024年10月3日 星期四

體驗 Google Cloud AI Study Jam 2024: goo.gle/csj-tw-2024


看著認識的 Google 技術傳教士分享這活動,趁颱風天來體驗一下 XD 總算做完 Path 1 的學習歷程,微累,但至少可以拿到個貼紙禮物了?XD


共 25 份學習教材,完成時間約 48 小時。

在影片觀看上,可以用兩倍速吸收,旁邊又有中文字幕,很不錯。整體耗時是還可以接受,倒是透過這次了解 vertex ai 的操作介面,很佛的設定好 prompt 後,還可以匯出程式碼,這點很方便,若要說卡關的話,好像有某堂課要驗證 vertex ai studio 某操作項目時,一直失敗,後來我猜到了,他是在掃已儲存的 prompt 的比對方式是用英文作為判斷,這時要把 vertex ai studio 的操作資料改成英文 (examples) 才能被偵測成功完成該項目。

整體上就熟悉一下 Google Cloud 服務,很順,此外 Path 1 某堂課也有稍微改 code 的地方,對於工程師背景的人來說,看懂題目,很簡單就能完成的。印象中,有一題很卡,題目上只有一個 example ,要自己再想另一個填入,接著,還要再想額外一個當作 promot & Test Input 來實驗(總共想兩個新句子),大概這題一開始不順會瞬間喪失自信 XD 但撐過了就沒問題了。經過這痛苦後,也被訓練到,看題目時可以挑熟悉的語言(中文),但建議還要另開一頁用英文的再看一次,避免翻中文時,一些關鍵操作看不懂。特別是一些操作選單,英文清楚非常多。

之前一直想用 LangChain 也略知一二,但恰好教學內容提了簡單 Python Code 真不錯,醍醐灌頂。

過去已經約一年多都在用 OpenAI API 開發服務,這次體驗了 Google 牌,也才了解 PaLMGemini 和 Vertex AI 的不同,之前 PaLM 剛推出來時,同事整合會議記錄,但整體上還是有不少需要客製化的地方,很快就放棄整合,沒想到 Google NotebookLM 最近推出,狂勝,且根據 Path 1 的學習歷程,大概能體會 Google 在 Responsible AI 投入很驚人的資源。

2014年6月4日 星期三

iOS 開發筆記 - 初學 Swift 與 Storyboard 互動方式,以 UITableViewController 和 prepareForSegue 為例



WWDC 2014 讓 Swift 出世見人,想學習的可先看 Apple 官網 Swift 文件:The Swift Programming Language,大概只要看完 A Swift Tour 即可有基本功力,看完心得:簡潔有力。接著,就可以看看 Using Swift with Cocoa and Objective-C 這份了,也是此次筆記項目。

首先下載 Xcode 6 beta 下來用,新增 Project 時,選用 Swift 程式語言,這時的程式架構就是 Swift 語法,與 Objective-C 大同小異,初次看還滿清爽的。

AppDelegate:

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
                         
    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    func applicationWillResignActive(application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(application: UIApplication) {
        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }

}


ViewController:

import UIKit

class ViewController: UIViewController {
                         
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}


接著,則是使用 Storyboard,承襲之前用 Xcode 開發的模式,新增元件後,可以拖拉到對應的程式碼(此例為 ViewController),就可以填寫一些 Code 了。

例如 UIButton 行為:

    @IBOutlet var button : UIButton
 
    @IBAction func myClick(sender : AnyObject) {
        println("Click")
        button.setTitle("change", forState: UIControlState.Normal);
    }


例如 UITableViewController :

import UIKit

class MyTableViewController: UITableViewController {
    var dataList = String[]()
 
    override func numberOfSectionsInTableView(tableView: UITableView?) -> Int {
        return 1
    }
 
    override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {
        return dataList.count
    }
 
    override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
     
        var cell:UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
     
        cell.text = dataList[indexPath.row]
     
        return cell
    }
 
}


以及 prepareForSegue 的用法:

    override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
        if segue.identifier.compare("showTable") == 0 {
            if segue.destinationViewController.isKindOfClass(MyTableViewController) {
                // Type 'AnyObject!' cannot be implicitly downcast to 'UIViewController'
                // var vc:UIViewController = segue.destinationViewController

                var tvc:MyTableViewController = segue.destinationViewController as MyTableViewController
             
                tvc.dataList.append("Hello")
                tvc.dataList.append("World")
            }
        }
    }


以上的小練習,就可以用 Swift 跟 Storyboard 切換 ViewController 等行為,而 UITableViewController 也稍微用了一下。

最後一提,目前使用 Swift 開發的不習慣之處:AutoComplete ! 沒了這招就真的等於砍掉重練了,試用的結果,不是按了 "." 之後會彈跳出來,而是要打 "->" 才會出現 Orz 我想應該還有不少待釐清的用法。