Tuesday, November 29, 2011

Google App Engine-Memcache

Memory cache is used in web applications to speed up the performance by caching frequently used entities. Memcache may also be useful for caching temporary values, not backed up persistent store. The app can provide an expiration time when a value is stored. By default, the values get evicted due to memory pressure, and the least recently used get evicted first. Applications should put logic to retrieve data on cache misses.

e.g.

1>        Getting App Engine's Memory Cache Service

      private static MemcacheService keycache = 
      MemcacheServiceFactory.getMemcacheService(); 
 

2>    Deleting Cache

      keycache.delete(key);
 
3>    Search for an entity
 
      return (Entity) keycache.get(key); 
 
4>    Add to cache
 
      keycache.put(key, entity); 
 
 

 

Deploying Google Apps Application

Step1: Register your application name at: https://appengine.google.com/

Step2:Modify appengine-web.xml For matching your application name  (war Folder>>WEB-INF Folder>>appengine-web.xml).

e.g.:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">

    <application>Your application name</application>
     ..
     .. 
</appengine-web-app>

Step3: Finally to deploy your application: click the App Engine deploy button on the toolbar in Eclise: The App Engine deploy button.

Friday, November 25, 2011

Google App Engine - A Quick Start

Google App Engine lets you run web applications on Google's infrastructure.

With App Engine's Java runtime environment, applications can be build with standard Java technologies, including the JVM, Java servlets, and the Java programming language.

Google App Engine includes the following features:
• Dynamic web serving, with full support for common web technologies
• Persistent storage with queries, sorting and transactions
• Automatic scaling and load balancing
• APIs for authenticating users and sending email using Google Accounts
• A fully featured local development environment that simulates Google App Engine on your computer
• Task queues for performing work outside of the scope of a web request
• Scheduled tasks for triggering events at specified times and regular intervals

Prerequisites:
Java Development Kit (JDK):
Google App Engine supports both Java 5 or Java 6 however Java 6 is preferred.
Download and install the "Java SE Development Kit" by this link http://tinyurl.com/25ldqvf

Follow these steps for configuring Google App Engine & installing eclipse:

STEP1:
Download and Install Eclipse IDE
Download Eclipse Indigo
Download Link:http://tinyurl.com/2fg85q4

STEP2:
Configure Google Plug-in for Eclipse
Install Google Plug-in for Eclipse and follow instructions given at : http://tinyurl.com/cd2okbe


STEP4:
File --> New Project --> Google --> Web Application Project

You Are Ready To GO!

*reference google apps website

Thursday, November 24, 2011

Enabling PHP on IIS 5.1 or higher

Install PHP from www.php.iis.net
In IIS
Open properties of default website
  1. Select the HOME directory and click configuration button
  2. Click Add on mapping tab (browse to C:\Windows32\inetserv\fcgiext.dll. Enter .php in Extension input box. Set limits to "GET, HEAD, POST".  
  3. Restart IIS.

Enabling Report Viewer in ASP.net

STEP 1:Copy following files in bin folder of your application:   
    Microsoft.ReportViewer.Common.dll
    Microsoft.ReportViewer.WebForms.dll
    Microsoft.ReportViewer.ProcessingObjectModel.dll
  

STEP 2: Add following enteries in web.config:

<add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

STEP 3: In IIS 7, we need to make sure to configure the ReportViewer handler.
You can follow these steps:

  • Open Internet Information Services (IIS) Manager and select your Web application.
  • Under IIS area, double-click on Handler Mappings icon.
  • At the Action pane on your right, click on Add Managed Handler.
  • At the Add Managed Handler dialog, enter the following:
    Request path: Reserved.ReportViewerWebControl.axd
    Type: Microsoft.Reporting.WebForms.HttpHandler
    Name: Reserved-ReportViewerWebControl-axd
  • Click OK.

Import Data From Excel Sheet To Mysql

Follow these steps to import data from excel to Mysql
Step1. Copy the content of excel file in a txt file. 
Step2. Create a temporary table in Mysql having same fields as in Excel file.
Step3. Run the following command on Mysql query browser

     LOAD DATA INFILE 'pathOfTxtFile' into table  tableName;

e.g.
Let you have to import the data from data.xls file. First copy the content in a txt  file (e.g. exldata.txt).
Now Create a table in Mysql (e.g. tmpTable) having same fields as in excel file.
Then use the command

LOAD DATA INFILE 'c:/exldata.txt' into table  tmpTable;

to import the data in Mysql Query Browser.

Report Viewer Error even after installing Report Viewer 2010 Distributable Package

Go to C:\WINDOWS\ASSEMBLY\GAC_MSIL On command line
Now use xcopy command to copy reportviewer dlls in bin folder of website build
e.g.

   " XCOPY /r Microsoft.ReportViewer.Common.dll
     TargetBinFolderPath"
   " XCOPY /r Microsoft.ReportViewer.WebForms.dll
     TargetBinFolderPath"
   " XCOPY /r Microsoft.ReportViewer.ProcessingObjectModel.dll
     TargetBinFolderPath"

Asp.NET Charting Controls

Download the free Microsoft Chart Controls

  • Download the VS 2008 Tool Support for the Chart Controls
  • Download the Microsoft Chart Controls Samples
  • Download the Microsoft Chart Controls Documentation
  • Visit the Microsoft Chart Control Forum 


  • Reference link:http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx
    Common Issue:
    MS Chart - System.Web.DataVisualization not found
    1. Follow this directory on windows explorer:
      C:\Program Files\Microsoft Chart Controls\Assemblies
    2. You will see 4 DLL files inside the folder. Two of those files are for Windows Applications and two of them for Web Applications. We need web application dll files so copy the dll files which are named 'System.Web.DataVisualization.Design' and 'System.Web.DataVisualization'
    3. Paste those dll files into the Bin folder on the root directory of your Web Application.
    4. Secondly, open the Web.Config file on the root directory of your web application.
    5. Find the <appSettings> node. You have a key add inside this just like below;

      <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />

      Replace this tag with the new one as below;

      <add key="ChartImageHandler" value="storage=file;timeout=20;"/>
      Save the changes on your Web.Config file and close it. Now copy the two dll inside the bin folder and replace the Web.Config file on your server with your new Web.Config file. 
      1. Reference Link:http://tinyurl.com/yl9kz95

      How to get Security Tab in XP Professional

      Go to windows explorer.

      Goto Tools >> Folder Options >> Veiw tab
      Uncheck 'Use simple file sharing"

      Error - Failed to Access IIS Meta Database

      Simply run the following from command line on comand prompt to reset the IIS registry settings for aspnet user.

       C:\WINDOWS\ Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

      Importing Excel Data in Asp.Net

      <%@ Page Language="C#" %>
      <%@ ImportNamespace="System.Data.OleDb" %>
      <%@ ImportNamespace="System.Data" %>
      <%@ Import Namespace="System" %>
      <scriptlanguage="C#" runat="server">
      protected void Page_Load(ObjectSrc, EventArgs E)
      {
      string strConn;
      strConn ="Provider=Microsoft.Jet.OLEDB.4.0;" +
      "DataSource=C:\\excel.xls;" +
      "Extended Properties=Excel 8.0;";
      //Youmust use the $ after the object you reference 

      // in the spreadsheet
      OleDbDataAdaptermyCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$]",strConn);

      DataSetmyDataSet = new DataSet();
      myCommand.Fill(myDataSet, "ExcelInfo");
      DataGrid1.DataSource= myDataSet.Tables["ExcelInfo"].DefaultView;
      DataGrid1.DataBind();
      }
      </script>
      <html>
      <head></head>
      <body>
      <p><asp:Labelid=Labelrunat="server">Spread  Sheet  Contents:</asp:Label></p>
      <aspataGridid=DataGrid runat="server"/>\
      </body>
      </html>

      Running Oracle SQL Scripts From Command Prompt

      EXAMPLE :
      <sample.bat>
      @echo off
      echo  SQLPlus running from a command line.....please wait....
      SQLPLUS  system/admin@xe @sample.sql

      <sample.sql>
       Select * from dual;

      Creating Web Site Setup Deployment Package using Visual Studio 2008

      • Download Visual Studio 2008 Web Deployment Projects.
      • In visual studio right click on website project and Select "Add web deployment project"
      • Add a new web setup project in the solution
      • Right click on web setup project in solution explorer. Select Add>>Project Output>>[Web deployment project]
      • Build the setup project.
      Install PHP from www.php.iis.net

      In IIS

      1. Open properties of default website

      2. Select the HOME directory and click configuration button

      3. Click Add on mapping tab (browse to C:\Windows32\inetserv\fcgiext.dll. Enter .php in Extension input box. Set limits to "GET, HEAD, POST".  

      4. Restart IIS.

      Friday, August 26, 2011

      ASP.NET Report Viewer Version 9.0 problem

      Solving Report Viewer Rendering Issue on IIS7

      Issues

      • Unable to render Report Viewer on ASP.NET Web pages while running on IIS7.
      • You have no problem viewing your reports when running on debug mode with your Visual Studio 2005.
      • You are able to view your reports on Report Manager but not able to view them on IIS7.
      • You encounter JavaScript error when loading your report page with Report Viewer. Image buttons such as calendar appear as red 'X'.
      Solution

      In the WebConfig File

      <buildProviders>
      <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </buildProviders>

      <httpHandlers>
      <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
      validate="false" />
      </httpHandlers>
      • Open Internet Information Services (IIS) Manager and select your Web application.
      • Under IIS area, double-click on Handler Mappings icon.
      • At the Action pane on your right, click on Add Managed Handler.
      • At the Add Managed Handler dialog, enter the following:
        Request path: Reserved.ReportViewerWebControl.axd
        Type: Microsoft.Reporting.WebForms.HttpHandler
        Name: Reserved-ReportViewerWebControl-axd
      • Click OK.
      Follow Link:http://otkfounder.blogspot.com/2007/11/solving-reportviewer-rendering-issue-on.html



      Friday, August 5, 2011

      Installation Guide for Android Development

      Step 1:
      Download and install the Java Development Kit (JDK). Download Windows 32-bit (x86) version or Windows 64-bit (x64) version .

      Step 2:
      Download and install the Android SDK.
      For complete details visit
      http://developer.android.com/sdk/installing.html
      NOTE: DO NOT install the android sdk in a directory on your computer that has spaces

      Step 3:
      Download and install an IDE for Java Developers. Eclipse IDE is the best one for windows, recommended by Android. You can download either "Eclipse IDE for Java EE Developers" or "Eclipse ISE for Java Developers". Java EE has got more features but a little more bigger in space, but that doesn't matter. Download Eclipse IDE for Java EE Developer: Windows 32-bit (x86) version or Windows 64-bit (x64)

      Step 4:
      After installing Eclipse, you'll need to download and install the "ADT plugin". To do this, open up Eclipse and go to Help > Install new software... Click on Add. For Name:, write ADT Plugin and for Location:, type https://dl-ssl.google.com/android/eclipse/. If that doesn't work, for Location:, type http://dl-ssl.google.com/android/eclipse/. Click OK .

      Step 5:
      After the ADT plugin is installed. you need to locate the Android SDK in Eclipse. To do this, go to Window > Prefrences and click on / highlight Android. Under SDK Location:, browse to your android sdk directory where you installed the sdk
      .
      Step 6:
      Create an AVD
      To create an AVD:
      In Eclipse, choose Window > Android SDK and AVD Manager.
      Select Virtual Devices in the left panel.
      Click New.
      The Create New AVD dialog appears.
      Type the name of the AVD, such as "my_avd".
      Choose a target. The target is the platform (that is, the version of the Android SDK, such as 2.1) you want to run on the emulator.
      You can ignore the rest of the fields for now.
      Click Create AVD.

      Step 7:
      Create a New Android Project

      After you've created an AVD, the next step is to start a new Android project in Eclipse.
      From Eclipse, select File > New > Project.
      If the ADT Plugin for Eclipse has been successfully installed, the resulting dialog should have a folder labeled "Android" which should contain "Android Project". (After you create one or more Android projects, an entry for "Android XML File" will also be available.)
      Select "Android Project" and click Next.
      http://developer.android.com/resources/tutorials/images/hello_world_0.png
      Fill in the project details with the following values:
      Project name: HelloAndroid
      Application name: Hello, Android
      Package name: com.example.helloandroid (or your own private namespace)
      Create Activity: HelloAndroid
      Click Finish.

      For complete installation procedure required and for making a sample android application visit the link http://developer.android.com/resources/tutorials/hello-world.html.

      3D Flash Tag cloud for blogengine.net

      Get the src from the link
      http://www.ugochirico.com/post/2010/file.axd?file=2010%2f9%2fFlashTagCloudBE.zip

      Installation
      Copy the folders in the zip in the root of you BlogEngine.NET installation.After that, you will see a new widget "Flash Tag Cloud" in the Widget Zone

      Issues
      If in the using section you see only using controls then you have to change it to
      using App_Code.Controls;

      In the FlashTagCloud.cs
      the namespace should be App_Code.Controls and not controls.

      Add namespace App_Code.Controls to flashtagcloud/edit.ascx.cs

      Adding Slide Share to the blogengine.net

      Add the embed src from the slide share to the raw html of the blogengine.net.

      Thursday, August 4, 2011

      Adding the Like Box Facebook Social Plugin

      Step 1: Create a new widget for Facebook Like Box social plugin.
      For creating a new widget
      Copy an existing widget (In this case calendar widget was copied)
      Changing the namespace and the name property in the cs file and changing the inherits in the ascx file will create the new widget.

      Step 2: After the new widget is created add the following src to the ascx page of the created widget

      Example Source:
      <iframe src="http://www.facebook.com/plugins/likebox.php?id=232510780120386&width=240&connections=10&stream=false&header=true&height=287" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:270px; height:287px;" allowTransparency="true"></iframe>

      The src could be obtained from facebook social plugin section.
      (http://developers.facebook.com/docs/plugins/)

      The id in the above src is the id of the page that is created in the facebook account that you want to link.
      The First width and height attributes are used to set the width and height of the plugin in the page.

      Step 3:
      Login as the administrator and add the widget to the page.

      Implementing Facebook Comment box with BlogEngine.net

      Step 1: Disable the built-in comment function
      Login as the administrator and disable the comment option.Click the comment link and uncheck the checkbox for enable comments.
      If you were using Disqus as your comment provider you should disable it too. The settings is at the bottom of the Comments setting page.


      Step 2: Adding the Facebook Comments plugin to your template
      The next thing you need to do is to add some code to your PostView.ascx.
      The PostView.ascx is for the current theme that is used for the blogengine.net.
      for eg:if the current theme is standard then the facebook comment plugin code should be put in the PostView.ascx of the standart theme.


      Example Code
      <h3>Comments</h3>
      <%if(this.Location == BlogEngine.Core.ServingLocation.SinglePost) { %>
      <div id="fb-root"></div>
      <script src="http://connect.facebook.net/en_US/all.js#appId=142835752451555&xfbml=1"></script>
      <fb:comments href="" num_posts="2" width="500"></fb:comments>
      <% } %>

      The source for the facebook comment box social plugin could be obtained from facebook.

      Reference: http://www.whatsupweb.net/post/2011/04/24/Implementing-Facebook-Comment-box-with-BlogEnginenet.aspx