How to customize Facebook Like Box ?

The Like Box is a special version of the Like Button designed only for Facebook Pages. It allows admins to promote their Pages and embed a simple feed of content from a Page into other sites.

facebook-like-box-customized

Below is the code used to get this done, here a jsfiddle for it.

<style>
#fb-root {
    background: #f9faff;
    border: 1px solid #031f34;
    width: 293px;
    height: 155px;
    position: absolute;
    padding: 5px 8px 0px 0;
}
</style>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=442901809147985";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like-box" style="overflow:hidden;height: 150px;" data-href="http://www.facebook.com/FacebookDevelopers" data-height="214" data-colorscheme="light" data-show-faces="true" data-header="false" data-stream="false" data-show-border="false"></div>

Hope this helps.

Domainz.in Hosting Review – Best affordable indian hosting

This review is based on my personal experience of hosting with Domainz.in, I have been hosting a couple of domains with Domainz.in, all of which have been on Linux servers.

Price
When it comes to price, NOBODY can beat the deal provided by Domainz.in, I have been using the Developer plan on all of my websites and haven’t experienced any problem on any of the sites yet. Below is a price chart of the different plans and their prices provided by Domainz.in

domainz plans

Features:
All standard features are present at Domainz.in like PHP 5, Ruby on Rails, MySQL Databases, CGI, Web Mail, Fantastico, Custom Error Pages and more…

Whats Good ? Whats Bad ?
Bad : What seems to be missing for domainz.in is the online web support.
Good : Though I would like to add that the helpline number was always accessible. Since the hosting company is from India, Punjab; and I am from Mumbai I didn’t have any trouble calling them up for any small query/doubt I had which they would be very happy to resolve. (Let me add that I did call up once with a very silly doubt regarding my Cpanel login details, which they were very patient to hear me out and they did help me).
When your domains brought from Domainz.in are to expire they will give you a call two time – one a month before expiring and other just days before it does, something again I liked.

So overall rating for Domainz.in
Feature – 9/10
Value for money – 10/10
Support – 8/10
Uptime – 9/10

How to add additional fields when using Membership in ASP.NET MVC 4

1. Modify your UserProfile class

Here in this example I am adding a new field called “MobileNumber“, have declared it as type string.

[Table("UserProfiles")]
public class UserProfiles
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int UserId { get; set;}
    public string Email { get; set;}
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string MobileNumber { get; set; }
}

2. Add the additional property(ies) to your RegisterModel.cs

Add the new property in your Model. In this example where we want an extra field while user registration we need to update the RegisterModel class. Add validations if need be.

public class RegisterModel
{
    [Required]
    [Display(Name = "Email")]
    [DataType(DataType.EmailAddress)]
    public string Email { get; set; }

    [Required]
    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Required]
    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 2)]
    [Display(Name = "First Name")]
    public string FirstName { get; set; }

    [Required]
    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 2)]
    [Display(Name = "Last Name")]
    public string LastName { get; set; }

    [Required]
    [StringLength(11, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 11)]
    [Display(Name = "Mobile No.")]
    public string MobileNumber { get; set; }

}   

3. Display additional fields on your View

Once you have update the Model you should be able to use the @Html.TextBoxFor(m => m.MobileNumber) in your view, which will bind the MobileNumber field to your ‘MobileNumber’ property declared in your model.

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary()

    @Html.LabelFor(m = m.Email)
    @Html.TextBoxFor(m => m.Email)

    @Html.LabelFor(m => m.Password)
    @Html.PasswordFor(m => m.Password)

    @Html.LabelFor(m => m.FirstName)
    @Html.TextBoxFor(m => m.FirstName)

    @Html.LabelFor(m => m.LastName)
    @Html.TextBoxFor(m => m.LastName)

    @Html.LabelFor(m => m.MobileNumber)
    @Html.TextBoxFor(m => m.MobileNumber)

    <input type="submit" value="Register">
}

4. Update your Controller – (AccountController in this case)

Last step, here you just need to read the value posted to your model and pass it along the repository for saving.

[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Register(RegisterModel model)
{
    if (ModelState.IsValid)
    {
        // Attempt to register the user
        try
        {
            WebSecurity.CreateUserAndAccount(model.Email, model.Password,
                                             new
                                                 {
                                                     FirstName = model.FirstName,
                                                     LastName = model.LastName,
                                                     MobileNumber = model.MobileNumber
                                                 });
            WebSecurity.Login(model.Email, model.Password);
            return RedirectToAction("Index", "Home");
        }
        catch (MembershipCreateUserException e)
        {
            ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
        }
    }

    // If we got this far, something failed, redisplay form
    return View(model);
}