With the iPhone 5, Apple introduced the in-cell display technology. This not only reduces light refraction, but helps manufacturers make their devices thinner. While this display method is great in some respects, it doesn’t come without its share of problems; most notably slowing response time of the display. According to a new report, Apple will switch the display technology used in their devices, turning to the new Touch-On-Display.

Before you start ranting, let me tell you that for the vast majority of us this glitch won’t be a problem; it’s likely that you’d never (or wouldn’t) even notice it. The only real way to notice it is moving your finger rapidly, diagonally over the display, it will drop out and become unresponsive. While no one can definitively say this is a hardware issue, it’s looking to be so. Have a look:

In order to fix this, The China Times is reporting that Apple will jump ship to the Touch-On-Display panels for future iPhone models, and has already teamed up with Chimei Innolux to do so. Apple has already begun testing these new displays, as Chimei Innolux transforms their 4.5G line to a supply line for touch panels. Also a breath of fresh air, China Times notes that this Touch-On-Display technology won’t make the display any thicker.

You may be thinking, “doesn’t this contradict earlier reports we’ve heard?” Not quite. Yes previous reports (as early as last week) stated Apple would be using Sharp’s IGZO display panel in future iDevices, but Sharp has supposedly licensed Chimei Innolux to produce/use the IGZO technology. From this angle, it looks like nothing but backing of earlier claims.

This glitch (or bug) may only look to be trouble for avid Fruit Ninja players, it’s a little deeper than that. Think of all the developers who want to build games or apps that incorporate rapid finger movement, but are stopped short by hardware (or software?) they love.

Courtesy : iPhoneDevelopers

We present a very good test application here and we are sure it will add a plus to your knowledge.

Build Your Own Group Messaging App

With Twilio’s REST API it’s easy to send text messages to any number of recipients. We’ve put together an example demonstrating how to build a simple group messaging application.  The example uses ASP.NET MVC and C# but the concepts can be easily applied to any other framework. Below we’ll discuss how to process incoming messages, handle subscribe and unsubscribe requests, and most importantly, forward messages from group members to the rest of the group.

In our group SMS app, members can join the group by texting START to your group phone number. After joining the group, any messages sent to the group number will be forwarded to all of the other members. To leave room for the sender’s number in the forwarded message, messages are limited to 140 characters in length. To leave the group, send STOP.

Group SMS Messaging Concepts

This example demonstrates receiving an incoming SMS via a POST request to your SMS URL, sending SMS messages to group members via the REST API and responding to the sender using a plain-text response to the incoming message HTTP request.

Implementation Overview

groupsms

  1. An SMS message is sent to your Twilio phone number
  2. Twilio sends a POST request to your phone number’s SMS URL (for this example it would be http://example.com/IncomingMessage).
  3. The message processor checks the message body for a command like START or STOP and changes the member’s group membership accordingly (the member list is stored in a database).
  4. If the message contains any other content and the sender is a member of the group, forward the included message to all other members via the Twilio REST API.
  5. Respond to the original sender with a confirmation message of the action taken.

Technical Requirements

This example was built with Visual Studio 2010, .NET 4, ASP.NET MVC 2, LINQ to SQL and SQL Server Express 2008. The code will work with a Visual Studio 2008, .NET 3.5 SP1 and ASP.NET MVC 1 project as well. This example also uses the TwilioRest C# SDK which can be found at http://github.com/twilio/twilio-csharp

Download

Download TwilioGroupSms.zip

Setup

For this example we’re using a simple LINQ to SQL class. You don’t have to use LINQ to SQL; any .NET data access strategy will work. Just replace the calls to the database with the equivalents in your favorite ORM. A sample database and .dbml file are included in the download.

1
2
3
4
CREATE TABLE [Member] (
     [MemberId] [int] IDENTITY(1,1) NOT NULL,
     [PhoneNumber] [nvarchar](50) NULL
)

Database schema

In one of your controllers, create an action method to receive the SMS messages. Here’s a sample controller structure that also includes a LINQ-to-SQL DataContext for easy reference. We’ll fill in the contents of IncomingMessage below with our message processing logic.

1
2
3
4
5
6
7
8
9
public class HomeController : Controller
{
    GroupSmsDataContext DB = new GroupSmsDataContext();
    [HttpPost] // or [AcceptVerbs(HttpVerbs.Post)] in MVC1
    public ActionResult IncomingMessage(string From, string To, string Body)
    {
         return View();
    }
}

Update your routes to allow this action to be accessed at /IncomingMessage:

1
2
3
4
public static void RegisterRoutes(RouteCollection routes)
{
    routes.MapRoute("Default", "{action}", new { controller = "Home", action = "Index" } );
}

Message Handling

All of our message processing will be handled inside the IncomingMessage action method.

When Twilio makes the POST request to your SMS URL it includes three values (To, From, Body) which will be bound by ASP.NET MVC to the appropriate method parameter. Once we know who the message is from, where it’s going and what it contains we can process it.

We first check for a join or leave command. If the contents of the message are one of the four supported commands, we add or remove the number from the group accordingly.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public ActionResult IncomingMessage(string From, string To, string Body) {
    string response;
    switch (Body.ToLowerInvariant().Trim()) {
        case "start":
        case "join":
            // subscribe member
            AddMemberToGroup(From);
            response = "SYSTEM: Welcome to the club :) Keep those messages under 140 characters! Send STOP to leave.";
            break;
        case "stop":
        case "leave":
            // unsubscribe member
            RemoveMemberFromGroup(From);
            response = "SYSTEM: See ya later alligator.";
            break;

If the message contains any other content we want to 1) check to see if they’re a member of the group already and 2) if so, forward the message on to all other members in the group.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
        default:
            // prevent non-members from sending messages to the group
            var member = DB.Members.FirstOrDefault(m => m.PhoneNumber == From);
            if (member == null) {
                response = "SYSTEM: Send START to send/receive messages from this group";
                break;
            }
           // set up the Twilio client
           var accountSid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // TODO: replace with your account ID
           var secretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // TODO: replace with your key
           var account = new TwilioRest.Account(accountSid, secretKey);
           // grab all the members of the group, except the sender
           var members = DB.Members.Where(m => m.MemberId != member.MemberId).ToList();
           foreach (var recipient in members) {
               // send the message to each member
               var url = string.Format("/2008-08-01/Accounts/{0}/SMS/Messages", accountSid);
               var values = new Hashtable();
               values.Add("To", recipient.PhoneNumber);
               values.Add("From", To);
               values.Add("Body", From + ": " + Body.Trim());
               account.request(url, "POST", values);
          }
          response = string.Format("SYSTEM: Message sent to {0} members", members.Count);
          break;
}

Lastly we respond back to the sender by outputting some plain text which Twilio reads and sends via SMS to the original sender.

1
2
3
    // respond with confirmation message
    return Content(response, "text/plain");
}

The membership management methods are implemented as follows. You can replace this implementation with the data access method of your choice.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
private void RemoveMemberFromGroup(string phoneNumber) {
    // retrieve member for this phone number
    var member = DB.Members.FirstOrDefault(m => m.PhoneNumber == phoneNumber);
    // if they exist, delete them from the database
    if (member != null) {
        DB.Members.DeleteOnSubmit(member);
        DB.SubmitChanges();
    }
}
private void AddMemberToGroup(string phoneNumber) {
    // retrieve member for this phone number
    var member = DB.Members.FirstOrDefault(m => m.PhoneNumber == phoneNumber);
    // if they're already a member, just ignore
    if (member != null) return;
    // add new member to database
    member = new Member();
    member.PhoneNumber = phoneNumber;
    DB.Members.InsertOnSubmit(member);
    DB.SubmitChanges();
}

Next Steps

There are a lot of ways you can extend this application. Here are a couple ideas to get you started:

  • Require a PIN to join the group
  • Allow members to set a display name
  • Handle messages longer than 140 characters
  • Add an option to mute messages for X hours
  • Allow members to specify quiet hours

Courtesy : Twilio

Dear Reader,

I know you are curious to improve your productivity, read following lines and achieve it! Having a great amount of confidence separates you from crowd, Just like a confident Tiger is everywhere saluted and respected.

You’re probably already aware that confidence plays an enormous role in success. When you exude confidence, you naturally attract others. People listen to you, follow you, and even buy products from you. Displaying confidence assures people that you know what you’re doing.

Even people with the highest levels of self-esteem feel unsure of themselves at times. Consider how difficult it is to be confident when you first start a new job and you don’t know exactly what you’re doing, you don’t feel fully comfortable with the routine, and you haven’t developed strong relationships with your co-workers yet. You probably don’t appear very confident.

There are a few simple tricks though that can help you boost your confidence at work, even when it’s down in the dumps. Whether you’re new
to a job or just suffering a momentary fit of self-doubt, give these tips a try:

Fake it till you make it

Remember that confidence is all about perception. Acting confident is the first step to feeling confident. In the process of convincing others, you may actually convince yourself. Have you ever felt really down but you had to pretend like nothing was wrong? What happened?

Most of the time, you’ll find that demonstrating a positive attitude (whether or not you really feel it inside) will actually help lead you
to feeling the same way. Project the confidence you want to feel and it will come to you. It’s all about your thought patterns. See yourself as a self-assured, outgoing, successful professional and eventually that is exactly what you will be.

Soak up knowledge and don’t be afraid to ask questions

No Question is ever silly, only the answers are. I believe confidence comes very naturally when you have a great deal of knowledge. Some of the best sales people are those who know their product inside and out. They feel secure with even the tiniest details. Soak up knowledge and don’t be afraid of showing others that you’re doing it. Don’t be shy about asking questions & you’ll usually find that others respect your inquisitiveness. It shows that you’re thinking, not just going through the motions.

Delete negative self talk

Nothing brings you down quite like an inner monologue that says “you’re not good enough”. Take a moment to listen to that voice and see if you’re guilty of negative self talk. When you’re faced with a challenge, do you hear yourself saying, “There’s no way you can do that”? When you make a mistake, do you hear yourself chide, “There you go again, you dummy”?

If so, you need to reprogram your brain. And lucky you;  you are human and can do it. It takes a lot of time and some dedicated, thoughtful activity, but the first step is to recognize what’s happening in your head. Go ahead and listen to the voices; take not of negativity and stop yourself. You and your brain are in this together and don’t let your inner critic run the show.

Avoid saying “I can’t”

Just saying these words makes you that much closer to failing. These words scream; “I don’t believe in myself! I see my limitations! I am afraid of failing!” Those are not the words of a confident person. Confident people look a challenge in the eye and say; “I can.” Just saying “I can” makes you that much closer to success. These words scream; “I believe in my abilities! I am capable of achieving anything! I am not afraid!” Remember that failure is not a crime, but not trying is. Give yourself the benefit of the doubt. Again, mindset is half the battle. In the famous word of William Ward; “If you can imagine it, you can achieve it. If you can dream it, you can become it.”

Look the part

This is a fundamental rule of confidence. When you dress for success, you feel much stronger, more powerful. Also, how you present yourself
has a big impact on how people perceive you. When you feel confident about the image you are projecting, you automatically project that
confidence with it. It’s not vain to take pride in your appearance; it’s just good sense.

Inspiration : Life Coaches

How to Add a Currency Converter in WordPress

To do business in our small but extremely well connected world, we need to take in consideration the many currencies that people use to purchase our products. When buying products on your website, your users might wonder how much would a specific product cost in my currency? In this article, we will show you how you to add a currency converter in WordPress, so your users can easily do currency conversion and determine the product cost within seconds.

First you need to install and activate Currencyr plugin. Upon activation, the plugin adds a Currencyr menu item in your admin sidebar. On Currencyr settings page you can choose the base currency (the default is United States Dollar). You can also choose which data provider you want to use, default option is Yahoo! Finance, but you may choose Google, Foxrate, European Central Bank or Open Exchange Rates.

Currencyr Settings Page

You obviously don’t want to fetch too much data as this could slow down your server. On the settings page you can choose how many times you want to update your currency exchange data. We recommend you do it twice a day.

Adding Currency Converter in WordPress

Currencyr plugin comes with a widget which you can add in your WordPress sidebar or any other widgetized area. The widget shows currency rates for the currencies you define. It also shows a currency converter tool which can be used to convert to and from any currency.

Currencyr Widget Settings

Apart from the widget, you can also add currency converter to any post or widget using shortcodes. Like for example, if you wanted to convert $135 USD to GBP you would add the following shortcode:

[currencyr amount=135 to=gbp]

If you want to convert the same amount into multiple currencies then you could use the shortcode like this:

[currencyr amount=139.99 to=eur|cad|aud]

You can also change the base currency, using the shortcode like this:

[currencyr amount=139.99 from=cad to=gbp|eur]

Currency Converter Display

There are many other currency conversion tools available out there. Some Forex information providers allow you to embed their conversion tools on your website, but most of them slow down your website which creates a bad user experience. This solution will allow you to add currency conversion in WordPress without slowing down your site. We hope that this article will help those who were looking to add currency conversion in WordPress. Let us know, if you have any other tips on how to handle currency conversion in WordPress.

Courtesy : WPBeginner

Dears,

iPhone development seems difficult just by hearing it or reading it, imagining it; but some good guidelines, good directions and good tools will make you learn the development very quickly. And We tell you, you’ve landed on the right webpage fortunately.

As Husen Daudi Sir says ‘Programming is all about ReUsability, you don’t have to develop anything from Scratch, use something existing, beautify it and enjoy’.

So you’ve got a Mac, you’ve got an iPhone, and you really want to start writing some apps. There’s tons of documentation available, but the best way to learn a new language and framework is to simply dive right in. All of the documentation and tutorials I ran across when learning to program the iPhone depended a little too much on Interface Builder, which basically sticks a layer of magic between me and what I want to do. Frankly, I like to begin at the bottom and work my way up, which is why this tutorial is going to show you how to create a basic ‘Hello World’ application programmatically – without the help of a visual designer.

When I pick up any new framework that includes a designer, I like to start out building interfaces in code, because then I get an understanding of what the designer is doing behind the scenes. And honestly, I find Interface Builder about one of the most confusing designers I’ve ever used.

The first thing you’re going to need to do is download and install the iPhone SDK. This is going to give you everything you need in order to build apps – XCode, iPhone Simulator, and Interface Builder. Downloading and installing the SDK is totally free. You’ll have to pay $99 if you want to run the app on a real iPhone or distribute it to the app store. For the purposes of learning, though, the simulator works just fine.

After you’ve got all that stuff installed, you’re ready to start. Start by launching XCode. By default it’s installed in the Developer folder.

Developer Folder

When you launch XCode you’ll be presented with a welcome screen. You can either look through that or just dismiss it, none of it is particularly important. What we need is a new project. Select File > New Project to bring up the project templates.

XCode New Project Window

The Window-Based Application is about as simple as it gets. What this template is going to give is a Window and an application delegate. An application delegate (UIApplicationDelegate) is an object that responds to messages from a UIApplication object. There can be only one UIApplication object, and the project template takes care of creating it for us. When you click Choose, you’ll now be prompted for a project name. I named mine “HelloWorld”.

Project Name

Once the project is created, you’ll be presented with the XCode interface and all of the files the project template has generated for you.

Basic XCode Interface

The important files are main.m, HelloWorldAppDelegate.h, and HelloWorldAppDelegate.m. The main function is where the single UIApplication object is created. The function call UIApplicationMain() takes care of that. You might be wondering, though, how in the world is HelloWorldAppDelegate hooked up to the UIApplication object? Well, unfortunately there’s still a little magic we can’t avoid. The template created a nib file for us (MainWindow.xib) that takes care of forming this relationship. You’ll just have to take it for granted that the messages will be passed into our delegate.

Now let’s check out the implementation of the delegate, HelloWorldAppDelegate.m. There are several messages we can get from the UIApplication object, however the template has already created the one we care about – applicationDidFinishLaunching

– (void)applicationDidFinishLaunching:(UIApplication *)application {

// Override point for customization after application launch
[window makeKeyAndVisible];
}

This function is where we’ll be creating our view controller, which will eventually hold our ‘Hello World’ label object. In order to create a view controller, we need to add another class to our project that subclasses UIViewController. Fortunately, since creating view controllers is a common task, XCode has a template for it. Right mouse click on the Classes folder and choose Add > New File.

XCode New File Window

When you click Next, you’ll be presented with some options. The only thing you should have to set is the filename. I named mine HelloWorldViewController. You might notice that the new implementation file (HelloWorldViewController.m) is full of commented out functions. View controllers are meant to be used by overriding the base implementation of various methods. In our case, we want to override loadView, which is used to manually populate a view controller.

// Implement loadView to create a view hierarchy programmatically,
// without using a nib.
– (void)loadView {}

We’re getting there. We’re almost ready to starting putting something on the screen. You don’t add controls directly to the view controller. They’re added to a UIView, which is a property of the view controller. The view, however, is not allocated yet, so we’re going to start there. We need to create a UIView object that is the size of our display and set it to the view controllers view property.

– (void)loadView {

//create a frame that sets the bounds of the view
CGRect frame = CGRectMake(0, 0, 320, 480);

//allocate the view
self.view = [[UIView alloc] initWithFrame:frame];

//set the view’s background color
self.view.backgroundColor = [UIColor whiteColor];
}

The first thing I do is create a CGRect object that will act as the bounds for our view. Basically I want the view positioned at (0, 0) and be the total size of the iPhone display (320, 480). View controllers have a view property that needs to be set to our new UIView object. The last thing I do is simply set the background color property to white.

All right, now we can actually create a label to hold our “Hello World” text.

– (void)loadView {

//create a frame that sets the bounds of the view
CGRect frame = CGRectMake(0, 0, 320, 480);

//allocate the view
self.view = [[UIView alloc] initWithFrame:frame];

//set the view’s background color
self.view.backgroundColor = [UIColor whiteColor];

//set the position of the label
frame = CGRectMake(100, 170, 100, 50);

//allocate the label
UILabel *label = [[UILabel alloc] initWithFrame:frame];

//set the label’s text
label.text = @”Hello World!”;

//add the label to the view
[self.view addSubview:label];

//release the label
[label release];
}

Again, I need to specify where I’d like the label to be, so I create another CGRect object. I then allocate the label and initialize it with the bounds I just created. Next up I set the text to “Hello World!” and add the label to the view. Objective-C uses reference counting to automatically delete objects, so whenever you’re done with a reference, you need to call release.

We now have a view controller with a label that will display the text, “Hello World”. Now we need to create an instance of this view controller and add it to our application. Remember that function, applicationDidFinishLaunching that I mentioned earlier. That’s where we’ll be creating our view controller.

The first thing you’re going to have to do it add an import statement at the top of that file (HelloWorldAppDelegate.m) so the compiler can find the declaration of that object.

#import “HelloWorldAppDelegate.h”
#import “HelloWorldViewController.h”

Just add it right under the existing import statement. Now we’re ready to create the view controller.

– (void)applicationDidFinishLaunching:(UIApplication *)application {

//allocate the view controller
self.viewController = [HelloWorldViewController alloc];

//add the view controller’s view to the window
[window addSubview:self.viewController.view];

[window makeKeyAndVisible];
}

Just like before, we simply allocate a new HelloWorldViewController. We don’t add the view controller directly to the window, rather we add it’s view property to the window. Technically we could create the view controller locally, but doing so would cause a memory leak. We need to save a reference to it somewhere so we can clean up the memory at a later time. I created a property called viewController to store the view controller.

Properties are defined in the .h file. Here’s my modified HelloWorldAppDelegate.h file.

#import <UIKit/UIKit.h>

@class HelloWorldViewController;

@interface HelloWorldAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;

HelloWorldViewController *viewController;

}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) HelloWorldViewController *viewController;

@end

The @class HelloWorldViewController is a forward declaration. Basically we’re telling the compiler a class with this name exists, but you don’t need to worry about its definition right now. In the @interface section, we declare a member variable to hold our view controller. Lastly, we use @property to wrap our member variable with implicit get and set functions.

We’re almost done. We now need to tell the compiler to actually create the get and set functions for our new property. We do that back in the .m file with @synthesize.

@synthesize window;
@synthesize viewController;

You should already see one for the window property. Just stick this one right underneath it. The very last thing we need to do is release our reference to the view controller when the dealloc is called. There should already be a dealloc function in the .m file. We just need to add a little to it.

– (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}

And there you have it. The final HelloWorldAppDelegate implementation file should look like this:

#import “HelloWorldAppDelegate.h”
#import “HelloWorldViewController.h”@implementation HelloWorldAppDelegate@synthesize window;
@synthesize viewController;- (void)applicationDidFinishLaunching:(UIApplication *)application {//allocate the view controller
self.viewController = [HelloWorldViewController alloc];//add the view controller’s view to the window
[window addSubview:self.viewController.view];[window makeKeyAndVisible];
}- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}

@end

We’re done. If you build and run the app (Build > Build and Go), you should see something that looks like the image below.

iPhone Hello World Screenshot

And there you have it. You’ve learned how to build a simple iPhone application entirely in code. The iPhone is a new platform for us, so as we learn we’ll continue to post new tutorials. If you’ve got questions, feel free to post them below or leave them in this Forums.

Want to learn more? Keep visiting our blogs regularly.
Courtesy : Major contents derived from SwitchOnTheCode