20 Dec: Must Read Codes [6-10]
Dec20

20 Dec: Must Read Codes [6-10]

Welcome to CodeSpread! We are sharing few must read codes/concepts which are required now and then. Each of these codereads doesn’t require a full length descriptive article so combining them into groups of five. CodeReads #6, What is the difference between Dispose and Finalize? #Point 1, Dispose is used to release unmanaged resources in a deterministic fashion, like we know when to release the resource. Finalize method is also used for the purpose of releasing resources but in non-deterministic fashion like we cannot be sure as when Garbage Collector will collect the resource. #Point 2 , Finalize method has a performance drawback due to the Garbage Collector as there will be two iterations of Garbage Collector and override operation. fbsource :https://www.facebook.com/codespread/posts/550605628295996 CodeReads #7, Garbage Collector maintains managed objects in “generations.” The generation indicates the lifetime of an object like objects having short life are stored in lower generations as GC runs much more frequently to clean up objects in the lower generations. The more the objects survive a GC cleanup, the more the chances that these objects will get moved to higher generations. There will be few GC swipes on higher generations and also that will happen only if lower generations have no space left. When we talk about generations, we talk about physical memory locations divided,managed and allocated to each generation number. fbsource: https://www.facebook.com/codespread/posts/550949951594897 CodeReads #8, .data() : Store arbitrary data associated with the matched elements or return the value at the named data store for the first element in the set of matched elements. For more information: http://api.jquery.com/data/ fbsource: https://www.facebook.com/codespread/posts/370621346386549 CodeReads #9, Elements of a UML Class Diagram are: Class Operations Relationships -Associations -Generalization -Dependency -Realization Constraint Rules and Notes fbsource: https://www.facebook.com/codespread/posts/552364564786769 CodeReads #10, Scaffolding is a technique in which the programmer may write a specification that describes how the application database may be used. With the help of this concept,programmer can create a functional Web site for viewing and editing data based on the schema of the data. ASP.NET Dynamic Data supports scaffolding. Refer the below link. For more information: http://msdn.microsoft.com/en-IN/library/ee845452%28v=vs.100%29.aspx fbsource:...

Read More
Release of jQuery 1.11.0/2.1.0 Beta 2
Nov28

Release of jQuery 1.11.0/2.1.0 Beta 2

We have latest news from jQuery desk. On Nov 15th2013, jQuery official site announced the release of  jQuery 1.11.0/2.1.0 Beta 2. These bets versions can be downloaded from the below mentioned links http://code.jquery.com/jquery-1.11.0-beta2.js http://code.jquery.com/jquery-2.1.0-beta2.js Note:  jQuery 1.x supports IE 6/7/8 and jQuery 2.x does not. What is new in these beta versions? Asynchronous Module Definition (AMD): Replacing old modular build system with AMD internally Published on npm : This introduction will help to use the release with node or packages like browserify. Performance: The new “lazy feature detects” feature is quite good as it reduces the startup time for the library. What is removed from these beta versions? Sourcemap comment is removed. But can still be continued to generate and distribute sourcemaps, like if the browser does not support manually associating map files , then add the appropriate sourcemap comment at the end of the minified...

Read More
jQuery: Effects/Methods
Dec09

jQuery: Effects/Methods

In our last article, jQuery Part 1 , we covered the basic understanding and now we will move to Methods or effects available in jQuery. Hide/Show/Toggle Methods The most used method Hide/Show. From the last tutorial, we already know, how to select an element of our page. Then, if we are successful, we just have call hide() or show() method as required. Do not forget to include the jQuery library file. <script type="text/&lt;span class=">// <!&#91;CDATA&#91; javascript</span>" src="/jquery/jquery-1.7.1.min.js"> // &#93;&#93;></script> <script type="text/&lt;span class=">// <!&#91;CDATA&#91; javascript</span>" language="javascript"> // &#93;&#93;></script> $(document).ready(function() { $("#btn").click(function () { $("div").show(); }); &nbsp; $(".btnclass").click(function () { $("p").hide(); }); }); &lt;/script&gt; Explanation: On click of a button which has ID “btn”, all the div elements in the page will not be visible to the user. On click of a button having CSS class “.btnclass”, all the paragraph elements in the page will be visible to the user. Note: Though there is no parameter mentioned for Hide/ Show methods in the above example ,still we have some liberty provided by jQuery in terms of optional parameters like, $(selector).hide(speed,callback); $(selector).show(speed,callback); Here, ‘speed’ is the string which can take predefined values like “slow”, “normal”, or “fast” or we can customized it by specifying the milliseconds running time of animation.For ex: $("p").hide(1000); And, ‘callback’ represents the function which will be executed, once the show/hide animation completes. In the below code, ‘event’ function is called as a callback and it will show all the div element of the page. function event (){ $(“div”).show(); } $("p").hide(1000, event); One more method related to show/hide is toggle(), lets see what it does, $("#btn").click(function(){ $("#label1").toggle(); }); Well, it is not difficult to deduce that on click of button with ID “btn”, label1 appearance toggles, if it is in visible state,it gets hidden and vice versa. Similar to Hide/Show methods, toggle also contains the same optional parameters “speed” and “callback”. Fade Methods I suppose, we all know the dictionary meaning of fade and that is the exact feature used by these method. So what are the animations we have related to Fade? fadeIn() : An invisible element would start appearing in fade mode. fadeOut() : A visible element would begin diminishing in fade mode. fadeToggle() : It performs both of the operations described above fadeTo() : element fades to a given opacity (value between 0 and 1). We will try to save time here by providing quick examples as the base would remain same. $("#btn").click(function(){ $("#label1").fadeIn(); $("#label2").fadeOut("slow"); $("#label3").fadeToggle(); $("#label4").fadeTo(“1000”,0.5); }); We mentioned two optional parameters “speed” and “callback” and their use. This two parameters are applicable to our fade methods also. There is an exception in case of...

Read More
UI: Jquery is Javascript Library
Dec08

UI: Jquery is Javascript Library

Jquery Basics: With the title itself, anybody can deduce that we are indirectly talking about javascript only. So, we can say that Javascipt is the guardian of Jquery. These are client end technologies which are completely different from our server side technologies but now they have blend in. Lets try an example in Javascript first,we will try to set the background color of document in our page. For that we will declare a javascript function. <script type="text/javascript"> function setBackgroundColor(color) { document.body.style.backgroundColor=color; } ; </script> <button onclick="setBackgroundColor('&lt;span class=">000AAA')"&gt;Set Color</button> Well,try it and you will see the action. Next,to achieve the similar functionality we will use a Jquery. $(this).css('background-color', 'red'); Look at the difference,Now let me ask you a question which one is neat? and which one you will prefer? Ofcourse, we all know that jquery is much simple, neat and easy to handle. Well, how was this possible? Jquery is a library, so like all library contains books which we read, similar way Jquery contains a lot of common tasks which would have required a lot of javascript code to be written. These tasks can be called in a simple way through Jquery by just following some syntax which we will see later in this document. Why Jquery and not others? There are other frameworks also available so why jquery, because it is very much popular and is growing daily with lot of new tasks being added to the library. One of the major factor is that it is being used by almost all the big companies. What are the prerequisites? This is an important question as, if you know things like HTML CSS JavaScript Then half of the battle is won. How can i start? Go and download the latest jquery from jquery.com and add it into the folder where you are developing your application. There are two version of jquery available: Production Version- Download this version, if you are new to jquery. Development version If you do not want to download, then also there is a way to include jquery in your project. There is a copy of jquery available on Google and Microsoft network, hosted on their CDN. You have to include this code in your page to include the library in your project. <html> script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"> </script> </html> The ‘$’ syntax We have our library in place, we will start with declaring ‘$’. This is a shortcut for $(document).ready. Why it is required? This requirement is somewhat related to Javascript issues which were faced by developers.What really happened was that any javascript code written for a particular element of the page requires the element to be...

Read More