Banner

Friday, 30 January 2015

Elgg Open Source

http://www.elgg.org/


Elgg is an award-winning open source social networking engine that provides a robust framework on which to build all kinds of social environments, from a campus wide social network for your university, school or college or an internal collaborative platform for your organization through to a brand-building communications tool for your company and its clients.

Magento Updates

Cake PHP Updates

Odin Tutorial: How to Use Odin to Flash ROM on Android Device

Source : http://donandroid.com

Odin is a very useful Windows tool that lets you install / flash ROM on your Android device. Here is a step by step guide on how to use Odin to flash stock ROM on your Android smartphone / tablet:

How to Install ROM (.tar.md5) using Odin

Before you Begin:
Take care of following:
Task 1: Install USB drivers for your device on your PC. You can download and install Samsung Kies which will automatically install device drivers.
Task 2: Be sure to backup your data including Contacts, SMS / MMS, APN & MMS Settings as well as photos and videos stored on your device’s internal or external storage.
Task 3: Make sure that your device is well charged. Ideally, the battery level should be around 60-80%. The more the better.
Task 4: USB Debugging should be enabled on your device.
Task 5: Make sure that Samsung Kies is not running.
Note: Installing official firmware / stock ROM does not involve much risks most of the time. However, try this at your own risk. We will not be responsible for any hard done to your device.
Step 1: Download the official firmware zip package for your device. Then extract the downloaded zip file. After extracting, you will either get one .tar / .tar.md5 file or will get multiple files.
  • If you get one file, it will have everything inside it: PDA + Phone + CSC.
  • If you get multiple files, there will be separate files for PDA, Phone & CSC.
Step 2: Download Odin3_v3.04.zip and extract the downloaded zip file. You will get following files:
  • Odin3 v3.04.exe
  • tmax.dll
  • zlib.dll
  • Odin3.ini
Step 3: Right click on Odin3 v3.04.exe and run it as administrator to start Odin.
Step 4: Boot your device in download mode. For most Samsung devices, you will need to do this:
  • Switch your device off.
  • Press & hold Power + Home + Volume down buttons till you see a triangle and Android robot.
  • Now press the Volume up button to confirm entering the download mode.
Step 5: Once it is in download mode, connect your device to the computer via USB cable.
When your device is connected, one of Odin ID:COM boxes will turn yellow and display the COM port number. See the screenshot below:
Odin3 ID:COM yellow
Important: If you do not see the port number in any of ID:COM boxes or if the box does not turn yellow, please do not proceed and check if the USB drivers are installed correctly and the device is connected via USB. If you do see the message, it means that your device was detected successfully by Odin and you can now flash any firmware files onto your device using Odin.
Recommended Reading: More information about Odin buttons & checkboxes >>
Step 6: If the firmware zip package had just one file, click on PDA button, then browse and select the firmware file (.tar or .tar.md5).
OR
Step 6: If the firmware package had multiple files:
  • Click on PDA button, then browse and select the file that has CODE / PDA in its name.
  • Click on Phone button and select the file that has MODEM in its name.
  • Click on CSC button and select the file with CSC in its name.
Skip any files that you did not find in the package.
Step 7: Make sure that you do not mess up with checkboxes:
  • Auto Reboot and F. Reset Time checkboxes should be selected
  • All other checkboxes should be unchecked.
Step 8: After selecting the appropriate files, click on “Start” button in Odin.
This will kick off the process to flash the ROM. Please do not disconnect your device during the process.
Step 9: Once flashing is complete, your device will reboot. You can now disconnect from the PC and start using it.
That’s it. You can use these steps to flash ROM on your Android device using Odin.

How To Start Trading: Trading As A Business

How To Start Trading: Trading As A Business

 

The idea of trading for a living is appealing to many people: you get to be your own boss, set your own schedule and work from home while enjoying virtually unlimited income potential. In addition to these factors, anyone with a computer, Internet connection and a small trading account can give it a try. Unlike many other jobs, no degrees, special training or experience is required.

Because of these factors, people often fail to acknowledge or realize the financial, emotional and time commitments that are required to build a successful trading business. Here are some quick facts about trading:
  • About 90% of day traders fail within the first year
  • There is no way to eliminate risk in trading
  • There is no trading system that wins 100% of the time
  • You will always have losing trades, even if you are a rock star trader
  • You need money to make money – it will take a long time to get rich with a small trading account
  • Successful independent traders can earn a comfortable income, but most do not become “filthy rich”
The ease with which you can start trading (just open a trading account and hit the “buy” button) in no way implies that becoming a successful and profitable trader is easy. Many of the 90% of traders who fail within the first year do so because they start trading without having developed any type of logical business or trading plan. Any business entered into with such a lack of planning is likely to fail.

There is also a lot of deception associated with learning the business of trading. Late night infomercials and hundreds of Web sites would have you believe that trading is easy and that anyone can generate a huge and consistent income from the financial markets. While there may be the rare case where a trader manages to make a huge amount of money in a short time, this is not the norm. For most people, trading involves a lot of hard work before becoming successful.

 

Wordpress Updates

http://wordpresslinks2569.blogspot.in/

WordPress is an online, open source website creation tool written in PHP. But in non-geek speak, it's probably the easiest and most powerful blogging and website content management system (or CMS) in existence today.

Thursday, 29 January 2015

What is cilory.com

http://www.cilory.com/


ABOUT US

What is cilory.com?

Cilory.com is an attempt by a team who want to bring the best of e-commerce experience to the Indian customers. You would find genuine products of leading brands here. Quality of service and privacy of our customers is top most priority for us.

Who we are?

We are a team of young professionals lead by IITians who want to provide best of online shopping experience to our customers. We source all our products from Brands directly or authorized agents of the brands. We run our own warehousing operations in Gurgaon to enable us to fulfill your orders and deliver it on time. We are part of Dew Solutions Pvt Ltd (www.dewsolutions.in) which also has interests in IT Consultancy Services.

Have suggestions for us?

We are always interested in feedback from our customers. What they want next? Please feel free to write to us at info@cilory.com.

Connect QuickBooks to apps

http://quickbooks.intuit.com/

How do I get started?

We're glad you asked! Once you choose your solution you will begin a short startup interview which will customize QuickBooks Online for your business. With QuickBooks Online Plus or Online Essentials you can import your data from another version of QuickBooks (most current versions will convert and upload) or start from scratch. Either way, you are ready to go in no time at all.


How much accounting do I need to know?

We designed QuickBooks Online to be as easy to use as possible. You don't need to know accounting. If you know how to write checks, create and send invoices, and file your bills, you'll know how to use QuickBooks Online. To help, we offer easy instructions and simple, recognizable forms so you can quickly and confidently be up and running.

Yes, you can add any features to your QuickBooks Online service at any time such as QuickBooks Payroll and QuickBooks Payments (additional fees apply).



QuickBooks Online includes: Full use of the features of the particular version of QuickBooks Online, automatic upgrades to your selected version at no extra cost, secure storage of your data, and product support1 at no extra cost. You can add optional features at any time for an additional monthly fee.


Tuesday, 27 January 2015

New issues since upgrading to WP 3.9.1

Source :: https://wordpress.org/support/

A couple of things:
1. Is Workbook Lite still an active application? Just asking - this plugin hasn't updated in the last 2 years. Looking at the Mantis board, nothing new there since 2011 or so!
2. Over the last year so WB Lite keeps on posting duplicate posts to my FB Page (https://www.facebook.com/Rogan.Coles.Photography?ref=hl) and/or my personal page (https://www.facebook.com/skopieblik). The results aren't consistent - as in, sometimes posts are duplicated and, sometimes not.
3. This is new since updating to WP 3.9.1:
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 91
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 103
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 118
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 141
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 147
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 154
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 168
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 174
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 191
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 267
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 280
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 316
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 428
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 462
Warning: fwrite(): supplied argument is not a valid stream resource in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php on line 493
Warning: Cannot modify header information - headers already sent by (output started at /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php:91) in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-admin/post.php on line 235
Warning: Cannot modify header information - headers already sent by (output started at /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-content/plugins/wpbook-lite/includes/publish_to_facebook.php:91) in /home/r064nc013s/domains/rogancoles.com/public_html/portfolio/wp-includes/pluggable.php on line 1121
I'm not a techie. So, have no idea what's going on here.
Looking forward to getting all this sorted.
Cheers - Rogan Coles
https://wordpress.org/plugins/wpbook-lite/

Thursday, 22 January 2015

SEO TIPS

http://www.seomark.co.uk/

  • No SEO means no visitors from search engines. If you don’t do it then search engines can’t categorise and rank your site for keywords relevant to your business.
  • Both on-site SEO and off-site SEO are required. You can’t achieve good results doing one without the other.
  • Start doing SEO now. The longer you leave it to start, the further ahead your competitors will be, and the harder it becomes to rank higher than them.
  • Know your competition. Find out what the sites ranking on the 1st page for the keywords that you want to rank for have done, on-site and off-site, to get there.
  • No two websites are the same. An SEO strategy that worked for someone else’s site isn’t guaranteed to work for yours because there are so many variables.
  • SEO doesn’t have to be expensive. You can get big results on a small budget if you invest time in creating good content and building online relationships.
  • SEO results aren’t instant. The results of SEO work done today might not become apparent, and might not be credited by search engines, for weeks, or even months.
  • The newer your website is, the more patient you will need to be. It takes time to build authority and trust, and until you’ve developed both, you shouldn’t expect to outrank older, more established sites.
  • Never consider your website to be finished. If you want your site to continue to rank higher, attract more visitors and make more sales, then you should always be adding to and improving it.
  • Adapt to algorithm updates. To attain and retain good rankings you need to adapt your SEO strategy as search engines evolve over time.
  • You don’t need to submit your website to search enginesThey have evolved beyond the point of needing to be directly notified when a new website, or page on a website, is created.
  • Get advice directly from Google. Via their Webmaster Guidelines and Webmaster Help Videos.
  • Don’t risk Google penalties. As they have a significant share of the search market, a penalty from them results in a significant, and often long-term, loss of visitors to your site.
  • You’re ultimately responsible for all of SEO work done on your website. Search engines won’t remove a penalty on the basis that you didn’t do, and didn’t know the specifics of, the SEO work on your site.
  • Set-up and use Google Webmaster Tools. To find out, among other things, what keywords your site is ranking for and which other sites are linking to yours.
  • Set-up and use Google Analytics. To find out, among other things, how many visitors your site gets, the keywords they use to find it, and what pages they visit.
  • Set-up a Google+ page for your business. Doing so builds trust with Google and improves rankings for localised keywords.
  • Diversify your traffic sources. Google is a great source of traffic but being 100% reliant on them for visitors puts you in a vulnerable position.
  • Use Pay Per Click in addition to SEO. If you can afford to do both, then do both, as although PPC can be costly, you can get visitors to your site straight away for any keywords that you want.
  • Low quality equals high risk. Low quality backlinks and/or low quality on-site content can easily result in your site being penalised by search engines.
  • Create content primarily for people, not search engines. There’s no point creating content that ranks well if it doesn’t help people, interest them, or persuade them to buy from you.
  • Remove duplicate content. You can be penalised for having the same, or very similar, content on multiple pages of your site.
  • Remove, merge or add to pages with little content on them. Having lots of content-light pages, with short page view times, can result in search engines downgrading all of your site’s keyword rankings.
  • Don’t copy content from other websites. If search engines find that content on your site has been taken from elsewhere they may downgrade rankings for some, or even all, of your webpages.
  • Claim authorship of your content. Linking your Google+ account to your content improves both rankings and click-through-rate.
  • Ensure your content is good enough to be on the 1st page. If your content isn’t better than the content already on the 1st page for a keyword then your site doesn’t deserve to rank there.
  • Make your content engaging for visitors. The more engaging it is, the longer people will stay on your site, and high viewing times signal to search engines that your site deserves good rankings.
  • Create videos. They increase the amount of time that people spend on your site and also allow you to get links from video sharing sites.
  • Create stats/charts/graphs/infographics. People are more likely to share and link to these types of content than plain written content.
  • More content equals more rankings, more visitors and more salesSearch engines reward, and visitors trust more, sites that are filled with lots of pages of good quality content.
  • Add a blog to your website. Doing so makes it quick and simple to add new pages of content to your site.
  • Create content to post on other websites and blogs. People are much more likely to link to you if you provide them with content to use on their site.
  • Balance creating content with marketing content. If you create content without marketing it then people will struggle to find it, and if they can’t find it they can’t link to it or share it.
  • Write a unique, descriptive title for every page. Within 55 characters you need to make the topic of a page clear to both humans and search engines.
  • Write a unique, descriptive meta description for every page. Within 160 characters you need to describe the topic of a page in a way that persuades people to click on your site instead of the other sites listed in the search results.
  • Research keywords before optimising for them. If you choose the wrong keywords, regardless of what you do for on-site and off-site SEO, you’ll get very few visitors and/or visitors who don’t convert into sales.
  • Use Google’s Keyword Tool. It provides a good list of words and phrases related to the keyword ideas that you enter into it.
  • Get keyword ideas from other people. They (customers, suppliers, partners, friends, etc.) see your business differently to you and may associate different words and phrases with it.
  • Target relevant keywords. The more relevant your keywords are, the easier and quicker it is to rank for them, and the higher the percentage of visitors who will become buyers.
  • Target keywords with commercial intent. You want visitors who are ready to spend money rather than those who are just looking for information.
  • Long-tail keywords are a great source of traffic. It’s quicker and cheaper to rank for longer, specific keyword phrases, and more than 40% of searches are comprised of four or more words.
  • Dedicate 1 page of your website to each keyword that you’re targeting. Doing so makes it simpler for search engines to categorise and rank your pages.
  • Add keywords in the right places. They’re less important than they used to be, but you should still include them in urls, page titles, meta descriptions, header tags and image alt tags.
  • Avoid keyword stuffing. You’re much more likely to be penalised than credited if you use a keyword phrase repeatedly on a page.
  • Backlinks affect rankings more than anything else. The number and quality of links pointing to your site will largely determine in what position your site ranks.
  • Don’t set backlink targets. Link building should be a steady, consistent, on-going process, that doesn’t stop when you reach a certain number.
  • Get backlinks from relevant sources. Search engines want to display relevant results for each keyword, and links from relevant pages/sites are a strong signal to them that your site is relevant.
  • Get backlinks from trusted sources. Links from trustworthy sites signal to search engines that your site is trustworthy too.
  • Be prepared to work for high quality backlinks. Generally, the more easily you can acquire a link, the less value it will likely have.
  • Be wary of paying people to link to your website. Buying backlinks can, and does work, however, there’s a definite risk involved if you buy cheap ones and/or from people who openly sell them.
  • Don’t get involved in link networks. The benefit of getting links from networks is low, whereas the risk of being penalised and losing rankings is high.
  • Diversify your backlink profile. Get different types of links from a wide range of IP addresses.
  • Build backlinks to every page of your website that you want to rank. Get people to link to the inner-pages of your site – the ones you want to rank for specific keywords – as well as to the homepage.
  • Existing relationships are an instant source of backlinks. Some of your suppliers, partners and customers will link to your site if you ask them to do so.
  • Get the good backlinks that your competition already has. If someone has already linked to one of your competitors then there’s a reasonable chance that they’ll link to you also if you give them a good reason to.
  • Get some backlinks with your target keywords as the link text. This type of link is important, but should make up less than 25% of your backlink profile.
  • The majority of your backlinks should be branded. A backlink profile without lots of branded links (like ‘Company Name’ and ‘www.companyname.co.uk’) signals to search engines that you’ve been using manipulative link building tactics.
  • Know who’s linking to you. Within Google Webmaster Tools, go to ‘Traffic’ and then ‘Links’ to check how many sites are linking to yours and which sites they are.
  • Sign up for Ahrefs, Majestic SEO or Open Site Explorer. Doing so gives you access to extensive backlink data for your site and also your competitors’ sites.
  • Every page of your website should be linked to from at least one other page. Search engines don’t include pages in their results that aren’t linked to either internally (from another page of the same site) or externally (from another site).
  • Have direct links from your homepage to your most important pages. Doing so passes authority from the homepage to your important pages and improves the rankings of those pages.
  • Add in-content links to other relevant pages on your website. Whilst not as valuable as external links, internal links do still pass authority and signal to search engines what pages to rank for which keywords.
  • Remove unnecessary outbound links. Only link to pages on other sites that you think visitors to your site would find helpful and/or interesting.
  • Link out to relevant websites and blogs. People generally notice if you link to them, and if you link to them, there’s a reasonable chance that they’ll link back to you if you have good site.
  • Leave comments on relevant websites and blogs. Doing so builds trust and relationships with people – both the site owners and visitors to those sites.
  • Interact with bloggers in your industry. The better people with relevant blogs know you (through social sites, forums, email, etc.) the more likely they’ll be to link to your site and to share your content.
  • Contact small businesses with relevant websites. A good relationship, in which you help promote each others’ sites, makes SEO simpler and cheaper for you and for them.
  • Write press releases to share news and opinions. This is a good way to get content on, and links from, sites outside of your industry and circle of connections.
  • Phone people to develop online relationships. Emails can easily be ignored or forgotten, but phone calls not so much.
  • Use your website to build trust and relationships. The more relationships you have, and the more people trust you, the more people will talk about you, link to you, and, ultimately, buy from you.
  • Add your address and phone number to every page of your website. This builds trust and improves rankings if you’re targeting keyword phrases that contain your town/city name.
  • Get listed in industry and local directories. Most directories are worthless, however, there should be at least 10 that are relevant to your area or industry.
  • Ask customers to leave reviews on Google+ and local directories. Positive reviews improve your rankings in Google’s local listings and can be accessed directly from the search results.
  • Be personal in a way that big businesses can’t be. Putting your individuality and  personality across throughout the off-site SEO process (outreach emails, guest posts, Tweets, etc.) makes others more likely to engage with you.
  • Use social websites to promote other people’s content as well as your own. People generally know if you’ve taken action on social sites to help them, and if they see that you’ve helped them, the chances of them helping you out in return are much higher.
  • Add social sharing buttons to your website. The easier you make it for people to share your content, the more likely they will be to do so.
  • Social media isn’t a replacement for SEO. Your social strategy should be part of, or should run alongside, your SEO strategy.
  • Search engines ranks webpages, not websites. Whether or not a page ranks for a particular keyword depends largely on the quality of that individual page, and not the quality of your site as a whole.
  • Small businesses can rank higher than big businessesIt’s not uncommon for a page on a small business’s site to rank higher than a page on the site of a big, national company.
  • Know where you’re ranking. Within Google Webmaster Tools, go to ‘Traffic’ and then ‘Search Queries’ to check where your site is ranking for keywords.
  • Aim to be in the top 3, not just the top 10If your site isn’t ranked in the top 3 positions for a keyword then you’ll only get a small percentage (less than 10%) of the traffic from searches for that keyword.
  • Rankings can be misleading. The number of 1st page rankings you have is irrelevant if those rankings don’t convert to visitor numbers and, ultimately, sales.
  • Don’t worry about PageRank. Sites with a low PR can, and often do, outrank sites with a high PR.
  • Choose between using www or not using www. Ensure that your site is set to load at either www.domainname.co.uk or domainname.co.uk – not both.
  • Adopt a flat website architecture. Any page of your site should be accessible within 3 clicks from your homepage.
  • Use a simple, clear URL structure. People should be able to guess the topic of a page by looking only at its URL.
  • Use header tags. Include variations of your target keyword phrases in a page’s H1 and H2 tags.
  • Use rich snippets. They provide additional data about your site to search engines and can improve the appearance of your site’s listing in search results.
  • Use 301 redirects. If you change the url of a page on your site, but don’t redirect the old url to the new one, any links pointing to the old one will be wasted.
  • Set-up a useful 404 error page. Linking to your best content from your 404 page means that visitors who see it are less likely to leave your site.
  • 55 Quick SEO Tips Even Your Mother Would Love

    Source : http://www.searchenginejournal.com/

    Everyone loves a good tip, right? Here are 55 quick tips for search engine optimization that even your mother could use to get cooking. Well, not my mother, but you get my point. Most folks with some web design and beginner SEO knowledge should be able to take these to the bank without any problem.
    1. If you absolutely MUST use Java script drop down menus, image maps or image links, be sure to put text links somewhere on the page for the spiders to follow.
    2. Content is king, so be sure to have good, well-written, and unique content that will focus on your primary keyword or keyword phrase.
    3. If content is king, then links are queen. Build a network of quality backlinks. Remember, if there is no good, logical reason for a site to link to you, you don’t want the link.
    4. Don’t be obsessed with PageRank. It is just one isty bitsy part of the ranking algorithm. A site with lower PR can actually outrank one with a higher PR.
    5. Be sure you have a unique, keyword focused Title tag on every page of your site. And, if you MUST have the name of your company in it, put it at the end. Unless you are a household name, your business name will probably get few searches.

    6. Fresh content can help improve your rankings. Add new, useful content to your pages on a regular basis. Content freshness adds relevancy to your site in the eyes of the search engines.
    7. Be sure links to your site and within your site use your keyword phrase. In other words, if your target is “blue widgets” then link to “blue widgets” instead of a “Click here” link.
    8. Focus on search phrases, not single keywords, and put your location in your text (“our Palm Springs store” not “our store”) to help you get found in local searches.
    9. Don’t design your web site without considering SEO. Make sure your web designer understands your expectations for organic SEO. Doing a retrofit on your shiny new Flash-based site after it is built won’t cut it. Spiders can crawl text, not Flash or images.
    10. Use keywords and keyword phrases appropriately in text links, image ALT attributes and even your domain name.
    11. Check for canonicalization issues – www and non-www domains. Decide which you want to use and 301 redirect the other to it. In other words, if http://www.domain.com is your preference, then http://domain.com should redirect to it.
    12. Check the link to your home page throughout your site. Is index.html appended to your domain name? If so, you’re splitting your links. Outside links go to http://www.domain.com and internal links go to http://www.domain.com/index.html.
    Ditch the index.html or default.php or whatever the page is and always link back to your domain.
    13. Frames, Flash and AJAX all share a common problem – you can’t link to a single page. It’s either all or nothing. Don’t use Frames at all and use Flash and AJAX sparingly for best SEO results.
    14. Your URL file extension doesn’t matter. You can use .html, .htm, .asp, .php, etc. and it won’t make a difference as far as your SEO is concerned.
    15. Got a new web site you want spidered? Submitting through Google’s regular submission form can take weeks. The quickest way to get your site spidered is by getting a link to it through another quality site.
    16. If your site content doesn’t change often, your site needs a blog because search spiders like fresh text. Blog at least three time a week with good, fresh content to feed those little crawlers.
    17. When link building, think quality, not quantity. One single, good, authoritative link can do a lot more for you than a dozen poor quality links, which can actually hurt you.
    18. Search engines want natural language content. Don’t try to stuff your text with keywords. It won’t work. Search engines look at how many times a term is in your content and if it is abnormally high, will count this against you rather than for you.
    19. Text around your links should also be related to your keywords. In other words, surround the link with descriptive text.
    20. If you are on a shared server, do a blacklist check to be sure you’re not on a proxy with a spammer or banned site. Their negative notoriety could affect your own rankings.
    21. Be aware that by using services that block domain ownership information when you register a domain, Google might see you as a potential spammer.
    22. When optimizing your blog posts, optimize your post title tag independently from your blog title.
    23. The bottom line in SEO is Text, Links, Popularity and Reputation.
    24. Make sure your site is easy to use. This can influence your link building ability and popularity and, thus, your ranking.
    25. Give link love, Get link love. Don’t be stingy with linking out. That will encourage others to link to you.
    26. Search engines like unique content that is also quality content. There can be a difference between unique content and quality content. Make sure your content is both.
    27. If you absolutely MUST have your main page as a splash page that is all Flash or one big image, place text and navigation links below the fold.
    28. Some of your most valuable links might not appear in web sites at all but be in the form of e-mail communications such as newletters and zines.
    29. You get NOTHING from paid links except a few clicks unless the links are embedded in body text and NOT obvious sponsored links.
    30. Links from .edu domains are given nice weight by the search engines. Run a search for possible non-profit .edu sites that are looking for sponsors.
    31. Give them something to talk about. Linkbaiting is simply good content.
    32. Give each page a focus on a single keyword phrase. Don’t try to optimize the page for several keywords at once.
    33. SEO is useless if you have a weak or non-existent call to action. Make sure your call to action is clear and present.
    34. SEO is not a one-shot process. The search landscape changes daily, so expect to work on your optimization daily.
    35. Cater to influential bloggers and authority sites who might link to you, your images, videos, podcasts, etc. or ask to reprint your content.
    36. Get the owner or CEO blogging. It’s priceless! CEO influence on a blog is incredible as this is the VOICE of the company. Response from the owner to reader comments will cause your credibility to skyrocket!
    37. Optimize the text in your RSS feed just like you should with your posts and web pages. Use descriptive, keyword rich text in your title and description.
    38. Use keyword rich captions with your images.
    39. Pay attention to the context surrounding your images. Images can rank based on text that surrounds them on the page. Pay attention to keyword text, headings, etc.
    40. You’re better off letting your site pages be found naturally by the crawler. Good global navigation and linking will serve you much better than relying only on an XML Sitemap.
    41. There are two ways to NOT see Google’s Personalized Search results:
    (1) Log out of Google
    (2) Append &pws=0 to the end of your search URL in the search bar
    42. Links (especially deep links) from a high PageRank site are golden. High PR indicates high trust, so the back links will carry more weight.
    43. Use absolute links. Not only will it make your on-site link navigation less prone to problems (like links to and from https pages), but if someone scrapes your content, you’ll get backlink juice out of it.
    44. See if your hosting company offers “Sticky” forwarding when moving to a new domain. This allows temporary forwarding to the new domain from the old, retaining the new URL in the address bar so that users can gradually get used to the new URL.
    45. Understand social marketing. It IS part of SEO. The more you understand about sites like Digg, Yelp, del.icio.us, Facebook, etc., the better you will be able to compete in search.
    46. To get the best chance for your videos to be found by the crawlers, create a video sitemap and list it in your Google Webmaster Central account.
    47. Videos that show up in Google blended search results don’t just come from YouTube. Be sure to submit your videos to other quality video sites like Metacafe, AOL, MSN and Yahoo to name a few.
    48. Surround video content on your pages with keyword rich text. The search engines look at surrounding content to define the usefulness of the video for the query.
    49. Use the words “image” or “picture” in your photo ALT descriptions and captions. A lot of searches are for a keyword plus one of those words.
    50. Enable “Enhanced image search” in your Google Webmaster Central account. Images are a big part of the new blended search results, so allowing Google to find your photos will help your SEO efforts.
    51. Add viral components to your web site or blog – reviews, sharing functions, ratings, visitor comments, etc.
    52. Broaden your range of services to include video, podcasts, news, social content and so forth. SEO is not about 10 blue links anymore.
    53. When considering a link purchase or exchange, check the cache date of the page where your link will be located in Google. Search for “cache:URL” where you substitute “URL” for the actual page. The newer the cache date the better. If the page isn’t there or the cache date is more than an month old, the page isn’t worth much.
    54. If you have pages on your site that are very similar (you are concerned about duplicate content issues) and you want to be sure the correct one is included in the search engines, place the URL of your preferred page in your sitemaps.
    55. Check your server headers. Search for “check server header” to find free online tools for this. You want to be sure your URLs report a “200 OK” status or “301 Moved Permanently ” for redirects. If the status shows anything else, check to be sure your URLs are set up properly and used consistently throughout your site.
    Richard V. Burckhardt, also known as The Web Optimist, is an SEO trainer based in Palm Springs, CA with over 10 years experience in search engine optimization, web development and marketing.

    Creating contact groups :: GOOGLE

    Source : https://support.google.com/mail/answer/30970?hl=en

    With contact groups you can easily organize your contacts, making it easier to email a specific set of people. For example, if you created a contact group called "Soccer club", you could just send a message to that group, rather than sending out an email to 50 different people. Never leave somebody off an email again!
    To create a contact group:
    1. Click Gmail at the top-left corner of your Gmail page, then choose Contacts.
    2. Select contacts that you want to add to a group, click the Groups button. , then Create new.
    3. Enter the name of the group.
    4. Click OK.
    To add contacts to a contact group:
    1. Select the contacts in the Contacts list.
    2. Click the Groups button.
    3. Select the group you'd like to add the contact to, or select Create new to create a new group.
    4. If you have multiple addresses saved for a contact, you can choose which address should belong to the contact group by opening the contact and clicking the small arrow next to the group you'd like to modify.
    Note: These instructions work only with the standard version of Gmail. If they don't match what you see in your Contact Manager, we suggest that you upgrade to a fully supported browser or click standard version in your account.

    Elegance Infosoft Pvt. Ltd.

    http://www.b2btechnosolutions.com/

    As a peerless management within our b2b techno specialization, customers turn to us for trusted loyal consultations. B2BtechnoSolutions is home to various industries’ leading business, while they are part of our commitment to quality in web design, graphic design, and application development. B2Btechnosolutions copes with ever-advancing work environments with that spy eye, when less is not expected.
    B2btechnosolutions attracts highly certified administrators, technical decision makers, and executives.B2btechnosolutions prepares your business to the most of web& design services in the globe.
    The distinct leap, by which we are more innovative than our counterparts, is our unrivaled capability of providing the best
    fitting, cost effective, advanced solutions in one single shot. Wishful thinking may come true, when people are able to see and express their gratitude about your new web outfit…. for that
    B2Btechnosolutions does matter!

    Links: http://www.phpframeworks.com/

    Links: http://www.phpframeworks.com/:  MVC: Indicates whether the framework comes with inbuilt support for a Model-View-Controller setup. Multiple DB's: Indicates...

    The Most Common Questions Answered in our WordPress Tutorial

    Source : http://www.siteground.com/tutorials/wordpress/

    How to Install WordPress?

    Step-by-step Manual WordPress Installation Guide

    In this tutorial we will provide you with detailed instructions on how to install WordPress on your web hosting account. Follow these guidelines if you want to perform a new, manual installation of the latest WordPress version.

    Or Get Free and Easy WordPress installation by SiteGround!

    We know that manual WordPress installation requires some time and effort. To spare you these our WordPress hosting service includes 3 easy install options that can save you the hassle:
    • SiteGround WordPress Setup Wizard
    • WordPress Auto-install through Softaculous
    • Free manual installation by our Support Team
    Get Hosting + Free Install!

    Step 1 Download the WordPress installation package

    To start the installation process, first you need to download WordPress from it's official download page. We recommend that you always download and install the latest stable version of WordPress.
    Once you click on the Download button for the latest WordPress version, the installation package will be saved to your hard disk. Locate the installation package that you've just downloaded and extract it to a new folder.

    Step 2 Upload the WordPress Files to Your Server

    Now, you need to upload the extracted files and folders to your web server. The easiest way to upload the installation files is via FTP. For detailed information on how to upload files via FTP, please check our FTP Tutorial.
    Important!If you want your WordPress to be the main installation on your account and to be accessible through your main domain (i.e. www.mydomain.com), you need to upload the extracted files to your public_html folder.
    Once the download is complete, extract the archive and upload it to your web hosting account. You can do that via FTP using a client application like Filezilla or via cPanel -> File Manager -> Upload file(s). If you want this WordPress installation to be main for your website, the files should reside in the public_html folder of your account. However, you can always make a subfolder (i.e. public_html/blog) if you want to run only part of your website on WordPress.

    Step 3 Create a MySQL Database for WordPress to use

    Now, you need to create a MySQL database and assign a user to it with full permissions. For detailed instructions on how to do that, please follow the steps described in our tutorial on How to Create MySQL Username and Database. Once you create your MySQL Database and User, make sure you write down the database name, database username and password you've just created. You will need those for the installation process.

    Step 4 Go through the installation process

    Now it's time to navigate to your website to start with the installation process. If you have uploaded WordPress in your public_html directory you'll need to go to http://yourdomain.com in your preferred browser. The first thing you will notice is a message, telling you that you don't have a wp-config.php file and you should create one. Just click on the Create a Configuration File button to proceed.
    On this page you will see a message, asking you to prepare the necessary information for the installation. Since we already have this information, simply press the Go! button.
    Enter the details for your newly created MySQL database and press the Sumbit button
    WordPress will now check if your settings are correct. If you have entered all the necessary information, you will see a confirmation screen. Press the Run the Install button to proceed.
    On the next screen you will have to enter the information about your administrative username and the title of your new site. In addition, you can specify whether you'd want search engines to index your site or not. Once you fill in that information, press the Install WordPress button. Bear in mind, however, that you should specify a real email address. It can be later used in case you forget your password.
    That's it!Your new WordPress application is installed. You can use the Login In button to access your administrative backend and start posting in your new site.

    http://www.phpframeworks.com/

    •  MVC: Indicates whether the framework comes with inbuilt support for a Model-View-Controller setup.
    • Multiple DB's: Indicates whether the framework supports multiple databases without having to change anything.
    • ORM: Indicates whether the framework supports an object-record mapper, usually an implementation of ActiveRecord.
    • DB Objects: Indicates whether the framework includes other database objects, like a TableGateWay.
    • Templates: Indicates whether the framework has an inbuilt template engine.
    • Caching: Indicates whether the framework includes a caching object or some way other way of caching.
    • Validation: Indicates whether the framework has an inbuilt validation or filtering component.
    • Ajax: Indicates whether the framework comes with inbuilt support for Ajax.
    • Auth Module: Indicates whether the framework has an inbuilt module for handling user authentication.
    • Modules: Indicates whether the framework has other modules, like an RSS feed parser, PDF module or anything else (useful).
    • EDP: Event Driven Programming.New!

    Venue Events

    http://www.venue.events/cruise-travel/

    We are a team of experienced professionals in the trade for more than two decades serving the corporate and other individually known clients for booking venues for events like Conferences, Meetings and Weddings both domestic and international.
    The team decided to enhance its services to clients by providing online access through which venue details across India can be sorted and positioned with inputs for various categories of rooms, conference halls and its facilities, local attractions if any and based on clients' requirements the venue can be suitably identified or can be referred to us.
    This website has been launched to provide the following benefits to clients:
    • Simple & easy to use and know your venue and place where it's located better before taking final decision.
    • Details of venues include general information like contact details, room and hall details, local attractions and any other activities etc.
    • You can 'Request Quote' for the venue which suits your requirement the best.
    • Saves time, cost and also all communication is written and documented.
    • Details of each hotel/venue have been sourced from the hotel/venue itself.
    We promise you to provide services at our best and you'll always think of CONFERENCE VENUE as and when you decide to book venue for an upcoming event!!!

    Laravel save records in database

    In this video show you in Laravel How to save data in database and how to validate data before save in the database





    Laravel Part 3: Select Records From Database In Laravel

    Show records from database in laravel (SELECT QUERY IN LARAVEL)





     

    Laravel Part 2: Using controller view routes manage site home page

    In this videos show how to create your first controller, Model view and first page of site how to create the layout and includes js css and images


    Links: Links: Google

    Links: Links: Google: Links: Google

    Wednesday, 21 January 2015

    Backbone js

    source :: http://backbonejs.org/

    When working on a web application that involves a lot of JavaScript, one of the first things you learn is to stop tying your data to the DOM. It's all too easy to create JavaScript applications that end up as tangled piles of jQuery selectors and callbacks, all trying frantically to keep data in sync between the HTML UI, your JavaScript logic, and the database on your server. For rich client-side applications, a more structured approach is often helpful.
    With Backbone, you represent your data as Models, which can be created, validated, destroyed, and saved to the server. Whenever a UI action causes an attribute of a model to change, the model triggers a "change" event; all the Views that display the model's state can be notified of the change, so that they are able to respond accordingly, re-rendering themselves with the new information. In a finished Backbone app, you don't have to write the glue code that looks into the DOM to find an element with a specific id, and update the HTML manually — when the model changes, the views simply update themselves.
    Philosophically, Backbone is an attempt to discover the minimal set of data-structuring (models and collections) and user interface (views and URLs) primitives that are generally useful when building web applications with JavaScript. In an ecosystem where overarching, decides-everything-for-you frameworks are commonplace, and many libraries require your site to be reorganized to suit their look, feel, and default behavior — Backbone should continue to be a tool that gives you the freedom to design the full experience of your web application.
    If you're new here, and aren't yet quite sure what Backbone is for, start by browsing the list of Backbone-based projects.
    Many of the examples that follow are runnable. Click the play button to execute them.

    Upgrading to 1.1

    Backbone 1.1 should be a fairly painless upgrade from the 0.9.X series. If you're upgrading from an older version, be sure to check out the change log. In brief, a few of the larger breaking changes are:
    • If you want to smartly update the contents of a Collection, adding new models, removing missing ones, and merging those already present, you now call set (previously named "update"), a similar operation to calling set on a Model. This is now the default when you call fetch on a collection. To get the old behavior, pass {reset: true}.
    • If you have characters in your URL segments that require URL encoding, Backbone will now decode them for you (normalizing the behavior cross-browser) before your route handlers receive them as arguments.
    • In 0.9.x, Backbone events gained two new methods: listenTo and stopListening, which make it easier to create Views that have all of their observers unbound when you want to remove the view.
    • Model validation is now only enforced by default in save — not in set unless the {validate:true} option is passed. Model validation now fires an "invalid" event instead of "error".
    • In 1.1, Backbone Views no longer have the options argument attached as this.options automatically. Feel free to continue attaching it if you like.
    • In 1.1, The Collection methods add, remove, set, push, and shift now return the model (or models) added or removed from the collection.

    Backbone.Events

    Events is a module that can be mixed in to any object, giving the object the ability to bind and trigger custom named events. Events do not have to be declared before they are bound, and may take passed arguments. For example:
    var object = {};
    
    _.extend(object, Backbone.Events);
    
    object.on("alert", function(msg) {
      alert("Triggered " + msg);
    });
    
    object.trigger("alert", "an event");
    
    For example, to make a handy event dispatcher that can coordinate events among different areas of your application: var dispatcher = _.clone(Backbone.Events)
    onobject.on(event, callback, [context])Alias: bind
    Bind a callback function to an object. The callback will be invoked whenever the event is fired. If you have a large number of different events on a page, the convention is to use colons to namespace them: "poll:start", or "change:selection". The event string may also be a space-delimited list of several events...
    book.on("change:title change:author", ...);
    
    To supply a context value for this when the callback is invoked, pass the optional third argument: model.on('change', this.render, this)
    Callbacks bound to the special "all" event will be triggered when any event occurs, and are passed the name of the event as the first argument. For example, to proxy all events from one object to another:
    proxy.on("all", function(eventName) {
      object.trigger(eventName);
    });
    
    All Backbone event methods also support an event map syntax, as an alternative to positional arguments:
    book.on({
      "change:title": titleView.update,
      "change:author": authorPane.update,
      "destroy": bookView.remove
    });
    
    offobject.off([event], [callback], [context])Alias: unbind
    Remove a previously-bound callback function from an object. If no context is specified, all of the versions of the callback with different contexts will be removed. If no callback is specified, all callbacks for the event will be removed. If no event is specified, callbacks for all events will be removed.
    // Removes just the `onChange` callback.
    object.off("change", onChange);
    
    // Removes all "change" callbacks.
    object.off("change");
    
    // Removes the `onChange` callback for all events.
    object.off(null, onChange);
    
    // Removes all callbacks for `context` for all events.
    object.off(null, null, context);
    
    // Removes all callbacks on `object`.
    object.off();
    
    Note that calling model.off(), for example, will indeed remove all events on the model — including events that Backbone uses for internal bookkeeping.
    triggerobject.trigger(event, [*args])
    Trigger callbacks for the given event, or space-delimited list of events. Subsequent arguments to trigger will be passed along to the event callbacks.
    onceobject.once(event, callback, [context])
    Just like on, but causes the bound callback to only fire once before being removed. Handy for saying "the next time that X happens, do this".
    listenToobject.listenTo(other, event, callback)
    Tell an object to listen to a particular event on an other object. The advantage of using this form, instead of other.on(event, callback, object), is that listenTo allows the object to keep track of the events, and they can be removed all at once later on. The callback will always be called with object as context.
    view.listenTo(model, 'change', view.render);
    
    stopListeningobject.stopListening([other], [event], [callback])
    Tell an object to stop listening to events. Either call stopListening with no arguments to have the object remove all of its registered callbacks ... or be more precise by telling it to remove just the events it's listening to on a specific object, or a specific event, or just a specific callback.
    view.stopListening();
    
    view.stopListening(model);
    
    listenToOnceobject.listenToOnce(other, event, callback)
    Just like listenTo, but causes the bound callback to only fire once before being removed.
    Catalog of Events
    Here's the complete list of built-in Backbone events, with arguments. You're also free to trigger your own events on Models, Collections and Views as you see fit. The Backbone object itself mixes in Events, and can be used to emit any global events that your application needs.
    • "add" (model, collection, options) — when a model is added to a collection.
    • "remove" (model, collection, options) — when a model is removed from a collection.
    • "reset" (collection, options) — when the collection's entire contents have been replaced.
    • "sort" (collection, options) — when the collection has been re-sorted.
    • "change" (model, options) — when a model's attributes have changed.
    • "change:[attribute]" (model, value, options) — when a specific attribute has been updated.
    • "destroy" (model, collection, options) — when a model is destroyed.
    • "request" (model_or_collection, xhr, options) — when a model or collection has started a request to the server.
    • "sync" (model_or_collection, resp, options) — when a model or collection has been successfully synced with the server.
    • "error" (model_or_collection, resp, options) — when model's or collection's request to remote server has failed.
    • "invalid" (model, error, options) — when a model's validation fails on the client.
    • "route:[name]" (params) — Fired by the router when a specific route is matched.
    • "route" (route, params) — Fired by the router when any route has been matched.
    • "route" (router, route, params) — Fired by history when any route has been matched.
    • "all" — this special event fires for any triggered event, passing the event name as the first argument.
    Generally speaking, when calling a function that emits an event (model.set, collection.add, and so on...), if you'd like to prevent the event from being triggered, you may pass {silent: true} as an option. Note that this is rarely, perhaps even never, a good idea. Passing through a specific flag in the options for your event callback to look at, and choose to ignore, will usually work out better.

    Backbone.Model

    Models are the heart of any JavaScript application, containing the interactive data as well as a large part of the logic surrounding it: conversions, validations, computed properties, and access control. You extend Backbone.Model with your domain-specific methods, and Model provides a basic set of functionality for managing changes.
    The following is a contrived example, but it demonstrates defining a model with a custom method, setting an attribute, and firing an event keyed to changes in that specific attribute. After running this code once, sidebar will be available in your browser's console, so you can play around with it.
    var Sidebar = Backbone.Model.extend({
      promptColor: function() {
        var cssColor = prompt("Please enter a CSS color:");
        this.set({color: cssColor});
      }
    });
    
    window.sidebar = new Sidebar;
    
    sidebar.on('change:color', function(model, color) {
      $('#sidebar').css({background: color});
    });
    
    sidebar.set({color: 'white'});
    
    sidebar.promptColor();
    
    extendBackbone.Model.extend(properties, [classProperties])
    To create a Model class of your own, you extend Backbone.Model and provide instance properties, as well as optional classProperties to be attached directly to the constructor function.
    extend correctly sets up the prototype chain, so subclasses created with extend can be further extended and subclassed as far as you like.
    var Note = Backbone.Model.extend({
    
      initialize: function() { ... },
    
      author: function() { ... },
    
      coordinates: function() { ... },
    
      allowedToEdit: function(account) {
        return true;
      }
    
    });
    
    var PrivateNote = Note.extend({
    
      allowedToEdit: function(account) {
        return account.owns(this);
      }
    
    });
    
    Brief aside on super: JavaScript does not provide a simple way to call super — the function of the same name defined higher on the prototype chain. If you override a core function like set, or save, and you want to invoke the parent object's implementation, you'll have to explicitly call it, along these lines:
    var Note = Backbone.Model.extend({
      set: function(attributes, options) {
        Backbone.Model.prototype.set.apply(this, arguments);
        ...
      }
    });
    
    constructor / initializenew Model([attributes], [options])
    When creating an instance of a model, you can pass in the initial values of the attributes, which will be set on the model. If you define an initialize function, it will be invoked when the model is created.
    new Book({
      title: "One Thousand and One Nights",
      author: "Scheherazade"
    });
    
    In rare cases, if you're looking to get fancy, you may want to override constructor, which allows you to replace the actual constructor function for your model.
    var Library = Backbone.Model.extend({
      constructor: function() {
        this.books = new Books();
        Backbone.Model.apply(this, arguments);
      },
      parse: function(data, options) {
        this.books.reset(data.books);
        return data.library;
      }
    });
    
    If you pass a {collection: ...} as the options, the model gains a collection property that will be used to indicate which collection the model belongs to, and is used to help compute the model's url. The model.collection property is normally created automatically when you first add a model to a collection. Note that the reverse is not true, as passing this option to the constructor will not automatically add the model to the collection. Useful, sometimes.
    If {parse: true} is passed as an option, the attributes will first be converted by parse before being set on the model.
    getmodel.get(attribute)
    Get the current value of an attribute from the model. For example: note.get("title")
    setmodel.set(attributes, [options])
    Set a hash of attributes (one or many) on the model. If any of the attributes change the model's state, a "change" event will be triggered on the model. Change events for specific attributes are also triggered, and you can bind to those as well, for example: change:title, and change:content. You may also pass individual keys and values.
    note.set({title: "March 20", content: "In his eyes she eclipses..."});
    
    book.set("title", "A Scandal in Bohemia");
    
    escapemodel.escape(attribute)
    Similar to get, but returns the HTML-escaped version of a model's attribute. If you're interpolating data from the model into HTML, using escape to retrieve attributes will prevent XSS attacks.
    var hacker = new Backbone.Model({
      name: "<script>alert('xss')</script>"
    });
    
    alert(hacker.escape('name'));
    
    hasmodel.has(attribute)
    Returns true if the attribute is set to a non-null or non-undefined value.
    if (note.has("title")) {
      ...
    }
    
    unsetmodel.unset(attribute, [options])
    Remove an attribute by deleting it from the internal attributes hash. Fires a "change" event unless silent is passed as an option.
    clearmodel.clear([options])
    Removes all attributes from the model, including the id attribute. Fires a "change" event unless silent is passed as an option.
    idmodel.id
    A special property of models, the id is an arbitrary string (integer id or UUID). If you set the id in the attributes hash, it will be copied onto the model as a direct property. Models can be retrieved by id from collections, and the id is used to generate model URLs by default.
    idAttributemodel.idAttribute
    A model's unique identifier is stored under the id attribute. If you're directly communicating with a backend (CouchDB, MongoDB) that uses a different unique key, you may set a Model's idAttribute to transparently map from that key to id.
    var Meal = Backbone.Model.extend({
      idAttribute: "_id"
    });
    
    var cake = new Meal({ _id: 1, name: "Cake" });
    alert("Cake id: " + cake.id);
    
    cidmodel.cid
    A special property of models, the cid or client id is a unique identifier automatically assigned to all models when they're first created. Client ids are handy when the model has not yet been saved to the server, and does not yet have its eventual true id, but already needs to be visible in the UI.
    attributesmodel.attributes
    The attributes property is the internal hash containing the model's state — usually (but not necessarily) a form of the JSON object representing the model data on the server. It's often a straightforward serialization of a row from the database, but it could also be client-side computed state.
    Please use set to update the attributes instead of modifying them directly. If you'd like to retrieve and munge a copy of the model's attributes, use _.clone(model.attributes) instead.
    Due to the fact that Events accepts space separated lists of events, attribute names should not include spaces.
    changedmodel.changed
    The changed property is the internal hash containing all the attributes that have changed since the last set. Please do not update changed directly since its state is internally maintained by set. A copy of changed can be acquired from changedAttributes.
    defaultsmodel.defaults or model.defaults()
    The defaults hash (or function) can be used to specify the default attributes for your model. When creating an instance of the model, any unspecified attributes will be set to their default value.
    var Meal = Backbone.Model.extend({
      defaults: {
        "appetizer":  "caesar salad",
        "entree":     "ravioli",
        "dessert":    "cheesecake"
      }
    });
    
    alert("Dessert will be " + (new Meal).get('dessert'));
    
    Remember that in JavaScript, objects are passed by reference, so if you include an object as a default value, it will be shared among all instances. Instead, define defaults as a function.
    toJSONmodel.toJSON([options])
    Return a shallow copy of the model's attributes for JSON stringification. This can be used for persistence, serialization, or for augmentation before being sent to the server. The name of this method is a bit confusing, as it doesn't actually return a JSON string — but I'm afraid that it's the way that the JavaScript API for JSON.stringify works.
    var artist = new Backbone.Model({
      firstName: "Wassily",
      lastName: "Kandinsky"
    });
    
    artist.set({birthday: "December 16, 1866"});
    
    alert(JSON.stringify(artist));
    
    syncmodel.sync(method, model, [options])
    Uses Backbone.sync to persist the state of a model to the server. Can be overridden for custom behavior.
    fetchmodel.fetch([options])
    Resets the model's state from the server by delegating to Backbone.sync. Returns a jqXHR. Useful if the model has never been populated with data, or if you'd like to ensure that you have the latest server state. A "change" event will be triggered if the server's state differs from the current attributes. Accepts success and error callbacks in the options hash, which are both passed (model, response, options) as arguments.
    // Poll every 10 seconds to keep the channel model up-to-date.
    setInterval(function() {
      channel.fetch();
    }, 10000);
    
    savemodel.save([attributes], [options])
    Save a model to your database (or alternative persistence layer), by delegating to Backbone.sync. Returns a jqXHR if validation is successful and false otherwise. The attributes hash (as in set) should contain the attributes you'd like to change — keys that aren't mentioned won't be altered — but, a complete representation of the resource will be sent to the server. As with set, you may pass individual keys and values instead of a hash. If the model has a validate method, and validation fails, the model will not be saved. If the model isNew, the save will be a "create" (HTTP POST), if the model already exists on the server, the save will be an "update" (HTTP PUT).
    If instead, you'd only like the changed attributes to be sent to the server, call model.save(attrs, {patch: true}). You'll get an HTTP PATCH request to the server with just the passed-in attributes.
    Calling save with new attributes will cause a "change" event immediately, a "request" event as the Ajax request begins to go to the server, and a "sync" event after the server has acknowledged the successful change. Pass {wait: true} if you'd like to wait for the server before setting the new attributes on the model.
    In the following example, notice how our overridden version of Backbone.sync receives a "create" request the first time the model is saved and an "update" request the second time.
    Backbone.sync = function(method, model) {
      alert(method + ": " + JSON.stringify(model));
      model.set('id', 1);
    };
    
    var book = new Backbone.Model({
      title: "The Rough Riders",
      author: "Theodore Roosevelt"
    });
    
    book.save();
    
    book.save({author: "Teddy"});
    
    save accepts success and error callbacks in the options hash, which will be passed the arguments (model, response, options). If a server-side validation fails, return a non-200 HTTP response code, along with an error response in text or JSON.
    book.save("author", "F.D.R.", {error: function(){ ... }});
    
    destroymodel.destroy([options])
    Destroys the model on the server by delegating an HTTP DELETE request to Backbone.sync. Returns a jqXHR object, or false if the model isNew. Accepts success and error callbacks in the options hash, which will be passed (model, response, options). Triggers a "destroy" event on the model, which will bubble up through any collections that contain it, a "request" event as it begins the Ajax request to the server, and a "sync" event, after the server has successfully acknowledged the model's deletion. Pass {wait: true} if you'd like to wait for the server to respond before removing the model from the collection.
    book.destroy({success: function(model, response) {
      ...
    }});
    
    Underscore Methods (6)
    Backbone proxies to Underscore.js to provide 6 object functions on Backbone.Model. They aren't all documented here, but you can take a look at the Underscore documentation for the full details…
    user.pick('first_name', 'last_name', 'email');
    
    chapters.keys().join(', ');
    
    validatemodel.validate(attributes, options)
    This method is left undefined, and you're encouraged to override it with your custom validation logic, if you have any that can be performed in JavaScript. By default validate is called before save, but can also be called before set if {validate:true} is passed. The validate method is passed the model attributes, as well as the options from set or save. If the attributes are valid, don't return anything from validate; if they are invalid, return an error of your choosing. It can be as simple as a string error message to be displayed, or a complete error object that describes the error programmatically. If validate returns an error, save will not continue, and the model attributes will not be modified on the server. Failed validations trigger an "invalid" event, and set the validationError property on the model with the value returned by this method.
    var Chapter = Backbone.Model.extend({
      validate: function(attrs, options) {
        if (attrs.end < attrs.start) {
          return "can't end before it starts";
        }
      }
    });
    
    var one = new Chapter({
      title : "Chapter One: The Beginning"
    });
    
    one.on("invalid", function(model, error) {
      alert(model.get("title") + " " + error);
    });
    
    one.save({
      start: 15,
      end:   10
    });
    
    "invalid" events are useful for providing coarse-grained error messages at the model or collection level.
    validationErrormodel.validationError
    The value returned by validate during the last failed validation.
    isValidmodel.isValid()
    Run validate to check the model state.
    var Chapter = Backbone.Model.extend({
      validate: function(attrs, options) {
        if (attrs.end < attrs.start) {
          return "can't end before it starts";
        }
      }
    });
    
    var one = new Chapter({
      title : "Chapter One: The Beginning"
    });
    
    one.set({
      start: 15,
      end:   10
    });
    
    if (!one.isValid()) {
      alert(one.get("title") + " " + one.validationError);
    }
    
    urlmodel.url()
    Returns the relative URL where the model's resource would be located on the server. If your models are located somewhere else, override this method with the correct logic. Generates URLs of the form: "[collection.url]/[id]" by default, but you may override by specifying an explicit urlRoot if the model's collection shouldn't be taken into account.
    Delegates to Collection#url to generate the URL, so make sure that you have it defined, or a urlRoot property, if all models of this class share a common root URL. A model with an id of 101, stored in a Backbone.Collection with a url of "/documents/7/notes", would have this URL: "/documents/7/notes/101"
    urlRootmodel.urlRoot or model.urlRoot()
    Specify a urlRoot if you're using a model outside of a collection, to enable the default url function to generate URLs based on the model id. "[urlRoot]/id"
    Normally, you won't need to define this. Note that urlRoot may also be a function.
    var Book = Backbone.Model.extend({urlRoot : '/books'});
    
    var solaris = new Book({id: "1083-lem-solaris"});
    
    alert(solaris.url());
    
    parsemodel.parse(response, options)
    parse is called whenever a model's data is returned by the server, in fetch, and save. The function is passed the raw response object, and should return the attributes hash to be set on the model. The default implementation is a no-op, simply passing through the JSON response. Override this if you need to work with a preexisting API, or better namespace your responses.
    If you're working with a Rails backend that has a version prior to 3.1, you'll notice that its default to_json implementation includes a model's attributes under a namespace. To disable this behavior for seamless Backbone integration, set:
    ActiveRecord::Base.include_root_in_json = false
    
    clonemodel.clone()
    Returns a new instance of the model with identical attributes.
    isNewmodel.isNew()
    Has this model been saved to the server yet? If the model does not yet have an id, it is considered to be new.
    hasChangedmodel.hasChanged([attribute])
    Has the model changed since the last set? If an attribute is passed, returns true if that specific attribute has changed.
    Note that this method, and the following change-related ones, are only useful during the course of a "change" event.
    book.on("change", function() {
      if (book.hasChanged("title")) {
        ...
      }
    });
    
    changedAttributesmodel.changedAttributes([attributes])
    Retrieve a hash of only the model's attributes that have changed since the last set, or false if there are none. Optionally, an external attributes hash can be passed in, returning the attributes in that hash which differ from the model. This can be used to figure out which portions of a view should be updated, or what calls need to be made to sync the changes to the server.
    previousmodel.previous(attribute)
    During a "change" event, this method can be used to get the previous value of a changed attribute.
    var bill = new Backbone.Model({
      name: "Bill Smith"
    });
    
    bill.on("change:name", function(model, name) {
      alert("Changed name from " + bill.previous("name") + " to " + name);
    });
    
    bill.set({name : "Bill Jones"});
    
    previousAttributesmodel.previousAttributes()
    Return a copy of the model's previous attributes. Useful for getting a diff between versions of a model, or getting back to a valid state after an error occurs.

    Backbone.Collection

    Collections are ordered sets of models. You can bind "change" events to be notified when any model in the collection has been modified, listen for "add" and "remove" events, fetch the collection from the server, and use a full suite of Underscore.js methods.
    Any event that is triggered on a model in a collection will also be triggered on the collection directly, for convenience. This allows you to listen for changes to specific attributes in any model in a collection, for example: documents.on("change:selected", ...)
    extendBackbone.Collection.extend(properties, [classProperties])
    To create a Collection class of your own, extend Backbone.Collection, providing instance properties, as well as optional classProperties to be attached directly to the collection's constructor function.
    modelcollection.model
    Override this property to specify the model class that the collection contains. If defined, you can pass raw attributes objects (and arrays) to add, create, and reset, and the attributes will be converted into a model of the proper type.
    var Library = Backbone.Collection.extend({
      model: Book
    });
    
    A collection can also contain polymorphic models by overriding this property with a constructor that returns a model.
    var Library = Backbone.Collection.extend({
    
      model: function(attrs, options) {
        if (condition) {
          return new PublicDocument(attrs, options);
        } else {
          return new PrivateDocument(attrs, options);
        }
      }
    
    });
    
    constructor / initializenew Backbone.Collection([models], [options])
    When creating a Collection, you may choose to pass in the initial array of models. The collection's comparator may be included as an option. Passing false as the comparator option will prevent sorting. If you define an initialize function, it will be invoked when the collection is created. There are a couple of options that, if provided, are attached to the collection directly: model and comparator.
    var tabs = new TabSet([tab1, tab2, tab3]);
    var spaces = new Backbone.Collection([], {
      model: Space
    });
    
    modelscollection.models
    Raw access to the JavaScript array of models inside of the collection. Usually you'll want to use get, at, or the Underscore methods to access model objects, but occasionally a direct reference to the array is desired.
    toJSONcollection.toJSON([options])
    Return an array containing the attributes hash of each model (via toJSON) in the collection. This can be used to serialize and persist the collection as a whole. The name of this method is a bit confusing, because it conforms to JavaScript's JSON API.
    var collection = new Backbone.Collection([
      {name: "Tim", age: 5},
      {name: "Ida", age: 26},
      {name: "Rob", age: 55}
    ]);
    
    alert(JSON.stringify(collection));
    
    synccollection.sync(method, collection, [options])
    Uses Backbone.sync to persist the state of a collection to the server. Can be overridden for custom behavior.
    Underscore Methods (28)
    Backbone proxies to Underscore.js to provide 28 iteration functions on Backbone.Collection. They aren't all documented here, but you can take a look at the Underscore documentation for the full details…
    books.each(function(book) {
      book.publish();
    });
    
    var titles = books.map(function(book) {
      return book.get("title");
    });
    
    var publishedBooks = books.filter(function(book) {
      return book.get("published") === true;
    });
    
    var alphabetical = books.sortBy(function(book) {
      return book.author.get("name").toLowerCase();
    });
    
    addcollection.add(models, [options])
    Add a model (or an array of models) to the collection, firing an "add" event. If a model property is defined, you may also pass raw attributes objects, and have them be vivified as instances of the model. Returns the added (or preexisting, if duplicate) models. Pass {at: index} to splice the model into the collection at the specified index. If you're adding models to the collection that are already in the collection, they'll be ignored, unless you pass {merge: true}, in which case their attributes will be merged into the corresponding models, firing any appropriate "change" events.
    var ships = new Backbone.Collection;
    
    ships.on("add", function(ship) {
      alert("Ahoy " + ship.get("name") + "!");
    });
    
    ships.add([
      {name: "Flying Dutchman"},
      {name: "Black Pearl"}
    ]);
    
    Note that adding the same model (a model with the same id) to a collection more than once
    is a no-op.
    removecollection.remove(models, [options])
    Remove a model (or an array of models) from the collection, and returns them. Fires a "remove" event, which you can use silent to suppress. The model's index before removal is available to listeners as options.index.
    resetcollection.reset([models], [options])
    Adding and removing models one at a time is all well and good, but sometimes you have so many models to change that you'd rather just update the collection in bulk. Use reset to replace a collection with a new list of models (or attribute hashes), triggering a single "reset" event at the end. Returns the newly-set models. For convenience, within a "reset" event, the list of any previous models is available as options.previousModels.
    Here's an example using reset to bootstrap a collection during initial page load, in a Rails application:
    <script>
      var accounts = new Backbone.Collection;
      accounts.reset(<%= @accounts.to_json %>);
    </script>
    
    Calling collection.reset() without passing any models as arguments will empty the entire collection.
    setcollection.set(models, [options])
    The set method performs a "smart" update of the collection with the passed list of models. If a model in the list isn't yet in the collection it will be added; if the model is already in the collection its attributes will be merged; and if the collection contains any models that aren't present in the list, they'll be removed. All of the appropriate "add", "remove", and "change" events are fired as this happens. Returns the touched models in the collection. If you'd like to customize the behavior, you can disable it with options: {add: false}, {remove: false}, or {merge: false}.
    var vanHalen = new Backbone.Collection([eddie, alex, stone, roth]);
    
    vanHalen.set([eddie, alex, stone, hagar]);
    
    // Fires a "remove" event for roth, and an "add" event for "hagar".
    // Updates any of stone, alex, and eddie's attributes that may have
    // changed over the years.
    
    getcollection.get(id)
    Get a model from a collection, specified by an id, a cid, or by passing in a model.
    var book = library.get(110);
    
    atcollection.at(index)
    Get a model from a collection, specified by index. Useful if your collection is sorted, and if your collection isn't sorted, at will still retrieve models in insertion order.
    pushcollection.push(model, [options])
    Add a model at the end of a collection. Takes the same options as add.
    popcollection.pop([options])
    Remove and return the last model from a collection. Takes the same options as remove.
    unshiftcollection.unshift(model, [options])
    Add a model at the beginning of a collection. Takes the same options as add.
    shiftcollection.shift([options])
    Remove and return the first model from a collection. Takes the same options as remove.
    slicecollection.slice(begin, end)
    Return a shallow copy of this collection's models, using the same options as native Array#slice.
    lengthcollection.length
    Like an array, a Collection maintains a length property, counting the number of models it contains.
    comparatorcollection.comparator
    By default there is no comparator for a collection. If you define a comparator, it will be used to maintain the collection in sorted order. This means that as models are added, they are inserted at the correct index in collection.models. A comparator can be defined as a sortBy (pass a function that takes a single argument), as a sort (pass a comparator function that expects two arguments), or as a string indicating the attribute to sort by.
    "sortBy" comparator functions take a model and return a numeric or string value by which the model should be ordered relative to others. "sort" comparator functions take two models, and return -1 if the first model should come before the second, 0 if they are of the same rank and 1 if the first model should come after. Note that Backbone depends on the arity of your comparator function to determine between the two styles, so be careful if your comparator function is bound.
    Note how even though all of the chapters in this example are added backwards, they come out in the proper order:
    var Chapter  = Backbone.Model;
    var chapters = new Backbone.Collection;
    
    chapters.comparator = 'page';
    
    chapters.add(new Chapter({page: 9, title: "The End"}));
    chapters.add(new Chapter({page: 5, title: "The Middle"}));
    chapters.add(new Chapter({page: 1, title: "The Beginning"}));
    
    alert(chapters.pluck('title'));
    
    Collections with a comparator will not automatically re-sort if you later change model attributes, so you may wish to call sort after changing model attributes that would affect the order.
    sortcollection.sort([options])
    Force a collection to re-sort itself. You don't need to call this under normal circumstances, as a collection with a comparator will sort itself whenever a model is added. To disable sorting when adding a model, pass {sort: false} to add. Calling sort triggers a "sort" event on the collection.
    pluckcollection.pluck(attribute)
    Pluck an attribute from each model in the collection. Equivalent to calling map and returning a single attribute from the iterator.
    var stooges = new Backbone.Collection([
      {name: "Curly"},
      {name: "Larry"},
      {name: "Moe"}
    ]);
    
    var names = stooges.pluck("name");
    
    alert(JSON.stringify(names));
    
    wherecollection.where(attributes)
    Return an array of all the models in a collection that match the passed attributes. Useful for simple cases of filter.
    var friends = new Backbone.Collection([
      {name: "Athos",      job: "Musketeer"},
      {name: "Porthos",    job: "Musketeer"},
      {name: "Aramis",     job: "Musketeer"},
      {name: "d'Artagnan", job: "Guard"},
    ]);
    
    var musketeers = friends.where({job: "Musketeer"});
    
    alert(musketeers.length);
    
    findWherecollection.findWhere(attributes)
    Just like where, but directly returns only the first model in the collection that matches the passed attributes.
    urlcollection.url or collection.url()
    Set the url property (or function) on a collection to reference its location on the server. Models within the collection will use url to construct URLs of their own.
    var Notes = Backbone.Collection.extend({
      url: '/notes'
    });
    
    // Or, something more sophisticated:
    
    var Notes = Backbone.Collection.extend({
      url: function() {
        return this.document.url() + '/notes';
      }
    });
    
    parsecollection.parse(response, options)
    parse is called by Backbone whenever a collection's models are returned by the server, in fetch. The function is passed the raw response object, and should return the array of model attributes to be added to the collection. The default implementation is a no-op, simply passing through the JSON response. Override this if you need to work with a preexisting API, or better namespace your responses.
    var Tweets = Backbone.Collection.extend({
      // The Twitter Search API returns tweets under "results".
      parse: function(response) {
        return response.results;
      }
    });
    
    clonecollection.clone()
    Returns a new instance of the collection with an identical list of models.
    fetchcollection.fetch([options])
    Fetch the default set of models for this collection from the server, setting them on the collection when they arrive. The options hash takes success and error callbacks which will both be passed (collection, response, options) as arguments. When the model data returns from the server, it uses set to (intelligently) merge the fetched models, unless you pass {reset: true}, in which case the collection will be (efficiently) reset. Delegates to Backbone.sync under the covers for custom persistence strategies and returns a jqXHR. The server handler for fetch requests should return a JSON array of models.
    Backbone.sync = function(method, model) {
      alert(method + ": " + model.url);
    };
    
    var accounts = new Backbone.Collection;
    accounts.url = '/accounts';
    
    accounts.fetch();
    
    The behavior of fetch can be customized by using the available set options. For example, to fetch a collection, getting an "add" event for every new model, and a "change" event for every changed existing model, without removing anything: collection.fetch({remove: false})
    jQuery.ajax options can also be passed directly as fetch options, so to fetch a specific page of a paginated collection: Documents.fetch({data: {page: 3}})
    Note that fetch should not be used to populate collections on page load — all models needed at load time should already be bootstrapped in to place. fetch is intended for lazily-loading models for interfaces that are not needed immediately: for example, documents with collections of notes that may be toggled open and closed.
    createcollection.create(attributes, [options])
    Convenience to create a new instance of a model within a collection. Equivalent to instantiating a model with a hash of attributes, saving the model to the server, and adding the model to the set after being successfully created. Returns the new model. If client-side validation failed, the model will be unsaved, with validation errors. In order for this to work, you should set the model property of the collection. The create method can accept either an attributes hash or an existing, unsaved model object.
    Creating a model will cause an immediate "add" event to be triggered on the collection, a "request" event as the new model is sent to the server, as well as a "sync" event, once the server has responded with the successful creation of the model. Pass {wait: true} if you'd like to wait for the server before adding the new model to the collection.
    var Library = Backbone.Collection.extend({
      model: Book
    });
    
    var nypl = new Library;
    
    var othello = nypl.create({
      title: "Othello",
      author: "William Shakespeare"
    });
    

    Backbone.Router

    Web applications often provide linkable, bookmarkable, shareable URLs for important locations in the app. Until recently, hash fragments (#page) were used to provide these permalinks, but with the arrival of the History API, it's now possible to use standard URLs (/page). Backbone.Router provides methods for routing client-side pages, and connecting them to actions and events. For browsers which don't yet support the History API, the Router handles graceful fallback and transparent translation to the fragment version of the URL.
    During page load, after your application has finished creating all of its routers, be sure to call Backbone.history.start(), or Backbone.history.start({pushState: true}) to route the initial URL.
    extendBackbone.Router.extend(properties, [classProperties])
    Get started by creating a custom router class. Define actions that are triggered when certain URL fragments are matched, and provide a routes hash that pairs routes to actions. Note that you'll want to avoid using a leading slash in your route definitions:
    var Workspace = Backbone.Router.extend({
    
      routes: {
        "help":                 "help",    // #help
        "search/:query":        "search",  // #search/kiwis
        "search/:query/p:page": "search"   // #search/kiwis/p7
      },
    
      help: function() {
        ...
      },
    
      search: function(query, page) {
        ...
      }
    
    });
    
    routesrouter.routes
    The routes hash maps URLs with parameters to functions on your router (or just direct function definitions, if you prefer), similar to the View's events hash. Routes can contain parameter parts, :param, which match a single URL component between slashes; and splat parts *splat, which can match any number of URL components. Part of a route can be made optional by surrounding it in parentheses (/:optional).
    For example, a route of "search/:query/p:page" will match a fragment of #search/obama/p2, passing "obama" and "2" to the action.
    A route of "file/*path" will match #file/nested/folder/file.txt, passing "nested/folder/file.txt" to the action.
    A route of "docs/:section(/:subsection)" will match #docs/faq and #docs/faq/installing, passing "faq" to the action in the first case, and passing "faq" and "installing" to the action in the second.
    Trailing slashes are treated as part of the URL, and (correctly) treated as a unique route when accessed. docs and docs/ will fire different callbacks. If you can't avoid generating both types of URLs, you can define a "docs(/)" matcher to capture both cases.
    When the visitor presses the back button, or enters a URL, and a particular route is matched, the name of the action will be fired as an event, so that other objects can listen to the router, and be notified. In the following example, visiting #help/uploading will fire a route:help event from the router.
    routes: {
      "help/:page":         "help",
      "download/*path":     "download",
      "folder/:name":       "openFolder",
      "folder/:name-:mode": "openFolder"
    }
    
    router.on("route:help", function(page) {
      ...
    });
    
    constructor / initializenew Router([options])
    When creating a new router, you may pass its routes hash directly as an option, if you choose. All options will also be passed to your initialize function, if defined.
    routerouter.route(route, name, [callback])
    Manually create a route for the router, The route argument may be a routing string or regular expression. Each matching capture from the route or regular expression will be passed as an argument to the callback. The name argument will be triggered as a "route:name" event whenever the route is matched. If the callback argument is omitted router[name] will be used instead. Routes added later may override previously declared routes.
    initialize: function(options) {
    
      // Matches #page/10, passing "10"
      this.route("page/:number", "page", function(number){ ... });
    
      // Matches /117-a/b/c/open, passing "117-a/b/c" to this.open
      this.route(/^(.*?)\/open$/, "open");
    
    },
    
    open: function(id) { ... }
    
    navigaterouter.navigate(fragment, [options])
    Whenever you reach a point in your application that you'd like to save as a URL, call navigate in order to update the URL. If you wish to also call the route function, set the trigger option to true. To update the URL without creating an entry in the browser's history, set the replace option to true.
    openPage: function(pageNumber) {
      this.document.pages.at(pageNumber).open();
      this.navigate("page/" + pageNumber);
    }
    
    # Or ...
    
    app.navigate("help/troubleshooting", {trigger: true});
    
    # Or ...
    
    app.navigate("help/troubleshooting", {trigger: true, replace: true});
    
    executerouter.execute(callback, args)
    This method is called internally within the router, whenever a route matches and its corresponding callback is about to be executed. Override it to perform custom parsing or wrapping of your routes, for example, to parse query strings before handing them to your route callback, like so:
    var Router = Backbone.Router.extend({
      execute: function(callback, args) {
        args.push(parseQueryString(args.pop()));
        if (callback) callback.apply(this, args);
      }
    });
    

    Backbone.history

    History serves as a global router (per frame) to handle hashchange events or pushState, match the appropriate route, and trigger callbacks. You shouldn't ever have to create one of these yourself since Backbone.history already contains one.
    pushState support exists on a purely opt-in basis in Backbone. Older browsers that don't support pushState will continue to use hash-based URL fragments, and if a hash URL is visited by a pushState-capable browser, it will be transparently upgraded to the true URL. Note that using real URLs requires your web server to be able to correctly render those pages, so back-end changes are required as well. For example, if you have a route of /documents/100, your web server must be able to serve that page, if the browser visits that URL directly. For full search-engine crawlability, it's best to have the server generate the complete HTML for the page ... but if it's a web application, just rendering the same content you would have for the root URL, and filling in the rest with Backbone Views and JavaScript works fine.
    startBackbone.history.start([options])
    When all of your Routers have been created, and all of the routes are set up properly, call Backbone.history.start() to begin monitoring hashchange events, and dispatching routes. Subsequent calls to Backbone.history.start() will throw an error, and Backbone.History.started is a boolean value indicating whether it has already been called.
    To indicate that you'd like to use HTML5 pushState support in your application, use Backbone.history.start({pushState: true}). If you'd like to use pushState, but have browsers that don't support it natively use full page refreshes instead, you can add {hashChange: false} to the options.
    If your application is not being served from the root url / of your domain, be sure to tell History where the root really is, as an option: Backbone.history.start({pushState: true, root: "/public/search/"})
    When called, if a route succeeds with a match for the current URL, Backbone.history.start() returns true. If no defined route matches the current URL, it returns false.
    If the server has already rendered the entire page, and you don't want the initial route to trigger when starting History, pass silent: true.
    Because hash-based history in Internet Explorer relies on an <iframe>, be sure to only call start() after the DOM is ready.
    $(function(){
      new WorkspaceRouter();
      new HelpPaneRouter();
      Backbone.history.start({pushState: true});
    });
    

    Backbone.sync

    Backbone.sync is the function that Backbone calls every time it attempts to read or save a model to the server. By default, it uses jQuery.ajax to make a RESTful JSON request and returns a jqXHR. You can override it in order to use a different persistence strategy, such as WebSockets, XML transport, or Local Storage.
    The method signature of Backbone.sync is sync(method, model, [options])
    • method – the CRUD method ("create", "read", "update", or "delete")
    • model – the model to be saved (or collection to be read)
    • options – success and error callbacks, and all other jQuery request options
    With the default implementation, when Backbone.sync sends up a request to save a model, its attributes will be passed, serialized as JSON, and sent in the HTTP body with content-type application/json. When returning a JSON response, send down the attributes of the model that have been changed by the server, and need to be updated on the client. When responding to a "read" request from a collection (Collection#fetch), send down an array of model attribute objects.
    Whenever a model or collection begins a sync with the server, a "request" event is emitted. If the request completes successfully you'll get a "sync" event, and an "error" event if not.
    The sync function may be overriden globally as Backbone.sync, or at a finer-grained level, by adding a sync function to a Backbone collection or to an individual model.
    The default sync handler maps CRUD to REST like so:
    • create → POST   /collection
    • read → GET   /collection[/id]
    • update → PUT   /collection/id
    • patch → PATCH   /collection/id
    • delete → DELETE   /collection/id
    As an example, a Rails handler responding to an "update" call from Backbone might look like this: (In real code, never use update_attributes blindly, and always whitelist the attributes you allow to be changed.)
    def update
      account = Account.find params[:id]
      account.update_attributes params
      render :json => account
    end
    
    One more tip for integrating Rails versions prior to 3.1 is to disable the default namespacing for to_json calls on models by setting ActiveRecord::Base.include_root_in_json = false
    ajaxBackbone.ajax = function(request) { ... };
    If you want to use a custom AJAX function, or your endpoint doesn't support the jQuery.ajax API and you need to tweak things, you can do so by setting Backbone.ajax.
    emulateHTTPBackbone.emulateHTTP = true
    If you want to work with a legacy web server that doesn't support Backbone's default REST/HTTP approach, you may choose to turn on Backbone.emulateHTTP. Setting this option will fake PUT, PATCH and DELETE requests with a HTTP POST, setting the X-HTTP-Method-Override header with the true method. If emulateJSON is also on, the true method will be passed as an additional _method parameter.
    Backbone.emulateHTTP = true;
    
    model.save();  // POST to "/collection/id", with "_method=PUT" + header.
    
    emulateJSONBackbone.emulateJSON = true
    If you're working with a legacy web server that can't handle requests encoded as application/json, setting Backbone.emulateJSON = true; will cause the JSON to be serialized under a model parameter, and the request to be made with a application/x-www-form-urlencoded MIME type, as if from an HTML form.

    Backbone.View

    Backbone views are almost more convention than they are code — they don't determine anything about your HTML or CSS for you, and can be used with any JavaScript templating library. The general idea is to organize your interface into logical views, backed by models, each of which can be updated independently when the model changes, without having to redraw the page. Instead of digging into a JSON object, looking up an element in the DOM, and updating the HTML by hand, you can bind your view's render function to the model's "change" event — and now everywhere that model data is displayed in the UI, it is always immediately up to date.
    extendBackbone.View.extend(properties, [classProperties])
    Get started with views by creating a custom view class. You'll want to override the render function, specify your declarative events, and perhaps the tagName, className, or id of the View's root element.
    var DocumentRow = Backbone.View.extend({
    
      tagName: "li",
    
      className: "document-row",
    
      events: {
        "click .icon":          "open",
        "click .button.edit":   "openEditDialog",
        "click .button.delete": "destroy"
      },
    
      initialize: function() {
        this.listenTo(this.model, "change", this.render);
      },
    
      render: function() {
        ...
      }
    
    });
    
    Properties like tagName, id, className, el, and events may also be defined as a function, if you want to wait to define them until runtime.
    constructor / initializenew View([options])
    There are several special options that, if passed, will be attached directly to the view: model, collection, el, id, className, tagName, attributes and events. If the view defines an initialize function, it will be called when the view is first created. If you'd like to create a view that references an element already in the DOM, pass in the element as an option: new View({el: existingElement})
    var doc = documents.first();
    
    new DocumentRow({
      model: doc,
      id: "document-row-" + doc.id
    });
    
    elview.el
    All views have a DOM element at all times (the el property), whether they've already been inserted into the page or not. In this fashion, views can be rendered at any time, and inserted into the DOM all at once, in order to get high-performance UI rendering with as few reflows and repaints as possible. this.el is created from the view's tagName, className, id and attributes properties, if specified. If not, el is an empty div.
    var ItemView = Backbone.View.extend({
      tagName: 'li'
    });
    
    var BodyView = Backbone.View.extend({
      el: 'body'
    });
    
    var item = new ItemView();
    var body = new BodyView();
    
    alert(item.el + ' ' + body.el);
    
    $elview.$el
    A cached jQuery object for the view's element. A handy reference instead of re-wrapping the DOM element all the time.
    view.$el.show();
    
    listView.$el.append(itemView.el);
    
    setElementview.setElement(element)
    If you'd like to apply a Backbone view to a different DOM element, use setElement, which will also create the cached $el reference and move the view's delegated events from the old element to the new one.
    attributesview.attributes
    A hash of attributes that will be set as HTML DOM element attributes on the view's el (id, class, data-properties, etc.), or a function that returns such a hash.
    $ (jQuery)view.$(selector)
    If jQuery is included on the page, each view has a $ function that runs queries scoped within the view's element. If you use this scoped jQuery function, you don't have to use model ids as part of your query to pull out specific elements in a list, and can rely much more on HTML class attributes. It's equivalent to running: view.$el.find(selector)
    ui.Chapter = Backbone.View.extend({
      serialize : function() {
        return {
          title: this.$(".title").text(),
          start: this.$(".start-page").text(),
          end:   this.$(".end-page").text()
        };
      }
    });
    
    templateview.template([data])
    While templating for a view isn't a function provided directly by Backbone, it's often a nice convention to define a template function on your views. In this way, when rendering your view, you have convenient access to instance data. For example, using Underscore templates:
    var LibraryView = Backbone.View.extend({
      template: _.template(...)
    });
    
    renderview.render()
    The default implementation of render is a no-op. Override this function with your code that renders the view template from model data, and updates this.el with the new HTML. A good convention is to return this at the end of render to enable chained calls.
    var Bookmark = Backbone.View.extend({
      template: _.template(...),
      render: function() {
        this.$el.html(this.template(this.model.attributes));
        return this;
      }
    });
    
    Backbone is agnostic with respect to your preferred method of HTML templating. Your render function could even munge together an HTML string, or use document.createElement to generate a DOM tree. However, we suggest choosing a nice JavaScript templating library. Mustache.js, Haml-js, and Eco are all fine alternatives. Because Underscore.js is already on the page, _.template is available, and is an excellent choice if you prefer simple interpolated-JavaScript style templates.
    Whatever templating strategy you end up with, it's nice if you never have to put strings of HTML in your JavaScript. At DocumentCloud, we use Jammit in order to package up JavaScript templates stored in /app/views as part of our main core.js asset package.
    removeview.remove()
    Removes a view from the DOM, and calls stopListening to remove any bound events that the view has listenTo'd.
    delegateEventsdelegateEvents([events])
    Uses jQuery's on function to provide declarative callbacks for DOM events within a view. If an events hash is not passed directly, uses this.events as the source. Events are written in the format {"event selector": "callback"}. The callback may be either the name of a method on the view, or a direct function body. Omitting the selector causes the event to be bound to the view's root element (this.el). By default, delegateEvents is called within the View's constructor for you, so if you have a simple events hash, all of your DOM events will always already be connected, and you will never have to call this function yourself.
    The events property may also be defined as a function that returns an events hash, to make it easier to programmatically define your events, as well as inherit them from parent views.
    Using delegateEvents provides a number of advantages over manually using jQuery to bind events to child elements during render. All attached callbacks are bound to the view before being handed off to jQuery, so when the callbacks are invoked, this continues to refer to the view object. When delegateEvents is run again, perhaps with a different events hash, all callbacks are removed and delegated afresh — useful for views which need to behave differently when in different modes.
    A view that displays a document in a search result might look something like this:
    var DocumentView = Backbone.View.extend({
    
      events: {
        "dblclick"                : "open",
        "click .icon.doc"         : "select",
        "contextmenu .icon.doc"   : "showMenu",
        "click .show_notes"       : "toggleNotes",
        "click .title .lock"      : "editAccessLevel",
        "mouseover .title .date"  : "showTooltip"
      },
    
      render: function() {
        this.$el.html(this.template(this.model.attributes));
        return this;
      },
    
      open: function() {
        window.open(this.model.get("viewer_url"));
      },
    
      select: function() {
        this.model.set({selected: true});
      },
    
      ...
    
    });
    
    undelegateEventsundelegateEvents()
    Removes all of the view's delegated events. Useful if you want to disable or remove a view from the DOM temporarily.

    Utility

    Backbone.noConflictvar backbone = Backbone.noConflict();
    Returns the Backbone object back to its original value. You can use the return value of Backbone.noConflict() to keep a local reference to Backbone. Useful for embedding Backbone on third-party websites, where you don't want to clobber the existing Backbone.
    var localBackbone = Backbone.noConflict();
    var model = localBackbone.Model.extend(...);
    
    Backbone.$Backbone.$ = $;
    If you have multiple copies of jQuery on the page, or simply want to tell Backbone to use a particular object as its DOM / Ajax library, this is the property for you. If you're loading Backbone with CommonJS (e.g. node, component, or browserify) you must set this property manually.
    var Backbone.$ = require('jquery');
    

    F.A.Q.

    Why use Backbone, not [other framework X]?
    If your eye hasn't already been caught by the adaptability and elan on display in the above list of examples, we can get more specific: Backbone.js aims to provide the common foundation that data-rich web applications with ambitious interfaces require — while very deliberately avoiding painting you into a corner by making any decisions that you're better equipped to make yourself.
    • The focus is on supplying you with helpful methods to manipulate and query your data, not on HTML widgets or reinventing the JavaScript object model.
    • Backbone does not force you to use a single template engine. Views can bind to HTML constructed in your favorite way.
    • It's smaller. There are fewer kilobytes for your browser or phone to download, and less conceptual surface area. You can read and understand the source in an afternoon.
    • It doesn't depend on stuffing application logic into your HTML. There's no embedded JavaScript, template logic, or binding hookup code in data- or ng- attributes, and no need to invent your own HTML tags.
    • Synchronous events are used as the fundamental building block, not a difficult-to-reason-about run loop, or by constantly polling and traversing your data structures to hunt for changes. And if you want a specific event to be asynchronous and aggregated, no problem.
    • Backbone scales well, from embedded widgets to massive apps.
    • Backbone is a library, not a framework, and plays well with others. You can embed Backbone widgets in Dojo apps without trouble, or use Backbone models as the data backing for D3 visualizations (to pick two entirely random examples).
    • "Two way data-binding" is avoided. While it certainly makes for a nifty demo, and works for the most basic CRUD, it doesn't tend to be terribly useful in your real-world app. Sometimes you want to update on every keypress, sometimes on blur, sometimes when the panel is closed, and sometimes when the "save" button is clicked. In almost all cases, simply serializing the form to JSON is faster and easier. All that aside, if your heart is set, go for it.
    • There's no built-in performance penalty for choosing to structure your code with Backbone. And if you do want to optimize further, thin models and templates with flexible granularity make it easy to squeeze every last drop of potential performance out of, say, IE8.
    There's More Than One Way To Do It
    It's common for folks just getting started to treat the examples listed on this page as some sort of gospel truth. In fact, Backbone.js is intended to be fairly agnostic about many common patterns in client-side code. For example...
    References between Models and Views can be handled several ways. Some people like to have direct pointers, where views correspond 1:1 with models (model.view and view.model). Others prefer to have intermediate "controller" objects that orchestrate the creation and organization of views into a hierarchy. Others still prefer the evented approach, and always fire events instead of calling methods directly. All of these styles work well.
    Batch operations on Models are common, but often best handled differently depending on your server-side setup. Some folks don't mind making individual Ajax requests. Others create explicit resources for RESTful batch operations: /notes/batch/destroy?ids=1,2,3,4. Others tunnel REST over JSON, with the creation of "changeset" requests:
      {
        "create":  [array of models to create]
        "update":  [array of models to update]
        "destroy": [array of model ids to destroy]
      }
    
    Feel free to define your own events. Backbone.Events is designed so that you can mix it in to any JavaScript object or prototype. Since you can use any string as an event, it's often handy to bind and trigger your own custom events: model.on("selected:true") or model.on("editing")
    Render the UI as you see fit. Backbone is agnostic as to whether you use Underscore templates, Mustache.js, direct DOM manipulation, server-side rendered snippets of HTML, or jQuery UI in your render function. Sometimes you'll create a view for each model ... sometimes you'll have a view that renders thousands of models at once, in a tight loop. Both can be appropriate in the same app, depending on the quantity of data involved, and the complexity of the UI.
    Nested Models & Collections
    It's common to nest collections inside of models with Backbone. For example, consider a Mailbox model that contains many Message models. One nice pattern for handling this is have a this.messages collection for each mailbox, enabling the lazy-loading of messages, when the mailbox is first opened ... perhaps with MessageList views listening for "add" and "remove" events.
    var Mailbox = Backbone.Model.extend({
    
      initialize: function() {
        this.messages = new Messages;
        this.messages.url = '/mailbox/' + this.id + '/messages';
        this.messages.on("reset", this.updateCounts);
      },
    
      ...
    
    });
    
    var inbox = new Mailbox;
    
    // And then, when the Inbox is opened:
    
    inbox.messages.fetch({reset: true});
    
    If you're looking for something more opinionated, there are a number of Backbone plugins that add sophisticated associations among models, available on the wiki.
    Backbone doesn't include direct support for nested models and collections or "has many" associations because there are a number of good patterns for modeling structured data on the client side, and Backbone should provide the foundation for implementing any of them. You may want to…
    • Mirror an SQL database's structure, or the structure of a NoSQL database.
    • Use models with arrays of "foreign key" ids, and join to top level collections (a-la tables).
    • For associations that are numerous, use a range of ids instead of an explicit list.
    • Avoid ids, and use direct references, creating a partial object graph representing your data set.
    • Lazily load joined models from the server, or lazily deserialize nested models from JSON documents.
    Loading Bootstrapped Models
    When your app first loads, it's common to have a set of initial models that you know you're going to need, in order to render the page. Instead of firing an extra AJAX request to fetch them, a nicer pattern is to have their data already bootstrapped into the page. You can then use reset to populate your collections with the initial data. At DocumentCloud, in the ERB template for the workspace, we do something along these lines:
    <script>
      var accounts = new Backbone.Collection;
      accounts.reset(<%= @accounts.to_json %>);
      var projects = new Backbone.Collection;
      projects.reset(<%= @projects.to_json(:collaborators => true) %>);
    </script>
    
    You have to escape </ within the JSON string, to prevent javascript injection attacks.
    Extending Backbone
    Many JavaScript libraries are meant to be insular and self-enclosed, where you interact with them by calling their public API, but never peek inside at the guts. Backbone.js is not that kind of library.
    Because it serves as a foundation for your application, you're meant to extend and enhance it in the ways you see fit — the entire source code is annotated to make this easier for you. You'll find that there's very little there apart from core functions, and most of those can be overriden or augmented should you find the need. If you catch yourself adding methods to Backbone.Model.prototype, or creating your own base subclass, don't worry — that's how things are supposed to work.
    How does Backbone relate to "traditional" MVC?
    Different implementations of the Model-View-Controller pattern tend to disagree about the definition of a controller. If it helps any, in Backbone, the View class can also be thought of as a kind of controller, dispatching events that originate from the UI, with the HTML template serving as the true view. We call it a View because it represents a logical chunk of UI, responsible for the contents of a single DOM element.
    Comparing the overall structure of Backbone to a server-side MVC framework like Rails, the pieces line up like so:
    • Backbone.Model – Like a Rails model minus the class methods. Wraps a row of data in business logic.
    • Backbone.Collection – A group of models on the client-side, with sorting/filtering/aggregation logic.
    • Backbone.Router – Rails routes.rb + Rails controller actions. Maps URLs to functions.
    • Backbone.View – A logical, re-usable piece of UI. Often, but not always, associated with a model.
    • Client-side Templates – Rails .html.erb views, rendering a chunk of HTML.
    Binding "this"
    Perhaps the single most common JavaScript "gotcha" is the fact that when you pass a function as a callback, its value for this is lost. When dealing with events and callbacks in Backbone, you'll often find it useful to rely on listenTo or the optional context argument that many of Underscore and Backbone's methods use to specify the this that will be used when the callback is later invoked. (See _.each, _.map, and object.on, to name a few). View events are automatically bound to the view's context for you. You may also find it helpful to use _.bind and _.bindAll from Underscore.js.
    var MessageList = Backbone.View.extend({
    
      initialize: function() {
        var messages = this.collection;
        messages.on("reset", this.render, this);
        messages.on("add", this.addMessage, this);
        messages.on("remove", this.removeMessage, this);
    
        messages.each(this.addMessage, this);
      }
    
    });
    
    // Later, in the app...
    
    Inbox.messages.add(newMessage);
    
    Working with Rails
    Backbone.js was originally extracted from a Rails application; getting your client-side (Backbone) Models to sync correctly with your server-side (Rails) Models is painless, but there are still a few things to be aware of.
    By default, Rails versions prior to 3.1 add an extra layer of wrapping around the JSON representation of models. You can disable this wrapping by setting:
    ActiveRecord::Base.include_root_in_json = false
    
    ... in your configuration. Otherwise, override parse to pull model attributes out of the wrapper. Similarly, Backbone PUTs and POSTs direct JSON representations of models, where by default Rails expects namespaced attributes. You can have your controllers filter attributes directly from params, or you can override toJSON in Backbone to add the extra wrapping Rails expects.

    Examples

    The list of examples that follows, while long, is not exhaustive. If you've worked on an app that uses Backbone, please add it to the wiki page of Backbone apps.
    Jérôme Gravel-Niquet has contributed a Todo List application that is bundled in the repository as Backbone example. If you're wondering where to get started with Backbone in general, take a moment to read through the annotated source. The app uses a LocalStorage adapter to transparently save all of your todos within your browser, instead of sending them to a server. Jérôme also has a version hosted at localtodos.com.