Posts

Best Practices: jQuery for SharePoint development

Rule 1

Set jQuery in no conflict state

This requires you to use jQuery instead of $
For example, write
jQuery("elementId").text("hello");
instead of
$("elementId").text("hello");


Rule 2

Use SharePoint's _spBodyOnLoadFunctionNames array instead of jQuery’s document ready function

SharePoint uses its own body onload function called _spBodyOnLoadFunctionNames which will collide with your document ready (run before or after).  If you are loading your JavaScript files through the elements.xml file (through a feature in Visual Studio), this can be particularly problematic with the order of how things load.


Instead, create a function with a custom name, and push the custom name into the _spBodyOnLoadFunctionNames array.  It’s wonderful and allows things to load in their proper order.

For example, write
_spBodyOnLoadFunctionNames.push("myCustomFunctionName");
function myCustomFunctionName() {
     // My custom functionality
}
instead of
$(document).…

CRUD operations on SharePoint list using AngularJS

Image
In this post, I am going to share some code snippets for performing CRUD operation on a SharePoint list using only client side script written with AngularJS.
It is a simple implementation, where I am going to create a web part, which will have reference to a controller that will read, create, update and delete list items.
I hope you are reading this post with some prior experience with SharePoint and AngularJS. The environment I am working upon is a SharePoint Online (Office 365) site.
I have created a Contacts list as in the below screenshot.

For this example, I will be using only 3 fields/columns in the list. ID (Auto generated for every item in the list) Last Name (Internal name: Title) First Name (Internal name: FirstName)
Create the webpart
I have added one Content Editor Webpart to a page and linked it to our view page [listItems.html].


The view page has 4 sections to view contacts, add, edit and delete them. For each of these operations, I have created 4 separate controllers. Below is th…

Blessed with 1080p 60fps gaming rig

Image
Honestly, nothing beats the satisfaction playing your favorite games, on a new rig, at 1080p 60fps.

The 1080p resolution is pretty standard in 2015, and has been sticking around for some time now. But the power and efficiency of new GPUs has increased exponentially. Now a days anyone can get a great gaming experience without breaking the bank.

I bought my first PC back in 2005, mostly built using cheap parts available in market. I was in college and budget was really an issue, especially in India, where you actually buy a PC to learn "coding" :P

It was not much, but did the job. Used to become hot like hell. Could dry my cloths during rainy days. Had two hard drives, both of them failed after 2 years of use, due to a bad power supply unit.

Later on I got a job, and I was moving from place to place, decided that a laptop will suffice my gaming crave. Spent 40K INR (~$600) on an Acer Aspire 5738G, with Core 2 Duo processor, 4GB memory and Ati Radeon 4570HD graphics card.

None…

The all new Movie Central

Image
Movie Central A free desktop personal movie collection manager Hi folks,

After a long time, I am glad to release the all new Movie Central desktop app for Windows.

All new fresh look, a new experience.The most fun way to manage your personal movie collection.Automatically scan your PC folders for movies, and add them to your collection.Movies can be played from the app itself.






Guided Tour

Download links

Project websitehttps://sourceforge.net/projects/moviecentral/ Contact mesidtechster@gmail.com https://twitter.com/@sidtechster https://www.facebook.com/MovieCentral2015




New Movie Central app in development....right now !!!

Image
Hello Folks,

After pretty long gap, I have started on development of a new version of Movie Central app. Here is a screenshot, nightly build.

And it will be kick-ass.

Set perfect wallpapers for Nexus 7

Image
I have a Google Nexus 7 2013 version. It's a hands down great device with a great display. I also love to change the wallpaper on the home screen regularly. Problem is I wasn't able to figure out the perfect wallpaper resolution for the device. I used 1080p photos but at the lock screen, a bit of the screen space is left out, which was annoying for me. So I found a simple solution. Rotate the device in landscape mode and then set the wallpaper from the "Settings" menu as you would normally do. Go back and lock the screen now and rotate it to portrait mode. The wallpaper should take up whole screen space.

PowerShell script to check user in Active Directory

Image
Here is a quick PowerShell script to check for user in present in Active Directory.

$user = "JohnDoe"
$searcher =  [ADSISearcher]"(sAMAccountName=$user)"
$results =  $Searcher.FindOne()
If ($results -eq $Null) 
    {"User does not exists"}
Else 
    {"User Exists"}


Same can be done using the user email

$email = "JohnDoe@company.com"
$searcher =  [ADSISearcher]"(mail=$email)"
$results =  $Searcher.FindOne()
If ($results -eq $Null) 
    {"User does not exists"}
Else 
    {"User Exists"}


It can be extended more to retrieve more information on the user. For example if the user account is active in AD.

$email = "JohnDoe@company.com"
$searcher =  [ADSISearcher]"(&(mail=$email)(userAccountControl:1.2.840.113556.1.4.803:=2))"
$results =  $searcher.FindOne()
If ($results -eq $Null) 
    {"User account is enabled"}
Else 
    {"User account is disabled"}


If we want to do this operation in bu…