Skip to main content

Posts

Recent posts

Node.js - Part 1

After a long time, I am starting to explore Node.js I am sharing my experience while learning Node, so this will be a good start-up point for someone who is willing to learn Node.js Few points for development environment: 1. Using Windows OS 2. Using Visual Studio Code for Node.js Jump to  https://nodejs.org  and get the Node.js suitable for your operating system.You can find more specific download at  https://nodejs.org/en/download/ Now open command prompt, and try That's it. We have successfully installed Node.js on our system. I'll be back with more article on Node soon. Cheers!!!

Jquery Tips and Tricks

Attribute selectors in Jquery We access page elements using Class and Id selectors most of the times but at times we need to fetch elements like, access all elements where class name starts with 'form-controls' or class name contains 'form-controls' $('[class^=form-controls]') // class name Begins with "form-controls" $('[class*=form-controls]') // class name Contains "form-controls" $('[class$=form-controls]') // class name Ends with "form-controls" Add new class to existing elements .addClass(className) This will add specified class(es) to the element. This will not replace the existing class(es), rather it will append new class to the existing ones. $( "table" ).addClass( "datatable stripped" ); This will add "datatable" and "stripped" class to all tables Common mistake while using addClass $('#pdOrder').addClass('.datatable'); //This is wrong

Keyboard driven menu in Jquery

I had a requirement to operate menu with keyboard just like we do in windows application. Traverse through menus using left/ right arrow keys, up/ down arrow keys should work as well. Further user should be able to navigate when Enter key is pressed. I was not able to find any jquery plugin to use for this purpose until I got this one,  https://hanshillen.github.io/jqtest/#goto_menubar This is what exactly I was looking, thanks a ton to the author. But later I realized it is not that easy to get just menu out of this. So I need to play with it and finally got it working. I am sharing code here so that if anyone ever need such type of menu it will be a quick one. This functionality is created by original author @Hans Hillen , I am just providing this code for simplicity. Download @  http://jmp.sh/Z3AtfVv

Using Redis Cache in Asp.Net MVC

Redis is an in-memory data structure store, used as database, cache and message broker. At first it seems a bit hard to get on with Redis so I tried with MemCache, Ignite Cache but once I get on with Redis since then I am not using anything else for caching. Redis is super fast compared with other caching alternatives. We can install redis as windows service. This is out of scope for this article so I am providing some external references so that you can get started with, how you can install Redis as windows service. http://www.alternatestack.com/development/running-redis-server-on-windows/ http://www.saltwebsites.com/2012/how-run-redis-service-under-windows Once you are done with Redis installation, a bit hectic though as compared with any other Microsoft products, where we are habitat of using "Next" and get our desired product installed. But the efforts worth it, trust me!!! We need to find for a package,stackexchange.redis, refer below screen, This wi

Union in Entity Framework

There are certain points we need to take into consideration while performing UNION in Entity Framework. This is an easier way to get entities with different queries and then use Union. As shown in below example, where we are using Union to get result from Texas and Florida states. var floridaEntity = ctx.Orders.Where(o => o.State == "Florida").Select(o => o); var TexasEntity = ctx.Orders.Where(o => o.State == "Texas").Select(o => o); var floridaTexas = floridaEntity.Union(TexasEntity); Another way to use Union is shown below, (from p in Tblpages join pa in Tblpageactions on p.PageId equals pa.PageId join rp in Tblrolepermissions on pa.ActionId equals rp.ActionId into jrs from jrResult in jrs.DefaultIfEmpty() where jrResult.RoleId == 1 select new {

Jquery Datatable with Keytable setting focus

Datatable will not have focus by default, we need to set the focus on datatable by using below code, <script src="~/Scripts/js/core/libraries/jquery.min.js"></script> <script type="text/javascript" src="~/Scripts/js/plugins/tables/datatables/datatables.min.js"></script> <script src="~/Scripts/js/plugins/tables/datatables/extensions/key_table.min.js"></script> //make sure you have included KeyTable plugin $(document).ready(function () { // initialise your datatable here, after that we are ready to set focus on datatable so that we can use arrow key for navigation like excel var table = $('#PurchaseorderList').DataTable(); table.cell(':eq(0)').focus(); table.cell(':eq(0)').click(); });