jQuery based Resource Localization

Create client side (JavaScript) based Resource Localization in any web application. Extremely light-weight library, just 3KB (Minified) and 8KB(Debug) version.

Implementing client side localization into any web application is always challenge. Most of web technologies provide localization using server-side technologies. For e.g. .Net application uses Resources Files(.resx) to implement localization into globalization application.

Nowadays world is extensively moving towards Asynchronous development models like AJAX / SPA. Several frameworks, libraries are already available on the web. To access these server side resources requires custom REST services / handlers to be additionally implemented into the host application.

This plugin makes life easier where you can manage all your localized resources into plain Text or JavaScript file. Based on current culture provided to this plugin, it loads associated resource entries for use. To enhance performance it Cache data for subsequent Initialization calls. So now no more server side development required for managing localization. It can be used in any web applications like SharePoint On-Premise / Online, Php, ASP.Net MVC, JAVA and many more as long as these technologies supports JavaScript.

Download Pugin from Github Github.

Install via Nuget Package.

JQuery Culture Information Plugin

Accessing Culture Information for all available cultures in JavaScript is always difficult and most of the web developer has to search on internet for this information. There may be several options available to fetch this information into Server-side technologies like ASP.Net, JAVA, PHP, and etc. But in JavaScript it is very difficult to find this information at one place.

To solve this problem, I have created small jQuery plugin which will give you this information at one place. You can search for Culture information by LCID (for e.g. 1033) or by Culture Name (for e.g. en-US), which will return you JSON Object. This plugin can be used in any of your favorite application which supports JavaScript.

  1. Refer to the Github Project JQuery Culture Information Plugin
  2. Install via the NuGet Package Install-Package PritamBaldota.JqueryCultureInfo

Sharing is Caring ūüôā

Free MP3 Downloader

Downloading MP3 songs is always difficult and one has to search several blogs to do this activity. Still we have limitation of time to search and download songs.

I have created small tool for my Wife¬†so she ¬†doesn’t need to worry about searching songs to play when offline. Sharing the same tool for your use. This is beta and still some enhancements required. Please drop your comments so I can improve it in next release.

Click Free MP3 Downloader to Download the tool.

On Install click Yes to download album list from server. It will take few sections to show all albums. On subsequent use it will not download list. You can refresh list on demand. Once list is downloaded you can search whatever album you want. Check the album(s) you would like to download. Set the target folder and Click Start Download in background.

mp3-downloader

Associate Custom Content Type with SharePoint 2010/2013 List Or Library using PowerShell

To automate deployment in SharePoint 2010/2013 on-premise solution, we have to use PowerShell. One of the deployment activity is creating SharePoint Custom Lists/Libraries and associating them with custom created content types. In this article we will be focusing only how to add/remove content types from the List/Library.

To add content type follow below steps –

  • Get Reference to Site collection and root web to get the content types.

[shell]

$siteRef = Get-SPSite http://domain/site
$rootWebRef = $siteRef.RootWeb

[/shell]

  • Get the target web reference to which content type will be added for List/Library.

[shell]
$web = Get-SPWeb http://domain/site/web
[/shell]

  • Get the reference to target list / library

[shell]
$listRef = $web.Lists[“List Title”]
[/shell]

  • Enable the management of content type for this list/library.

[shell]

$listRef.ContentTypesEnabled  = $true
$listRef.Update()

[/shell]

  • Get the deployed Content Type¬†reference from root web which will be added to the target list.

[shell]
$targetContentType= $rootWebRef.ContentTypes[“CustomContentType”]
[/shell]

  • Check if Content is already exists from ContentTypes collection of a List. If not found then add the content type to the list.

[shell]
$contentTypeExist = $listRef.ContentTypes[$contentType.Name]
if($contentTypeExist -ne $null)
{
$listRef.ContentTypes.Add($targetContentType)
$listRef.Update()
}
[/shell]

To delete content type follow below steps –

To delete content type association from list, we have to get the reference of associated content type and pass the Id of content type to Delete method on ContentTypes collection.

[shell]

$contentTypeExist = $listRef.ContentTypes[$contentType.Name]

$listRef.ContentTypes.Delete($contentTypeExist.Id)

[/shell]

This is how the complete code will look like –

[shell]

$siteRef = Get-SPSite http://domain/site
$rootWebRef = $siteRef.RootWeb
$web = Get-SPWeb http://domain/site/web

$listRef = $web.Lists[“List Title”]
if ($listRef -ne $null)
{
$listRef.ContentTypesEnabled  = $true
$listRef.Update()
$targetContentType = $rootWebRef.ContentTypes[$contentType.Name]
if($targetContentType -ne $null)
{
$contentTypeExist = $listRef.ContentTypes[$contentType.Name]
if($contentTypeExist -ne $null)
{
Write-Host “Adding Content Type – ” $targetContentType.Name -ForegroundColor Green
$listRef.ContentTypes.Add($targetContentType)
}
else
{
Write-Host ”¬† Content Type already exists – ” $targetContentType.Name -ForegroundColor Green
}
}
$listRef.Update()
}

[/shell]

Happy Coding ūüôā