Tuesday, January 14, 2014

// // Leave a Comment

How to find Dimension of an array C-Sharp

How to find Dimension of an array C-Sharp


Rank Property is used to find the dimensions of an array
class SampleArray
{
    static void Main()
    {
        // Declare and initialize an array: 
        int[,] Sample = new int[5, 10];
        System.Console.WriteLine("{0} dimensions.", Sample .Rank);
    }
}
// Output: 2 dimensions.
Read More
// // Leave a Comment

Toggle Two Classes in Jquery - Best way

 Toggle Two Classes in Jquery - Best way

$("#TriggerElement").toggle(function() 
{
        $('#TargerElement').removeClass("FirstClass").addClass("SecondClass"); 

}, function() {
        $('#TargerElement').removeClass("SecondClass").addClass("FirstClass"); 
});
$('#TriggerElement').click(function(){
     $('#TargerElement').toggleClass('FirstClass','SecondClass'); });
Read More

Wednesday, January 8, 2014

// // Leave a Comment

Limit characters in textbox textarea with counter



Bind Text Counter



function TextCounter (CountLimit, Elem, CounterElem) {
var elem = $("#" + Elem);var Counterelem = $("#" + CounterElem);
elem.bind("keyup focus", function () {
setCount(elem[0], Counterelem,CountLimit);
});
setCount(elem[0], Counterelem,CountLimit);
}



function setCount (src, elem,limit) {
var chars = src.value.length;
if (chars > limit) {
src.value = src.value.substr(0, limit);
chars = limit;
}
elem.html(limit - chars);
}





Calling Method
TextCounter(5,'samp','counter');
Read More
// // Leave a Comment

Allow only numeric in text box jquery

Use the following code for allowing only numbers while entering in text box


            var Elem=$("#"+ElemId);
            Elem.on('input propertychange', function () {
                Elem.val(Elem.val().replace(/[^0-9]/g, ''));
            });

Read More
// // Leave a Comment

Javascript Keycode for Chrome,Mozilla Firefox,Internet Explorer


Javascript Keycode for Chrome,Mozilla Firefox,Internet Explorer
ommon key codes that are relatively safe to use across browsers are shown in black. Key codes that differ across browsers are shown in red. Do not use this table for character codes of keypress events:keypress character codes are not key-specific and may be enirely different fromkeydown/keyup key codes.





Opera   MSIE  Firefox  Safari  Chrome    Key pressed
_________________________________________________________

  8       8       8       8       8      Backspace
  9       9       9       9       9      Tab
 13      13      13      13      13      Enter
 16      16      16      16      16      Shift
 17      17      17      17      17      Ctrl
 18      18      18      18      18      Alt
 19      19      19      19      19      Pause, Break
 20      20      20      20      20      CapsLock
 27      27      27      27      27      Esc
 32      32      32      32      32      Space
 33      33      33      33      33      Page Up
 34      34      34      34      34      Page Down
 35      35      35      35      35      End
 36      36      36      36      36      Home
 37      37      37      37      37      Left arrow
 38      38      38      38      38      Up arrow
 39      39      39      39      39      Right arrow
 40      40      40      40      40      Down arrow
         44      44      44      44      PrntScrn (see below)
 45      45      45      45      45      Insert
 46      46      46      46      46      Delete
 48-57   48-57   48-57   48-57   48-57   0 to 9
 65-90   65-90   65-90   65-90   65-90   A to Z  
112-123 112-123 112-123 112-123 112-123  F1 to F12 
144     144     144     144     144      NumLock
145     145     145     145     145      ScrollLock

188     188     188     188     188      , <
190     190     190     190     190      . >
191     191     191     191     191      / ?
192     192     192     192     192      ` ~
219     219     219     219     219      [ { (see below)
220     220     220     220     220      \ |
221     221     221     221     221      ] }
222     222     222     222     222      ' "
In most browsers, pressing the PrntScrn key fires keyup events only. 
Caution! Key code 219 also corresponds to the Win Key (Start) in Opera.
The following key codes differ across browsers:
      keydown/keyup event.keyCode                    
Opera   MSIE  Firefox  Safari  Chrome    Key pressed
_________________________________________________________ 

 59     186      59     186     186      ; :             
 61     187     107     187     187      = +             
109     189     109     189     189      - _             
219      91      91      91      91      WIN Key (Start) 
  0      93      93      93      93      WIN Menu        


Opera    All Others (NumLock On/Off)     Key pressed
_________________________________________________________

48/45       96/45                        Numpad 0 Ins    
49/35       97/35                        Numpad 1 End    
50/40       98/40                        Numpad 2 Down   
51/34       99/34                        Numpad 3 Pg Down
52/37      100/37                        Numpad 4 Left   
53/12      101/12                        Numpad 5        
54/39      102/39                        Numpad 6 Right  
55/36      103/36                        Numpad 7 Home   
56/38      104/38                        Numpad 8 Up     
57/33      105/33                        Numpad 9 Pg Up  
42/42      106/106                       Numpad *        
43/43      107/107                       Numpad +        
45/45      109/109   (45 is also Ins)    Numpad -        
78/46      110/46    (78 is also N)      Numpad . Del    
47/47      111/111                       Numpad /     
Read More
// // Leave a Comment

10 useful libraries for JavaScript developers

10 useful libraries for JavaScript developers

Here I highlight ten tools that you can use to enhance your users' experience on your website.

Hammer.js

Probably one of the lightest JavaScript libraries around, hammer.js weighs at only 2KB. The library offers touch support for touch devices. The library allows a developer to add tap, double tap, drag, hold and transform actions. In addition, hammer.js can be bound to an HTML element allowing a touch event to return a callback with any kind of array whether it is an event, rotation, position, scale or touch.

HTML Canvas Library

Even with the new element, it may be a little challenging to create animations and visualizations. The HTML Canvas Library offers a standalone and lightweight JavaScript wrapper to simplify the whole process. Tasks like frame-rate control, rotations, multi-touch, image loading and other animations can be done easily and in a consistent manner. The library also supports high-performance animations.

Smoke.js

Have you ever wanted to customize alert notifications for your website? Smoke.js is a small JavaScript library that helps you do that. The library replaces the default alert function with CSS notifications that do not require any JavaScript frameworks. Each alert can be customized inside functions by specifying styles using CSS3 animations and backgrounds.

Kinetic.js

The element continues to get lots of hype in the HTML5 circles and the Kinetic.jslibrary adds to that hype as well. This library enables canvas interactivity by allowing you to draw shapes and images using the canvas API for both desktop and mobile applications. You can move, scale and rotate images independently for high performance animations as well as add event listeners to them.

JSZip

If you are looking to serve your users with zip files without wasting server resources and bandwidth, JSZip can do it for you. Not only is it simple to use but it allows you to zip multiple files without generating a lot of data. By getting the client-side to do the heavy-lifting, no server-side resource is used allowing you to use the saved bandwidth for other things.

PDFKit

Allowing PDF document viewing or download on your site will require that all your documents reside in that format. The PDFKit document generation library makes your work easy by creating printable PDF documents for you. Generating documents has been made easy and only requires a few function calls.  It supports vector graphics, font and image embedding and annotations within the generated documents. The library runs on the node.js platform and has a great API for integrating with apps using server-side JavaScript.

Fitvids.js

If you deliver video on your website, you need the flexibility to resize your video embeds. Unfortunately, this can be a little hectic as you have to code that into every video that you embed. Fitvids.js saves you that hustle by use of a JQuery plugin. With this plugin, you can add fluid video embeds to make responsive websites that your users will love to interact with.

Impress.js

Who still uses programs like Powerpoint when your browser can serve the same purpose? Theimpress.js library turns your browser into a powerful presentation tool. It uses CSS3 transforms and transition to deliver powerful presentation features right within the browser window. Just visit the link above to get the feel of what this library can do.

Colors

Color adds.....well, color to your website and applications. The Color JavaScript library allows you to manipulate colors in multiple ways and can generate random color values. In addition, it can get complimentary color values and handle unit conversions of multiple types including RGB to Hexadecimal, Hexadecimal to RGB among others.

GMap

Do you find it difficult or challenging to embed Google Maps on sites? This GMap offers a flexible and highly customizable way of embedding Google Maps onto your website. The plugin weighs in at only 2KB, giving developers a way to have maps on sites in a lightweight style.
Read More