Adobe AIR trick: Faster file loading on development machine

I had pretty weak company computer in my recent job and also pretty old rubbish Windows installation. Because of that, duration of loading our Adobe AIR game was about 14 seconds. Colleagues had better times, like 11 seconds. I was curious if I could make it faster.

Every change in code made whole application recompile, restart and load again. I disliked it more and more, then a simple idea came to my mind:

if you don't want to waste time on loading every time, then load it once!

Actually, why not. Easier said than done, right? Load whole data into RAM in another application and then send it through sockets to the application.

So I wrote simple application in C# which reads all files (graphics, sounds, etc.). I have also added new option of loading data to the game - through sockets. Result - came down from 14 seconds to 7 seconds! I could have done it earlier.

WPF/Silverlight Design Data without XAML

Here's a class for our sample data. That's where the data should go into.

In App.xml define your namespace:

and then:

The last step - instantiate sample data as DesignContext. You can do it in your Window, Page or whatever. I did it in MainPage.xaml in my Windows Phone 7 application:

Our sample data is bound to whole page. Use it like every other binding.

CoffeeScript to JavaScript compilation in Sublime Text 2/3

Ever wanted to write code in CoffeeScript? It surely is great but you wonder why is this not automated or smaller. Actually there are two options:

  1. include CoffeeScript so it will compile to JavaScript when page is loaded
  2. include pure JavaScript - generated from CoffeScript code.

First option is very easy but may vary on performance. Second is better in performance bad worse in usage. I'll teach you how to automate that process so it will be both fast on page load and easy too.

→ Continue reading

Interface with basic implementation in C#

Today we have simple question:

How to avoid abstract classes by giving base implementation?

The story

Once in a time I was building animation system which was planned to be used in IGWOCTISI project. It happened that I wanted to created some predefined tweens (animated translations) like ScaleTo, MoveTo, RotateBy and so on.

In the horizon appeared a requirement which was pretty straightforward:

The fact was that my type T not always was able to be some Transformable object.

→ Continue reading

Better Memento

Today I asked myself - how to use Memento design pattern to store object state in a more safe and effective way? Of course by automating some things using some base implementation. Read about why I needed better Memento and how did I achieved nice combination of Memento and Command design patterns. Full code is given.

→ Continue reading

Why is Ruby so entertaining? Mixins.


Ruby [0] is a simple, yet powerful language, thanks to which developers are enabled to create or programmatically sketch many things in a fast manner. It's good for prototyping GUI (Shoes [1]), web development (Rails [2], Merb [3]) or even for network administrator's scripting (for massive or scheduled actions).

The question today is - why are there so many people interested in that language? I think that one of strong features are mixins.
→ Continue reading

Immutability of Java’s Integer

As Wiki states

In object-oriented [...], an immutable object is an object whose state cannot be modified after it is created.

That totally applies to Java's Integer. Let's take a look at the code to talk about:

Integer is a class then why variables a and b have different values?! - you may ask. See the explanation if eager.
→ Continue reading

Swype language on Milestone 2

Motorola Milestone 2 showed up with built-in Swype app. It's handy but for those whose mostly used language is installed in it. My language wasn't there so what can I do to use Swype? The only way was to uninstall old version and install the newer one.

→ Continue reading

Visual Studio 2010 also may be messy

My C: partition on Windows is too small so sometimes I have problems with space. I have made a recent discovery that not only Windows itself but also Visual Studio 2010 is an out-of-space-situation helper.

C:\ProgramData\Microsoft Visual Studio\10.0\TraceDebugging

This is where you may find lots of files which will not be probably needed anymore. I've just deleted 2.5GB from there. I've got shocked it would be that much.

I recommend WinDirStat. It's a cool and simple application that helped me to find the path given above.