2012-02-10 02月10日の日記 (2012年)
■[html5][css3] Introduction to CSS3 Transitions & CSS3 Animations (CSS3, MSDN, HTML5)
CSS3 TransitionsとAnimationsについての資料があったのでメモメモ。
綺麗な記事ですごく分かりやすいです。
何気に、記事の下のほうに各ブラウザの対応状況が載っているのが
一番興味示しました。IE以外のブラウザはほぼ対応している状態。
IEは、次のバージョンである10.0からみたいですね。
記事の後半は、どちらも対応していないブラウザで
javascriptで同じ動作をさせるためのコードが記述されています。
メモメモ。
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
購入: 1人 クリック: 15回
2012-02-01 02月01日の日記 (2012年)
■[C#][DevExpress] DevExpress奮闘記-094 (CodeRush Tips&Tricks)
CodeRushやRefactorのTipsがいっぱい記述されているページを発見。
メモメモ。ここ凄い。
- DevExpress CodeRush Tips&Tricks
- Category 'CodeRush'
- Category 'Common'
- Category 'DXCore'
- Category 'Refactor'
一つ一つの記事に、ちゃんとイメージもついているのでものすごく見やすいです。
よく見てみると、ブログオーナーさん、DevExpressの人みたいですね。
メモ:今度日本語に翻訳して、記事をここにアップしていって良いかメールしてみよう。
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
■[mono][C#] MacだとMonoDevelopでアプリが実行できない件について (Mono, MonoDevelop, Run On External Console, ScriptError)
これ、すでにFAQなのかもしれないですがとりあえずメモメモ。
私のMac(Snow Leopard)だと、多分MonoDevelopのバージョンが2.4? 2.5?くらいから
プログラムを記述して実行しても、実行時に
ScriptError: xxxxxxx
という記述が表示されて実行することができませんでした。
以下のようなエラーとなります。
Finderで見てみると、実行モジュール自体はちゃんと出来ていたので
コンパイルは正常に行えているみたいでした。
面倒くさかったので、そのまま放置プレイしていましたが
先日、以下の設定を行うと実行できました。
プロジェクト設定にて「Run on External Console」のチェックを外すと実行できる。
まず、プロジェクト設定にて以下の場所を表示します。
デフォルトで、Run on External Consoleにチェックがついているので外します。
どうも、2.4のリリースノートに記載があるので、これが原因だったみたいです。
- What's new in MonoDevelop 2.4
試したバージョン:
- Mono 2.10.8
- MonoDevelop 2.8.5
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
2012-01-30 01月30日の日記 (2012年)
■[asp.net][C#] ASP.NET MVC 4 Mobile Features (MSDN, スマフォ, Windows Phone, 英語)
まだ、中身を読んでいないけどとりあえずメモメモ。
- ASP.NET MVC 4 Mobile Features
- ASP.NET MVC 4 Mobile Features (Tutorial完全版)
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
2012-01-20 01月20日の日記 (2012年)
■[C#][DevExpress] DevExpress奮闘記-093 (v2011 vol.2リリースノート 個人的まとめ)
v2011 vol2がリリースされてから、結構経過していますが今頃リリースノートまとめです。
所々訳が分からなかったり、おかしかったり、面倒なのでそのままの部分とかありますが
ご勘弁を。
ざらっと新機能の一覧を一枚で見たい方は、良ければどうぞ。
v2011 vol.2のリリースノートは以下で見ることが出来ます。
- What’s New in 11.2
[大きな点での追加機能]
- タッチサポート
- DXLayoutControlにTile Layoutが追加された
- DXScheduler for Silverlightが追加された
- DXPivotGrid for Silverlightが追加された
- MapControl for Silverlightが追加された
- WPFとSilverlightにGaugeコントロールが追加された
- WPFとSilverlightにState Indicatorコントロールが追加された
- WPFとSilverlightに新しいエディタコントロールが追加された
- Silverlightのプロジェクトウィザードが追加された
- WPF用のテーマエディタが追加された
- ASP.NET用のテーマビルダーが追加された
- XAFのASP.NETアプリがAjaxベースのUIとなった。
- XAFに新たなセキュリティシステムが追加された。(メンバーレベルとオブジェクトレベル)
- XAF用の中間層アプリケーションサーバーが追加
- XAF Domain Components Technologyがリリース
- XPOにて、パフォーマンスの改善、CriteriaOperatorの改善、XPOProfilerのリリース
- クロスプラットフォームライブラリの改善
- あといろいろ・・・
[WPF]
- タッチサポート
- DataGrid
- TreeList
- Chart
- Gauge
- PivotGrid
- DockingLibrary
- RichTextEditor
- WPFレポートビューアにて、watermarkのサポート
[WPF Grid Control]
→WcfInstantFeedbackDataSourceを利用。
- 新たなスクロールモード「Fix Group Rows」が追加
→グループ化した際の帯の部分を固定してスクロールできるモード。(XtraGridにも存在する。)
- グループサマリーの表示にて、カラム毎に表示位置(左寄せ、中央寄せ、右寄せ)を設定出来るようになった。
- ICollectionViewとIEditableCollectionViewのサポート
- PLINQのサポート
→データソースとして、PLINQをサポート。以下のデータソースクラスを利用する。
・PLinqServerModeDataSource
・PLinqInstantFeedbackDataSource
- MVVM用の拡張
- 列とデータサマリーに対するバインディング
- 自動生成列に対してのテンプレートの利用
- 行選択状態の同期
- TreeListView用の拡張
- 複数ノード選択とクリップボードサポート
- Hit Testのサポート
- レイアウトのシリアライゼーションサポートとその他諸々・・
- その他の改良点
- グループサマリーの非同期ローディング
- カラムヘッダーの水平スクロール
[WPF Tree List]
- タッチサポート
- 複数ノード選択とクリップボードのサポート
- Hit Testのサポート
- レイアウトのシリアライゼーションサポート
- HieararchicalDataTemplateのサポート
[WPF Chart Control]
- タッチサポート
- 複数Paneのサポート
- 新たなチャートタイプの追加
- 2D Scatter Line
- 2D Range Area
- 2D Overlapped Range Bar
- 2D Side-by-Side Range Bar
- Logarithmic Scaleのサポート (対数??)
- Coordinates Conversion (cross-hair cursors)
[WPF Gauge Control]
- 新たなCircular Gaugesの追加
- Custom Scale Elements
- CircularとLinear scaleに対して、カスタム要素を追加できるようになった。
- 新たなDigital Gauge Controlの追加
- LEDデバイスのように文字と数字を表示することが可能.
- 新たなState Indicator Controlの追加
[WPF Toolbar and Menu System]
- MVVMデザインパターンのサポート
[WPF Ribbon Control]
- リボンの実行時カスタマイズ機能の追加.(Office 2010ライク)
- リボンのマージ機能のサポート
- MVVMデザインパターンのサポート
- Ribbon Action
- アクションは別で定義して、Ribbon Controlに連結.
- その他
- デフォルトコマンド用のアイコンがRibbon Controlに含まれるようになった。
[WPF Scheduler Control]
- 繰り返し予定ダイアログの追加
[WPF Pivot Table Control]
- XMLAのサポート
- フィルタードロップダウンに、フィルター可能なデータのみが表示されるようになった。
- サマリーの新たな表示方法の追加
- Percent of the summary in the Grand Total, Column Grand Total or Row Grand Total value.
- The summary value's rank in its column or row - from largest to smallest values, or vice versa.
- The index value that reflects the summary value's importance in its row and column context. This value is calculated as follows:
- ドラッグアンドドロップでフィールドを隠すことが可能に。
- フィルター項目を隠す事が可能に。
- CustomFilterPopupItemsイベントをハンドルすることで可能になる。
[WPF Dock Window Control]
- MVVMパターンのサポート
[WPF Form Layout Control]
- インプレースレイアウトビルダー機能が追加
- デザイナ上にてon-the-flyでレイアウトコントロールを追加できるようになった。
[WPF Data Editor Controls]
- Search LookUp Editコントロールの追加
- Font Pickerコントロールの追加
- ICollectionViewのサポート
- サポートしているのは、ComboBoxEdit, LookUpEdit, ListBoxEdit
[WPF Theme Editor]
[WPF Theme]
- The Seven Themeが追加
- The Office2010Black Themeが追加
[WPF Tile Layout Control & Silverlight Tile Layout Control]
- DXLayoutControlにて、TileLayoutを選択することにより利用可能。
- Windows8のようなタイルアプリが作成出来る。
[WPF Rich Editor Control]
- Enhanced Paragraph Formatting
- Style Editor
- Floating Objects Support (Beta)
- Printing via DXPrinting System
[Silverlight]
[XtraReport for Silverlight]
- Silverlight用のエンドユーザデザイナが追加
- プレビュー時にWaterMarkの設定が出来るようになった
[Silverlight Grid Control]
- Instant Feedback UI ModeがWCF RIA Servicesでも利用可能になった。
- RiaInstantFeedbackDataSource
- http://www.youtube.com/embed/xkUImaTycoo?autoplay=1
- スクロールモードの追加:Fix Group Rows
- WinFormsのものと同じ。
- Align Group Summaries By Columns
- ICollectionViewとIPagedCollectionViewのサポート
- MVVM拡張
- TreeListViewの拡張
- その他の追加点
- グループサマリーの非同期ロード
- 列ヘッダの水平スクロール機能
- UI Automation Support and Section 508 Compliance
- Section 508 Compliance=リハビリテーション法第508条??
[Silverlight Tree List]
- 複数ノード選択とクリップボードのサポート
- ヒットテストのサポート
- レイアウトのシリアライゼーションサポート
- HieararchicalDataTemplateのサポート
[Silverlight Chart Control]
- 複数ペインのサポート
- チャートタイプの追加
- 2D Scatter Line
- 2D Range Area
- 2D Overlapped Range Bar
- 2D Side-by-side Range Bar
- 対数目盛のサポート
- Coordinates Conversion
[Silverlight Gauge Control]
- WPF版と同じ追加点。
[New Map Control for Silverlight]
- 新規追加コントロール。Bing Mapが利用できる模様。
- http://www.devexpress.com/Subscriptions/DXperience/DXv2/index.xml?page=24
- http://community.devexpress.com/blogs/thinking/archive/2011/09/15/wpf-silverlight-map-control-an-early-preview.aspx
- http://community.devexpress.com/blogs/thinking/archive/2011/09/23/wpf-and-silverlight-map-control-a-few-more-images-coming-in-v2011-vol-2.aspx
- http://www.youtube.com/embed/zsdwEVBbHg0?autoplay=1
[Silverlight Toolbar and Menu System]
- MVVMデザインパターンサポート
[Silverlight Ribbon Control]
- WPF版と同じ。
[New Silverlight Scheduler]
- 新規追加コントロール
[New Silverlight Pivot Table]
- 新規追加コントロール
[Silverlight Dock Window Control]
- MVVMサポート
[Silverlight Form Layout Control]
- WPF版と同じ。
[Silverlight Data Editor Controls]
- WPFバント同じ。
[New Theme for Silverlight]
- The Seven Themeが追加
- The Office2010Black Themeが追加
[Silverlight Rich Editor Control]
- Enhanced Paragraph Formatting
- Style Editor
- Floating Objects Support (Beta)
[WinForms]
[XtraTile Suite]
- Tile Controlの追加
[タッチサポート]
- 以下のコントロールがタッチをサポート
- Grid Control
- TreeList Control
- Chart Control
- Pivot Grid Control
- Docking Library
- Rich Text Editor
- Image Slider
[XtraReport Suite]
[XtraChart Suite]
- タッチサポート
- http://community.devexpress.com/blogs/thinking/archive/2011/09/06/winforms-controls-multi-touch-and-tablet-support-coming-in-v2011-vol-2.aspx
- http://community.devexpress.com/blogs/thinking/archive/2011/09/12/winforms-controls-multi-touch-and-tablet-support-part-2.aspx
- http://tv.devexpress.com/#WinFormsMultiTouchSupport
- http://tv.devexpress.com/#WinFormsTouchSupport
- 重なっている軸ラベルを隠す機能を追加 (Hide Overlapped Axis Labels).
- Enable Automatic Resolving
[WinForm Grid Control]
- タッチサポート
- データの分割表示機能が追加. (Split Grid Presentation)
- 水平分割、垂直分割の両方に対応。
- http://www.youtube.com/embed/CMddO4LuAgo?autoplay=1
[WinForm Gauge Control]
[WinForm Dock Window, Ribbon & Toolbar-Menu Library]
[DocumentManagerの拡張]
- ドキュメントセレクタの改善
- よりVisual Studioライクに
- ツールチップのサポート
- タブのカラーリング機能が追加
- DocumentManager, XtraTabbedMdiManager, XtraTabControl, XtraLayoutControl
- Aero Snapが可能に
- ドキュメントもしくはパネルがそれぞれAero Snap可能になった。
[Dock Libraryの拡張]
- コンテキストメニューが表示可能に。
- Auto Hide Layoutの改善
[WinForms Pivot Table Control]
- XMLAのサポート
- フィルタードロップダウンに、フィルター可能なデータのみが表示されるようになった。
- フィルタードロップダウンウィンドウに、ツールバーが追加
- http://community.devexpress.com/blogs/thinking/archive/2011/09/27/winforms-pivot-grid-control-enhancements-coming-in-v2011-vol-2.aspx
- Percent of the summary in the Grand Total, Column Grand Total or Row Grand Total value.
- The summary value's rank in its column or row - from largest to smallest values, or vice versa.
- The index value that reflects the summary value's importance in its row and column context. This value is calculated as follows:
- フィルター項目を隠す事が可能に。
[WinForms Scheduler Control]
[WinForms Data Editors and Common Controls]
- Image Sliderコントロールの追加
- PictureEditにズーム機能と大きな画像の際のスクロール機能が追加
- Progress Panelの追加
- 進捗状況の表示に利用できる。
- Shared Image Collectionの追加
- その他の拡張
[WinForms TreeList Control]
- Excelスタイルのフィルタードロップダウンが追加
- Auto Filter Rowの追加
- 拡張フィルターエディタダイアログの追加
- フィルターパネルの追加
- Criteria Operatorsのサポート
- TreeListにて条件を指定する際にCriteriaを指定可能になった。
[WinForms Splash Screen Manager]
- Splash Screen Managerの追加
- スプラッシュスクリーンを手軽に利用できるコントロール
- http://www.youtube.com/embed/mFl6P9I6c5A?autoplay=1
[HTML Formatting]
- Imageタグのサポートが追加
[Metro Inspired Theme]
- Metro-Styleテーマの追加
[WinForms Rich Editor Control]
- Enhanced Paragraph Formatting
- Style Editor
- Floating Objects Support (Beta)
-
[ASP.NET]
[iOSとAndroid用のタッチサポート]
- Callback Panel
- Combo Box
- Dock Panel
- Grid View
- List Box
- Menu
- Panel
- Pivot Grid
- Popup Control
- Scheduler
- Splitter
- Tree List
- 上記のサポートは、WebForms, MVCの両方に追加されている。
- http://community.devexpress.com/blogs/thinking/archive/2011/09/09/asp-net-controls-touch-enabled-on-the-ipad.aspx
- http://community.devexpress.com/blogs/thinking/archive/2011/09/26/asp-net-touch-support-for-the-ipad-and-android-tablet-devices-coming-in-v2011-vol-2.aspx
- http://tv.devexpress.com/#ASPiPadSupport
[DevExpress MVC Extensions]
- Pivot Grid Extensionの追加
- Track Bar Extensionの追加
- Check Box List Extensionの追加
- MVC GridView Extension
- 組み込みフィルターコントロールの追加
- MVC UploadControl Extension
- 複数ファイルのアップロードが可能に.
- MVC Date and Calendar Editors Extensions
- Custom Day Renderingの追加
- http://mvc.devexpress.com/Editors/Calendar
[ASP.NET Gauge Control]
[ASP.NET Scheduler Control]
- 時間セルの自動高さ調整が追加。
[ASP.NET Pivot Table Control]
- Hierarchical Filter for Grouped Fields
- フィルタードロップダウンに、フィルター可能なデータのみが表示されるようになった。
- Percent of the summary in the Grand Total, Column Grand Total or Row Grand Total value.
- The summary value's rank in its column or row - from largest to smallest values, or vice versa.
- The index value that reflects the summary value's importance in its row and column context. This value is calculated as follows:
- フィルター項目を隠す事が可能に。
[ASP.NET HTML Editor Control]
- キーボードショットカットのフルカスタマイズが可能に。
- コンテキストメニューのカスタマイズ
[ASP.NET Navigation & Data Browsing Library]
[ASP.NET Upload Control and File Manager]
- 複数ファイルのアップロードが可能に。
[ASP.NET Data Editor Controls]
- Track Barコントロールの追加
- Check Box Listコントロールの追加
- ASP.NET Date and Calendar Editor
- Custom Day Renderingの追加
- http://demos.devexpress.com/ASPxEditorsDemos/ASPxCalendar/DayRender.aspx
[.NET Reports: ASP.NET Enhancements]
[ASP.NET Chart Control]
- 重なっている軸ラベルを隠す機能を追加 (Hide Overlapped Axis Labels).
[ASP.NET Theme Builder Tool]
- http://www.devexpress.com/Subscriptions/DXperience/DXv2/index.xml?page=58
- http://community.devexpress.com/blogs/thinking/archive/2011/09/25/asp-net-theme-and-css-style-builder-coming-in-v2011-vol-2.aspx
- http://www.youtube.com/embed/e_QJtnAPyt0?autoplay=1
[.NET Application Framework (XAF)(ここは丸々訳せていない・・・後で調べて記述し直す事。>自分)]
- AJAX-based Rendering in XAF ASP.NET Applications
- Domain Components Technology Release
- EasyTest
- Localization
- Middle Tier Service
- Middle Tier Security
- Object-level and Member-level Security
- Online XAF ASP.NET Demos
- Project Subfolders in XAF Project Templates
- Support for Exporting in all Built-in List Editors
- State Machine Module
[.NET Object-Relational Mapping Library (XPO)]
[CodeRush]
- DDC - Duplicate Code Detection and Consolidation (重複コードの検出)
- JavaScriptサポートの改善
- MVCサポートの改善
- The Use Raw Assembly Load option
- プラグイン制作時に有効な機能
- Unit Test Runnerの改善
- Support for VS2010 VSIX DXCore plug-ins
- Quick Navのローディングスピードの改善
- String.Formatter Windowの追加
- 超便利!
- 使い方は、フォーマット部分に{0}などと入力してから、Ctrl+`
- Code Cleanupの追加
- Make variable implicit
- Remove redundant "base" qualifier
- Remove redundant "this" qualifier
- New code providers
- Introduce Using Statement
- Format Item
- Implement IDisposable
- Dispose Fields
- 対象のクラスに定義されているDispose可能なフィールドをDisposeするためのコードを自動生成
- http://www.devexpress.com/Subscriptions/DXperience/DXv2/i/coderush-dispose-fields-code-provider.swf
- Consolidate duplicate code to
- New refactorings
- Consolidate Conditional Blocks
- Reverse Boolean
[Cross-Platform Data Library]
- 新たなServer ModeとInstant Feedbackデータソースが追加
- EF4用
- EntityServerModeSource
- EntityInstantFeedbackSource
- Parallel Linq to Object
- PLinqServerModeSource
- PLinqInstantFeedbackSource
- WCF Data Services
- WcfServerModeSource
- WcfInstantFeedbackSource
- WCF RIA Services for Silverlight
- RiaInstantFeedbackSource
- EF4用
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
2012-01-19 01月19日の日記 (2012年)
■[C#] Oxygene言語とC#の比較資料 (Embarcadero Prism XE2, RemObjects)
最近、すごく興味があるRemObjectsのOxygene言語。
Embarcaderoの人がC#との比較記事を書いてくださってます。
notifyはいいなー。これC#にも追加してほしい。
以下、参考資料です。
Prism XE2欲しい。
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
2012-01-12 01月12日の日記 (2012年)
■[C#] ESE Toolkit (Extensible Storage Engine, JET Blue, 組み込みデータストア, ISAM)
元ネタは、InfoQさんの以下の記事。
こんなのあったんだって感じです。Windows 2000以降であれば標準で付属しているとのこと。
上記記事内にてリンクされているページにて、ESEをC#から扱うことができるツールキットが入手できるとのこと。
暇があったら触ってみたい。
以下、関連情報のリンクです。
- ESE C#/C++ toolkit 1.2 for Microsoft Extensible Storage Engine
- Extensible Storage Engine
- http://msdn.microsoft.com/en-us/library/windows/desktop/gg269259(v=exchg.10).aspx
- Extensible Storage Engine Reference
- http://msdn.microsoft.com/en-us/library/windows/desktop/gg269245(v=exchg.10).aspx
- Extensible Storage Engine
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
2012-01-11 01月11日の日記 (2012年)
■[asp.net] ASP.NET アプリケーションをハッキングから守る (MSDN マガジン December 2011, security)
MSDNにて公開されている記事。メモメモ。
2回に分けて記事になるみたいですね。
第一回目は、SQLインジェクションとパラメーターの改ざんについて記述されています。
第二回目が公開されたら、リンクをアップデートすること。>自分
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
■[oracle] apex.oracle.com (Oracle Application Express, 無料で利用できるOracle Database, Webブラウザのみで利用可能, 学習目的)
@ITにて、以下の記事を発見。便利だったので、ついでにメモメモ。
上記記事で、Oracle Application Expressを評価できるサイト apex.oracle.comが
紹介されています。このサイト、無料で利用できて且つWebブラウザがあれば試せるので
SQLの勉強にもってこいです。
登録の仕方などは、上に挙げた@ITの記事に詳しく記述されています。
最初から、DEPTやEMPなどのおなじみのテーブルも用意されているので学習には便利ですね。
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
2011-12-27 12月27日の日記 (2011年)
■[C#][asp.net] Webアプリケーションプロジェクトでエディットコンティニュー(EditContinue)を有効にする (VisualStudio, EditContinue, Web Application Project)
情けないことに知らなかったので、自分用にメモです。
ASP.NETでは、プロジェクトを作成する際にWebアプリケーションプロジェクトと
Webサイトプロジェクトの2つの形式が選択できます。
違いについては、MSDNに記述されています。
- Web アプリケーション プロジェクトと Web サイト プロジェクト
で、上記の記事を見るとWebアプリケーションプロジェクトの利点として以下のものが挙げられています。
って書いてあるのですが、VisualStudioにてWebアプリケーションプロジェクトを作成し
Breakpointを設定して、デバッグ時に値を書き換えようとしても以下のダイアログが出ます。
なんや、出来ひんやんけ!って勝手に思ってしまってて今まで毎回起動→停止を
繰り返していましたww
で、今日VisualStudioのプロジェクト設定の部分を見ていると以下の部分を発見。
チェックをつけるとエディットコンティニューが出来るようになりました・・・。
これ、なんで最初からONになってないんだろ・・・。
画像は、VS2010のものです。VS2008の場合は同じページ内のNTLM認証のチェックボックスの下に
エディットコンティニューの項目があります。
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
2011-12-12 12月12日の日記 (2011年)
■[C#].NET クラスライブラリ探訪-051 (System.Drawing.ImageConverter)(Imageからバイト配列の変換, バイト配列からImageへの変換)
よく忘れるので、個人的メモです。
イメージを扱う際にバイト配列に変換したり、その逆を行ったりする際に利用します。
利用するクラスは
System.Drawing.ImageConverter
ConvertToメソッド
ConvertFrom
を利用します。
以下、サンプルです。
#region ImageConverterSamples-01 /// <summary> /// ImageConverterクラスのサンプルです。 /// </summary> public class ImageConverterSamples01 : IExecutable { public void Execute() { // // Imageオブジェクトを取得. // Image image = Image.FromFile("database.png"); // // Imageをバイト配列に変換. // Imageから別のオブジェクトに変換する場合はConvertToを利用する. // ImageConverter converter = new ImageConverter(); byte[] imageBytes = (byte[]) converter.ConvertTo(image, typeof(byte[])); // // バイト配列をImageに変換. // バイト配列からImageオブジェクトに変換する場合はConvertFromを利用する. // Image image2 = (Image) converter.ConvertFrom(imageBytes); // 確認. Debug.Assert(image != null); Debug.Assert(imageBytes != null && imageBytes.Length > 0); Debug.Assert(image2 != null); // // [補足] // Imageオブジェクトをファイルとして保存する場合は以下のようにする. // //string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //string fileName = @"Sample.png"; //string filePath = Path.Combine(desktopPath, fileName); // //using (Stream stream = File.Create(filePath)) //{ // image.Save(filePath, System.Drawing.Imaging.ImageFormat.Png); //} } } #endregion
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
2011-12-09 12月09日の日記 (2011年)
■[C#][WCF] WCF入門-019 (基本的なサンプル, webHttpBinding, RSS, Atom 1.0, WebGet, SyndicationFeed, フィード配信)
webHttpBindingの基本についてのメモ。
CodeProjectにWCF RESTサービスについての素晴らしい記事があったので
それを参考にしたメモです。
- Windows Communication Foundation and RESTful Web Services Primer
- WCFの参考リソース (CodeProject, REST, webHttpBinding, behaviorExtensions, リンク)
WCFでは、.NET Framework 3.5よりRSS/ATOMフィードを配信する機能が追加されました。
フィードを配信する際に利用するクラスは以下のものです。
System.ServiceModel.Syndication.SyndicationFeed
System.ServiceModel.Syndication.SyndicationItem
使い方としては、最初に配信内容としてSyndicationItemのリストを
構築し、それをSyndicationFeedにセットします。
セットした後は、SyndicationFeedのSaveAsAtom10メソッド、または、SaveAsRss20メソッド
を呼び出すと内容が出力されます。
WCFで利用する場合は、SyndicationFeedを作成した後に
Atom 1.0/RSS 2.0に対応したフォーマッターを作成します。
以下のクラスです。
System.ServiceModel.Syndication.SyndicationFeedFormatter
しかし、SyndicationFeedFormatterクラスは抽象クラスとなっていますので
派生クラスである以下のどちらかを使います。
System.ServiceModel.Syndication.Atom10FeedFormatter
System.ServiceModel.Syndication.Rss20FeedFormatter
尚、SyndicationFeedクラスにはLoadという静的メソッドが
以下、サンプルです。
サンプルでは、URLにatom10パラメータとsiteパラメータを
テンプレートとして指定しています。どちらも型はbooleanです。
atom10にtrueを指定すると、出力されるフィードがATOM 1.0になります。
siteにtrueを指定すると、MSDNの最新ニュースのフィードを取得してそれを
出力します。
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.ServiceModel.Syndication; using System.ServiceModel.Web; namespace Gsf.Samples.WCF { [ServiceContract(Namespace="http://Gsf.Samples.WCF")] [ServiceKnownType(typeof(Atom10FeedFormatter))] [ServiceKnownType(typeof(Rss20FeedFormatter))] public interface IMyService { [OperationContract] [WebGet(UriTemplate="rss?atom10={atom10}&site={site}", BodyStyle=WebMessageBodyStyle.Bare)] SyndicationFeedFormatter GetFeed(bool atom10, bool site); } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Xml; namespace Gsf.Samples.WCF { public class MyService : IMyService { public SyndicationFeedFormatter GetFeed(bool atom10, bool site) { if (site) { return GetSiteFeed(atom10); } else { return CreateDummyFeed(atom10); } } private SyndicationFeedFormatter GetSiteFeed(bool atom10) { // MSDN最新情報のRSS const string url = @"http://www.microsoft.com/japan/msdn/rss.xml"; SyndicationFeed feed = null; using (XmlReader reader = XmlReader.Create(url)) { feed = SyndicationFeed.Load(reader); reader.Close(); } return GetFormatter(atom10, feed); } private SyndicationFeedFormatter CreateDummyFeed(bool atom10) { List<SyndicationItem> items = new List<SyndicationItem>(); for (int i = 0; i < 500; i++) { SyndicationItem newItem = new SyndicationItem(); newItem.Title = new TextSyndicationContent(string.Format("Item Title-{0}", i)); newItem.Content = new TextSyndicationContent(string.Format("Item Content-{0}", i)); newItem.Links.Add(new SyndicationLink(new Uri(@"http://d.hatena.ne.jp/gsf_zero1"))); items.Add(newItem); } SyndicationFeed feed = new SyndicationFeed(); feed.Title = new TextSyndicationContent("Test Feed."); feed.Description = new TextSyndicationContent("This is a test feed."); feed.Authors.Add(new SyndicationPerson("xxxx@gmail.com", "gsf_zero1", @"http://www.google.co.jp")); feed.Categories.Add(new SyndicationCategory(@"C#")); feed.Items = items; feed.LastUpdatedTime = DateTime.Now; return GetFormatter(atom10, feed); } private SyndicationFeedFormatter GetFormatter(bool atom10, SyndicationFeed feed) { SyndicationFeedFormatter formatter = null; if (atom10) { formatter = new Atom10FeedFormatter(feed); } else { formatter = new Rss20FeedFormatter(feed); } return formatter; } } }
最後にアプリケーション構成ファイル。
webHttpBindingを利用する場合、EndpointBehaviorが必須となりますので注意が必要です。
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true"/> </system.web> <system.serviceModel> <services> <service name="Gsf.Samples.WCF.MyService"> <host> <baseAddresses> <add baseAddress="http://localhost:8093/MyService"/> </baseAddresses> </host> <endpoint name="epWebHttp" address="" binding="webHttpBinding" contract="Gsf.Samples.WCF.IMyService" behaviorConfiguration="webHttpEndpointBehavior" /> <endpoint name="epMex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <endpointBehaviors> <behavior name="webHttpEndpointBehavior"> <webHttp/> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="False"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration>
すると、ブラウザ上に以下のデータが表示されます。
IEで見ると以下のような感じです。
すると、ブラウザ上にMSDNのフィードデータが表示されます。
サンプルは以下の場所にアップしてあります。
https://sites.google.com/site/gsfzero1/Home/WCFSample-018.zip?attredirects=0&d=1
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ
■[java] Joda TimeとDate4J (日付操作、DateTime, infoq)
元ネタは、InfoQさんの以下の記事です。とりあえずメモメモ。
- Date4j- 日付を扱う最小限のライブラリ
DATE4Jのサイトのタイトルが大分過激ですねぇ・・。
DATE4Jのサイトの内にて、WEB4Jの記述があったので
ついでにメモメモ。懐かしいなこれ。
DATE4Jは、WEB4Jから日付部分をライブラリ化したものとのこと。
なので、作者はどちらも同じ人。
- WEB4J
================================
過去の記事については、以下のページからご参照下さい。
- いろいろ備忘録日記まとめ









Development Tools-Visual C#