Blog

Filtering all blogs archived in "June 2011"    Clear filter

Ataxx Bio-Warfare - Online Multi-Player Game1

Ataxx Bio-Warfare is a turn-based game of strategy, where you control the movement of Fungi petri dishes. Get one of your dishes within one space of your opponent's dishes and your fungi will take them over. Be the first to gain control of all the dishes on the lab table.

 

Read More

Log to Debug efficiently in Objective-C

Everyone wants to have an effecient logging method that releave him from the stepping debugging.

The following is a macro for debugging showing only in debug mode.

It shows:

  • Current File.
  • Current Function.
  • Current Line.
  • Custom Argments.

#ifdef DEBUG
#   define DLog(fmt, ...) NSLog((@"%s %s [Line %d] " fmt), __FILE__, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define DLog(...) ;
#endif

// ALog always displays output regardless of the DEBUG setting
#define ALog(fmt, ...) NSLog((@"%s %s [Line %d] " fmt), __FILE__, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

 

Ex: ALog(@"Hello world") will print:

path/to/LibraryController.m  -[LibraryController awakeFromNib] [Line 364] Hello world

 

Enjoy

Reference: http://stackoverflow.com/questions/969130/nslog-tips-and-tricks

Read More

Rails Helper including another helper problem in Development mode

I had a tough couple of hours fighting with Rails helpers , my desire was to include a helper inside another one to have a method of that other helper aliased, so I wrote the following:
 
module MyHelper

  include TheirHelper

  def their_method_with_my_mehtod
    puts their_method_without_my_method
  end

  alias_method_chain :my_method, :their_method

end
That worked with the first request, but subsequent requests, throwed a "Stack overflow error", because in development mode, helper is re-included and the two methods "their_method_with_my_mehtod" and "their_method_without_my_method" became pointing to the same thing, so the solution was:
 
 
module MyHelper

  include TheirHelper

  def their_method_with_my_mehtod
    puts their_method_without_my_method
  end

  alias_method_chain :my_method, :their_method unless method_defined?(their_method_without_my_method)

end

Another way to do that is through writing "unloadable" at the module start
module MyHelper

  unloadable # prevent it from being unloaded in development mode
             # other wise, a stack overflow exception will be 
             # thrown due to the alias method chain being called twice
  include TheirHelper

  def their_method_with_my_mehtod
    puts their_method_without_my_method
  end

  alias_method_chain :my_method, :their_method unless method_defined?(their_method_without_my_method)

end

Read More

RMagick installation: no such file to load — mkmf

I was following the steps mentioned here: http://rmagick.rubyforge.org/install2-linux.html, 
to install RMagick gem, but I got the error

http://rmagick.rubyforge.org/install2-linux.html

And the solution to this error was to install the dev package of Ruby, (ruby1.8-dev OR ruby1.9-dev)

After that, the installation worked fine.

Read More

Flex 4.1, 4.5(Hero) In Flex 3 compatibility mode, text not shown

A problem occured to me, when I tried to migrate to use Flex 4.5 (Hero), that text in pop-ups, and text in combo lists aren't viewed and that, it's mirrored, after some googling arround I've found that, it's a known issue with compatibility mode, and found this bug report with a word arround  

Read More
« Previous Entries