пятница, 12 ноября 2010 г.

Подготовка к экзамену 70-506: Silverlight 4, Development. Часть 4: Working with Data

В начало

Что нужно знать:

  • Format data.
    This objective may include but is not limited to: formatting string values in data binding, formatting culture-specific string values

  • Implement data binding.
    This objective may include but is not limited to: setting the data context, binding data sets to controls, binding elements to other elements, implementing INotifyPropertyChanged, implementing ObservableCollection, setting binding modes, setting a fallback value

  • Create and consume value converters.
    This objective may include but is not limited to: creating a value converter, referencing a value converter, passing parameters

  • Implement data validation.
    This objective may include but is not limited to: implementing the INotifyDataErrorInfo interface, implementing the IDataErrorInfo interface, implementing data binding errors (NotifyOnValidationError, ValidatesOnExceptions, ValidatesOnDataErrors, ValidatesOnNotifyDataErrors)

1. Format data.
Formatting string values in data binding (Типы форматирования, StringFormat)
Formatting culture-specific string values
Общие представления о кодировках

2. Implement data binding.
Setting the data context
Binding data sets to controls
Binding elements to other elements
Implementing INotifyPropertyChanged
Implementing ObservableCollection
Setting binding modes
Setting a fallback value (TargetNullValue)

3. Create and consume value converters.
Creating a value converter
Referencing a value converter
Passing parameters


Пошаговое руководство. Создание привязки данных с помощью конструктора Silverlight

4. Implement data validation.
Implementing the INotifyDataErrorInfo interface
Implementing the IDataErrorInfo interface
Implementing data binding errors

Блоги/Статьи:
Привязка данных (Data Binding) в Silverlight
Trying out Binding.StringFormat (EN)
Варианты реализации INotifyPropertyChanged
Класс ObservableCollection
Вводное руководство по WPF - Часть III (Связывание данных)
Silverlight 4: Обработка ошибок при связывании
Silverlight. Основы. Валидация. Часть 1. DataAnnotations & ValidatesOnExceptions
Silverlight. Основы. Валидация. Часть 2. IDataErrorInfo & INotifyDataErrorInfo
Mark Monster (EN)

Видео: (в основном EN):
Связывание данных. Часть 1. (RU)
Связывание данных. Часть 2. List Binding (RU)
Связывание данных. Часть 3. (RU)
Displaying and Manipulating Data
List Based Data Binding
Data Binding UI to .NET Classes with Converters
Data Binding
Simple Data Binding of UI to .NET Classes
How Do I: Use Binding Validation in Silverlight 3
Validating Data: Factoring and Logging
Validating Data: Getting Started
Validating Data: Valid and Invalid
Asynchronous Data Validation

Книга:
Книга “Введение в Silverlight 3” глава 14

Silverlight 4 Hands On Labs:
Silverlight Business Apps: Module 3 - Authentication, Validation, MVVM, Implicit Styles and RichTextBox Lab
Silverlight Validation, Binding, DataForm and DataGrid Lab

четверг, 11 ноября 2010 г.

Подготовка к экзамену 70-506: Silverlight 4, Development. Часть 3: Implementing Application Logic

В начало

Что нужно знать:

  • Handle events.
    This objective may include but is not limited to: handling routed events, bubbling events, implementing AddHandler.

  • Consume services asynchronously.
    This objective may include but is not limited to: creating and adding service references, handling asynchronous completed events, configuring service endpoints, handling service exceptions, handling timeouts

  • Work with background threads.
    This objective may include but is not limited to: spawning a background thread to execute code, returning data to the UI thread by using the dispatcher object, implementing the dispatcher timer

  • Work with dependency properties.
    This objective may include but is not limited to: creating dependency properties, specifying dependency property metadata, getting and setting dependency property values

  • Interact with attached properties.
    This objective may include but is not limited to: setting attached properties in XAML, getting and setting attached properties programmatically

  • Implement ICommand.
    This objective may include but is not limited to: executing an ICommand, implementing an ICommand, binding to an ICommand, passing a parameter

1. Handle events.
Handling routed events
Bubbling events
Implementing AddHandler

2. Consume services asynchronously.
Creating and adding service references
Handling asynchronous completed events, IAsyncResult 
Configuring service endpoints
Handling service exceptions
Handling timeouts

3. Work with background threads.
Class Dispatcher
Spawning a background thread to execute code
Returning data to the UI thread by using the dispatcher object
Implementing the dispatcher timer

4. Work with dependency properties.
Creating dependency properties
Specifying dependency property metadata
Getting and setting dependency property values

5. Interact with attached properties.
Setting attached properties in XAML
Getting and setting attached properties programmatically

6. Implement ICommand.
Executing an ICommand
Implementing an ICommand (Пример приложения для бизнеса, в нем реализованы ICommand, а так же следующие два пункта)
Binding to an ICommand
Passing a parameter

Блоги/Статьи:
Mark Monster (EN)
Маршрутизируемые события в Silverlight
Создание и настройка WCF сервиса в Silverlight 4 приложении
Приложения, управляемые службами, с использованием Silverlight 2 и WCF
Отображение данных в DataGrid при помощи LINQ и WCF в Silverlight
Silverlight 3 и WCF: Duplex
Который раз о фоновом потоке
Архитектура WPF. Dependency Properties
ЗАВИСИМЫЕ СВОЙСТВА (DEPENDENCY PROPERTIES)
Пример MVVM (Model-View-ViewModel) или программирование на WPF (Silverlight)
New SL4 Feature: Commanding (EN)
ICommand for Silverlight with Attached Behaviors (EN)

Video: (EN) 
Respond to Keyboard Events in Silverlight
How Do I: Use Command line Proxy Generation for Silverlight 3?
.NET RIA Services Intro
RIA Services support in Visual Studio 2010
WCF and Data Entity Modeling in Silverlight
Making Calls to Web Services
Asynchronous Downloads with the WebClient Class
How to Consume WCF and ASP.NET Web Services in Silverlight
Calling Web Services over HTTPS
HTTP Request with HttpWebRequest
Asynchronous Uploads with the WebClient Class
Http Communication
Using Multiple Threads with the BackgroundWorker
MVVM Introduction

Книга:
Книга “Введение в Silverlight 3” глава 12

Подготовка к экзамену 70-506: Silverlight 4, Development. Часть 2: Enhancing the User Interface

В начало

Что нужно знать:

  • Create or modify control styles.
    This objective may include but is not limited to: setting a style locally, setting a style at the page control level, setting a style globally, implementing implicit styles, overriding styles at different levels, creating based-on styles

  • Create control templates.
    This objective may include but is not limited to: creating a template, attaching a template, implementing a content placeholder, implementing template binding

  • Create or modify data templates.
    This objective may include but is not limited to: modifying item templates for data controls, creating a create template, creating an update template, using a user control as a data template

  • Manipulate visuals.
    This objective may include but is not limited to: transforming controls by using skew transformations, rotate transformations, scale transformations, translate transformations, or perspective transformations; applying pixel shaders

  • Animate visuals.
    This objective may include but is not limited to: creating storyboards, programmatically starting and stopping storyboards, implementing easing functions, using keyframes, triggering storyboard on load, repeating and reversing storyboards, setting keyframe begin time, responding to events, configuring bitmap caching

  • Implement behaviors.
    This objective may include but is not limited to: triggering storyboards by using behaviors, dragging and dropping elements, calling a method

  • Manage the visual state.
    This objective may include but is not limited to: creating states, creating state groups, transitioning states, programmatically changing states

MSDN:

1. Create or modify control styles.
Собственно, сам Class Style
Setting a style locally
Setting a style at the page control level
Setting a style globally
Implementing implicit styles
Overriding styles at different levels
Creating based-on styles

2. Create control templates.
Class ControlTemplate
Creating a template
Attaching a template
Implementing a content placeholder (видимо имелось ввиду  ContentPresenter)
Implementing template binding

3. Create or modify data templates.
Class DataTemplate
Modifying item templates for data controls
Creating a create template
Creating an update template
Using a user control as a data template

4. Manipulate visuals.
Transforming controls by using skew transformations
Rotate transformations
Scale transformations
Translate transformations
Perspective transformations
Applying pixel shaders
CompositeTransform (в списке, почему-то, не указан, но знать нужно обязательно)
TransformGroup (тоже)

5. Animate visuals.
Creating storyboards
Programmatically starting and stopping storyboards (пауза и возобновление)
Implementing easing functions
Using keyframes
Triggering storyboard on load
Repeating and reversing storyboards
Setting keyframe begin time
Responding to events
Configuring bitmap caching

6. Implement behaviors.
Тут я ничего не понял, видимо имелся ввиду StoryboardTrigger и производный от него StoryboardCompletedTrigger. Ну и ControlStoryboardAction тоже стоит посмотреть.
Triggering storyboards by using behaviors
Dragging and dropping elements
Calling a method

7. Manage the visual state.
Class VisualStateManager
Creating states
Creating state groups
Transitioning states
Programmatically changing states

Блоги/Статьи (в основном RU)
Mark Monster (EN)
SilverLight 3: Стили и ресурсы
Использование элементов стиля в Silverlight 2
Эти простые стили и ресурсы
Раздел Стили и Шаблоны на silverlight.su
Использование шаблонов для настройки внешнего вида и поведения контролов (Перевод Скота Гатри)
Применение функций ListBox и DataBinding для отображения данных списка (Перевод Скота Гатри)
Использование инструментов стилизации для улучшения внешнего вида приложения (Перевод Скота Гатри)
Темплейты
Вводное руководство по WPF - Часть V (Стили)
Вводное руководство по WPF - Часть IV (Шаблоны данных и триггеры)
Трансформация в Silverlight
Использование CompositeTransform в Silverlight 4
Трюки при создании и использовании элементов управления WPF и Silverlight
Простые поведения в Silverlight
Создание анимации с помощью XAML и Expression Blend
VisualStateManager или как удобно определить внешний вид приложений на WPF и Silverlight

Видео (в основном EN)
Модель Содержимого (ContentControl) (RU)
Triggers vs. Visual State Manager
Creating Styles
Styles
How Do I: Change Styles at Runtime in Silverlight 3
Modify an Existing Silverlight Theme
Use a Content Presenter with Templates
Templating a Simple Button Control
DataBinding and DataTemplates in XAML
How Do I: Basic Animation in Silverlight 3
How Do I: Improve graphics performance using CacheMode
Animation Easing Libraries
How Do I: Easing Functions in Silverlight 3
In-State Animation
Controlling Animations & Storyboards
Add States to a UserControl for Silverlight
Templates Without VSM
Templates and VSM
Silverlight Business Apps: Module 5.2 - Layout Visual States

Книги:
Книга “Введение в Silverlight 3” Главы 13,5

Silverlight 4 Hands On Labs:
Silverlight Business Apps: Module 3 - Authentication,Validation, MVVM, Implicit Styles and RichTextBox Lab

четверг, 4 ноября 2010 г.

Подготовка к экзамену 70-506: Silverlight 4, Development. Часть 1: Laying Out a User Interface

В начало

Что нужно знать:

  • Arrange content with panels.
    This objective may include but is not limited to: arranging content with panels (grid, stack panels, canvas, border, scroll viewer, ViewBox), managing grid properties (autosizing, star sizing, column definitions, row definitions, gridlines), setting Z order, setting visibility, setting orientation, setting positioning

  • Implement and configure core controls.
    This objective may include but is not limited to: implementing and configuring core controls (textbox, button, text block, checkbox) and content controls, referencing namespaces

  • Create user controls.
    This objective may include but is not limited to: creating user controls, creating control parts, mapping control parts

  • Implement a navigation framework.
    This objective may include but is not limited to: implementing caching on a frame, modifying journal mode, handling navigation events (Navigating, Navigated, NavigationFailed, NavigationStopped),  implementing and configuring deep linking

  • Display collections of items.
    This objective may include but is not limited to: implementing and configuring item controls (datagrid, listbox, items control, combo box, tree view), working with selected items and indices

  • Play media files.
    This objective may include but is not limited to: implementing digital rights management (DRM), playing streams, creating timeline markers, playing multiple audio tracks, displaying closed captioning, responding to timeline marker events, handling media playback events


    MSDN:

    1. Arrange content with panels.
    Элементы управления:
    Grid
    StackPanel
    Canvas
    Border
    ScrollViewer
    ViewBox

    Управление свойствами таблицы:
    Autosizing,Star sizing
    Column definitions
    Row definitions
    Gridlines

    Манипулирование элементами
    Setting Z order
    Setting visibility
    Setting orientation
    Setting positioning

    2. Implement and configure core controls.
    Textbox
    Button
    Text block
    Checkbox
    Content controls
    Referencing namespaces

    3. Create user controls
    Creating user controls (класс), пример создания 
    Creating control parts
    Mapping control parts

    4. Implement a navigation framework.
    Собственно, основные классы: NavigationService, Frame и Page
    Implementing caching on a frame
    Modifying journal mode, CanGoBack
    Handling navigation events:
    Navigating
    Navigated
    NavigationFailed
    NavigationStopped
    Implementing and configuring deep linking

    5. Display collections of items.
    Datagrid
    Listbox
    Items control
    Combo box
    Tree view
    Working with selected items and indices (см. также SelectionMode, SelectedValuePath, SelectedValue, SelecedItem)

    6. Play media files.
    MediaElement
    Implementing digital rights management (DRM)
    Playing streams
    Creating timeline markers
    Playing multiple audio tracks  (или имелись ввиду списки вопроизведения?)
    Displaying closed captioning
    Responding to timeline marker events
    Handling media playback events (MediaOpened, MediaEnded, MediaFailed)

    Блоги/Статьи (в основном RU):
    Mark Monster (EN)
    Управление внешним видом (Layout Management) в Silverlight 2
    Контролы - контейнеры
    Введение в SilverLight 4: Элемент управления ViewBox
    Вводное руководство по WPF – Layout
    CustomControl
    Navigation Framework
    Многостраничные приложения в Silverlight
    Навигация между страницами

    Видео (RU):
    Менеджер размещения Grid
    Менеджер размещения StackPanel
    Менеджер размещения Canvas
    Модель содержимого(Content Controls)
    Навигация в Silverlight-приложениях. Поисковая оптимизация
    Возможности по работе с элементами управления в Silverlight 2
    Создание элементов управления для платформы Silverlight 2
    MediaElement. Часть 1
    MediaElement. Часть 2

    Видео (EN):
    Grid Control Design-Time Row and Column Manipulation Features
    Intro To Xaml
    Adding Controls to an Application
    Using the ViewBox Control
    Embedding Video and Audio
    How to Build a Simple User Control
    Laying out Content with StackPanel
    UserControls
    Dynamic UserControl
    Using the Silverlight Canvas
    StandardGrid
    Navigation Framework
    Introduction to Media Players
    Creating a Media Player
    Implementing Audio Controls
    Loading Media at Runtime

    Книги:
    Книга “Введение в Silverlight 3” главы 8 и 9.

    Подготовка к экзамену 70-506: Silverlight 4, Development. Часть 0: Введение

    Пока готовился к beta экзамену накопилось много материалов и ссылок на материалы. Отстрелявшись решил все упорядочить и выложить. Может кому пригодится.

    Основная страница экзамена находится здесь.


    Итак, знания которые следует подтвердить при сдаче:

    Laying Out a User Interface (15%)

    • Arrange content with panels.
    • Implement and configure core controls.
    • Create user controls.
    • Implement a navigation framework.
    • Display collections of items.
    • Play media files.

    Enhancing  the User Interface (14%)

    • Create or modify control styles.
    • Create control templates.
    • Create or modify data templates.
    • Manipulate visuals.
    • Animate visuals.
    • Implement behaviors.
    • Manage the visual state.

    Implementing Application Logic (16%)

    • Handle events.
    • Consume services asynchronously.
    • Work with background threads.
    • Work with dependency properties.
    • Interact with attached properties.
    • Implement ICommand.

    Working with Data (17%)

    • Format data.
    • Implement data binding.
    • Create and consume value converters.
    • Implement data validation.

    Interacting with a Host Platform (11%)

    • Implement the printing API.
    • Create out-of-browser applications.
    • Access isolated storage.
    • Interact with the HTML DOM.
    • Access the clipboard.
    • Read from and write to the host file system.
    • Handle alternative input methods.

    Structuring Applications (13%)

    • Create and consume resource dictionaries.
    • Implement localization and globalization.
    • Handle application-level events.

    Deploying Applications (13%)

    • Configure the Silverlight plug-in.
    • Dynamically load application resources.
    • Create a client access policy.

    Итак, основные ссылки:

    Сайты/нужности:
    The Official Microsoft Silverlight Site (EN)
    Silverlight 4 Training Course на 9-ом канале (EN)
    Silverlight 4 Training Course (для скачивания) (EN)
    Автономная документация по Silverlight 4 (RU)
    То же самое, но он-лайн (RU)
    Книга “Введение в Silverlight 3” (RU)
    Центр разработчиков Silverlight (RU)
    Сильверлайтер (RU)
    Все о Microsoft Silverlight (RU)

    Блоги:
    Silverlight Team Blog (EN)
    Silverlight Tips of the Day (EN)
    Mark Monster (EN)
    Блог Сергея Пугачева (RU)
    Sergey Lutay's Blog (RU)
    Блог Сергея Байдачного (RU)
    А здесь весь список MVP по сильверлайту, почти у всех есть блоги, так что можно найти много интересной информации.

    Агрегаторы:
    SilverlightCream (EN)
    GotDotNet (RU)
    Хабра (RU)
    Доклады на TechDays (RU)

     Кажется, ничего не забыл… 


    А если все-таки забыл, шлите линки…

    вторник, 14 июля 2009 г.

    Postgres 8.4 и VC++ runtime error

    Собрался я тут было перевести рабочий сервер на Postgres 8.4. Для проверки решил поставить на своей машине, а он сволочь выдает сообщение "An error occured executing the Microsoft VC++ runtime installer".
    Немного покрутив пальцем у виска обнаружил, что в этом случае следует пускать инсталяху с ключом "--install_runtimes 0".

    А вот полный список ключей:
    • --prefix <путь>: директория в которую инсталировать postgres (по умолчанию %PROGRAMFILES%\PostgreSQL\8.X в Windows, /opt/PostgreSQL/8.X в Linux и /Library/PostgreSQL/8.X в Mac OS X);
    • --datadir <путь к директории данных>: определеяет где создавать диретокрию для храниня данных (по умолчанию $PREFIX/data) ;
    • --superpassword <пароль>: определяет пароль суперюзера (postgres который). Для Windows заодно и пароль пользователя от которого пускается сервис;
    • --port <номер порта>: определяет номер порта, по умолчанию 5432, но если порту уже занят установленым посгрисом то 5433 и тд;
    • --locale <локаль>: локаль по умолчанию;
    • --create_shortcuts [1|0]: определяет создавать ли ярлыки в меню "Пуск". По умолчанию 1;
    • --install_plpgsql [1|0]:определяет устанавливать ли pl/pgsql в template1. По умолчанию 1;
    • --install_runtimes [1|0]: (только Windows): определяет устинавливать или нет Microsoft Visual C++ runtimes перед установкой.По умолчанию 1.
    В принципе все данные по инсталции можно посмотреть на сайте EnterpriseDB

    пятница, 27 марта 2009 г.

    NPGSQL и Notification

    Решил я прикрутить к одной проге, которая хранит данные в postgresql, систему обмена короткими сообщениями между пользователями.

    Вроде бы все просто:
    Делаем таблицу для хранения сообщений, пишем функции для отправки и получения, и через listen и notify организуем оповещения о поступлении сообщения. Серверная часть вроде заработала быстро, а вот с клиентом возникли затруднения.

    В FormLoad написали:
    NpgsqlCommand listener = new NpgsqlCommand("listen "+ username,this.npgsqlConnection1);
    listener.ExecuteNonQuery();<
    this.npgsqlConnection1.Notification += new NotificationEventHandler(npgsqlConnection1_Notification);


    И в обработчике сообщения:
    NpgsqlCommand getmes = new NpgsqlCommand("select _функция_забора_сообщения_();", this.npgsqlConnection1);
    MessageBox.Show(getmes.ExecuteScalar().ToString(), "Срочное сообщение");


    Сообщение получалось почему то далеко не всегда, не смотря на то, что соединение использовало SyncNotification, и при закрытии конекшена прога подвисала, при этом сам NPGSQL не вызывал никаких эксепшенов.

    Немного порывшись в инете обнаружил какую то пространную фразу о thread'инге и переписал все так:
    Thread thread_new = new Thread(delegate()
    {
    NpgsqlCommand getmes = new NpgsqlCommand("select _функция_забора_сообщения_();", this.npgsqlConnection1);
    MessageBox.Show(getmes.ExecuteScalar().ToString(), "Срочное сообщение");
    });
    thread_new.Start();

    После чего эксепшен отловлен и был.

    Видимо, я снова что-то не дочитал в документации к NPGSQLю.