C++11 auto className::functionName(Parameters..) -> Type

A few days ago I found a totally new syntax like
auto ClassName::functionName() -> something.

Then I started to find out what does it mean and got my answer. Today I am going to share this.
Lets we have a class as Person Class

what do you think? is there any problem?

Actually there is a problem. The enum Type declared inside the Class and when we will try to define the function outside the class, compiler will not found the Type there. In this case

Type Person::getType()
will cause an error.

Now there is a solution to avoid this error is to define the function inside the class. But what if you we don’t want to do that. How can we define such functions outside the class?
here comes the syntax We talked about.
auto className::functionName()->returnType

This is the feature of C++11.

in our case our function will be
auto Problem::getType() -> Type
return m_type;

Thank you.

Posted in C++ | Tagged , , | Leave a comment

Skin Detection in C++ using OpenCV

Today I am going to share how to detect the human skin using YCbCr color space in OpenCV. It is very easy. Here I made an class that will detect the skin.

Continue reading

Posted in Image Processing | Tagged , , , , , , | 24 Comments

How to check whether a character is from English language or not in Objective-C

Last day I needed to check the UITextField ‘s text whether it is from English language or other Unicode character form other language. And also how many characters are form English language and how many from others?

Here is how I solved this problem.

int counterEng=0;
int counterOther=0;
for(int i=0;i<[textField.Text length];i++)
unichar lastChar = [textField.Text characterAtIndex:i];
if(lastChar >= 0x000 && lastChar <=0x255)
NSLog(@"Other Language");

Here unichar is the type for Unicode characters and if its value is from 0x000 to 0x255 then this character is from English language. Otherwise it is from other language.

If you know any better solution please share with us.


Posted in CodeProject, iPhone | Tagged , , , , , | Leave a comment

UITextField Custom Input Accessory View Class

Sometimes we need an accessory view of uitextfield to perform some action like hide the keyboard. To solve this I create a class which will add a toolbar on top of the keyboard holding a done button. If done button is pressed then keyboard will be hide.

Continue reading

Posted in CodeProject, iPhone | Tagged , , , , | 1 Comment

2012 in review

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 33,000 views in 2012. If each view were a film, this blog would power 8 Film Festivals

Click here to see the complete report.

Posted in Uncategorized | Leave a comment

[[UIDevice currentDevice] orientation] is not working for iPad

Today I face a problem in developing my app for iPad. I am checking the current orientation of my device using the following function and checking weather it is in Portrait or Landscape mode. This was working for iPhone 5.1 simulator properly but when I am checking this for iPad Simulator 5.1 it’s not working.
Continue reading

Posted in iPhone | Tagged , , , , , , | 1 Comment

Hide UINavigationBar LeftBarButtonItem & add custom UIButton in iOS 4.3 and iOS 5.1

You can easily hide the UINavigationBar LeftBarButton. But the problem is your way may not work for both iOS 4.3 & iOS 5.1.

I just find a way that work in both iOS

Code is:
Continue reading

Posted in Uncategorized | Tagged , , , , , | 2 Comments