Indian politician Brinda Karat has demanded that the Google website be banned in India for showing ads of clinics that help parents determine the sex of their baby during the pregnancy stage. The law of the land says:
The Pre-natal Diagnostic Techniques Act prohibits determination and disclosure of the sex of foetus. It also prohibits any advertisements relating to pre-natal determination of sex and prescribes punishment for its contravention. The person who contravenes the provisions of this Act is punishable with imprisonment and fine.
Since this looks like a punishable offence, Brinda has made an additional demand – the chief of Google India website be "arrested and prosecuted immediately" for the violation.
Google on their part have denied posting such ads on their website – "In India, we do not allow ads for the promotion of prenatal gender determination or preconception sex selection."
The interesting part is that Brinda’s claim isn’t entirely incorrect.
The moment I published this story, a Google AdSense Ad for "no-risk prenatal test" appeared in the sidebar of the blog as shown in the screenshot below. As I am seeing this page from India, Google algorithms should have ideally blocked that ad.
But yes, there were no ads for these topics on the main Google site.
Indian Politician Wants Ban On Google India Website
Originally published at Digital Inspiration by Amit Agarwal.
If you like simple wallpapers that don’t distract, do check out Simple Desktops. It contains a nice collection of minimal, yet beautiful desktop backgrounds in solid colors without any gradients or photographs.
Tom Watson, who is a product designer at Facebook and also the brain behind Simple Desktops, says that these desktop wallpapers make your computer beautiful while helping you stay focused.
Thanks Divya Manian.
Minimal Yet Beautiful Wallpapers for your Desktop
Originally published at Digital Inspiration by Amit Agarwal.
CSS sprites can dramatically increase a website’s performance, and with jQuery, we can implement awesome transition effects easily. Let’s get started.
Sprites date back to the early days of video games, where they were used as optimization technique for displaying 2D graphics. A CSS sprite is a technique that involves grouping images to form a single master image, and then selectively displaying only the required sections using CSS attributes (width, height, background-position etc).
In this tutorial we’ll create a navigation menu inspired by Dragon Interactive. They have an excellent design concept, with a perfect use of highlights and colors.
Step 1Begin by creating a new Photoshop document, which is 800px wide by 500px high.
Step 2Next, we’ll create a horizontal ruler at the 70px mark by going to view -> new guide; this will be our menu height.
Step 3Now we are going to create a folder menu, and inside it, a sub folder called “Menu Text.”
Step 4Select the text tool(shortcut: t) and set the following properties in the character toolbox.
Other fonts can be used as well but this font family is best suited for embedded text effect which we will give later. If you don’t have this font you can get it from Website.
Step 5Create another horizontal ruler at 40px, this will help to keep our menu text horizontally aligned.
Step 6Now select the menu text folder, and type the menu words HOME, SERVICES, PORTFOLIO, ABOUT, and CONTACT, keeping equal spaces between each. It should now look like the image below.
Step 7Now create another folder below the menu text folder, and name it “Menu Background.”
Step 8Let’s next create a new layer inside the Menu Background folder, and then using a rectangular marquee tool, create a selection of 100px wide and 70px high.
Step 9Select the gradient tool (shortcut : g), and set the gradient colors from #555555 to #adadae .
Step 10Now draw a gradient starting from the bottom of the selection to the top of the selection; then give it a stroke with the following properties:
The stroke was added to provide depth to our menu divisions.
Step 11Now In order to achieve the highly polished ends, and to create the proper effect when the mouse hover occurs, we will give it an adjacent highlight.
Step 12Go to select > modify > contract and enter 1px.
Step 13Select the burn tool and set the following properties:
Now we will move the menu division right 1px, using the move tool(shortcut: v) in order to show the left side of the stroke, which was invisible due to its position.
Step 15Create copies of the above layer and adjust them with respect to the menu text.
Two things that Must be NotedThis is what the menu looks like when we adjust the positioning of the layers and menu text accordingly.
Step 16In order to embed the typographic effect, we add the “Drop Shadow” effect with the following settings to our text:
Now, its time to create what the menu looks like during the mouse hover state. Create a copy of the “Menu Background” folder, and rename it to “Menu Hover.” Then, using the move tool, move the folder 70px down so that the newly created menu’s top part touches the horizontal guide.
The reason we have created the copy of the menu folder, is because we’re interested in the positioning of the menu text. If we had created it manually, then we would have to worry about the exact alignment of the menu’s text, which would be much more tedious.
Step 18Now, we will select the background layer of the service menu from the “Menu Hover” folder, and give it a nice elegant effect upon the hover state. To do this, first create a selection by pressing ctrl and click on the layer; then press delete, which will delete the current shade. Next…
Select radial gradient, and draw a line from the bottom of the selection to 30px above the top of the selection.
Step 19Our work is not done quite yet. To give it a smooth touch, we need to polish it a bit more. To create a more revealing menu division, we’ll make the edges darker. To achieve this, we need to add the following effects:
Apply a similar effect for the portfolio and about menus. For the contact menu, change the gradient colors to:
This what our menu looks like now:
Step 21The home menu division needs to be given special treatment; select the layer by pressing ctrl and clicking on the layer. Press delete to remove the current shade, and select the gradient tool with the following colors:
This time, select linear gradient, and draw a gradient from the top of the selection to the bottom of the selection.
Step 22Select the burn tool, keeping the rest of the properties the same except for the range, set it to midtones, and apply brush strokes around the edges except for the top.
Step 23Now to create the glassy effect: select the pen tool, make sure that “shape fill” is selected, and draw the shape like the one in the image, and set its blend mode to soft light with an opacity of about 40%.
Step 24Two more things before we’re finished with the Photoshop part.
Finally our sprite image looks so:
Step 25Now comes the coding section, which is quite easy. Create an html file, and add the following code:
<html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.easing.1.3.js"></script> <script type="text/javascript" src="sprite.js"></script> <title>Awesome Menu</title> </head> <body> <div id="nav"> <ul id="navigation"> <li ><a class="home" href="#"></a></li> <li ><a class="services" href="#"></a></li> <li ><a class="portfolio" href="#"></a></li> <li ><a class="about" href="#"></a></li> <li ><a class="contact" href="#"></a></li> </ul> </div> </body> </html>Here we have created a simple html file, which consists of an unordered list – our navigation bar. Before moving forward, let’s take a look at a couple of files we’ll now be importing:
Create an external .js file, called sprite.js, and paste in the following code.
$(function(){ $('#navigation li a').append(''); // span whose opacity will animate when mouse hovers. $('#navigation li a').hover( function() { $('.hover', this).stop().animate({ 'opacity': 1 }, 700,'easeOutSine') }, function() { $('.hover', this).stop().animate({ 'opacity': 0 }, 700, 'easeOutQuad') }) });When the DOM is loaded, we inject a span into our anchor tag; this span will actually animate. Then, using the hover function for the anchor tag, we animate the opacity of the span. To create a smoother animation, we will use the easing equation. I am using ‘easeoutsine’ and ‘easeoutquad’; feel free to try an alternative combinations, if you wish.
Step 27Now comes the CSS part. Create the style.css file. Below is the initial image of what the menu looks like. For now, it’s only four dots, because we haven’t yet styled it.
Step 28First, we align the list.
body{ background:#000000; } #navigation { margin-left:250px; } #navigation li { float:left; }We’ve only moved the menu in the center a bit.
Step 29Style the anchor tag; its background will be our sprite image.
#navigation li a { background-image:url(images/sprite.jpg); display:block; }The display style must be set to block; otherwise, nothing will be displayed.
In the next step, we will give each of them the proper positioning.
.home { background-position:0px 0px; width:102px; height:70px; } .services { background-position:-102px 0px; width:110px; height:70px } .portfolio { background-position:-212px 0px; width:108px; height:70px } .about { background-position:-320px 0px; width:102px; height:70px } .contact { background-position:-422px 0px; width:103px; height:70px }Here, we’ve set the background positioning, and width of each anchor tag. The values may vary, and it requires a bit of time to get perfect.
Step 30 #navigation a .hover { background:url(images/sprite.jpg) no-repeat; display: block; opacity: 0; position: relative; top: 0; left: 0; height: 100%; width: 100%; } #navigation a.home .hover { background-position: -0px -72px; } #navigation a.services .hover{ background-position: -102px -72px; } #navigation a.portfolio .hover { background-position: -212px -72px; } #navigation a.about .hover { background-position: -320px -72px; } #navigation a.contact .hover { background-position: -422px -72px; }Now we will define the CSS for the span; this is the same sprite image which is used above. The height and width are made 100% so that it occupies the whole anchor block. The background of each span tag is adjusted, and finally our work is complete.
Step 31Note that it takes time to get the position and width tuning right; you may end up with slightly different values for these attributes – and that’s perfectly okay!
CSS Sprites ResourcesPhew seems like a lot of work, but great things take time to build up. Here are some additional resources that you might find handy.
Like OpenDNS, Google today launched their own public DNS service that they say will make your web-surfing experience "faster, safer and more reliable."
If you want to access a site (say example.com) from your browser, your computer needs the IP address of the web server that is hosting that domain. The computer will then query a public DNS server to find the IP address of the site example.com.
This DNS server is generally maintained by your ISP but now you can instruct your computer (or wireless router) to use Google’s DNS server instead of your ISP’s DNS server. Google says their Public DNS Servers are hosted in data centers worldwide, and they use anycast routing to send users to the geographically closest data center.
If you are keen on making the switch to Google DNS, here’re the steps involved for Windows XP, Vista and Windows 7.
Video: Setup Google DNS on Windows XP
Select Internet Protocol Version 4 (TCP/IPv4), followed by Properties and them replace the IP addresses of your Preferred DNS server and Alternate DNS server with the IP addresses of the Google DNS servers which are 8.8.8.8 and 8.8.4.4 - the order doesn’t matter.
Screencast: Use Google DNS Servers on Windows 7 / Vista
In the above videos, I have changed settings for an Ethernet (LAN) connection but the steps are similar for Wireless networks as well.
In case you would like to setup Google DNS at the router level, open your router dashboard (e.g., http://192.168.1.1) and put the Google DNS server addresses (8.8.8.8 and 8.8.4.4) as your DNS server settings and apply.
How to Test Google DNS Servers
Open your command prompt and clear your DNS cache using the command ipconfig /flushdns. Then do a nslookup for any web address and you should see 1e100.net with 8.8.8.8 as the IP address for the DNS resolver.
C:\>ipconfig /flushdns Windows IP Configuration Successfully flushed the DNS Resolver Cache. C:\>nslookup www.microsoft.com Server: any-in-0808.1e100.net Address: 8.8.8.8 Non-authoritative answer: Name: lb1.www.ms.akadns.net Addresses: 64.4.31.252 207.46.19.190 207.46.19.254 Aliases: www.microsoft.com toggle.www.ms.akadns.net g.www.ms.akadns.net C:\>Video: How to Setup Google DNS on your Computer
Originally published at Digital Inspiration by Amit Agarwal.
If there are specific folders on your hard-drive that you access frequently, here’s a simple tip that will help you quickly reach these folders inside Windows Explorer without having to type the full folder path.
There’s an old DOS command called subst that you may use to assign easy-to-remember drive letters to any local folder in Windows.
Let’s assume that you have iTunes on your computer and it downloads all music, podcasts, movies, etc. in the following folder – C:\Users\labnol\Music\iTunes. Open the command prompt window and type the following command to associate drive "Y" with that folder.
subst y: C:\Users\labnol\Music\iTunesNow the next time you open Windows Explorer, you’ll see a new drive labeled Y: under My Computer that will directly open your iTunes folder.
You can repeat this process and assign different drives to all your other frequently used directories (the subst command cannot be used with mapped network folders though).
Screencast: How to use SUBST
The downside is that these virtual drives are temporary and will be removed as soon as you shutdown or restart the computer.
In that case, you may either put all the subst commands in your autoexec.bat file or download the free psubst utility – its just like the subst command but creates permanent virtual drives that will live even after a reboot. If you find the command prompt a little geeky, check the Visual Subst tool that not only adds a nice GUI to subst but also create persistent drives.
Related: More Useful DOS Commands
Assign Drive Letters to your Frequently Used Folders in Windows
Originally published at Digital Inspiration by Amit Agarwal.
Bing is good and it has definitely helped Microsoft improve its market share in the search engine market this year but most people here would have problems agreeing with the findings of a study that was recently posted on YouTube.
Microsoft hired a qualitative research firm to study if Google users were willing to switch to Bing. The firm in turn recruited 15 Google users and instructed them to use Bing, exclusively, for one week without revealing to them that the study was sponsored by Microsoft.
Out of these 15 participants, the study reveals that 10 indicated that they’ll switch from Google to Bing. Here are all the promo clips:
“15 Google Users Tried Bing for a Week and 10 of them Switched”
Originally published at Digital Inspiration by Amit Agarwal.
FirePHP is a Firefox plugin and server-side library combination which allows you to send all sorts of juicy info from your web application directly to your browser, much like the console.log() functionality with JavaScript. In this PLUS tutorial and companion screencast, we’ll teach you how to get started from the very beginning! Join TUTS Plus.
For those unfamiliar, the family of TUTS sites runs a premium membership service called “TUTSPLUS”. For $9 per month, you gain access to exclusive premium tutorials, screencasts, and freebies from Nettuts+, Psdtuts+, Aetuts+, Audiotuts+, and Vectortuts+! For the price of a pizza, you’ll learn from some of the best minds in the business. Join today!
Yes, you can use Google for sending snail-mail and this is not an April Fool’s joke.
If you have friends and family members in the US whom you would like to send greeting cards this holiday season, here’s something really interesting for you.
You can use a new service from Google to send some cool holiday greeting cards via snail-mail to anyone in the US for free. Just fill-in this simple form, type the postal address (not email address) of your friend and Google will post the card to him or her on your behalf with the stamps and everything for free.
Here’s how the personalized greeting card that your friend will receive via Google would look like – the version below uses the default Gmail template but there are about half a dozen more to choose from. Enjoy!
Also see: How to send postal letters through email
Google Can Help You Send Holiday Greetings via Snail Mail for Free
Originally published at Digital Inspiration by Amit Agarwal.
Sribbly is a nice note taking application that sits in your system tray and lets you quickly jot down notes, to-do lists, ideas and any other text-based information that you may want to remember later.
While writing notes, you can click the timer icon in the Scribbly window to add the current time and date in your notes. Or hit the Escape key on your keyboard and application will automatically hide itself.
The feature-set is limited but what I like most about Scribbly is that you can email youself all the notes with a click (see that message icon). You just have to specify your email address at the time of installation and there’s no other configuration required.
Scribbly is available as a free download on Adobe Marketplace and since its based on Adobe AIR, you can use it for capturing /emailing notes on Windows, Mac and Linux machines.
Related: Free Web Clipping Tools
Take Notes on the Desktop and Email Them to Yourself with Scribbly
Originally published at Digital Inspiration by Amit Agarwal.
Do you use Microsoft Office programs for creating documents and then use Google Docs to edit these documents online or as an offsite backup?
Well, now that Office 2010 and Office Web Apps are available under public beta for free, here are some reasons why you should consider uploading documents, presentations and spreadsheets into Office Web Apps via Windows Live SkyDrive in addition to your Google Docs account.
1. Windows Live SkyDrive supports larger files
You can upload office documents as large as 50 MB into Office Web Apps via Windows Live SkyDrive but the size limits are much less in the case of Google Docs. For instance, you can only upload Word Documents up to 500 KB, Presentations up to 10MB and Spreadsheets up to 1MB into your Google Docs account via the web.
2. Document formatting is preserved
If you are writing documents inside Microsoft Office, Office Web Apps are will preserve the document formatting much better than Google Docs.
In the above example, the left screenshot is of the original document composed inside Microsoft Word. The middle screenshot is of the same document imported into Google Docs while the image on extreme right is from Office Live Web Apps.
Related: Try Office Web Apps Now!
3. OpenXML file formats
Google Docs does not support .pptx which is the default file format of PowerPoint 2007 and 2010. You can however upload Word (docx) and Excel (xlsx) files into Google Docs. Office Web Apps with Windows Live SkyDrive supports all newer Office file formats.
4. Public Documents are in the Lifestream
Even if you upload documents into a publicly shared folder on Google Docs, you’ll still have to inform your audience about the location of these files. In the case of Windows Live SkyDrive, the documents are automatically published in your lifestream as soon as you upload them (see example) so everyone in the network can see them without you having to share any links.
5. Content is not ‘lost in translation’
Both Office Web Apps and Google Docs are still early products and do not support all the rich features that are available only inside Office desktop applications. Therefore, if you create a document or presentation inside Microsoft Office and then upload that file on to Google Docs or Windows Live SkyDrive, some of the document features (for example, slide transitions) won’t be available in the web version of the document.
But there’s one big difference here that I will try to illustrate with an example.
Let’s say you have created a presentation inside PowerPoint (sample file) that includes both slide transitions and animations. When you upload this file onto Google Docs, none of the transitions and animations will be visible online since Google Docs doesn’t support the feature. And when you download this presentation file from Google Docs and re-open inside PowerPoint, all the original transitions and animations are lost forever.
Expected behavior, right? Well, Office Web Apps will handle this a little different.
When you upload a document in Office Web Apps, the application will automatically preserve all the data in that document even if a particular feature is not currently supported by the online applications.
For instance, if your PowerPoint presentation contains a slide transition (e.g., Vortex) that is not supported in the online version of Office, the feature will be preserved in your presentation even if you upload it on to Office Web Apps via Windows Live SkyDrive. Later, when you download and open that presentation inside PowerPoint, it would be just like the original version. The content is not ‘lost in translation’ with Office Web Apps.
Are you using Google Docs as a Document Backup Service?
Some Microsoft Office users use Google Docs for "offsite backup" but there’s a small risk here because later, when you decide to download these documents from Google Docs into your local drive, some of the features of your original documents would be lost forever.
Office Web Apps won’t just preserve all the original features of your documents but you can also download entire directories of Office documents as a ZIP file with a simple click.
Related: Microsoft Office 2010 – A Visual Guide
Why You Should Upload Documents to Office Web Apps via SkyDrive
Originally published at Digital Inspiration by Amit Agarwal.
Whether you’re a programmer or not, you have seen it everywhere on the web. At this moment your browsers address bar shows something that starts with “http://”. Even your first Hello World script sent HTTP headers without you realizing it. In this article we are going to learn about the basics of HTTP headers and how we can use them in our web applications.
What are HTTP Headers?HTTP stands for “Hypertext Transfer Protocol”. The entire World Wide Web uses this protocol. It was established in the early 1990’s. Almost everything you see in your browser is transmitted to your computer over HTTP. For example, when you opened this article page, your browser probably have sent over 40 HTTP requests and received HTTP responses for each.
HTTP headers are the core part of these HTTP requests and responses, and they carry information about the client browser, the requested page, the server and more.
ExampleWhen you type a url in your address bar, your browser sends an HTTP request and it may look like this:
GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1 Host: net.tutsplus.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: PHPSESSID=r2t5uvjq435r4q7ib3vtdjq120 Pragma: no-cache Cache-Control: no-cacheFirst line is the “Request Line” which contains some basic info on the request. And the rest are the HTTP headers.
After that request, your browser receives an HTTP response that may look like this:
HTTP/1.x 200 OK Transfer-Encoding: chunked Date: Sat, 28 Nov 2009 04:36:25 GMT Server: LiteSpeed Connection: close X-Powered-By: W3 Total Cache/0.8 Pragma: public Expires: Sat, 28 Nov 2009 05:36:25 GMT Etag: "pub1259380237;gz" Cache-Control: max-age=3600, public Content-Type: text/html; charset=UTF-8 Last-Modified: Sat, 28 Nov 2009 03:50:37 GMT X-Pingback: http://net.tutsplus.com/xmlrpc.php Content-Encoding: gzip Vary: Accept-Encoding, Cookie, User-AgentThe first line is the “Status Line”, followed by “HTTP headers”, until the blank line. After that, the “content” starts (in this case, an HTML output).
When you look at the source code of a web page in your browser, you will only see the HTML portion and not the HTTP headers, even though they actually have been transmitted together as you see above.
These HTTP requests are also sent and received for other things, such as images, CSS files, JavaScript files etc. That is why I said earlier that your browser has sent at least 40 or more HTTP requests as you loaded just this article page.
Now, let’s start reviewing the structure in more detail.
How to See HTTP HeadersI use the following Firefox extensions to analyze HTTP headers:
In PHP:
Further in the article, we will see some code examples in PHP.
HTTP Request StructureThe first line of the HTTP request is called the request line and consists of 3 parts:
The remainder of the request contains HTTP headers as “Name: Value” pairs on each line. These contain various information about the HTTP request and your browser. For example, the “User-Agent” line provides information on the browser version and the Operating System you are using. “Accept-Encoding” tells the server if your browser can accept compressed output like gzip.
You may have noticed that the cookie data is also transmitted inside an HTTP header. And if there was a referring url, that would have been in the header too.
Most of these headers are optional. This HTTP request could have been as small as this:
GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1 Host: net.tutsplus.comAnd you would still get a valid response from the web server.
Request MethodsThe three most commonly used request methods are: GET, POST and HEAD. You’re probably already familiar with the first two, from writing html forms.
GET: Retrieve a DocumentThis is the main method used for retrieving html, images, JavaScript, CSS, etc. Most data that loads in your browser was requested using this method.
For example, when loading a Nettuts+ article, the very first line of the HTTP request looks like so:
GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1 ...Once the html loads, the browser will start sending GET request for images, that may look like this:
GET /wp-content/themes/tuts_theme/images/header_bg_tall.png HTTP/1.1 ...Web forms can be set to use the method GET. Here is an example.
<form method="GET" action="foo.php"> First Name: <br /> Last Name: <br /> <input type="submit" name="action" value="Submit" /> </form>When that form is submitted, the HTTP request begins like this:
GET /foo.php?first_name=John&last_name=Doe&action=Submit HTTP/1.1 ...You can see that each form input was added into the query string.
POST: Send Data to the ServerEven though you can send data to the server using GET and the query string, in many cases POST will be preferable. Sending large amounts of data using GET is not practical and has limitations.
POST requests are most commonly sent by web forms. Let’s change the previous form example to a POST method.
<form method="POST" action="foo.php"> First Name: <input type="text" name="first_name" /> <br /> Last Name: <input type="text" name="last_name" /> <br /> <input type="submit" name="action" value="Submit" /> </form>Submitting that form creates an HTTP request like this:
POST /foo.php HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://localhost/test.php Content-Type: application/x-www-form-urlencoded Content-Length: 43 first_name=John&last_name=Doe&action=SubmitThere are three important things to note here:
POST method requests can also be made via AJAX, applications, cURL, etc. And all file upload forms are required to use the POST method.
HEAD: Retrieve Header InformationHEAD is identical to GET, except the server does not return the content in the HTTP response. When you send a HEAD request, it means that you are only interested in the response code and the HTTP headers, not the document itself.
“When you send a HEAD request, it means that you are only interested in the response code and the HTTP headers, not the document itself.”
With this method the browser can check if a document has been modified, for caching purposes. It can also check if the document exists at all.
For example, if you have a lot of links on your website, you can periodically send HEAD requests to all of them to check for broken links. This will work much faster than using GET.
HTTP Response StructureAfter the browser sends the HTTP request, the server responds with an HTTP response. Excluding the content, it looks like this:
The first piece of data is the protocol. This is again usually HTTP/1.x or HTTP/1.1 on modern servers.
The next part is the status code followed by a short message. Code 200 means that our GET request was successful and the server will return the contents of the requested document, right after the headers.
We all have seen “404″ pages. This number actually comes from the status code part of the HTTP response. If the GET request would be made for a path that the server cannot find, it would respond with a 404 instead of 200.
The rest of the response contains headers just like the HTTP request. These values can contain information about the server software, when the page/file was last modified, the mime type etc…
Again, most of those headers are actually optional.
HTTP Status CodesAs mentioned before, this status code is sent in response to a successful request.
206 Partial ContentIf an application requests only a range of the requested file, the 206 code is returned.
It’s most commonly used with download managers that can stop and resume a download, or split the download into pieces.
404 Not FoundWhen the requested page or file was not found, a 404 response code is sent by the server.
401 UnauthorizedPassword protected web pages send this code. If you don’t enter a login correctly, you may see the following in your browser.
Note that this only applies to HTTP password protected pages, that pop up login prompts like this:
403 ForbiddenIf you are not allowed to access a page, this code may be sent to your browser. This often happens when you try to open a url for a folder, that contains no index page. If the server settings do not allow the display of the folder contents, you will get a 403 error.
For example, on my local server I created an images folder. Inside this folder I put an .htaccess file with this line: “Options -Indexes”. Now when I try to open http://localhost/images/ – I see this:
There are other ways in which access can be blocked, and 403 can be sent. For example, you can block by IP address, with the help of some htaccess directives.
order allow,deny deny from 192.168.44.201 deny from 224.39.163.12 deny from 172.16.7.92 allow from all 302 (or 307) Moved Temporarily & 301 Moved PermanentlyThese two codes are used for redirecting a browser. For example, when you use a url shortening service, such as bit.ly, that’s exactly how they forward the people who click on their links.
Both 302 and 301 are handled very similarly by the browser, but they can have different meanings to search engine spiders. For instance, if your website is down for maintenance, you may redirect to another location using 302. The search engine spider will continue checking your page later in the future. But if you redirect using 301, it will tell the spider that your website has moved to that location permanently. To give you a better idea: http://www.nettuts.com redirects to http://net.tutsplus.com/ using a 301 code instead of 302.
500 Internal Server ErrorThis code is usually seen when a web script crashes. Most CGI scripts do not output errors directly to the browser, unlike PHP. If there is any fatal errors, they will just send a 500 status code. And the programmer then needs to search the server error logs to find the error messages.
Complete ListYou can find the complete list of HTTP status codes with their explanations here.
HTTP Headers in HTTP RequestsNow, we’ll review some of the most common HTTP headers found in HTTP requests.
Almost all of these headers can be found in the $_SERVER array in PHP. You can also use the getallheaders() function to retrieve all headers at once.
HostAn HTTP Request is sent to a specific IP Addresses. But since most servers are capable of hosting multiple websites under the same IP, they must know which domain name the browser is looking for.
Host: net.tutsplus.comThis is basically the host name, including the domain and the subdomain.
In PHP, it can be found as $_SERVER['HTTP_HOST'] or $_SERVER['SERVER_NAME'].
User-Agent User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)This header can carry several pieces of information such as:
This is how websites can collect certain general information about their surfers’ systems. For example, they can detect if the surfer is using a cell phone browser and redirect them to a mobile version of their website which works better with low resolutions.
In PHP, it can be found with: $_SERVER['HTTP_USER_AGENT'].
if ( strstr($_SERVER['HTTP_USER_AGENT'],'MSIE 6') ) { echo "Please stop using IE6!"; } Accept-Language Accept-Language: en-us,en;q=0.5This header displays the default language setting of the user. If a website has different language versions, it can redirect a new surfer based on this data.
It can carry multiple languages, separated by commas. The first one is the preferred language, and each other listed language can carry a “q” value, which is an estimate of the user’s preference for the language (min. 0 max. 1).
In PHP, it can be found as: $_SERVER["HTTP_ACCEPT_LANGUAGE"].
if (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) == 'fr') { header('Location: http://french.mydomain.com'); } Accept-Encoding Accept-Encoding: gzip,deflateMost modern browsers support gzip, and will send this in the header. The web server then can send the HTML output in a compressed format. This can reduce the size by up to 80% to save bandwidth and time.
In PHP, it can be found as: $_SERVER["HTTP_ACCEPT_ENCODING"]. However, when you use the ob_gzhandler() callback function, it will check this value automatically, so you don’t need to.
// enables output buffering // and all output is compressed if the browser supports it ob_start('ob_gzhandler'); If-Modified-SinceIf a web document is already cached in your browser, and you visit it again, your browser can check if the document has been updated by sending this:
If-Modified-Since: Sat, 28 Nov 2009 06:38:19 GMTIf it was not modified since that date, the server will send a “304 Not Modified” response code, and no content – and the browser will load the content from the cache.
In PHP, it can be found as: $_SERVER['HTTP_IF_MODIFIED_SINCE'].
// assume $last_modify_time was the last the output was updated // did the browser send If-Modified-Since header? if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { // if the browser cache matches the modify time if ($last_modify_time == strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { // send a 304 header, and no content header("HTTP/1.1 304 Not Modified"); exit; } }There is also an HTTP header named Etag, which can be used to make sure the cache is current. We’ll talk about this shortly.
CookieAs the name suggests, this sends the cookies stored in your browser for that domain.
Cookie: PHPSESSID=r2t5uvjq435r4q7ib3vtdjq120; foo=barThese are name=value pairs separated by semicolons. Cookies can also contain the session id.
In PHP, individual cookies can be accessed with the $_COOKIE array. You can directly access the session variables using the $_SESSION array, and if you need the session id, you can use the session_id() function instead of the cookie.
echo $_COOKIE['foo']; // output: bar echo $_COOKIE['PHPSESSID']; // output: r2t5uvjq435r4q7ib3vtdjq120 session_start(); echo session_id(); // output: r2t5uvjq435r4q7ib3vtdjq120 RefererAs the name suggests, this HTTP header contains the referring url.
For example, if I visit the Nettuts+ homepage, and click on an article link, this header is sent to my browser:
Referer: http://net.tutsplus.com/In PHP, it can be found as $_SERVER['HTTP_REFERER'].
if (isset($_SERVER['HTTP_REFERER'])) { $url_info = parse_url($_SERVER['HTTP_REFERER']); // is the surfer coming from Google? if ($url_info['host'] == 'www.google.com') { parse_str($url_info['query'], $vars); echo "You searched on Google for this keyword: ". $vars['q']; } } // if the referring url was: // http://www.google.com/search?source=ig&hl=en&rlz=&=&q=http+headers&aq=f&oq=&aqi=g-p1g9 // the output will be: // You searched on Google for this keyword: http headersYou may have noticed the word “referrer” is misspelled as “referer”. Unfortunately it made into the official HTTP specifications like that and got stuck.
AuthorizationWhen a web page asks for authorization, the browser opens a login window. When you enter a username and password in this window, the browser sends another HTTP request, but this time it contains this header.
Authorization: Basic bXl1c2VyOm15cGFzcw==The data inside the header is base64 encoded. For example, base64_decode(’bXl1c2VyOm15cGFzcw==’) would return ‘myuser:mypass’
In PHP, these values can be found as $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'].
More on this when we talk about the WWW-Authenticate header.
HTTP Headers in HTTP ResponsesNow we are going to look at some of the most common HTTP headers found in HTTP responses.
In PHP, you can set response headers using the header() function. PHP already sends certain headers automatically, for loading the content and setting cookies etc… You can see the headers that are sent, or will be sent, with the headers_list() function. You can check if the headers have been sent already, with the headers_sent() function.
Cache-ControlDefinition from w3.org: “The Cache-Control general-header field is used to specify directives which MUST be obeyed by all caching mechanisms along the request/response chain.” These “caching mechanisms” include gateways and proxies that your ISP may be using.
Example:
Cache-Control: max-age=3600, public“public” means that the response may be cached by anyone. “max-age” indicates how many seconds the cache is valid for. Allowing your website to be cached can reduce server load and bandwidth, and also improve load times at the browser.
Caching can also be prevented by using the “no-cache” directive.
Cache-Control: no-cacheFor more detailed info, see w3.org.
Content-TypeThis header indicates the “mime-type” of the document. The browser then decides how to interpret the contents based on this. For example, an html page (or a PHP script with html output) may return this:
Content-Type: text/html; charset=UTF-8“text” is the type and “html” is the subtype of the document. The header can also contain more info such as charset.
For a gif image, this may be sent.
Content-Type: image/gifThe browser can decide to use an external application or browser extension based on the mime-type. For example this will cause the Adobe Reader to be loaded:
Content-Type: application/pdfWhen loading directly, Apache can usually detect the mime-type of a document and send the appropriate header. Also most browsers have some amount fault tolerance and auto-detection of the mime-types, in case the headers are wrong or not present.
You can find a list of common mime types here.
In PHP, you can use the finfo_file() function to detect the mime type of a file.
Content-DispositionThis header instructs the browser to open a file download box, instead of trying to parse the content. Example:
Content-Disposition: attachment; filename="download.zip"That will cause the browser to do this:
Note that the appropriate Content-Type header should also be sent along with this:
Content-Type: application/zip Content-Disposition: attachment; filename="download.zip" Content-LengthWhen content is going to be transmitted to the browser, the server can indicate the size of it (in bytes) using this header.
Content-Length: 89123This is especially useful for file downloads. That’s how the browser can determine the progress of the download.
For example, here is a dummy script I wrote, which simulates a slow download.
// it's a zip file header('Content-Type: application/zip'); // 1 million bytes (about 1megabyte) header('Content-Length: 1000000'); // load a download dialogue, and save it as download.zip header('Content-Disposition: attachment; filename="download.zip"'); // 1000 times 1000 bytes of data for ($i = 0; $i < 1000; $i++) { echo str_repeat(".",1000); // sleep to slow down the download usleep(50000); }The result is:
Now I am going to comment out the Content-Length header
// it's a zip file header('Content-Type: application/zip'); // the browser won't know the size // header('Content-Length: 1000000'); // load a download dialogue, and save it as download.zip header('Content-Disposition: attachment; filename="download.zip"'); // 1000 times 1000 bytes of data for ($i = 0; $i < 1000; $i++) { echo str_repeat(".",1000); // sleep to slow down the download usleep(50000); }Now the result is:
The browser can only tell you how many bytes have been downloaded, but it does not know the total amount. And the progress bar is not showing the progress.
EtagThis is another header that is used for caching purposes. It looks like this:
Etag: "pub1259380237;gz"The web server may send this header with every document it serves. The value can be based on the last modify date, file size or even the checksum value of a file. The browser then saves this value as it caches the document. Next time the browser requests the same file, it sends this in the HTTP request:
If-None-Match: "pub1259380237;gz"If the Etag value of the document matches that, the server will send a 304 code instead of 200, and no content. The browser will load the contents from its cache.
Last-ModifiedAs the name suggests, this header indicates the last modify date of the document, in GMT format:
Last-Modified: Sat, 28 Nov 2009 03:50:37 GMT $modify_time = filemtime($file); header("Last-Modified: " . gmdate("D, d M Y H:i:s", $modify_time) . " GMT");It offers another way for the browser to cache a document. The browser may send this in the HTTP request:
If-Modified-Since: Sat, 28 Nov 2009 06:38:19 GMTWe already talked about this earlier in the "If-Modified-Since" section.
LocationThis header is used for redirections. If the response code is 301 or 302, the server must also send this header. For example, when you go to http://www.nettuts.com your browser will receive this:
HTTP/1.x 301 Moved Permanently ... Location: http://net.tutsplus.com/ ...In PHP, you can redirect a surfer like so:
header('Location: http://net.tutsplus.com/');By default, that will send a 302 response code. If you want to send 301 instead:
header('Location: http://net.tutsplus.com/', true, 301); Set-CookieWhen a website wants to set or update a cookie in your browser, it will use this header.
Set-Cookie: skin=noskin; path=/; domain=.amazon.com; expires=Sun, 29-Nov-2009 21:42:28 GMT Set-Cookie: session-id=120-7333518-8165026; path=/; domain=.amazon.com; expires=Sat Feb 27 08:00:00 2010 GMTEach cookie is sent as a separate header. Note that the cookies set via JavaScript do not go through HTTP headers.
In PHP, you can set cookies using the setcookie() function, and PHP sends the appropriate HTTP headers.
setcookie("TestCookie", "foobar");Which causes this header to be sent:
Set-Cookie: TestCookie=foobarIf the expiration date is not specified, the cookie is deleted when the browser window is closed.
WWW-AuthenticateA website may send this header to authenticate a user through HTTP. When the browser sees this header, it will open up a login dialogue window.
WWW-Authenticate: Basic realm="Restricted Area"Which looks like this:
There is a section in the PHP manual, that has code samples on how to do this in PHP.
if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; exit; } else { echo " Hello {$_SERVER['PHP_AUTH_USER']}. "; echo " You entered {$_SERVER['PHP_AUTH_PW']} as your password. "; } Content-EncodingThis header is usually set when the returned content is compressed.
Content-Encoding: gzipIn PHP, if you use the ob_gzhandler() callback function, it will be set automatically for you.
ConclusionThanks for reading. I hope this article was a good starting point to learn about HTTP Headers. Please leave your comments and questions below, and I will try to respond as much as I can.
Whether you are looking to organize your personal life at home or to collaborate on a team project with your coworkers, here are some of the best web-based project management software that can help you stay organized and on top of your work.
All online project management apps discussed here offer introductory free accounts so you can use them at home or school as well without requiring any budget. And since they are online apps, you can successfully manage your projects, tasks and deadlines from virtually any computer.
1. Basecamp | Keep up with what needs to be done on your project
Basecamp from 37Signals attempts to keep you focused on the tasks at hand with its task-centric interface. The main dashboard shows all the upcoming tasks and milestones of all of your projects organized by date.
While creating to-do lists, you can assign individual items to any of the team members or everyone. There’s a message board associated with every project where you can share project updates or even post questions without having to email anyone – it’s just like an online message board but accessible only to your internal team who’s part of that project.
Basecamp offers wiki-style Writeboards for collaborative writing. Project members can additionally chat with the group through Campfire which is like a web-based instant messaging tool that also save a chat transcript for reference later.
Basecamp offers a free account for 1 project with unlimited users but you cannot add documents and other files to the project. For additional projects and features, upgrades are available starting at $12/month. There’s no learning curve involved.
2. Goplan | Know how long you’ve spent on each task
Goplan is a task-orientated project management tool that provides a discussion board, calendar, document storage (with file versioning), timesheets, tasks and tickets (e.g. for bug tracking and resolution).
One of the very unique features of Goplan is that it lets you easily track the time you spend on different tasks. It works like this. When working on a particular task (or a ticket), you can start the timer inside Goplan (the clock icon) and update your status so that everyone in the team is aware of what you are working on. When you stop the timer, this gets recorded automatically in your time sheet.
When creating new tasks and tickets inside Goplan, you can attach documents and other files to the project. And if you have team members who aren’t part of the project, they can still add tickets to the project by simple emailing a note to a specific email address.
Goplan offers more projects with the free plan than most other project management apps. The free plan provides 3 projects for 2 users, and 100Mb of online storage space for your files. Upgrades are available starting at $10/month for additional projects, users, and storage.
3. Soshiku | Manage your school or college assignments
Soshiku is aimed primarily at high school and college students to help them keep track of all pending assignments and other school work.
The home page shows all of the assignments that are due today, as well as upcoming events and assignments for the full week. You can invite partners (or your classmates) and collaborate on class assignments within Soshiku itself. You can also attach files up to 50 MB in size with assignments.
Although other project management products can be useful for students, Soshiku is designed specifically for students with no extra features and it’s completely free (supported by ads).
4. Harvest | Track Time and Money spent on projects
With Harvest, you can easily track time spent on a task using the web interface or through dedicated desktop widgets available for Mac and PC. Harvest offers integration with Basecamp, so you can use Harvest’s time tracking features along with the other project management features found in Basecamp.
If you are freelancer who’s using Harvest to track the time spent on a project, you can use the same tool to directly produce invoices for your clients for your time and other expenses. Once an invoice is created, the invoice dashboard keeps track of all open, past due, and recently paid invoices.
Harvest offers a free account for one user with up to 2 projects, 4 clients, and unlimited invoicing, and then offers upgrades with unlimited projects and additional users and features starting at $12/month.
4a. Co-op | Know what team members are doing right now
Co-op helps you track updates from everyone in the team inside a Twitter style interface. Team members can post anything in their status updates and it is visible to the entire team. The best part is that co-op includes built-in time tracking from Harvest (discussed above) so everyone know what you have been working on and for how long.
5. DeskAway | Know how your project is going with graphs and reports
If you want to keep track of your projects with graphs and reports, DeskAway could be a good service for you. DeskAway supports tasks, milestones, calendar, time sheets and file sharing. You can email all members of the project using DeskAway itself and the messages are also archived in a central location.
DeskAway offers detailed reports and graphs showing information about completed, overdue, and upcoming deadlines, as well as graphs showing your overall progress on various projects. You can also create an internal blog with DeskAway for team members.
DeskAway offers a free account for up to 3 active projects, 5 users, and 25MB of file storage but without support for issue tracking. You may upgrade starting at $10/month for accounts with more features including additional users, storage space and deskmail (a feature that lets you manage tasks via email).
6. Zoho Projects | Stay connected in a group project with social networking
There are quite a few things that set Zoho Projects apart from competition. For instance, if you already have your project plan created inside Microsoft Project, you can import the file into Zoho Projects and easily make that switch from desktop to web based apps.
Like most other Zoho services, you can log into Zoho Projects using your existing Google Account or Yahoo! credentials. Zoho Project is integrated with Google Docs so you can attach documents with your projects that are already on Google Docs. And like other online project management apps, Zoho Projects too offers an iCal feed of the project calendar so you can track milestones, tasks, etc. in Google Calendar or even Outlook.
With Zoho Projects, you can add tasks and milestones to a project, and communicate with your team through wikis, built-in chat, and forums (or message board). Each forum has a unique email address so you can post replies to forums posts via a simple email message.
The free version of Zoho Projects will let you create a single project with 1 wiki and 100 MB of file storage. The premium version of Zoho Projects offers support for timesheets, invoices and additional projects at $12/month.
Comparison of Online Project Management Apps
Originally published at Digital Inspiration by Amit Agarwal.
If you have not logged into your Facebook account for some time, I suggest that you do so now. Once you are logged-in, click the "Photos" tab on your Facebook profile and what you see there might surprise you.
It’s your own personal photo album on Facebook but none of these pictures of odd-looking cartoon characters, horoscope charts, photo collages, friend graphs, etc. have been uploaded by you.
What photo tagging applications can do to your Facebook profile
The culprit, as you may have guessed, are these Facebook applications that tag random images with your name and the tagged image therefore shows up in your Facebook profile page without you doing anything.
What’s the problem?
These "collages" not only make your Facebook profile look very unprofessional but there’s something else to worry about as well.
Some photo tagging applications on Facebook (as the one below) add links to bad sites in "your" photos and your innocent Facebook friends, who are just randomly browsing your pictures, might fall in the trap.
What can you do?
The simple way is that you remove your name tag from the tagged photo and it will be instantly removed from your Facebook photo album as well.
Next you should find the Facebook application that you friend used to create that photo collage in the first place and block that application forever so that your other friends are unable to use that application to spam your Facebook profile page.
Also make sure that you get notifications each time someone tags you in a photo. You can control this setting from the "Notifications" tab on the Account Settings page.
Photo tagging is the one of the most popular features on Facebook and, probably for this reason, Facebook doesn’t offer a simple setting that will prevent other users and applications from tagging you in photographs. You can however hide "photos tagged of you" from the privacy page so that the images don’t appear in your public photo albums and are visible only to you.
And as a precautionary measure, visit the authorized apps pages to make sure that you haven’t authorized any Facebook app to tag images of other people on your behalf. If you find one, just click the cross to remove that Facebook app from your profile permanently.
What can Facebook do?
When you are tagged in a photo by your friends (or a Facebook application), the tag is automatically approved and the picture appears in your profile. All we therefore need is an extra privacy setting that would let us to approve tags before a tagged photo appears on our profile page.
Facebook won’t let developers add apps to your profile without permission then why do they allow them to add pictures to your profile without asking.
The Biggest Nuisance on Facebook – Photo Tags
Originally published at Digital Inspiration by Amit Agarwal.
Nearing in on 100K (Apple approved) available apps as of this writing, the iPhone is the “do anything” device that’s ready and capable of near desktop computing in the palm of your hand with the convenience of fitting in your pocket. For web designers and developers, this means no more toting around a laptop just to take care of the small bits of our job. From work to play and everything in between, the iPhone probably has you covered. As the saying goes, “Yup, there’s an app for that”.
I’ve listed 50 iPhone apps for all you web designers and developers which covers everything from color scheme creators and font manuals to FTP and SSH clients. Also keep in mind there are many more of the same type of app.
.postimage { float: left; margin-right: 2em; margin-bottom: 2.7em; } cliqcliq ColorsWith cliqcliq’s Colors app, you can easily create, convert and manage colors and palettes. The app allows conversion between RGB, HSB and Grayscale. You can also extract colors and palettes from photos you’ve snapped or imported into your photo library.
When you’re done, you can email the palettes to yourself or someone else to quickly import into Photoshop or Illustrator.
Color Expert gives you an easy to use color wheel for creating great color palettes but also lets you get colors from photos, sliders and swatches. You can easily search through Pantone, web safe or HTML colors to find just what you’re looking for.
When you’re done, save or send the palette as an Adobe Swatch Exchange file (ASE) for Photoshop or another Adobe app.
HEX RGB Colors Guide is a pretty basic app for having a RGB and HEX color code reference guide in your pocket at all times. Choose between block or list view and get quick access to the color information you need right away.
For the price vs features, this is a bit spendy but could be very handy for some designers.
Quickly select and preview colors for the web with HTML Colors for some fun exploring or just to make sure you have the right combination. The sample text and background color make it easy to get the right foreground and background color combination.
You can also view HTML safe colors or try your luck with the “Random” button, then save or send your palette.
You’re probably familiar with MyFont’s WhatTheFont service. This app connects to that service for font discovery anywhere. Take a photo of the font (magazine, book or computer screen) or use an iPhone screenshot and WhatTheFont will tell you what the font is in just a few seconds, then view the font details within the app.
You never know when you’ll see a font you like or what and you it’s hard to beat free!
Need typographic inspiration? FontShuffle might be your solution. Browse 650+ font families or shake your iPhone for FontShuffle to mix new fonts into your results. Browse by category or search for something more specific, then view up to 24 similar typefaces in a list.
Once you’ve found something you like, you can preview it with custom sample text. You can also check out the font’s glyph set.
Interested in learning about typography? Or maybe just more about it? This is the app for that. It includes 60+ pages on the history of type, type basics, the latest info. on web typography and more. It doesn’t stop there though, it also has a 100+ page glossary of type terminology and examples.
There’s a lot more included in this app and it really is one of the best ways to learn typography.
This is the mobile companion to Photoshop.com for the iPhone which gives you access to your Photoshop.com photos for editing, uploading and sharing. Your editing capabilities are somewhat limited but considering this is on your phone, it’s quite nice.
You can crop and rotate, adjust color, saturation and exposure or apply filters like Sketch or Soft Focus along with many more options. It’s basic but powerful for a handheld device.
Convert is an easy to use unit converter that even web designers and developers will want. It includes conversions all the usual stuff like volume, angles and money but also for typography, pixels, picas and a lot more.
It also includes a regular calculator though so you won’t need to use the iPhone’s included calculator any more.
Caliper is a basic but very handy app to have in your toolbox. With it you can quickly and precisely measure objects (placed on or near the screen) or images on screen in pixels, centimeters, inches and more. The measurement jaws are also multitouch for faster measuring.
Source Viewer does exactly what it sounds like. It lets you view the source code of websites. However, it does much more such as syntax coloring with links highlighted specially, link extraction to easily view website resources, image collection for separate viewing and much more.
You can also open resource URL’s via browser or send them via email, save bookmarks and toggle source code word wrap. This is a great one for developers on the go!
Web Source Viewer is a much more basic than Source Viewer but it’s a fast and free way to view source code of any website from your iPhone.
FTP On The Go is a fully featured FTP app for the iPhone. It lets you do just about everything your desktop application does but with the convenience of mobility. Browse, upload, download, edit and preview files on your FTP or even on your iPhone. You can even email files, view documents within the app like Word, Excel, PDF’s, etc. and much more.
There are far too many features to list but this is a fantastic app for the price so check it out.
ServersMan essentially lets you use your iPhone like a wireless USB flash drive… or web server. Yeah, you can actually run a website with ServersMan. You can also store files on your iPhone via WiFi or 3G from any internet connected computer with a browser.
You’ll also be able to open files like Microsoft Office (Word, Excel, PowerPoint), iWork (Pages, Numbers, Keynote), PDF’s, HTML, CSS and much more.
If you’re looking for a full SSH terminal app, this is it. Access your servers via WiFi, 3G or EDGE with just about all the features you’d find in a desktop SSH terminal application. If you need a step up, there is also TouchTerm SSH Pro with some more advanced features optimizing usage on the iPhone.
With the Pro version you get features like gestures, auto-completion, graphical filesystem navigation and much, much more.
DatabaseViewer gives you mobile access to your databases and the tools you need to work with them. It supports MySQL, PostgreSQL, MS Access, MS Excel, Oracle and several more. Sync database data via 3G, EDGE or WiFi, apply SQL Select queries, filters and much more.
It’s a little bit expensive, but if you need access to your databases on the go, this is a solid choice.
If you run or host several websites, especially for clients, it’s important to keep an eye on their status. If you use the Are My Sites Up? service, this task is a breeze. This is the accompanying iPhone app for both subscription based and free versions of the service.
From the app you can manage account settings like email and SMS alerts, view your sites’ status and get push alerts.
With SEO IT you can easily analyze a website’s Search Engine Optimization. The application will analyze tons different parts including complete source code listing, META tags, tag counts, title contents, back links and many more parts of your website of choice.
Curious about your competition? This is a great way to check them out.
With Web Tools you can check whois information, domain availability, view server information, check response times and more. When you find information you want to keep for later or share, you can email the results.
It’s a pretty basic app but very useful, especially if you’re with a client who’s looking for a domain.
Nomina does more than just check domain availability. It can pull up a lot of helpful information for building a brand such as trademark checking, common-law usage, relevance of the brand name and lots more. It’ll save you tons of time when trying to build a brand for you or your client.
iStat gives you a great set of tools to monitor iPhone resource usage (including battery) as well as resource usage on remote systems including Mac, Linux and Solaris. You also get network tools such as ping and traceroute. Unfortunately Apple requested that they remove the “Free Memory” feature, which many are not happy about.
Easily monitor your iPhone, home computers and even web servers anywhere. Great value for the price!
Ego gives you a quick overview of your web statistics from services like Google Analytics but can also check stats on services like Twitter, Vimeo, Squarespace, Mint, Feedburner and Ember. The app is clean and simple to provide a quick view of your current stats. Tapping a service rotates through additional stats.
This is a great app for developers who want to keep track of web stats as well as developing social media stats.
If you’re looking for a fully featured Google Analytics app, this would be it. You’ll get quick access to your Google Analytics account, including maps, and all the information you’ll need. Google changed their API for Analytics so the app is being rewritten and the free update is due out this month.
You’ll also be able to access all your Google Analytics information via WiFi, 3G or EDGE.
Mint Stats plugs into Shaun Inman’s Mint analytics and provides stats for the last 24 hours. Check hourly and daily totals for views and unique visits, manage multiple sites, auto-refresh and more.
Overall, it’s a pretty basic app but gives you the info. you need while you’re on the go.
The Web Developer Bible app is a very handy reference for RGB to HEX color conversion, HTML entities and more. It’s a pretty simple app but it could certainly be useful for some web developers and because it’s free, it’s definitely worth at least checking out.
Developer’s Took Kit combines several helpful tools for developers and designers such as a computer science hex calculator (works with binary, octal and logic operations), color wheel and categorized ANSI UTF-8 character set. The character can be browsed by name, unicode value and symbol type.
The price seems a little much for what’s included but the calculator is quite helpful and finding UTF-8 characters is a breeze.
Learning CSS? Need a refresher course or just a reference sheet for CSS? This is a great app for just that. CSS Cheat Sheet is searchable and easy to browse by category. It includes descriptions, values and examples for backgrounds, borders, classifications, fonts, margins and a whole lot more.
This is probably one of the most thorough CSS reference apps available for the iPhone.
jQuery Cheat Sheet is another reference app from Concentric Sky. If you just need to reference something real quick or even if you’re new to jQuery, this is a great app to have handy. You can even write and test your jQuery within the app now.
It’s also important to note that this app doesn’t retrieve any of its information from the internet, so you can use it anytime, anywhere.
JavaScript Cheat Sheet is another reference app from Concentric Sky. It’s another great app for learning JavaScript or if you would like a handy reference app for those times you just can’t remember an expression or something else.
As with Concentric Sky’s other apps, this one also works completely offline.
This is probably one of the more popular reference apps from Concentric Sky that also allows you to write and test HTML within the app. Reference everything from tag lists to character sets and more with this.
As with Concentric Sky’s other reference apps, this is another goodie for beginners and those who would like a quick reference guide in their pocket.
If you’re a developer, your cheat sheet collection wouldn’t be complete without Concentric Sky’s PHP cheat sheet. Again, it’s great for those who would like a quick reference and for those who might be learning PHP.
The WordPress app gives you the power of WordPress in your pocket. Create and edit content on your sites, even if you’re offline. The app supports true previews, tags, categories, iPhone photo integration and most other functions you can do in WordPress from your desktop.
The app also lets you manage multiple sites if you need.
iBlogger is a multi-platform capable blogging app for everything from WordPress and TypePad to SquareSpace, Xanga and ExpressionEngine. You can easily manage just about any major blog installation with support for most major features like pictures, tags, links, etc.
If you run multiple blogs on multiple platforms, this is the app you’ll want for easy mobile access.
If you’re not using a password manager already, you might consider looking for one. 1Password is a popular choice and with iPhone integration, the choice is even easier. Store your information and passwords securely and let it automatically log you into websites with ease.
There’s a lot you can do with it, especially for the price.
PassGen is a straight forward and basic app that generates random passwords between 4 and 16 digits that will be much more secure than the basic passwords most people use. Once you generate a password, email it to yourself for safe keeping.
As a designer and/or developer, you probably share and sync files with lots of people across many computers. The Dropbox app gives you easy access to your Dropbox.com account files for viewing, managing and sharing while you’re on the go.
SugarSync is a service similar to Dropbox and provides easy file access anywhere. The same applies to the iPhone app which lets you view, manage and share your synced files anywhere, anytime. You can even stream entire music collections stored on your computer!
Discover lets you use your iPhone as a wireless mobile hard drive via WiFi. You (or others) can connect and transfer or share files. It even works iPhone to iPhone. Within the app you can also view all the major document formats including Microsoft Office, PDF’s, HTML and other text based files and many more.
Air Sharing gives you drag and drop access to your iPhone over WiFi when mounted as a wireless drive on Mac, Windows or Linux. You can also connect through a browser if necessary. You can view literally just about every major file format available including Microsoft Office and iWork files.
Store and view files on your iPhone with the Files app, again, over WiFi. You can also email and password protect your files if needed. Files also supports all major file formats such as Microsoft Office and Apple iWork. Once you’ve viewed files, the app can even remember the page and zoom level.
Quickoffice Files is part of an online service for managing your office files but the app can be used independently as well. Transfer files via WiFi, view, email and password protect files and even access your MobileMe iDisk account.
Sketches lets you easily jot down notes and thoughts as well as annotate your pictures and more. It’s sort of a cross between a fun and creative drawing and annotation app and something that also serves its purposes for business. You can also send your creations once you’re done.
As designers and developers, we get ideas all the time–regardless of location. iBlueSky lets you ditch the paper napkin and take brainstorming and problem solving to a new level. When you’re done you can send via email in Novamind, PDF, PNG, OPML and more formats.
There’s many more great functions with this app as well as integration with Box.net. The price seems a bit steep but it’s hard to put a price on great ideas right?
Things for the iPhone brings the power of Things for the desktop, to your iPhone. Wirelessly sync your lists and tasks when you’re near your computer. The great thing about this app though, is you don’t need the desktop application. Things for the iPhone is an independent app, thus the rather steep price.
Things simplifies task management and makes it much easier to stay productive and keep track of life anywhere you might be.
Remember The Milk (RTM) connects with the online service to sync your lists and tasks. You can also work offline and sync when the internet is available. RTM is a super simple and easy to use app and service but also provides the options and flexibility you might need.
RTM also has lots of integration with the iPhone such as detecting location for nearby tasks and much more.
MiniBooks brings the popular invoicing software, FreshBooks, to the iPhone. As far as I can tell, it’s an independent application that is capable of syncing with your online FreshBooks account (if not, the price is way steep). You get all the features and power of FreshBooks while you’re on the go.
There’s also a lite version available which I believe requires a FreshBooks account.
Jobs is a simple time tracking and time sheet creation app. It’s important to keep track of your time to make sure you get paid. Jobs features multiple timers, sessions, exporting, different currencies and more.
The nice thing about Jobs is that it’s not bloated with extra crap you don’t need. That way it’s easy as pie to keep track of your time.
Most of you are familiar with PayPal. If you’re not yet, you most likely will be soon. PayPal for the iPhone gives you quick access to your account for checking your balance, reviewing history, sending money and more. In fact, it’s so fast and easy, I use it to check my account even while I’m at the computer.
Beejive is arguably the best iPhone instant messaging app around that’s more capable than some desktop messaging clients. Connect to all the major services such as AIM, Windows Live, Yahoo!, GoogleTalk, Facebook, Myspace… and the list goes on. It also moves from 3G/EDGE to WiFi seamlessly and is capable of push notifications after you close the app.
I communicate with many clients via chat and this makes it easy to take my chats with me anywhere.
Prowl is simply a Growl client for the iPhone. Get push notifications from your Mac or Windows computer for anything you configure Growl with and would like push notifications on your iPhone. It’s all highly configurable to fit your needs.
I personally use it for multiple email accounts, messaging, system alerts and a lot more.
Well, there you have it fellow web designers and developers. 50 fantastic iPhone apps for taking on many of our daily tasks anytime, anywhere, from the convenience of a pocket sized device. As I mentioned at the beginning, there are several other options for many of these app types. I couldn’t include them all though or this list would be a mile long. These are the ones I’ve picked from personal experience and reviews during my own searches for apps to make my job a little easier.
As I’m sure we all are, I’m always on the lookout for fresh new apps to make my web design or development tasks easier, faster or more mobile. So, if you know of any really great apps, please share them with us in the comments below. Thanks!
A couple weeks ago, I received an email from Chris Coyier, of CSS-Tricks, containing a review copy of his recently released “Digging into WordPress” e-book. Expecting it to be more of a mini-book, I nonchalantly told him that I’d post a review that Friday; little did I know that this was a full-fledged book, packed full of knowledge.
“Written by WordPress veterans Chris Coyier and Jeff Starr, Digging into WordPress is 400+ jam-packed pages of everything you need to get the most out of WordPress. WordPress is great right out of the box, but unless you want an ordinary vanilla blog, it is essential to understand the full potential of WordPress and have the right tools to get the job done.”
Those of you who read CSS-Tricks will be well aware that Chris writes in a very easy-to-understand fashion. Rather than flooding each article with high-level jargon that only the most knowledgeable of us can understand, he instead dumbs each article down to the fundamentals – even to the point of being honest enough to convey when he doesn’t quite understand the reasoning behind some line of code.
As a result, he’s built a wonderful community and reputation for himself in the last few years. This book, co-written with Jeff Starr, is no different: straight-forward, easy-to-understand, and simple.
Simple LearningThanks to the use of fun, and helpful illustrations, even those who are brand new to WordPress will be able to dig their heals in — with minimal confusion.
The 400 page ebook covers everything from navigating the admin panel, to creating a comments form, to even more advanced topics like plugin development. And though it’s generally good practice to point out a few negatives in one’s review, it’s difficult to do so when a book is such a pleasure to read.
Heart of a TeacherChris and Jeff, in this book, have proven that they have the hearts of teachers. Even for intermediate to advanced WordPressers, there’s something to be learned — and at $27, the purchase is a no-brainer!
“Digging into WordPress is perfect for WordPress users in the beginner to intermediate range, but contains plenty of great information for the advanced user as well. If you have any level of experience working with web design or WordPress, this book is written to help you take WordPress to the next level.”
400 Pages of Practical Information“There is much to learn about the World’s most popular publishing platform.
From your first steps of learning about WordPress all the way through
maintaining a site throughout the years, this book is packed with truly
practical information.”
“We go into depth about the anatomy of a WordPress theme. How they work, and how
to write the code you need to do the things you want. This means real code that
you can sink your teeth into, as well as copy and paste. Beyond theme
building, we introduce many tricks your functions.php file can pull off and show
you ways to increase performance and security through HTAccess.”
Chris has generously offered to give away a few copies to our community. To enter, simply leave a comment, and be sure to check back on Friday to see if you were randomly chosen!
Continuing on from lesson one, Jeremy McPeak, author of Professional AJAX, and Beginning JavaScript: 4th Edition, will take things a step further as we delve deeper into working with the ASP.NET framework.
The Complete Series Screencast Other Viewing Options
eBay, the world’s largest online auction place, recorded over a million transactions on Black Friday which is probably one of the busiest and most hectic shopping days of the year in US.
Now if you ever wondered what a Black Friday looks like on eBay (1 million transactions in less than 24 hours or around 12 transactions per second), check this interesting heat map on Facebook that captures all the buying-selling activity on eBay across the US on Black Friday.
What happens on a Black Friday
The areas with lower transactions during Black Friday appear in yellow while those with the highest number of total transactions on eBay appear in red.
The application has been developed by eBay using Virtual Earth so you can zoom in or out using the slider or hold the mouse button to pan around the heat map.
And here’s a non-interactive screencast video of the same heat-map visualization of US-based buyer and seller transactions that happened on eBay on Black Friday, 2009.
What Does a Black Friday Look Like on eBay
Originally published at Digital Inspiration by Amit Agarwal.
We live in a web centric world right now, and if you haven’t already, you’ll most likely be facing website related dilemma(s). For example, maybe you need an email template to send out your company newsletter(s) but you don’t have the first clue as to how to create one let alone create one that works with all major clients, looks outstanding and is easy to customize and reuse.
Or maybe you need a stylish but functional admin panel for a client whom you’ve just built a complex CMS for, but you aren’t a designer. There are an infinite number of possible problems you could be facing and fortunately, there are solutions.
1. Airmail! – Customizable Email Template“Airmail is a professionally built and designed custom HTML email template! Perfect for just about anyone – usable for everything from newsletters to eFlyers to whitepapers.”
2. Simpla Admin – Flexible & User Friendly Admin skin“Simpla Admin is a professional template with a beautiful and user friendly interface. With various smart and intuitive jQuery functions, navigating the interface is a breeze.”
3. CleanMail – Email Template Package – 5 Colors!“CleanMail is a simple yet sexy email template package with 5 different color schemes!”
4. WordPress Wiki Theme“If you’re looking for a Knowledge Base or Wiki for your company but don’t want or need a full blown Wiki Application. This is the theme for you. Built with a custom Frequently Asked Questions plugin to help extend the functionality of your web site. The plugin acts as a custom write panel that displays in essence short FAQs below posts in their respective categories. The FAQs are searchable and paginate and are not required.”
5. Marketplace Community WordPress Theme“Marketplace is a both clean and stylish WordPress theme with the intent and focus on creating a community site for industry news, tutorials, etc. This theme includes many popular built in features seen in today’s industry leading community sites. This themes comes with 5 different color options to choose from.”
6. vCard Professional Portfolio“This is a professional and clean vCard based on Tim Van Damme’s website. With this design you can use almost any background.”
7. Sleek Server Error Pages“This is a clean, web 2.0 design for website / server error pages. It is flexible and very easy to customize. It comes with 5 of the most common error pages (404, 403, 401, 500 and 503) but it’s very easy to add more if needed. All text is real text so adding more pages is a breeze, no image editing required.”
8. NEOTERIC—The Ultimate Under Construction Page!“NEOTERIC is a clean single page ‘Under Construction/Coming Soon’ template in 10 SKINS designed to keep your users up to date on your site’s progress.”
9. Under Construction Page with Twitter & Pie Graph!“Make sure your visitors know whats going on with this Under construction site template that features a feed of your latest tweets (which can be easily removed if you dont use twitter) and a pie chart that is easy to change to reflect your progress!”
10. Minimo – A minimal one page portfolio theme“Minimo is a simple and attractive one page portfolio showcase theme. This theme is built using the 960.gs grid system framework, giving it a structured and professional look and features custom designed icons. Included is a form mail script, so the entire site works out of the box, simply add your destination email address.”
ConclusionWhen working on projects for your clients, what kinds of templates do you find yourself most in need of? Thanks for reading!
Regular expressions can be scary…really scary. Fortunately, once you memorize what each symbol represents, the fear quickly subsides. If you fit the title of this article, there’s much to learn! Let’s get started.
Section 1: Learning the BasicsThe key to learning how to effectively use regular expressions is to just take a day and memorize all of the symbols. This is the best advice I can possibly offer. Sit down, create some flash cards, and just memorize them! Here are the most common:
Yep – it’s not fun, but just memorize them. You’ll be thankful if you do!
ToolsYou can be certain that you’ll want to rip your hair out at one point or another when an expression doesn’t work, no matter how much it should – or you think it should! Downloading the RegExr Desktop app is essential, and is really quite fun to fool around with. In addition to real-time checking, it also offers a sidebar which details the definition and usage of every symbol. Download it!.
The next step is to learn how to actually use these symbols! If video is your preference, you’re in luck! Watch the five lesson video series, “Regular Expressions for Dummies.”
In this final section, we’ll review a handful of the most important JavaScript methods for working with regular expressions.
1. Test()This one accepts a single string parameter and returns a boolean indicating whether or not a match has been found. If you don’t necessarily need to perform an operation with the a specific matched result – for instance, when validating a username – “test” will do the job just fine.
Example var username = 'JohnSmith'; alert(/[A-Za-z_-]+/.test(username)); // returns trueAbove, we begin by declaring a regular expression which only allows upper and lower case letters, an underscore, and a dash. We wrap these accepted characters within brackets, which designates a character class. The “+” symbol, which proceeds it, signifies that we’re looking for one or more of any of the preceding characters. We then test that pattern against our variable, “JohnSmith.” Because there was a match, the browser will display an alert box with the value, “true.”
2. Split()You’re most likely already familiar with the split method. It accepts a single regular expression which represents where the “split” should occur. Please note that we can also use a string if we’d prefer.
var str = 'this is my string'; alert(str.split(/\s/)); // alerts "this, is, my, string"By passing “\s” – representing a single space – we’ve now split our string into an array. If you need to access one particular value, just append the desired index.
var str = 'this is my this string'; alert(str.split(/\s/)[3]); // alerts "string" 3. Replace()As you might expect, the “replace” method allows you to replace a certain block of text, represented by a string or regular expression, with a different string.
ExampleIf we wanted to change the string “Hello, World” to “Hello, Universe,” we could do the following:
var someString = 'Hello, World'; someString = someString.replace(/World/, 'Universe'); alert(someString); // alerts "Hello, Universe"It should be noted that, for this simple example, we could have simply used .replace(’World’, ‘Universe’). Also, using the replace method does not automatically overwrite the value the variable, we must reassign the returned value back to the variable, someString.
Example 2For another example, let’s imagine that we wish to perform some elementary security precautions when a user signs up for our fictional site. Perhaps we want to take their username and remove any symbols, quotation marks, semi-colons, etc. Performing such a task is trivial with JavaScript and regular expressions.
var username = 'J;ohnSmith;@%'; username = username.replace(/[^A-Za-z\d_-]+/, ''); alert(username); // JohnSmith;@%Given the produced alert value, one might assume that there was an error in our code (which we’ll review shortly). However, this is not the case. If you’ll notice, the semi-colon immediately after the “J” was removed as expected. To tell the engine to continue searching the string for more matches, we add a “g” directly after our closing forward-slash; this modifier, or flag, stands for “global.” Our revised code should now look like so:
var username = 'J;ohnSmith;@%'; username = username.replace(/[^A-Za-z\d_-]+/g, ''); alert(username); // alerts JohnSmithNow, the regular expression searches the ENTIRE string and replaces all necessary characters. To review the actual expression – .replace(/[^A-Za-z\d_-]+/g, ”); – it’s important to notice the carot symbol inside of the brackets. When placed within a character class, this means “find anything that IS NOT…” Now, if we re-read, it says, find anything that is NOT a letter, number (represented by \d), an underscore, or a dash; if you find a match, replace it with nothing, or, in effect, delete the character entirely.
4. Match()Unlike the “test” method, “match()” will return an array containing each match found.
Example var name = 'JeffreyWay'; alert(name.match(/e/)); // alerts "e"The code above will alert a single “e.” However, notice that there are actually two e’s in the string “JeffreyWay.” We, once again, must use the “g” modifier to declare a “global search.
var name = 'JeffreyWay'; alert(name.match(/e/g)); // alerts "e,e"If we then want to alert one of those specific values with the array, we can reference the desired index after the parentheses.
var name = 'JeffreyWay'; alert(name.match(/e/g)[1]); // alerts "e" Example 2Let’s review another example to ensure that we understand it correctly.
var string = 'This is just a string with some 12345 and some !@#$ mixed in.'; alert(string.match(/[a-z]+/gi)); // alerts "This,is,just,a,string,with,some,and,some,mixed,in"Within the regular expression, we created a pattern which matches one or more upper or lowercase letters – thanks to the “i” modifier. We also are appending the “g” to declare a global search. The code above will alert “This,is,just,a,string,with,some,and,some,mixed,in.” If we then wanted to trap one of these values within the array inside of a variable, we just reference the correct index.
var string = 'This is just a string with some 12345 and some !@#$ mixed in.'; var matches = string.match(/[a-z]+/gi); alert(matches[2]); // alerts "just" Splitting an Email AddressJust for practice, let’s try to split an email address – nettuts@tutsplus.com – into its respective username and domain name: “nettuts,” and “tutsplus.”
var email = 'nettuts@tutsplus.com'; alert(email.replace(/([a-z\d_-]+)@([a-z\d_-]+)\.[a-z]{2,4}/ig, '$1, $2')); // alerts "nettuts, tutsplus"If you’re brand new to regular expressions, the code above might look a bit daunting. Don’t worry, it did for all of us when we first started. Once you break it down into subsets though, it’s really quite simple. Let’s take it piece by piece.
.replace(/([a-z\d_-]+)Starting from the middle, we search for any letter, number, underscore, or dash, and match one ore more of them (+). We’d like to access the value of whatever is matched here, so we wrap it within parentheses. That way, we can reference this matched set later!
@([a-z\d_-]+)Immediately following the preceding match, find the @ symbol, and then another set of one or more letters, numbers, underscore, and dashes. Once again, we wrap that set within parentheses in order to access it later.
\.[a-z]{2,4}/ig,Continuing on, we find a single period (we must escape it with “\” due to the fact that, in regular expressions, it matches any character (sometimes excluding a line break). The last part is to find the “.com.” We know that the majority, if not all, domains will have a suffix range of two – four characters (com, edu, net, name, etc.). If we’re aware of that specific range, we can forego using a more generic symbol like * or +, and instead wrap the two numbers within curly braces, representing the minimum and maximum, respectively.
'$1, $2')This last part represents the second parameter of the replace method, or what we’d like to replace the matched sets with. Here, we’re using $1 and $2 to refer to what was stored within the first and second sets of parentheses, respectively. In this particular instances, $1 refers to “nettuts,” and $2 refers to “tutsplus.”
Creating our Own Location ObjectFor our final project, we’ll replicate the location object. For those unfamiliar, the location object provides you with information about the current page: the href, host, port, protocol, etc. Please note that this is purely for practice’s sake. In a real world site, just use the preexisting location object!
We first begin by creating our location function, which accepts a single parameter representing the url that we wish to “decode;” we’ll call it “loc.”
function loc(url) { }Now, we can call it like so, and pass in a gibberish url :
var l = loc('http://www.somesite.com?somekey=somevalue&anotherkey=anothervalue#theHashGoesHere');Next, we need to return an object which contains a handful of methods.
function loc(url) { return { } } SearchThough we won’t create all of them, we’ll mimic a handful or so. The first one will be “search.” Using regular expressions, we’ll need to search the url and return everything within the querystring.
return { search : function() { return url.match(/\?(.+)/i)[1]; // returns "somekey=somevalue&anotherkey=anothervalue#theHashGoesHere" } }Above, we take the passed in url, and try to match our regular expressions against it. This expression searches through the string for the question mark, representing the beginning of our querystring. At this point, we need to trap the remaining characters, which is why the (.+) is wrapped within parentheses. Finally, we need to return only that block of characters, so we use [1] to target it.
HashNow we’ll create another method which returns the hash of the url, or anything after the pound sign.
hash : function() { return url.match(/#(.+)/i)[1]; // returns "theHashGoesHere" },This time, we search for the pound sign, and, once again, trap the following characters within parentheses so that we can refer to only that specific subset – with [1].
ProtocolThe protocol method should return, as you would guess, the protocol used by the page – which is generally “http” or “https.”
protocol : function() { return url.match(/(ht|f)tps?:/i)[0]; // returns 'http:' },This one is slightly more tricky, only because there are a few choices to compensate for: http, https, and ftp. Though we could do something like – (http|https|ftp) – it would be cleaner to do: (ht|f)tps?
This designates that we should first find either an “ht” or the “f” character. Next, we match the “tp” characters. The final “s” should be optional, so we append a question mark, which signifies that there may be zero or one instance of the preceding character. Much nicer.
For the sake of brevity, this will be our last one. It will simply return the url of the page.
href : function() { return url.match(/(.+\.[a-z]{2,4})/ig); // returns "http://www.somesite.com" }Here we’re matching all characters up to the point where we find a period followed by two-four characters (representing com, au, edu, name, etc.). It’s important to realize that we can make these expressions as complicated or as simple as we’d like. It all depends on how strict we must be.
Our Final Simple Function: function loc(url) { return { search : function() { return url.match(/\?(.+)/i)[1]; }, hash : function() { return url.match(/#(.+)/i)[1]; }, protocol : function() { return url.match(/(ht|f)tps?:/)[0]; }, href : function() { return url.match(/(.+\.[a-z]{2,4})/ig); } } }With that function created, we can easily alert each subsection by doing:
var l = loc('http://www.net.tutsplus.edu?key=value#hash'); alert(l.href()); // http://www.net.tutsplus.com alert(l.protocol()); // http: ...etc. ConclusionThanks for reading! I’m Jeffrey Way…signing off.
If you are curious to know the average CPM rates for online advertising across verticals, this graph from Adify should give you a good idea.
CPM trends across verticals
Except Food, Entertainment and Real Estate, the CPM rates for display ads have declined across industries in the last three quarters which is quite good news for online advertisers but not so good news for web publishers and bloggers.
For some unknown reason, this Adify Report excludes the Technology sector which also commands high CPM rates (the CPM rates for tech industry were around $15 in Q2 2009).
CPM = cost per thousand ad impressions.
The Average CPM Rates Across Different Verticals
Originally published at Digital Inspiration by Amit Agarwal.