I want to list all the posts with alphabetical headings like this site:
How can I do this with drupal 7 using views?
You need to try this simple way, just create a view with views module:
Have you looked at the "Glossary" view? It is a sample view included with the views module that lists all site content by letter in a manner similar to the link you listed.
The "Glossary" view is disabled by default, but you can enable it on the views admin page (admin/structure/views).
The settings for sorting the posts in the "Glossary" view can be found on the views edit screen under Advanced-> Contextual Filters-> Content: Title. If you click Content: Title, under "More" you will find the option to use upper or lower case when sorting the view.
This new module might be helpful: https://www.drupal.org/project/alpha_pagination
It uses the glossary functionality that Patrick Kenny mentioned but it extends that in super-powerful and useful ways.
From the module page: The Alpha Pagination for Views module enables you to add an alphabetical menu in the header or footer of a views display.
Install Install the Alpha Pagination module.
Copy the alpha_pagination folder to the modules folder in your installation. Download and enable dependencies (views and views_ui). Enable the Alpha Pagination for Views module using Administer -> Modules (/admin/build/modules). Views Integration and Configuration
Build a new view of either users, content (nodes), or comments. Add whatever field you want to use as the basis for the alphabetic grouping (e.g. title, body). You can optionally exclude this field from display if you don't want it to appear in the results shown on the page for some reason. You can only choose a field that is a textfield, textarea or a textarea with a summary.
Add either a header or a footer to your view. Select the new item available in the menu of options for Global: Alpha Pagination.
Configure how you want alpha_pagination to work and specify where it should appear: set the path to the results view page.
select the field you want to use as the basis for the alphabetic grouping from the options presented in the select list (note: if the field you want to use does not appear, go back and add it to your view and then return to this configuration page to select the field).
add a context that is the same as the field you wish to use as the basis for alphabetic sorting. Be sure to enable Glossary mode and set the character limit to 1. The transform case option on the URL should be set to Upper Case.
by default the alpha pagination will apply to all displays; if you only want the alpha pagination to appear on the current display, use the drop-down menu at the top of the administrative interface to change the setting from "All displays" to "This page (override)".
An optional sample view is included and can be enabled via the alpha_pagination_example view. The sample relies on the 'article' default content type. You can create sample content using the devel module or rely on your own data.
This module exists thanks to the support of Highwire Press, Inc. and the Institute for the Arts and Humanities and UNC and was created as part of the Symposiac Conference Platform.