Smart TV with ownCloud

Whenever you want to watch a movie, its troublesome to copy that to a USB and plug into your smart TV. Specially if its several Gigabytes of data.

A workaround is to created your OwnCloud server at home and copy all movies to one centralised place. Then go to Internet in Smart TV app and click on the movie. This works with mp4 formats. File with extension MOV doesnt work.

owncloud.png

 

 

Advertisements
Posted in Uncategorized | Leave a comment

Zero carbon emission for one month

 

My ride to office (and back home) captured in a phone camera. No parking fees, fines, fuel costs and 15 minutes exercise on the way to office.

Posted in Uncategorized | Leave a comment

Access .NET MVC model property in javascript

This looks to me very useful as it converts and entire server object in to a javascript accessible object.

var yourComplexObject = @Html.Raw(Json.Encode(Model.YourComplexObject));

Add this inside <script> tags when loading the view.

Posted in Uncategorized | Leave a comment

Display a user‚Äôs Full Name instead of User.Identity.Name – .NET MVC with AD

A simple article on how to get first Name and last name from Active Directory,

Click here to view the article

One thing is missing in this tutorial is to add the assembly to Web Config file. You have to add the following code ,

<add assembly="System.DirectoryServices.AccountManagement" />

Also I had the version 4.0.0.0 and for some reason it didnt work if I add the correct version within above.

 

Posted in Uncategorized | Leave a comment

Call Java Class static methods from javascript.

This may be a useful tip if you want to call a Java class static methods from javascript.

The syntax is ,

Packages.<package>.<class>.<method>

Make sure jar files loaded and if there are any variables, pass it as javascript array.

var args = [ <param1>, <param2>……. ]

ūüôā

 

Posted in Uncategorized | Leave a comment

Wireless and Powerline adapter speed.

Yes, its noticeable. Compare the results below.

WiFi

Screen Shot 2017-09-11 at 9.17.43 pm

With Tp-link powerline adapter

Screen Shot 2017-09-11 at 9.16.35 pm

If you have a NAS at home, and dont have an ethernet connection use powerline adapter. In my case 1 GB file was transferred with 2 min and 15 sec.

Posted in Uncategorized | Leave a comment

Integrate LDAP to ASP.NET Web Application

With VS 2017 its very simple, follow the steps.

  1. Create ASP.NET web appcreate_proj.PNG
  2. Select authentication with “Individual User Accounts”create_proj_2.PNG
  3. Change AccountController as below,
  4. [AllowAnonymous]
    [HttpGet]
    public ActionResult Login()
    {
    return View();
    }

    [AllowAnonymous]
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
    {
    if (ModelState.IsValid)
    {
    if (Membership.ValidateUser(model.Email, model.Password))
    {
    FormsAuthentication.SetAuthCookie(model.Email,                   model.RememberMe);
    return RedirectToAction(“Index”, “Home”);
    }
    else
    {
    ModelState.AddModelError(“”, “The user name or password provided is incorrect”);
    }
    }
    model.Password, model.RememberMe, shouldLockout: false);

    return RedirectToLocal(returnUrl);
    }

    private ActionResult RedirectToLocal(string returnUrl)
    {
    if (Url.IsLocalUrl(returnUrl))
    {
    return Redirect(returnUrl);
    }
    return RedirectToAction(“Index”, “Home”);
    }

    public ActionResult LogOff()
    {
    FormsAuthentication.SignOut();

    return RedirectToAction(“Index”, “Home”);
    }

  5. Most important port is configuring the WebConfig file for AD connection
  6. Make sure the Forms Authentication module is available
  7. <modules><modules> <remove name=”FormsAuthentication” /> <add name=”FormsAuthentication” type=”System.Web.Security.FormsAuthenticationModule” /> <remove name=”ApplicationInsightsWebTracking” /> <add name=”ApplicationInsightsWebTracking” type=”Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web” preCondition=”managedHandler” /> </modules>

  8. Add connection string as below,
  9. <connectionStrings><connectionStrings> <add name=”ADConnectionString” connectionString=”LDAP://<your AD server>” /> </connectionStrings>

  10. Authentication mode and membership as blelow,
  11. <authentication mode=”Forms”><authentication mode=”Forms”> <forms name=”.ADAuthCookie” loginUrl=”~/Account/Login” timeout=”45″ ¬†slidingExpiration=”false” protection=”All” /> </authentication> <membership defaultProvider=”MyADMembershipProvider”> <providers> <add name=”MyADMembershipProvider” type=”System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” connectionStringName=”ADConnectionString” connectionUsername=”<AD username>” ¬† connectionPassword=”<ADUserPassword>” ¬†attributeMapUsername=”<value as below 12>” /> </providers> </membership>

12. “attributeMapUsername” can either be “distinguisedName” or “sAMAccountName”

13. That’s all !

Posted in Uncategorized | Leave a comment