Wednesday, August 27, 2014

victor graphics

adobe illustrator victor graphics

corael draw

http://www.coreldraw.com/us/product/graphic-design-software/?trkid=USsemKWS

Code foster

http://codefoster.com/

Monday, August 25, 2014

Maintaining the ViewState

http://www.w3schools.com/aspnet/aspnet_viewstate.asp

When a form is submitted in classic ASP, all form values are cleared. Suppose you have submitted a form with a lot of information and the server comes back with an error. You will have to go back to the form and correct the information. You click the back button, and what happens.......ALL form values are CLEARED, and you will have to start all over again! The site did not maintain your ViewState.
When a form is submitted in ASP .NET, the form reappears in the browser window together with all form values. How come? This is because ASP .NET maintains your ViewState. The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat="server"> control. The source could look something like this:
<form name="_ctl0" method="post" action="page.aspx" id="_ctl0">
< input type="hidden" name="__VIEWSTATE"
value="dDwtNTI0ODU5MDE1Ozs+ZBCF2ryjMpeVgUrY2eTj79HNl4Q=" />

.....some code

< /form>

post back

 If you want to execute the code in the Page_Load subroutine only the FIRST time the page is loaded, you can use the Page.IsPostBack property. If the Page.IsPostBack property is false, the page is loaded for the first time, if it is true, the page is posted back to the server (i.e. from a button click on a form):

Friday, August 22, 2014

Microsoft Azure logging & tracing

http://msdn.microsoft.com/en-us/magazine/ff714589.aspx

http://azure.microsoft.com/en-us/documentation/articles/web-sites-enable-diagnostic-log/

http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-troubleshoot-visual-studio/

Consuming web service in console application

Below took me a while to find, so just copy over for future reference:

http://www.c-sharpcorner.com/UploadFile/718fc8/consuming-web-service-in-console-application/


IntroductionHere I am creating a simple web service and using it in a console application. Using a web service in a console application is similar to using a web service in window application. At first, we create a web service. Follow the given steps.
  • Create new project
  • Select ASP.NET Empty Web Application
  • Give name to your project and click ok button
  • Go to Solution Explorer and right click at your project
  • Select Add New Item and select Web Service application
  • Give it name and click ok button 
Now replace the code in the .asmx.cs page with the following code. 
using System;
using
 System.Collections.Generic;
using
 System.Linq;
using
 System.Web;
using
 System.Web.Services;
 

namespace
 myproject
{
    /// <summary>    /// Summary description for MyService    /// </summary>    [WebService(Namespace = "example.abc/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.     // [System.Web.Script.Services.ScriptService]    public class MyService : System.Web.Services.WebService    { 
        [WebMethod(Description="show simple message")]
        public string show()
        {
            return "My Web Service Application";
        }
        [WebMethod(Description = "show datetime")]
        public string showdate()
        {
            return DateTime.Now.ToLongDateString();
        }
        [WebMethod(Description = "addition of two int")]
        public int add(int a,int b)
        {
            return a + b;
        }   
    }
}

Run the application

Output window:

 
Now, create a new project and take Console Application.  Add the service reference. For doing this, follow the given steps.
  • Go to Solution Explorer and right click at your application. 
 
  • Click Add Service Reference. A new window will be open.
 
  • Click the "Advanced" button. A new window will be open.

      
  • Again click the "Add Web Reference" button. Again a new window will be open.
 
  • Copy the URL of your running service application and paste to it at URL( As given in above figure) and click the "Go" button.

   
  • Set the service reference name. The default name is "localhost". Now click the "Add Reference" button.
Now the service has been added in your console application. Write the following code.

using
 System;
using
 System.Collections.Generic;
using
 System.Linq;
using
 System.Text;
namespace MyApplication
{
    class 
Program
    {
        static void Main(string[] args)
        {
            myservicereference.MyService obj = new myservicereference.MyService();
            Console.WriteLine(" Calling Web Methods");
            Console.WriteLine("---------------------");
            Console.WriteLine("\n Calling show Method");
            Console.WriteLine("  "+obj.show());
            Console.WriteLine("\n\n"+" Calling showdate Method ");
            Console.WriteLine("  "+obj.showdate());
            Console.WriteLine("\n Calling add Method ");
            Console.Write("  Enter First Number:");
            int a = Convert.ToInt32(Console.ReadLine());
            Console.Write("  Enter Second Number:");
            int b = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("\n  Addition is:" + obj.add(a, b).ToString());
            Console.ReadLine();
        }
    }
}

 
Press Ctrl+f5 to run the code.

Output:

 
 Enter first and second number. Then press "enter".

Output:

Visual studio 2013 - To add a Web reference to a project

http://msdn.microsoft.com/en-us/library/bb628649.aspx


To add a Web reference to a project

  1. In Solution Explorer, right-click the name of the project that you want to add the service to, and then click Add Service Reference.
    The Add Service Reference dialog box appears.
  2. In the Add Service Reference dialog box, click the Advanced button.
    The Service Reference Settings dialog box appears.
  3. In the Service Reference Settings dialog box, click Add Web Reference.
    The Add Web Reference dialog box appears.


web service get file and put file

I converted the return of get file to a string.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace TestWebService
{
   /// <summary>
   /// Summary description for WebService1
   /// </summary>
   [WebService(Namespace = "http://tempuri.org/")]
   [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
   [System.ComponentModel.ToolboxItem(false)]
   // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
   // [System.Web.Script.Services.ScriptService]
   public class WebService1 : System.Web.Services.WebService
   {

      [WebMethod]
      public string HelloWorld()
      {
         return "Hello World";
      }

      [WebMethod]
      public string GetFile(string filename)
     // public byte[] GetFile(string filename)
      {
         BinaryReader binReader = new
  BinaryReader(File.Open(Server.MapPath(filename), FileMode.Open,
  FileAccess.Read));
         binReader.BaseStream.Position = 0;
         byte[] binFile =
  binReader.ReadBytes(Convert.ToInt32(binReader.BaseStream.Length));
         binReader.Close();
         var str = System.Text.Encoding.Default.GetString(binFile);
         return str;
      }

      [WebMethod]
      public void PutFile(byte[] buffer, string filename)
      {
         BinaryWriter binWriter = new
  BinaryWriter(File.Open(Server.MapPath(filename), FileMode.CreateNew,
  FileAccess.ReadWrite));
         binWriter.Write(buffer);
         binWriter.Close();


      }
   }
}

below is code to run the web methods

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestAccessWebService
{
   class Program
   {
      static void Main(string[] args)
      {


       //  ServiceReference1.RolesServicePortClient cli = new ServiceReference1.RolesServicePortClient();
        // ServiceReference1.Role[] r ;
       
         //r = cli.getGlobalRolesByEmployee("0001445");
        // ServiceReference1.Role r1;
         //r1 = r[0];

         net.azurewebsites.smallgroup.WebService1 obj = new net.azurewebsites.smallgroup.WebService1();

         //myservicereference.WebService1 obj = new myservicereference.WebService1();
         //Console.WriteLine(r1.ToString());
         //Console.WriteLine(r1.OrgEntityID);
         Console.WriteLine("---------------------");
         //Console.WriteLine("\n Calling show Method");
         Console.WriteLine("  " + obj.HelloWorld());
         Console.WriteLine("\n\n" + " Calling GetFile Method ");
         byte[] bytearray = obj.GetFile("storelist.txt");
         //byte[] bytearray = obj.GetFile("StopSQL.bat");
         //Console.WriteLine("---------------------");
         var str = System.Text.Encoding.Default.GetString(bytearray);
         Console.WriteLine(str.ToString());
         Console.WriteLine("---------------------");
         //obj.PutFile(bytearray, "storelist.txt");
         //bytearray = obj.GetFile("storelist.txt");
         Console.WriteLine("---------------------");
         //str = System.Text.Encoding.Default.GetString(bytearray);
         //Console.WriteLine(str.ToString());
      }
   }
}

Wednesday, August 20, 2014

Debugging your ASP.NET Web APIs with Fiddler

fiddler

http://www.devcurry.com/2013/03/debugging-your-aspnet-web-apis-with.html

Visual studio says cannot debug

If IE is not installed or removed you will have this error

ASP web API getting started

http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api

Friday, August 15, 2014

Windows Azure app sample

http://azure.microsoft.com/en-us/documentation/articles/cloud-services-dotnet-multi-tier-app-using-service-bus-queues/

Thursday, August 14, 2014

URL not found: C:\Program Files (x86)\Android\android-studio\sdk\temp\support_r20.zip (Access is denied)

A work around is to run the SDK Manager as Administrator.  

When Android Studio is installed under C:\Program Files (x86)\Android\... by e.g. installing for all users it is unable to update the SDK.  The following errors are shown: 

Preparing to install archives
Downloading Android SDK Tools, revision 23.0.2
URL not found: C:\Program Files (x86)\Android\android-studio\sdk\temp\tools_r23.0.2-windows.zip (Access is denied)

https://www.overdrive.com/media/1532701/html5-and-css3-all-in-one-for-dummies page 220 sample not working

<!DOCTYPE html>
<html lang = "en-US">
<head>
<meta charset = "UTF-8">
<title> Gradient 220 </title>
<style type = "text/css">
#gradient {
border: grey 3px solid;
height: 200px;
width: 200px;
background-image: linear-gradient (left, red, white);
background-image: -moz-linear-gradient (left, red, white);
background-image: -webkit-linear-gradient (left, red, white);
}
p {
text-align: center;
}
</style>
</head>
<body>
<div id = "gradient">
<p> Box 1, gradient doesn't work. 220 </p>
</div>
</body>
</html>

CanIuse.Com

links to different tech

Found this on a website

asp.net:
http://www.dotnetfox.com/articles/how-to-add-edit-delete-update-records-in-grid-view-Asp-Net-1003.aspx

http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/

http://www.aspsnippets.com/Articles/DataBinding-DropDownList-Label-and-Textbox-Controls-in-ASP.Net.aspx

http://www.cramerz.com/aspdotnet

http://www.slideshare.net/mannysiddiqui/Advanced-ASPNET-Concepts-and-Constructs

http://msdn.microsoft.com/en-us/library/az24scfc.aspx

http://www.aspsnippets.com/Articles/How-to-bind-GridView-with-DataReader-in-ASPNet-using-C-and-VBNet.aspx

http://www.aspdotnet-suresh.com/2012/10/aspnet-difference-between-datareader.html

http://www.microsoft.com/web/post/adding-video-to-your-website-using-the-new-html5-video-tag

http://www.homewebsitebuilder.com/admin/site/niche

http://www.tutorialspoint.com/asp.net/asp.net_multi_views.htm

http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html

http://www.aspsnippets.com/Articles/Simple-Insert-Select-Edit-Update-and-Delete-in-ASPNet-GridView-control.aspx

http://www.aspdotnet-suresh.com/2011/12/how-to-create-simple-login-form-using.html


c#.net:

http://www.c-sharpcorner.com/1/75/asp-net-controls.aspx

http://www.c-sharpcorner.com/UploadFile/sapnabeniwal/a-glimpse-to-image-slideshow-using-jquery/

http://www.c-sharpcorner.com/UserRegistration/UserRegistration.aspx?check=r&ReturnURL=/uploadfile/sapnabeniwal/a-glimpse-to-image-slideshow-using-jquery/

http://samples.gaiaware.net/Combinations/WebApps/Chess/

http://www.dotnetpools.com/Article/ArticleDetiail/?articleId=183

http://www.tutorialspoint.com/csharp/csharp_overview.htm

http://www.c-sharpcorner.com/UploadFile/b8d90a/send-sms-using-C-Sharp-net/

http://forums.asp.net/t/1883175.aspx/1

http://social.msdn.microsoft.com/Search/en-US?query=sms%20senting%20method%20asp.net&emptyWatermark=true&ac=6

file related
http://go.microsoft.com/FwLink/p/?LinkID=303856
http://go.microsoft.com/FwLink/p/?LinkID=303859
http://go.microsoft.com/FwLink/p/?LinkID=303863
http://go.microsoft.com/FwLink/p/?LinkID=303861

http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDsQFjAA&url=http%3A%2F%2Fsourceforge.net%2Fdirectory%2Fbusiness-enterprise%2Fenterprise%2Fmedhealth%2F&ei=qGvmUoPWJcWNrgfUtYHIDQ&usg=AFQjCNE1mbxdpBcX7qYaBVokbUtxpOxO3g&cad=rja


http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&ved=0CFQQFjAE&url=http%3A%2F%2Fmastersinhealthinformatics.com%2F2009%2F25-open-source-software-projects-that-are-changing-healthcare%2F&ei=qGvmUoPWJcWNrgfUtYHIDQ&usg=AFQjCNEFLVbn2_l2eTlmgD4P8_O1iAkGCA&cad=rja

http://www.1000projects.org/sr1p/dn17p/he-in-ma.zip


http://www.1000projects.org/sr1p/dn17p/he-in-ma.zip


http://www.ondd.org/the-top-100-open-source-software-tools-for-medical-professionals/


sql

http://programmers.stackexchange.com/questions/181651/are-these-sql-concepts-for-beginners-intermediate-or-advanced-developers

http://www.gplivna.eu/papers/sql_join_types.htm

http://developers.cartodb.com/tutorials/joining_data.html

webservice:http://www.aspdotnet-suresh.com/2011/05/aspnet-web-service-or-creating-and.html

http://www.aeiucm.com/index.php/erp-system/payroll-system

http://www.finetechcode.com/upload-and-free-download-php-source-code-php-projects/

http://visuallightbox.com/visuallightbox-mac-setup.zip?affiliateid=WPG731GH

http://www.kannel.org/download.shtml#devel

http://www.developershome.com/sms/sms_tutorial.asp?page=smsGateway

http://www.clickatell.com/

http://www.ozekisms.com/index.php?owpn=230


wpf&wcf:

http://tnvbalaji.com/articles/wcf-tutorials/

http://www.codeproject.com/Tips/468354/WCF-Example-for-Inserting-Deleting-and-Displaying

http://www.codeproject.com/Articles/99330/WPF-Step-by-Step-Getting-Started-with-WPF-and-Expr

http://www.aspdotnet-suresh.com/2012/10/c-difference-between-aspnet-webservice.html

jquery url:

http://jqueryui.com/effect/

http://www.slidesjs.com/

http://bxslider.com/examples

http://www.htmlgoodies.com/tutorials/forms/article.php/3895776/HTML-Forms-jQuery-Basics---Getting-Started.htm

http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/

http://msdn.microsoft.com/en-us/library/bb386416%28v=vs.100%29.aspx

http://msdn.microsoft.com/en-us/library/x8k61whf%28v=vs.100%29.aspx

http://gregfranko.com/jquery.selectBoxIt.js/#Examples

http://www.cssbasics.com/css-classes/


menu

http://jqueryui.com/menu/#default and apycom.com

Design

http://www.subcide.com/articles/creating-a-css-layout-from-scratch/

wizard

ttp://www.codeproject.com/Articles/15804/ASP-NET-2-0-Wizard-Control

calender holiday

http://www.c-sharpcorner.com/uploadfile/puranindia/calendar-control-in-Asp-Net/

tutorial

http://www.java2s.com/Tutorial/CSharp/CatalogCSharp.htm

ajax asp.net

http://www.programcall.com/7/aspnet/binding-dropdownlist-with-dataset-values-in-aspnet.aspx

http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/

storedprocedure

http://www.mssqltips.com/sqlservertutorial/164/using-try-catch-in-sql-server-stored-procedures/

nth max salary

http://www.programmerinterview.com/index.php/database-sql/find-nth-highest-salary-sql/

hosting

http://www.dotnetfunda.com/articles/article1247-how-to-host-aspnet-application-on-the-web-server-iis.aspx


js slider

http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/#prettyPhoto

solutions

http://www.dotnetspider.com/resources/Category518-ASP.NET-GridView.aspx

Excel
>http://www.codeproject.com/Articles/16210/Excel-Reader

>http://www.smartxls.com/download.htm\

mobile find location:
http://msdn.microsoft.com/en-us/magazine/hh852592.aspx

js:
http://bxslider.com/examples/auto-show-start-stop-controls

jscript validation

http://webcheatsheet.com/javascript/form_validation.php

http://www.w3resource.com/javascript/form/javascript-sample-registration-form-validation.php

http://www.tizag.com/javascriptT/javascriptform.php

sql:
http://www.1keydata.com/sql/inline-view.html

http://www.tutorialspoint.com/sql/sql-rdbms-concepts.htm

http://programmers.stackexchange.com/questions/181651/are-these-sql-concepts-for-beginners-intermediate-or-advanced-developers
image slide show using jquery

http://www.c-sharpcorner.com/UserRegistration/UserRegistration.aspx?check=r&ReturnURL=/uploadfile/sapnabeniwal/a-glimpse-to-image-slideshow

http://www.aspdotnet-suresh.com/2011/04/ajax-accordion-control-example-or-how.html


http://www.w3resource.com/javascript/form/javascript-field-level-form-validation.php

http://www.mywebsite123.com/


http://www.aspdotnet-suresh.com/2013/04/8-jquery-popup-window-plugin-examples.html

jqueryslidertemplates

http://wowslider.com/rq/own-template-beautiful-jquery-slider-1e.html

http://wowslider.com/best-jquery-slider-crystal-linear-demo.html

http://cube3x.com/2013/08/30-free-jquery-slider-plugins/


http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html

Xcode for iphones apps
1.https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html

2.http://www.appcoda.com/improve-detail-view-controller-storyboard-segue/

basic web service in codeproject

ado.net :

*dataset
*datatable
*datarow
*datacolumn
***********
*sqldataadapter
*sqldatareader
*sqlcommand
************
*executereader
*executenonquery
*executescalar
**********************
http://www.dotnetspider.com/projects/category2.aspx

http://wowslider.com/download/wowslider-win-setup.zip?utm_source=free_downl_win&utm_medium=email&utm_campaign=wow_downl_link

http://www.freshdesignweb.com/jquery-login-registration-contact-form.html

http://demos.devexpress.com/MVCxGridViewDemos/DataBinding/DataBinding

http://w3layouts.com/healthy-mobile-website-template

http://www.webcodeexpert.com/2013/08/create-registration-form-and-send.html#.UyGOqD-Sxr0 conformation email

http://www.aspdotnet-suresh.com/2012/10/aspnet-difference-between-datareader.html




http://visuallightbox.com/visuallightbox-mac-setup.zip?affiliateid=WPG731GH

http://www.c-sharpcorner.com/UploadFile/sapnabeniwal/a-glimpse-to-image-slideshow-using-jquery/

http://www.c-sharpcorner.com/UserRegistration/UserRegistration.aspx?check=r&ReturnURL=/uploadfile/sapnabeniwal/a-glimpse-to-image-slideshow-using-jquery/


http://www.microsoft.com/web/post/adding-video-to-your-website-using-the-new-html5-video-tag



http://www.homewebsitebuilder.com/admin/site/niche


http://www.filesmix.com/item/live-demo/3127 LOGIN TEMPLATE


http://www.templatemo.com/

http://streetsmash.com/admin-templates/

http://bootsnipp.com/?page=4

Dynamic cloud widgets animation
http://www.dotnettips4u.com/2013/03/registering-in-web-site.html
http://www.goat1000.com/tagcanvas.php
http://www.portnine.com/bootstrap-themes

c#.net add webmethod important:
http://www.mikesdotnetting.com/Article/104/Many-ways-to-communicate-with-your-database-using-jQuery-AJAX-and-ASP.NET
http://www.citehr.com/318322-payroll-excel-sheet.html

http://www.c-sharpcorner.com/Blogs/12509/difference-between-datareader-dataset-dataadapter-and-data.aspx[^]

Tuesday, August 12, 2014

codeshow for HTML5 CSS

http://codeshow.codeplex.com/

TFS check in other users check in

http://stackoverflow.com/questions/1690351/how-to-undo-another-users-checkout-in-tfs-via-the-gui


I like the one solution below:

I just had this problem myself and found an easier way to clean up old workspaces.
1) In visual studio, open source control explorer.
2) From the 'Workspace' dropdown select 'Workspaces...'
3) A dialog will appear showing the workspaces on your current PC. Select 'Show remote workspaces'
4) You will now also see workspaces from your previous PC (as long as they are from the same user account). Select the old workspace(s) and click 'Remove'. This should delete the old workspace from from TFS along with any persisting checkouts.

TFS power tools

http://visualstudiogallery.msdn.microsoft.com/f017b10c-02b4-4d6d-9845-58a06545627f

streak for Gmail

http://www.streak.com/

TFS delete team project

TFSDeleteProject /force /collection:http://tfsserver:8080/tfs/collection TeamprojectName

Microsoft TypeScript, WinJS, WinMD

Friday, August 8, 2014

Json2.js

Fiddler

Fiddler2

Local. To trick it.

How to find IP device static IP address if unknown

Download wireshark, and start monitor the IP traffic and turn off/on IP device,  then it will start broadcast  and you can see the IP address


below is a ARP, 10.199.91.103 is the IP address

89 108.722425000 DelphiDi_02:cb Broadcast ARP 60 Gratuitous ARP for 10.199.91.103 (Request)

Flip board

http://openaphid.github.io/blog/2012/05/21/how-to-implement-flipboard-animation-on-android/

Thursday, August 7, 2014

Visual studio connect to TFS git repository

http://stackoverflow.com/questions/16835212/connect-to-tfs-git-repository







ASP web API tracing

http://www.asp.net/web-api/overview/testing-and-debugging/tracing-in-aspnet-web-api
make sure install
Install-Package Microsoft.AspNet.WebApi.Tracing
Update-Package Microsoft.AspNet.WebApi.WebHost


http://www.codeguru.com/csharp/.net/using-tracing-in-asp.net-web-api.htm


Microsoft MSDN sample code

http://code.msdn.microsoft.com/

asp.net tutorials

http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/introduction-and-overview

Goolge play noom Google fit api

google cloud save

Google developers console
cloud save
cloud debugging
cloud tracing
cloud alert
cloud monitoring

cloud dataflow

appurify

Wednesday, August 6, 2014

Windows Azure deploy web service from Visual Studio 2013

you download the profile from Azure website management

From VS project, do publish and select Windows Azure, then import the profile. Then publish. it is pretty straight forward.

When changing the web service client. you need to update to Web reference/service reference to bring in the new methods.





send file to windows Azure website

http://blogs.msdn.com/b/avkashchauhan/archive/2012/06/19/windows-azure-website-uploading-downloading-files-over-ftp-and-collecting-diagnostics-logs.aspx

file transfer using ASP.net

http://blogs.msdn.com/b/codefx/archive/2012/02/23/more-about-rest-file-upload-download-service-with-asp-net-web-api-and-windows-phone-background-file-transfer.aspx


http://apps.microsoft.com/windows/en-us/app/sample-browser/6fd83c79-a2fc-4887-9284-535681eb3993

Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.



http://forums.asp.net/t/1491204.aspx?Unrecognized+attribute+targetFramework+

Tuesday, August 5, 2014

Android web view

http://pavantilak.blogspot.com/2012/02/code-to-display-pdftextdocdocxdoc.html

http://stackoverflow.com/questions/14670638/webview-load-website-when-online-load-local-file-when-offline

http://stackoverflow.com/questions/8911666/storing-a-webview-for-offline-browsing-android

http://alex.tapmania.org/2010/11/html5-cache-android-webview.html

WebView webView = new WebView( context );
webView.getSettings().setAppCacheMaxSize( 5 * 1024 * 1024 ); // 5MB
webView.getSettings().setAppCachePath( getApplicationContext().getCacheDir().getAbsolutePath() );
webView.getSettings().setAllowFileAccess( true );
webView.getSettings().setAppCacheEnabled( true );
webView.getSettings().setJavaScriptEnabled( true );
webView.getSettings().setCacheMode( WebSettings.LOAD_DEFAULT ); // load online by default

if ( !isNetworkAvailable() ) { // loading offline
    webView.getSettings().setCacheMode( WebSettings.LOAD_CACHE_ELSE_NETWORK );
}

webView.loadUrl( "http://www.google.com" );
The method isNetworkAvailable() checks for an active network connection:
private boolean isNetworkAvailable() {
    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService( CONNECTIVITY_SERVICE );
    NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
    return activeNetworkInfo != null;
}
Finally, don't forget to add the following three permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Hello, First of all, thank you for the very useful answer. I am very grateful but I just give you a small piece of code that make my app work perfectly. Because the function isNetworkAvailable that you posted here seems to not work for me.
private boolean isNetworkAvailable() {
  boolean isConnected = false;
  ConnectivityManager check = (ConnectivityManager)        
  this.getSystemService(Context.CONNECTIVITY_SERVICE);
  if (check != null){ 
    NetworkInfo[] info = check.getAllNetworkInfo();
    if (info != null){
     for (int i = 0; i <info.length; i++){
       if (info[i].getState() == NetworkInfo.State.CONNECTED){
         isConnected = true;
       }
    }
    return isConnected;
  }