スキップしてメイン コンテンツに移動

投稿

C#: XML string to XmlDocument

I have wrote some utility methods for creating XmlDocument from XML string. public static class XMLUtils { // xml string to XmlDocument public static XmlDocument ToXmlDocument(this string xml) { var doc = new XmlDocument(); doc.LoadXml(xml); return doc; } // XmlReader to XmlDocument // XMLReader is useful for read xml data from url source public static XmlDocument ToXmlDocument(this XmlReader reader) { var doc = new XmlDocument(); doc.Load(reader); return doc; } // path to xml file to XmlDocument public static XmlDocument ReadFromPath( string path) { return ToXmlDocument(File.ReadAllText(path)); } }

ActionScript 3.0: Hit Youtube API

I wrote a tiny program for getting Youtube video information by hitting Youtube API in ActionScript 3.0. Some generic classes or methods might be missing but I think you can easily guess what they are doing and can add them easily yourself. Example Usage Ok, starting from the example usage. package utils.video { import flash.display.Sprite; import utils.file.SyncFileSaveDownLoader; import utils.ITaskProgressCounter; import utils.TaskProgressCounter; import utils.video.youtube.YoutubeAPI; import utils.video.YoutubeFLVURLGetEvent; import utils.video.youtube.YoutubeLocalCacheManager; import utils.video.youtube.YoutubeVideoEntryDispatcher; import utils.video.youtube.YoutubeVideoEntryEvent; public class Tester extends Sprite { private var downloader:SyncFileSaveDownLoader = new SyncFileSaveDownLoader(); private var youtubeLocalCacheManager:YoutubeLocalCacheManager = new YoutubeLocalCacheManager("c:\\temp\\youtube&qu

Webアプリケーション開発のためのリンク集

Webアプリケーション全般 OpenSpace : Webアプリの開発に関する非常に有用な情報が満載です! Webアプリケーション開発講座 WEB API 活用 WWWの基礎 とほほのWWW入門 http://x68000.q-e-d.net/~68user/net/ : ネットワークプログラミングを基礎から解説しています。 PHP phpthumb() : PHPでサムネイルを生成するためのソフトウェア cairo-php : PHPで画像処理をするためのCairo Graphics Libraryを利用した拡張モジュール Windows 7 で PHP の開発・実行環境を整える! :少し古い記事ですが、XAMPも含めて設定の仕方が書いてあるので参考になりました。 HTML Tag index : HTMLのタグについての解説サイト CSS Less : CSSをよりプログラムチックに扱うためのライブラリ。ただしLessファイルをCSSにコンパイルする必要があります。 Web API AmazonのProduct APIを使った開発については、 ここ が参考になります。私も早くチャレンジせねば。。。 Ruby Ruby Installer for Windows アクセスランキング解析 言わずと知れた Alexa のサイトです。 認証 Kerberos

PHP: Grouping Elements in Array by Specific Key Field

This is the code for grouping elements in array by specific key field of the element. Code <?php function groupBySpecificKey(array& $source, $key){ $map = array(); foreach($source as $elem){ $groupKey = $elem[$key]; if(is_null($groupKey)) continue; $map[$groupKey][] = $elem; } return $map; } Example $result = groupBySpecificKey($source, 'country'); var_dump($result); $source = array( array('id' => 1, 'name' =>'Joe', 'country' => 'China'), array('id' => 2, 'name' =>'Chris', 'country' => 'USA'), array('id' => 3, 'name' =>'Tod', 'country' => 'USA'), ); The result is below. array(2) { ["China"]=> array(1) { [0]=> array(3) { ["id"]=> int(1) ["name"]=> string(3) "Joe"

JSON

最近 JSON 形式のファイルを扱うことが多く、色んなライブラリを触ってきました。 どれも甲乙つけがたいですが、とりあえずいくつか紹介します。(そのうちコードサンプルを交えたレビューも書きたいと思います。) .Net用のライブラリ Json.NET : stackoverflowではかなり強く推薦されていました。 Jayrock Java用のライブラリ Jackson : これが一番使いやすかったです。annotationの機能はかなり便利です。 XStream : XMLのシリアライゼーションで有名ですが、JSONでも使えます。残念ながらまだ試したことはありません。。。 JSON Tools stringtree.org Json-lib : これも使ったことがあります。多機能すぎて、個人的には使用法を理解するのに時間がかかりました。ちょっと癖があると思います。

SourceForge.net: Platform

This entry is just for my memo. I always forget the sourceforge platform details and googling and googling again and again X( Project web and developer web platform : This page explains what language can be used on sourceforge web services including memory usage limitation etc. Release files for download Subversion repository administration SVN Admin Repo : This page is helpful when you would like to reset svn repository. Shell Service File Management Service : This page explains what protocols can be used for transferring files to source forge server.

ActionScript 3.0: Read catalog.xml

I have written reading catalog.xml program in ActionScript 3.0. I know my code is not perfect however I make my code public because I would like to help someone who would like to analyze catalog.xml... hope it helps :) In short the code is simply reading xml file. package utils.tool { public class CatalogXmlReader { // you should change the namespace based on flash version private static const NS:String = "http://www.adobe.com/flash/swccatalog/9"; public function CatalogXmlReader() { } public function create(xml:XML):SWCCatalog { var ns:Namespace = getDefaultNamespace(xml); if (!(ns.uri === NS)) throw new Error("Namespace is wrong"); var versions:XMLList = xml.child(new QName(ns, "versions")); var swcVersion:SWCVersions = new SWCVersions(); swcVersion.swcVersion = versions