Dec 23, 2012

Apple System Status Notifier released

I have released a chrome extension Apple System Status Notifier. This extension is quite simple. It periodically checks Apple System Status and displays number of issues recently happened.

This extension uses event pages feature. It consumes less resources than background pages. I hope many other extensions adopt this feature.

Dec 18, 2012

monogusa Released

Last Sunday, I have released monogusa gem.

Its purpose is to list your usage of AWS resources. When you use Management Console, you have to click and click the icons of AWS services you would like to check. If you are running instances across the regions, you have to click more.

Monogusa is trying to make it easier. At the moment is does not list statuses across regions, next version will do it. This is screen shot of next version.


Dec 1, 2012

Create a URL Signature for Amazon CloudFront Using Python

There is no official document to create a url signature for Amazon CloudFront in Python. I found an easy way to do it.

from tlslite.utils import keyfactory
from base64 import b64encode
import time

url = "http://d3iwlid5dsmdb3.cloudfront.net/_default_san.png"
expires = int(time.time() + 60)
privkey_file = "pk-APKAJ4YNPASFVCNBXK3A-cloudfront.pem"
key_pair_id = "APKAJ4YNPASFVCNBXK3A"

policy = '{"Statement":[{"Resource":"%s","Condition":{"DateLessThan":{"AWS:EpochTime":%d}}}]}' % (url, expires)
privkey = keyfactory.parsePrivateKey(open(privkey_file).read())            
print '%s?Expires=%d&Signature=%s&Key-Pair-Id=%s' % (url, expires, b64encode(privkey.hashAndSign(policy)), key_pair_id)

The library tlslite is very easy to use. boto also has a method to create signed url but it uses M2Crypto. To install M2Crypto, swig command is required but my OSX does not have it. If you do not like to install swig, tlslite is a good option.

Nov 19, 2008

Alchemy has arrived eventually !

Today the timeline of twitter was filled by the tweets about Adobe Alchemy. This project is quite impressive for me because I am used to C/C++, and relatively new to Flash. Then I began to install it to my Ubuntu 8.04 in the VirtualBox.

There is a zip file of Alchemy Toolkit for Linux which contains README.ubuntu. At first I thought this file is valuable for me, but it was not. README.ubuntu did not help me. I read the install steps for Mac that is not so different from Linux's one.

After that the second problem has come. llvm-gcc is not found. when I tried following command;

gcc stringecho.c -O3 -Wall -swc -o stringecho.swc
there was no output in the console. I checked gcc.
vim `which gcc`
gcc is not a binary executable but a perl script for Alchemy from the time alc-on command is executed until the time alc-off is executed. I put some checkpoints in gcc and found that this script exits when trying to run llvm-gcc command. The reason of that is quite simple. There is no command named llvm-gcc.

$ALCHEMY_HOME/bin/llvm-gcc is a symbolic link to $ALCHEMY_HOME/bin/llvm-gcc4-ubuntu-install/bin/llvm-gcc that does not exist. I need this file or link llvm-gcc to somewhere appropriate.

Apr 3, 2008

VaporVision3D

I have published VaporVision3D for this year's April fool. I am writing articles about 3D representation on Flash from scratch, so this VaporVision3D does not depend on Papervision3D or such 3D graphics framework.

I do not think that Reinvention of the Wheel has no meaning, but reinvention of 3-D graphcis framework is a heavy task. Who want to use 3D graphics on Flash should use Papervision3D or such however implementing 3D engine gives you lots of experiences. But I am seriously interested in performance problems on 3D engines. It is a well-known fact that drawing of FlashPlayer is very slow. What we can do is to reduce drawing. For now, my articles intentionally cut performance problems for simplicity. The time to argue the problems will come soon.

Mar 5, 2008

Long path handling of JSFL File API

Copy function of JSFL File API can not handle long URI, for example a URI consists 300 characters. I've wrote extended copy function that can handle such long URI. This is first time to write a extension for Flash in C language, but I found that it is not difficult to implement it. The sample extension really helped me to understand how the extension works.

Nov 21, 2007

AS3 3D and physics engines

2D physics engines:
APE
This engine may be the most well-known one. It has been ported to C++ and Java. MIT license.
Box2DAS3Box2DFlashAS3
Crayon Physics Deluxe made the people attracted to this engine. Box2D was written in C++, now ported to AS3 as Box2DFlashAS3. zlib/ligpng licence.
FOAM
It was lately released, but seems worth trying. MIT license.
Fisix
Perhaps you do not know this engine because of its own license. Let's check the demo.
Motor Physics
This one is expected to join the AS3 physics engine list. Some demos are already available. zlib/libpng license.
This seems a little complicated compared with C++. In C++, there are practically two choices of 3D physics engine, PhyX and Havok. Which engine will survive? 3D graphics engine:
Papervision3D
I think that I do not need to explain about this most known 3D engine. MIT License.
Away3D
This engine is Papervision3D based one, but has has better visual quality.
Sandy
I immediately understood this name because I am a Japanese (see why). The API resembles Java3D, e.g. TransfomGroup class.
-------
Corrected the name of Box2DFlashAS3. (Nov. 23)

Oct 29, 2007

a nasty one.

A really really nasty one. I can not understand a compile error of C#, CS1583 that says 'file' is not a valid Win32 resource file. For details, see MSDN Forum. I saw this error when I compiled Apple Wireless Keyboard Helper for Windows at 3:00 am. I was sleepy and did not have energy to read articles on the forum. Then I read only the latest post that says:

Just double click on properties at solution explorer then you will see an option button with a textbox contaning file name delete it ,or copy same file in your home comp at same location.


I tried this way then succeeded to compile the project. I started to test the application against my JIS keyboard, and found that '英数' and 'かな' key have scan code 113 and 114.

Oct 2, 2007

Color detection by AS3

Here is a demo of skin color detection by ActionScript 3.
  • Inspired by this video.
  • Hatsune Miku swings her arm when skin color moves vertically.
  • Push V key to show/hide camera input.
  • Push M key to show/hide detection result.
Detection algorithm is of this paper, section 3.1. Because this algorithm is very simple, it can be implemented by bitmap filter. Performance should be compared between both implementations.

Aug 29, 2007

tracd does not accept folded http header

I found that tracd does not work in some cases, specifically when the http header is folded because of its longness. To solve this problem, I modified /usr/lib/python2.4/site-packages/trac/web/wsgi.py as following.
  1. Make unfold_header function.
    def unfold_header(self):
        lineno = 1
        while lineno < len(self.headers.headers):
            header = self.headers.headers[lineno]
            if header.startswith(' ') or header.startswith('\t'):
                self.headers.headers[lineno - 1] += header
                del(self.headers.headers[lineno])
            else:
                lineno = lineno + 1
    
  2. Call this function from setup_environ function in WSGIRequestHandler class.
    length = self.headers.getheader('content-length')
    if length:
        environ['CONTENT_LENGTH'] = length
    
    # insert this line here.
    self.unfold_header()
    
    for name, value in [header.split(':', 1) for header
                        in self.headers.headers]:
    
This was my first time to program in Python, so there might be some problems. But this modified tracd is working for now.

Aug 22, 2007

mqo loader beta ?

I have eventually submitted my metasequoia loader to Snippets of Spark project. Only few tests about my library have done, so any bug reports are welcomed.

My next task is perhaps to load MIKOTO file that describes motion of metasequoia model. Watching motion of 3D model will fascinate us rather than watching rendered image that never moves.

Aug 5, 2007

mqo loader private alpha

Here is my private alpha version of .mqo file loader for Papervision3D. Mqo files are used by Metasequoia typically in Japan.

Jul 23, 2007

Location of flashlog

Since I changed my computer from XP to Vista, today is first time to use trace function of AS3. First, I created file named mm.cfg and wrote these lines.

TraceOutputFileName=D:\Users\\Documents\AS3\trace.txt
ErrorReportingEnable=1
TraceOutputFileEnable=1


But this did not work. I changed all the backslashes into slashes, but nothing has changed. I removed the first line to put the output file in default location, then it worked. Even TraceOutputFileName is not an necessary option, this behavior is strange.

I found the answer of this problem in the LiveDocs.

Note: Beginning with the Flash Player 9 Update, Flash Player ignores the TraceOutputFileName property.


TraceOutputFileName no longer works.

Jul 18, 2007

Poor Japanese VS2005 Express

Playing with Orcus is something exciting, but VS2005 Express Edition is still good choice for indie programmers. You can get it by pushing 'Go' button at here.

Japanese version is somehow complicated. When you click 'Web からインストール', you will be requested to log into msn. Moreover, an annoying form will appear that must be filled out. Your name, email address, address of work location, and some questionnaires will be needed. But you can download Japanese version from English site. Of course, a key to activate Visual Studio is needed.

Jul 15, 2007

Use macro for dynamic linking of DLL

Dynamic linking of DLL needs more code than static linking. We have to use GetProcAddress() API for each functions. It may cause bug if we make typo.
m_fnSetCommInfo =
  reinterpret_cast< FnSetCommInfo >(
  ::GetProcAddress( m_hLibrary, "SetCommInfo" ) );
m_fnGetCommInfo =
  reinterpret_cast< FnGetCommInfo >(
  ::GetProcAddress( m_hLibrary, "GetComInfo" ) ); // <-- Ahh !!
Define statement prevents such bug.
#define LOAD_FUNCTION(name) \
  m_fn##name = reinterpret_cast< Fn##name >( \
  ::GetProcAddress( m_hLibrary, #name ) );

LOAD_FUNCTION( SetCommInfo );
LOAD_FUNCTION( GetCommInfo );
This is easier to read. Macro sometimes prevents bug.

Jul 9, 2007

Adding feed subscriber to Firefox



There is RSS button on the address bar of Firefox when a web site is providing feed. You can add any feed subscriber by doing follows:
  1. Input about:config into address bar.
  2. See there are some browser.contentHandlers.types.N.(title|type|uri) entries.
  3. Add subscribers after them.
For example, I add Fastladder by adding these entries.
  • browser.contentHandlers.types.6.title = Fastladder
  • browser.contentHandlers.types.6.type = application/vnd.mozilla.maybe.feed
  • browser.contentHandlers.types.6.uri = http://fastladder.com/subscribe/%s

running svk

Running svk is not hard, however some terms are different from svn's ones. commit is push and update is pull. These may be more intuitive terms than svn's. As I said, svk can reduce revision number of repository. To do this, use -l option for push that means merge everythins into a single commit log.
svk push -l //local/YourProject
Then you can commit your source files after changing few lines without worrying about revision number. I think this is most important thing for refactoring.

Another first step guide of svk. Simple and easy to understand. I do not need boring text but really need sample code or command. When there is something unclear, I will search official document that is more accurate, reliable one than somebody's blog.

Jul 8, 2007

install svk

I know Mercurial is a great SCM system which is called distributed one. I am using svn and commiting my code many times when I made changes. It may disturb others because revision number changes frequently. Distributed SCM systems are different, however they do not have integrated GUI like TortoiseSVN. Even if Mercurial got such interface, repositories I am working on are still svn's one. svk is a solution to use svn as distributed one. I refered these sites to install svk. At the moment, I made a copy of remote repository and checked out files from there. Revision number had been smaller. It seems that revisions are skipped which are not related to files I got from remote repository. This may be a problem when I use svn:keyword like $Id$ or $Rev$. Later, I will write about it.

template typedef

Last week I knew this code is possible to compile.
typedef CWindowImpl<Hoge> CWindowImpl;
I felt it is a little strange. I could not understand how the compiler interpret these two symbols are different ones. Today, I replaced strtok by boost::tokenizer for better security and readability. Some code fragments I've found via Google used typedef like above. Perhaps it is possible because their namespaces are different, boost and other. I will continue to use this idiom for readability especially code using boost and WTL.

Jul 5, 2007

First post

MUDAI, no title, aucun titre, kein Titel, ...