2011年10月5日 星期三

Moose--以Smalltalk開發的視覺化系統分析工具

Moose是一套以Smalltalk開發的視覺化系統分析工具,從1996年發展至今功能已非常強大,在產業及學界也有多個專案採用這套工具,Jimmy's papa曾用過Rational RoseTogether開發過專案,卻是頭一次聽過Moose,而且還是免錢的開放程式碼工具,這在台灣應該沒機會採用^ ^,以下是Jimmy's papa牛刀小試一番

  • 下載最近的版本 Moose Suite 4.5
  • 啟動程式
  • Mac: launch the app file;
  • Linux: launch .app/moose.sh
  • Windows: launch .app/moose.lnk
  • 文件可參考這裡The Moose Book

    寄件者 scratchlab

    在Workspace執行下列Smalltalk程式,則會產出NumberParser類別的Class Diagram

    view := MOViewRenderer new.
    view shape: UMLClassDiagram new umlShape.
    
    view interaction popupText.
    view nodes:  NumberParser withAllSubclasses asArray.
        
    view shape: (MOArrowedOrthoVerticalLineShape new).
    view edgesFrom: #superclass.
    
    view layout: MOTreeLayout new.
    view open
    
    寄件者 scratchlab

    在Workspace執行下列Smalltalk程式,則會產出URL類別的Class Diagram

    view := MOViewRenderer new.
    view shape: UMLClassDiagram new umlShape.
    
    view interaction popupText.
    view nodes:  Url withAllSubclasses asArray.
        
    view shape: (MOArrowedOrthoVerticalLineShape new).
    view edgesFrom: #superclass.
    
    view layout: MOTreeLayout new.
    view open
    
    寄件者 scratchlab

    2011年10月4日 星期二

    ROS(Robot Operating System) on Android

    以下是jimmy's papa整理的相關資料連結,如果能深入研究的話 對機器人操作平台基礎架構會有一定的概念,Jimmy's papa已經安裝好SL4A(Scripting Layer for Android)在平板上,改天再找時間研究看看如何安裝ROS

    ROS的介紹
    http://www.ros.org/wiki/ROS/Introduction

    VMI Android Mobile Main Package
    http://www.ros.org/wiki/android

    rosjava
    http://code.google.com/p/rosjava/
    http://www.ros.org/wiki/rosjava

    Get ROS running on Android
    https://vmi.lmt.ei.tum.de/svn/vmi-ros-pkg/trunk/vmi_android/android/README

    Android running ROScore
    https://vmi.lmt.ei.tum.de/projects/ros/wiki/Androidinstall

    Using Lego NXT with ROS
    http://www.ros.org/wiki/Robots/NXT
    http://www.ros.org/wiki/nxt/Installation

    2011年10月2日 星期日

    Pharo UITheme

    UITheme可用來安排UI畫面Layout,不過網路上的範例及說明文件很少,官方的資料只提到下列幾個範例,可以打開SystemBrowser閱讀相關程式碼

    UITheme exampleBasicControls.
    UITheme exampleColorControls.
    UITheme exampleDialogs.
    UITheme exampleGroups.
    UITheme exampleOtherControls.
    UITheme exampleWindowWithToolbars.
    

    以下是Pharo轉出的Smalltalk程式碼,是Jimmy's papa整理過的簡單範例程式,看起來很多,其實在Pharo的環境下寫沒幾行,在加上Smalltalkm語法規則超簡單,蠻容易上手的

    Object subclass: #HelloButton
        instanceVariableNames: 'builder content'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'JimmyScratchLab'!
    
    !HelloButton methodsFor: 'main' stamp: 'JimmyScratchLab 10/2/2011 23:35'!
    aboutButtonClick
         SmalltalkImage current aboutThisSystem.! !
    
    !HelloButton methodsFor: 'main' stamp: 'JimmyScratchLab 10/2/2011 10:22'!
    builder
        ^ builder
    ! !
    
    !HelloButton methodsFor: 'main' stamp: 'JimmyScratchLab 10/2/2011 10:24'!
    builder: anObject
        builder := anObject
    ! !
    
    !HelloButton methodsFor: 'main' stamp: 'JimmyScratchLab 10/2/2011 23:40'!
    helloButtonClick
        Transcript show: 'hello,JimmyScratchLab'; cr.
    
    ! !
    
    !HelloButton methodsFor: 'main' stamp: 'JimmyScratchLab 10/2/2011 10:24'!
    initialize
        self builder: UITheme builder.
    ! !
    
    !HelloButton methodsFor: 'main' stamp: 'JimmyScratchLab 10/2/2011 23:37'!
    open
    
    content := builder newColumn: {  
            builder newButtonFor: self 
            action: #helloButtonClick 
            label: 'Hello' 
            help: 'Say hello!!!!!!'.    
                
            builder newButtonFor: self 
            action: #aboutButtonClick 
            label: 'About' 
            help: 'Show About!!!!!!'.    
            }.
    
    (content openInWindowLabeled: 'HelloBouton') extent: 300@50.
    ! !
    
    "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
    
    HelloButton class
        instanceVariableNames: 'content'!
    
    !HelloButton class methodsFor: 'main' stamp: 'JimmyScratchLab 10/2/2011 10:20'!
    open
        ^ self new open.
    ! !
    

    在WorkSpace寫入HelloButton open後執行DoIt,便會在畫面出現HelloButton視窗

    寄件者 scratchlab