Namek Dev
a developer's log
NamekDev

WPF/Silverlight Design Data without XAML

February 19, 2014

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

public class MainViewModelDesignData : MainViewModel {
    public MainViewModelDesignData() {
        // TODO: instantiate your sample data
    }
}

In App.xml define your namespace:

xmlns:models="clr-namespace:YourApp.ViewModels"

and then:

<Application.Resources>
    <models:MainViewModel x:Key="DesignDataContext" />
</Application.Resources>

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:

→ Continue reading Visual Studio, WPF/Silverlight, csharp

CoffeeScript to JavaScript compilation in Sublime Text 2/3

May 19, 2013

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 CoffeeScript, javascript

Interface with basic implementation in C#

February 2, 2013

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:

public class MoveTo<T> : Animation<T>
        where T : ITransformable

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

→ Continue reading csharp, gamedev, languages, Visual Studio

Better Memento

November 4, 2012

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 Design Patterns, Languages, csharp

Why is Ruby so entertaining? Mixins.

August 16, 2012

Ruby

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 ruby, languages

Immutability of Java's Integer

July 6, 2012

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 a = 5;
Integer b = a;
b = b+1;
System.out.println("a = " + a);  // a = 5
System.out.println("b = " + b);  // b = 6

Integer is a class then why variables a and b have different values?

→ Continue reading Java, Languages

Swype language on Milestone 2

December 1, 2011

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

November 9, 2011

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 was shocked it was that much.

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

→ Continue reading IDEs, Visual Studio