Monday, April 14, 2014
JQuery Tips and Tricks #1–Simple Addition using JQuery
Sunday, April 13, 2014
ASP.Net Forums – FAQ #1 : How to enable Adsense in my site?
This is the most frequently asked question in ASP.Net Forums. As a Adsense user (struggled with google over 6 months I got my adsense approval), I’m going to explain how to enable adsense in your website regardless of technology (either you used ASP.Net or PHP or Java etc) which you are using to built your site.
I just want to tell one thing first there is no short cut to get your adsense approval from google. Go with the below guidelines:
Sunday, March 16, 2014
Daily Interview Question #7: Implicit and Explicit Implementation of Interface
This is the most common interview question for experienced professionals.
Normally an interface can be implemented in a class in a normal way which is a implicit implementation. Sometime, we may have same method name in different interfaces. If this is the case, we need to do explicit implementation of the interface method. The main use of explicit implementation is to avoid the ambiguities between the class or method name. In order, to do that the interface name put before that interface’s method.
Below example, shows the implicit and explicit implementation:
namespace ConsoleApplicationC
{
// 2 interfaces with same method name
interface IintegerAdd
{
void Add();
}
interface IfloatAdd
{
void Add();
void Multiply();
}// We implement Both interfaces
class ArithmeticOperation : IintegerAdd, IfloatAdd
{
// Implicit Implementation : There is no name collision so we can implement implicitly
// NOTE : public modifier MUST here
public void Multiply()
{
float a = 1.5f, b = 2.5f;
Console.WriteLine("Float Multiplication is:" + a * b);
}// Explicit Implementation : Explicitly tell the compiler that we implement the interface IintegerAdd
void IintegerAdd.Add()
{
int a = 10, b = 20;
Console.WriteLine("Integer Addition Is:" + (a + b));
}// Explicit Implementation : Explicitly tell the compiler that we implement the interface IfloatAdd
void IfloatAdd.Add()
{
float a = 1.5f, b = 2.5f;
Console.WriteLine("Float Addition Is:" + (a + b));
}
}
class Program
{
static void Main(string[] args)
{
ArithmeticOperation objA = new ArithmeticOperation();
IintegerAdd iobj = (IintegerAdd)objA;
iobj.Add();
IfloatAdd fobj = (IfloatAdd)objA;
fobj.Add();
Console.ReadKey();
}
}
}
Output :
Integer Addition Is:30
Float Addition Is:4
Tuesday, March 11, 2014
Visual Studio Tips & Tricks - 8: Breakpoint will not currently be hit. No symbols have been loaded for this project.
Most of the developers who are using Visual studio have encountered the above problem. As a ASP.Net Developer I have this atleast once a day. So the below are my tricks to get ride of this issue.
1) Just Close the VS IDE.
2) Go to Task Manager and kill the worker process. (If you are working on ASP.Net application).
3) Go to the .Net installation folder ( Normally it should be C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files OR C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files) and clear the temp files from the temporary folder.
4) Open the solution and "Rebuild" entire solution. Now try to attach the debugger.
Please note that, in some machines you may have 2 framework installation, one for 32-bit and another for 64-bit. So when you go with step 3, pay close attention and make sure which .net framework was used and also which version no (either 2,3,3.5 or 4) was used by your application.
Hope this helps!
Saturday, March 8, 2014
Using MSCaptcha
Recently, in one of my project I need a captcha for my application. Just a google search provides number of options. I need a open source solution, so I go with krisanov’s solution. I just download and try to using that on my project. However it doesn’t works fine. Just follow the instruction mention by mudasar in this url. But I have encountered several problems (that is it doesn’t display any captcha image) the when I added that into my project, which leads to write this post.
Below are the steps that I have followed:
1) Just download the captcha from the url.
2) Add the reference into the project by “Right Click on the Project –> Add Reference”.
3) After that you need to include the below lines into web.config file:
<system.web>
<httpHandlers>
<add verb="GET" path="CaptchaImage.aspx" type="WebControlCaptcha.CaptchaImageHandler, WebControlCaptcha"/>
</httpHandlers></system.web>
<location path="CaptchaImage.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
What previously done, I have missed out entire “location” element, which is also not mentioned in the mudasar’s tutorial. I have found this solution in this asp.net forum thread.
Hope this helps to someone!
- Learn By Experience: SMS Gateways
- ASP.Net Forums - FAQ #2 : ASP.Net Project Ideas
- ASP.Net Forums – FAQ #1 : How to enable Adsense in my site?
- Main components of .Net Framework
- ASP.Net Forums–FAQ #6: ASP.Net Session Expired Problem
- How to Send SMS From ASP.Net Web Application?
- Visual Studio Tips & Tricks: 2 – Create Virtual Directory Problem
- Visual Studio Tips & Tricks–10 : How to Change the color theme in Visual Studio 2015?
- CRUD Operation - ASP.Net MVC with ADO.Net
- .Net Architecture