28. May 2011

Flash Memory Monitor

Simple memory monitor which displays total memory usage of Flash Players in browser.

Some links:

You can also reuse package published here and embed this monitor in your app:

<iframe src="https://georgik.rocks/wp-content/flex/memory-monitor/0.1/MemoryMonitor.html" 
width="400" height="150" frameborder="0" marginheight="0" 
marginwidth="0">Loading...</iframe>

You can also just open this app and see what is going on with memory usage of Flash Player.

2. April 2011

Debugging Flex apps in Firefox 4

When you want to debug Flex app just start debugger in Flash Builder. It will launch browser, e.g. Firefox 4.

The problem is that when you stop at break point for too long, Firefox 4 will terminate Flash plugin. Default limit is 45 seconds.

This is useful behavior for normal web, but it’s not good for debugging.

Solution is quite easy.

Type URL: about:config

Enter filter: dom.ipc.plugins.timeoutSecs

Change value to -1

I found this solution at: support.mozilla.com

Happy debugging. :-)

7. January 2011

How to dump POST request with Python

Python contains one helpful module: SimpleHTTPServer. You can expose local directory via HTTP by the following command:

python -m SimpleHTTPServer

Python will start HTTP server at http://localhost:8000

It is very worthy when you’re doing some tests of web application.

The only problem is that SimpleHTTPServer does not support POST. Sometimes it’s very useful to see the content of POST request.

Is there any simple way how to achieve this in Python?

Here is a small extension of SimpleHTTPServer with do_POST handler:

import SimpleHTTPServer
import SocketServer
import logging
import cgi

PORT = 8000

class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):

    def do_GET(self):
        logging.error(self.headers)
        SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)

    def do_POST(self):
        logging.error(self.headers)
        form = cgi.FieldStorage(
            fp=self.rfile,
            headers=self.headers,
            environ={'REQUEST_METHOD':'POST',
                     'CONTENT_TYPE':self.headers['Content-Type'],
                     })
        for item in form.list:
            logging.error(item)
        SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)

Handler = ServerHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()

You can download SimpleServer.py here and start it with command:

python SimpleServer.py

24. December 2009

Flash Game: Snowflakes – PF 2010

Collect all snowflakes. Click at the blue part of the screen to start the game.

Source code available in FXP format.

You can find more games at georgik.rocks/tag/games/