Understanding HTTP Request and Response

an iOS app that harnesses the power of networking. http://goo.gl/uLEpLj

 

Introducing HTTP

The major contribution of  Sir Tim Berners-Lee in modern Internet era could be specified into three terms, which are HTTP, URL, and HTML. By adapting HTTP, clients and servers could communicate with each other in an efficient way. By formatting the message in HTML, communicators could convey text in a styling way. Both client and server could know the “address” of each other by specifying their URLs.

 

Understanding HTTP Request and Response

The communication process between client and server could be illustrated into the following processes:

1. The client establishes a TCP Connection to the server

2. The client sends an HTTP Request to the server

3. The servers reacts to the request by sending a HTTP Response over the same TCP Connection

4. The client could reuse the same TCP Connection for the making other requests or close the TCP connection.

 

URL Structure

The structure of URL could be separated into six parts, and here’s an example of URL:

http ://user:password@ hostname : port /absolute-path ?query

(1)                   (2)                    (3)         (4)             (5)                (6)

1. Protocol: The protocol component specifies which application layer protocol to use to communicate to the server, HTTP for example.

2. Credential: In the context of Enterprise Networks, some HTTP servers support the delivery of user credentials in the URL to fulfill a BASIC authentication challenge.

3. Hostname: The hostname portion of the URL specifies the TCP hostname or IP address of the host containing the wanted resource.

4. Port: The port portion of the URL specifies the TCP port to which the client should connect.

5. Absolute-Path: The absolute-path component specifies the path to the network resource as if the HTTP server was drilling down into a directory tree.

6. Query: The last component of a URL is the query string. This value is separated from the absolute-path by a question mark (?).

Before sending request to server, we have to encode our URL because the contents of the absolute-path and query string are restricted. Therefore, iOS provides a method on the NSString object to perform percent encoding of URLs.

NSString *urlString = @”http:// myhost.com ?query =This blog is awesome!”;

NSString *encodedString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

And the output would be: http://myhost.com?query=This%20blog%20is%20awesome!

 

Request Contents

An HTTP Request consists of three parts, which are the request line, the request headers, and the request body.

  • Request Line:

The request line contains three pieces of information:

  1. The HTTP Request Method
  2. The Request URI
  3. The HTTP Version

Ex:

GET /search?source=ig&hl=en&rlz=&q=ios&btnG=Google+Search HTTP/1.1

(1)                                                        (2)                                                       (3)

 

  • Request Headers:

Ex:

Host: http://www.google.com

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0)…

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en,en-us;q=0.7,en-ca;q=0.3

Accept-Encoding: gzip, deflate

Connection: keep-alive

Referer: http://www.google.com/ig?hl=en&source=webhp

Cookie: PREF=ID=fdf9979…

 

  •  Request Body:

The request body is an arbitrary sequence of bytes separated from the headers by a single blank line.

 

Response Contents

Response Content is structured similarly as Request Content. Starting with the status line (1), followed by headers (2), and a response body (3).

Ex:

(1)

HTTP/1.1 200 OK

 

(2)

Date: Tue, 27 Mar 2012 12:59:18 GMT Expires: -1

Cache-Control: private, max-age=0 Content-Type: text/html; charset=UTF-8 Content-Encoding: gzip Transfer-Encoding: chunked

Server: gws

 

(3)

<!doctype html><html itemscope=”itemscope” itemtype=”http://schema.org/WebPage”&gt;

<head><meta itemprop=”image” content=”/images/google_favicon_128.png”/> <title>ios – Google Search</title> <script>window.google={kEI:”prlxT5qtNqe70AHh873aAQ”, getEI:function(a){var b; while(a&&!(a.getAttribute&&(b=a.getAttribute(“eid”

In iOS’s URL loading system, the NSURLResponse object and its subclass NSHTTPURLResponse encapsulate the data returned from a request.

VAIO’S STP Strategy in China

sony_vaio_logo_2_by_dj_steaua-d3dr6pj

This article is to propose that Sony should focus on Status Focused segment, and Family User segment as target markets. The VAIO brand image should be positioned as premium laptops that represent distinguished status, and associate with the attribute of easy-to-use for these segments.

As a graduate student who majors in marketing, I believe that Sony have a great potential to success in China laptop market by focusing on Status Focused segment. According to the report, an emerging segment of Chinese consumers aspired to enjoy levels of status similar to those of more developed nations. In addition, the majority of Chinese laptop owners (Exhibit #3, attached) are located in 25-34 age specific, college degree education, and higher average income. Moreover, the respondents of Status Focused segment (Exhibit #8, attached) show the most interest to purchase laptops within the next 12 months, prefer to rank Sony as their top laptop brand, and disagree that laptop knockoffs are as good as the genuine products, implies that more consumers may willing to pay higher ASP for several intangible benefits, such as status, or brand image. These facts indicate that the potential market is not only immediate, but also have good prospects of gain.

Besides, targeting on Family User segment is also a highly recommended option for company to market our products to China. According to the description of Family User segment (Exhibit #5, attached), this group of consumers prefers the prospect of technology integration, which means they want their work to be done in an easy way without downloading software separately. Fortunately, one of company’s differentiators on laptop market is the multimedia software, which increases the accessibility by integrating video editing, photo editing, and music software into one suite. In addition, the segment characteristics (Exhibit #5, attached) also point out that the group of consumers seeks for stylish laptops. In fact, the demand perfectly fits with the strategic direction of company, which emphasizes design cues and reducing laptop weight and size. In other word, the group of consumers may tend to pay extra for laptops based on the convenience and aesthetic design considerations, and these two distinguishing features fit well with VAIO’s product strengths. Hence, I would suggest positioning our laptop products as premium laptops that represent distinguished status, and associate with the attribute of easy-to-use.

The focus on Status Focused segment and Family User segment will make us the opportunity to take advantage on the China laptop market. However, we still need to consider other noteworthy factors, such as political situation between Japan and China, historical complexity, and potential substitutes that may influence the marketing effectiveness.

 

3

Exhibit 3 shows that the 25-34 age specific (36%), college degree education (43%), and higher average income segments (46%) of laptop owners in China are the majority, comparing to other segments.

 

5

Exhibit 5 illustrates that the Family User segment enjoys technology integration, and seeks for stylish laptops.

 

8

Exhibit 8 shows that the Status Focused segment may plan to purchase laptops within the next 12 months, rank Sony as their top brand, and think that the genuine products are better than laptop knockoffs.

In remastering machine intelligence, Google rewrites search engine rules

Google has produced a car that drives itself and an Android operating system that has remarkably good speech recognition. Yes, Google has begun to master machine intelligence. So it should be no surprise that Google has finally started to figure out how to stop bad actors from gaming its crown jewel – the Google search engine. We say finally because it’s something Google has always talked about, but, until recently, has never actually been able to do.

With the improved search engine, SEO experts will have to learn a new playbook if they want to stay in the game.

SEO Wars

In January 2011, there was a groundswell of user complaints kicked off by Vivek Wadwa about Google’s search results being subpar and gamed by black hat SEO experts, people who use questionable techniques to improve search-engine results. By exploiting weaknesses in Google’s search algorithms, these characters made search less helpful for all of us.

We have been tracking the issue for a while. Back in 2007, we wrote about Americans experiencing “search engine fatigue,” as advertisers found ways to “game the system” so that their content appeared first in search results (read more here). And in 2009, we wrote about Google’s shift to providing “answers,” such as maps results and weather above search results.

Even the shift to answers was not enough to end Google’s ongoing war with SEO experts. As we describe in this CNET article from early 2012, it turns out that answers were even easier to monetize than ads. This was one of the reasons Google has increasingly turned to socially curated links.

In the past couple of years, Google has deployed a wave of algorithm updates, including Panda and Panda 2, Penguin, as well as updates to existing mechanisms such as Quality Deserved Freshness. In addition, Google made it harder to figure out what keywords people are using when they search.

The onslaught of algorithm updates has effectively made it increasingly more difficult for a host of black hat SEO techniques — such as duplicative content, link farming and keyword stuffing — to work. This doesn’t mean those techniques won’t work. One look into a query like “payday loans” or ‘‘viagra” proves they still do. But these techniques are now more query-dependent, meaning that Google has essentially given a pass for certain verticals that are naturally more overwhelmed with spam. But for the most part, using “SEO magic” to build a content site is no longer a viable long-term strategy.

The New Rules Of SEO

So is SEO over? Far from it. SEO is as important as ever. Understanding Google’s policies and not running afoul of them is critical to maintaining placement on Google search results.

With these latest changes, SEO experts will now need to have a deep understanding of the various reasons a site can inadvertently be punished by Google and how best to create solutions needed to fix the issues, or avoid them altogether.

Here’s what SEO experts need to focus on now:

Clean, well-structured site architecture. Sites should be easy to use and navigate, employ clean URL structures that make hierarchical sense, properly link internally, and have all pages, sections and categories properly labeled and tagged.

Usable Pages. Pages should be simple, clear, provide unique value, and meet the average user’s reason for coming to the page. Google wants to serve up results that will satisfy a user’s search intent. It does not want to serve up results that users will visit, click the back button, and select the next result.

Interesting content. Pages need to have more than straight facts that Google can answer above the search results, so a page needs to show more than the weather or a sports score.

No hidden content. Google sometimes thinks that hidden content is meant to game the system. So be very careful about handling hidden items that users can toggle on and off or creative pagination.

Good mobile experience. Google now penalizes sites that do not have a clean, speedy and presentable mobile experience. Sites need to stop delivering desktop web pages to mobile devices.

Duplicate content. When you think of duplicate content you probably think of content copied from one page or site to another, but that’s not the only form. Things like a URL resolving using various parameters, printable pages, and canonical issues can often create duplicate content issues that harm a site.

Markup. Rich snippets and structured data markup will help Google better understand content, as well as help users understand what’s on a page and why it’s relevant to their query, which can result in higher click-through rates.

Google chasing down and excluding content from bad actors is a huge opportunity for web content creators. Creating great content and working with SEO professionals from inception through maintenance can produce amazing results. Some of our sites have even doubled in Google traffic over the past 12 months.

So don’t think of Google’s changes as another offensive in the ongoing SEO battles. If played correctly, everyone will be better off now.

Top 4 Strategic SEO Trends to Watch for

200910124957MissionVision

Search engine optimization (SEO) has become one of the most popular digital marketing tools in recent decade. Marketing specialists have tried utilizing the marketing effectiveness by leveraging the SEO strategies. However, since the effectiveness of SEO campaigns is heavily depended on the algorithm of search engines. It’s essential for digital marketing strategists to predict the trends of SEO, and adapt for these changes in order to enhance the effectiveness of SEO campaigns.

Last year saw another whirlwind of changes and developments in search technology, with 65 updates to Google’s algorithm in August and September alone. Developing sites that perform well consumes so much energy that it can be easy to get caught up in the tactical day-to-day changes each time search engines do something new. Companies that will continue to secure top SERPs are those who look at the digital landscape from a birds-eye view and understand the main driver behind Google’s never-ending changes: serving the best possible results to searchers. Since today’s Internet savvy surfer seeks information from a growing number of devices and locations, a constant stream of algorithm updates is necessary and understandable. With that in mind, here are my thoughts and predictions for what SEO trends and developments we can expect in 2013 — and how to help ensure that your organization does not get lost in the shuffle.

1. Quality is the new SEO

Can a machine actually read an article and have the capacity to make a subjective judgment on whether or not the article was “good” or not?  It’s a bit scary, but the answer is a definite maybe. While we are far from turning our national defense systems over to Skynet, search engines are rapidly advancing towards the goal of understanding if your content is actually good. In 2013, search engines will continue to improve their ability to judge the value of a site’s content.

Google has become expert at determining what differentiates a great website from a mediocre one, and specifies over 20 stylistic, topical and structural guidelines for content creators to follow. The rankings of sites that engage in tactics that violate these guidelines will be removed, thereby allowing sites that meet the guidelines to rise up in the rankings.

So how do you differentiate your site from those of your competitors? All else being equal, the only way to do it is with good content. It is critical that your team has the right process in place to build relevant, compelling and engaging content on a consistent basis. To do so, you may want to ask yourself the following questions:

  • Do you have an editorial process?
  • Do you know the difference between an expert and a writer?
  • Does your content have grammatical or spelling errors?
  • Are you providing new substantial insights?
  • Is your content good enough to be published in a magazine?

2. Social plays an important role

Social is going to increasingly impact your rankings. In 2013 we will see a greater balance between the weight of factual and social search influences. Engines will consume massive amounts of data about its user’s social presence, including geography, influence, friends and interests.

To that end, Google has started to build social signals into search algorithms, and Facebook announced plans to develop a robust search feature using their wealth of social data. Facebook has constructed an interconnected graph of 1 billion human interrelationships, likes and preferences. Privacy issues aside, this is a strategic asset that will impact the future of searches.

It is clear that consumers don’t want just the facts, but are increasingly drawn to the opinions and experiences of their peers. So it’s no surprise that high rankings in Google can correlate very strongly with social signals from activity on Twitter, Facebook and YouTube. We’ve only just begun to see how this plays out.

3. Mobile Friendly is Not an Option

It is a necessity. With many sites seeing double-digit yearly increases in mobile traffic, a site that does not conform to the requirements of mobile devices will lose a growing percentage of search traffic. Search engines will be looking for the same elements in a mobile site that they do for a standard website: keywords, title tags, links and quality content. But remember, mobile query strings are, on average, 25 percent shorter than desktop searches. With limited visual space and condensed search tactics, it will be critical to include research, development, optimization and measurement that is strictly focused on the mobile experience.

Beyond keyword and linking tactics, consider the mobile user experience and, more importantly, mobile user expectations. Two thirds of smartphone users cited that slow to load websites are one of their biggest frustrations, with 64 percent expecting a site to load within four seconds. Large images and excessive use of flash or animated content will slow the load time of your mobile site and should be avoided.

4. The Knowledge Graph

In 2013, we will see Google attempt to answer more complex questions directly in the SERPs with the Google knowledge graph. The simplest way to understand a ‘knowledge graph’ is to examine the top right side of your screen on Google after searching for “Harrison Ford”. You will see a panel detailing Ford’s vital statistics followed by his most popular movies, as well as a list of what “People also search for” that shows suggestions for related searches based on searches of others with similar interests.

Still in its infancy, Google’s knowledge graph reservoir is a collection of roughly 18 billion facts on 570 million “objects” presented in a manner that intuitively provides several panels of answers surrounding information commonly associated with your search query. By understanding how to leverage the primary sources of trusted information for the Knowledge Graph, brands can optimize their presence and leverage opportunities for exposure. Wikipedia, one of the top sources of information for Knowledge Graph search, is a great place to start. Develop a high quality, informational Wikipedia page on your brand and validate the page by linking to trusted sources. Notice how this impacts the results on the right hand panel of search results. Take note of the related sources that are displayed to get ideas about how to impact that information.

As Google continues to experiment with structuring its information to improve the searcher’s experience, marketers and IT professionals alike will need to craft content that performs well and motivates searchers to go beyond the results page to read the full story.

Bottom line, developing relevant and valuable content for your audience will be the key to your success. Content that serves a purpose beyond a purchase or sale — that enables a user to solve a problem — will be a key factor in determining who succeeds in search and social and who falls from ranking grace.

The Hardness of Being a Digital Marketing Consultant

digital-marketing-trends1

Being a digital marketing consultant, or any type of consultant for that matter, is exciting. Working for yourself offers you a lot of freedom. If you’re good … or lucky … you can make more money than you used to make working for someone else. And you can control everything from the types of clients you work with to the hours you decide to spend with them.

But it also presents some different challenges, too. There’s plenty of stress, particularly when you’re first starting out, have no capital and if one client misses a payment you’ll have to sell plasma to make the mortgage. It’s not the same kind of stress you had when you were working for someone else, but it’s there.

You also go through the process of learning your strengths, weaknesses and, most importantly, your limitations. Biting off too much can be disastrous. There’s no sick feeling like the one you get when more than one of your clients are mad at you. But not biting off enough can also be disastrous. You’re back to the plasma thing again.

I’ve had two unfortunate experiences in my now year-and-a-half of experiencing, “life on my own.” One was a shortcoming of a client. The other was, at least I think, a shortcoming of mine. Neither were fun to experience, but both were necessary to help me learn my limitations.

About halfway through year one of Social Media Explorer (the business, not just the blog), I signed a neat client. They engaged me for a fair amount of work and I was able to budget 4-5 months out with them and another couple of accounts so that I could take some time to work on a bootstrapped side project after their busy beginning months were complete. But three months in, the client stopped paying. And by the time I reached my “time off” to focus on my project, the deficit caused by the client’s unwillingness to pay nearly bankrupted me.

But I recovered and let the legal system tend to the issue. I hated that the relationship had to go south, but I don’t work for free and when your lack of concern over your bills affects my children’s ability to eat or live in our home, I don’t have a lot of sympathy for you. I learned the value of contracts, due diligence on accounts receivable, my accountant and a good attorney.

More recently, I came to the end of a year-long engagement with another client and gave them an assessment and recommendation of where we should go next. After getting the go-ahead to submit another contract proposal, they abruptly ended our partnership without much explanation. While we went through some odd challenges together, ones neither of us could have prevented or predicted, and were behind schedule on what we’d set out to accomplish, I can only assume they weren’t happy with my ability to help them.

In retrospect, I keep thinking I could have done more, focused more time or attention to prevent it from turning out the way it did. But you learn to take the client’s wishes and move on.

Dealing with the bad news in client work is never anyone’s favorite thing to do. I’ve always tried to be confident and proud, but understanding and service-oriented when the fit hits the shan, as it were. Do I have shortcomings and limitations? Absolutely. Am I generally pretty effective and well-received by my clients? I sure think so.

At the end of the day you learn more from experiencing the bad than you do from the good. I’m a better person, professional and consultant because I’ve had to fire and sue a client, and because I perhaps didn’t do enough for another. But it doesn’t take away the sting and self-doubt.

How do you handle the bad in your job? Is there a better way to cope and deal than wallow in self-doubt until you smack yourself and have an internal locker room tirade with your confidence? I’m all ears. The comments are yours.

Too Much Love Will Kill You

Queen-Live-In-Milton-Keynes

Too Much Love Will Kill You

I’m just the pieces of the man I used to be
Too many bitter tears are raining down on me
I’m far away from home
And I’ve been facing this alone
For much too long
I feel like no-one ever told the truth to me
About growing up and what a struggle it would be
In my tangled state of mind
I’ve been looking back to find
Where I went wrong
Too much love will kill you
If you can’t make up your mind
Torn between the lover
And the love you leave behind
You’re headed for disaster
‘cos you never read the signs
Too much love will kill you
Every time
I’m just the shadow of the man I used to be
And it seems like there’s no way out of this for me
I used to bring you sunshine
Now all I ever do is bring you down
How would it be if you were standing in my shoes
Can’t you see that it’s impossible to choose
No there’s no making sense of it
Every way I go I’m bound to lose
Too much love will kill you
Just as sure as none at all
It’ll drain the power that’s in you
Make you plead and scream and crawl
And the pain will make you crazy
You’re the victim of your crime
Too much love will kill you
Every time
Too much love will kill you
It’ll make your life a lie
Yes, too much love will kill you
And you won’t understand why
You’d give your life, you’d sell your soul
But here it comes again
Too much love will kill you
In the end…
In the end.