Shake To…

On 15/10/2009, in Development, Source Code, Tips, iPhone, by Pelaez

This is a class I made to detect shakes. It’s really simple, you just create an object, initialize it, set a delegate, and it will send messages to the delegate when the movement change is significant, then your object can do whatever you want, like refreshing info or whatever.

Details:

  • Detects side shakes.
  • Has a mechanism to avoid sending multiple messages for one long shake.
  • Sensitivity can be edited easily.
  • It has it’s protocol, so you don’t have to add new methods to your receiver’s interface.
  • It uses #ifndef’s so it can be imported several times without causing errors for having the same class multiple times.
  • Only one can be working at the time (activating a new one will deactivate the previous working one).

Continue reading »

Tagged with:  

Efficient Buffer

On 28/05/2009, in Java, Source Code, Tips, Tutorials, by Pelaez

This is a “tip” on making an efficient buffer in which, after you use the first object in it, it is removed from it.

Continue reading »

Tagged with:  

Blog Conventions

On 07/05/2009, in Blog, by Pelaez

This is like an introduction to understand this blog’s types of text better:

Types of Text:

//Comments
if([postText isSourceCode]){
}
"Strings"
$ [Terminal Input]

How I write code

This are the “rules” I follow when writing code:

1
2
3
4
5
6
7
8
//Camel-cased object names, no spaces before '['.
UILabel *myLabel = [[UILabel alloc] init];
if(condition){ //Brackets in the same line
/*if there are a lot of things nested, sometimes I comment
after the bracket to know what it closes, also in special
ocations like class/interface declarations*/

} //if
rect = CGRectMake(0.0f, 0.0f, 320.0f, 460.0f); //Spaces after comas, but not before.

Terms

iDevice – With this I refer to the iPod Touch or iPhone, whichever you are using

I’ll add more as I need them.

Tagged with: