Friday, April 11, 2014

ASP.NET tips: ASP.NET MVC4 OAuth Facebook Login

Today, I tried to add Facebook OAuth login feature into my ASP.NET MVC 4 application. Here is the step to add that feature: 
1. Open AuthConfig.cs that you can find in App_Start folder in your project.

2. Un-comment the Facebook client register code and insert yout application id and application secret as bellow:
   OAuthWebSecurity.RegisterFacebookClient( appId: "32499828342XXXX", appSecret: "3242kjsfudfsoirewXXXX");

3. And then run your application and go to http://yourmachine/Account/Login, you will find a button for login using your Facebook account. Try to press that button, if it is successful then you have configure your Facebook app correctly.

Common Error:

When you press Facebook button It will redirect and give this kind of  error message:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains

To resolve this problem you need to open you account and open your application go to Settings > Advanced, search for Valid OAuth redirect URIs field and insert http://yourmachine/ExternalLoginCallback, since you are using ASP.NET MVC4, or change to other callback url that you need.

That's it for today.. :D
Thank you.

Friday, December 13, 2013

Android Programming Tips : Error Unable to Execute Dex When Run a Project

Today I tried to download open source android project source code from the internet. I use Eclipse as my IDE and tried to import the project to Eclipse. Everything worked fine until I tried to execute and run this project. The IDE quickly told me that there is an error in my project and 2 line of error message in console log as bellow:

[2013-12-13 21:04:48 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2013-12-13 21:04:48 - xxxxxx] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.

But I couldn't find any error in the source code. So I thought this was a configuration error. And here were the way I solved it :

  1. Right click on your project.
  2. Select Android Tools -> Add Support Library
  3. There was a process running for a while, and then tried to run the project once more, and It worked well. Viola!!
Please comment if you find this tips useful. :D

Thursday, November 29, 2012

ASP.NET Tips : How To Give Easy Row Number to DataGridView or DataGrid

I find It very annoying when adding row number to a query result, espesially when you're working with different RDMS like Oracle or SQL Server. They have their own syntax for row numbering. But when you use that in a GridView or DataGrid, it will be a piece of cake. You can try using this technique in just like example :

<asp:TemplateColumn HeaderText="No.">
<asp:Label runat="server" ID="LabelNumber" 
Text="<%# Grid1.PageSize*Grid1.currentPageindex + Container.ItemIndex+1%>">

Add a new column for your Row number. And you will find Grid1 is the ID of your GridView or DataGrid.

Here's give it a try :)

Thursday, May 10, 2012

Bug Fixing & Trouble Shooting : Retrieving the COM class factory for component with CLSID Error

Hi guys... It's been a really long time since my last post. Today I'll write my bug fixing and trouble shooting experience :  Retrieving the COM class factory for component with CLSID {2F422F62-D11B-11D0-8384-00A0C92018F4} failed due to the following error: 80040154.

This error usually occur when we develop in different type of CPU processor and OS. I've developed a web based application in windows server 2003 32-bit and then I moved them into a Windows server 2008 64-bit. And when I was running the application that execute a method from a 32-bit dll, it always shows that error message. After several hours working and searching in google, I found that there is special setting in IIS that allows application pool to execute 32-Bit applications.

So the solution steps are :

  1. Press ctrl + run. (to open Run)
  2. Type inetmgr then press enter ( to Open IIS)
  3. Expand the server name tree and you'll find Applications Pool.
  4. In the right side of the view, choose the application pool that your application using.
  5. And in the most right panel there is an Advanced Settings under the Edit Application Pool group.
  6. There'll appear an Advanced Settings dialog, and change the Enable 32-Bit Application value into True.

And It worked well for my problem... :)

and if you find my post is useful, please share a comment. :)

See you next time.

Sunday, March 20, 2011

Announcement : After a long break

It's been a long time since my last post about 2 months ago. I had a very busy time because I had to prepare myself to move to a new city, to larger city than I was. I had no time to online for writing any post in the past two months.
From this time, I will regularly keep updating my blog and posting simple tips but useful in programming realm.

Sorry for the inconvenient... See you in the next post...

Tuesday, January 4, 2011

Javascript Tips : How to create a pop up window using javacript in a Button?

How to create a pop up window when someone click on a button?
Here's a simple code the way I made it..
============================ ==================================
    <title>How to create pop up window using java script in a Button</title>
    <script language="javascript" type="text/javascript">
        function popup()
            // change with your target URL
            popwindow ="");
            return false;
    <input type="submit" value="pop up" onclick="return popup()"/>

============================== ==================================
we create a javascript function that we called "popup()". The statement, accept url parameter.
and then to call the function we utilized the button's onclick event.

That's is my simple way to create a pop up function... if you find this post help you, please leave a comment bellow.

Thank you...

Wednesday, December 22, 2010

Basic Question : What is HTML?

If we talk about web, we could not forget about HTML. So, what is HTML?
HTML stands for Hyper Text Markup Language. It's the main markup language for the web pages.
HTML elements are consist of tags (a word surrounded by angle brackets < and >). The tags in HTML usually come in a pair (start/opening tag and end/closing tag) eg.: <html></html>, <b></b>, etc. HTML element also have properties that usually we called with attributes. For list of elements and elements attributes you can find it here or here.

Here's some of example of simple HTML document:
<!doctype html>
    <title>Hello HTML</title>
    <p>Hello World!</p>
I think that' is for today, I hope you'll find it helpful. 
Please leave a comment below
Thank you..