Showing posts with label Ajax and jquery. Show all posts
Showing posts with label Ajax and jquery. Show all posts
Wednesday, December 21, 2011
Why we chose Dojo for our Ajax framework : ATG
ATG made the decision to standardize on Dojo in September 2005. We have revisitedthis decision once and still believe it is the right framework for us and our customers.We looked at a lot of other Ajax toolkits, both open source and commercial. Our first goalwas to decide if any of the commercial toolkits offered significant functionality that wecouldn't get in an open source toolkit. Mostly the answer was no. This decision neededto be made because we'd have had license fees to pay if we did an OEM of a toolkit, andthere would be potential licensing issues for our customers too.In fact, most of the commercial toolkits have some serious downsides in addition to thelicensing. We found that some of them had really focused on the compression of theJavaScript at the cost of readability of the code (JackBe had this issue). We also lookedat Backbase, which was pretty nice but we didn't see anything overly compelling. Most ofthe commercial toolkits had focused on building complete interfaces in their toolkit ratherthan incremental addition. While ATG was building some entirely new applications usingAjax we also know that we would be incrementally enhancing many existing interfaces.Once we narrowed down the decision to open source only, we eliminated all open sourceprojects that had only one developer or that had very little in the way of downloads. Thisleft us with Prototype, jQuery, Dojo and DWR. In our initial review GWT and YUI hadn'tbeen released yet - and we still wouldn't have picked them. Also the TIBCO GeneralInterface toolkit didn't exist either.Here was our reasoning for each toolkit:
Prototype/Scriptaculous:
Was a very basic toolkit and seemed to be mostly focused on making fancy web pagesrather than building web apps. Prototype had a lot of good stuff for making it easier to callXMLHttpRequest and do DOM manipulation. For its target market it’s a very good tool,ATG just wasn’t in that target market.It was somewhat cryptic in its method names. It didn't really have a good client sideframework for writing reusable components. It didn't have a client side messaginginfrastructure. It's big plus was that the download was tiny (15KB at the time) and it is stillin that range. It also had (and still has) the biggest community (according to ajaxian.com).The Dojo 1.0 release should have a footprint about the same size as Prototype, that’ssomething the Dojo community has been working hard on.
jQuery
:Very similar to Prototype. jQuery was a little easier to understand but was still very basic.Again it mainly focused on making XHR and DOM manipulation a little easier. It had littlein the way of client side framework or component creation. The documentation for jQuerywas really good.
DWR
:A very good toolkit for binding server side Java code to Javascript client. It handled thetransport and conversion well. Easy to plug into ATG (the connector that's in thewhitepaper took me an hour to create as part of our evaluations). No client sideframework. No DOM manipulation toolkit. DWR is really just a server communicationtool.
Dojo
This was the only toolkit we found that had focused on an approach for creating reusable,componentized code. This is something we knew we were going to need. It also has asolid client side event model and a pub/sub messaging scheme. It had some good UIwidgets right from the start. Server communication piece was as good as jQuery andPrototype, although DWR had the edge in this category because of the server side tie in.Dojo had some nice utilities for creating requests from forms automatically.Overall Dojo seemed the most complete. Also the community around Dojo was thrivingand several other major ISVs standardized on it around the same time we did, althoughwe were one of the first.On the release of YUI and GWT we took a look at these frameworks. We were skepticalof their usefulness to us because of the closed nature of the toolkits. They are controlledby another company rather than a pure open source community effort.GWT is a nice idea for application developers that work in Java that want to create Ajaxapplications. You are completely isolated from the JavaScript and really don't need toknow much about the client side. This is both good and bad. They've added JSNI(JavaScript Native Interface) in an attempt to get around the bad, but we don't think thisis a good overall solution. Building internal applications with this toolkit may work well,but in customer facing ecommerce sites we are skeptical of how easy it would be.YUI has a really good selection of widgets. Yahoo has done a good job with this. Thetoolkit has developed quickly and has a strong following. It is still quite closed from acommunity perspective and ATG really wants a toolkit with an open active community inwhich we can participate. Yahoo isn’t really offering that. This toolkit is probably evolvingfaster than any of the others, and there is a bit of a footrace for features with Dojo, witheach adopting the better ideas of the other. We like this toolkit, but the strong tie toYahoo is difficult for us from an ISV perspective.
Dojo release
The ATG 2007.1 release uses Dojo 0.4.3. On Monday November 5th, 2007, Dojo 1.0 wasreleased. ATG plans on supporting this release in a future version of ATG. There was amajor revision of the Dojo framework between 0.4.3 and 0.9 that requires ATG to reworkmany of our custom widgets. ATG also knew the plans for Dojo 1.0 and decided not togo through the upgrade effort until Dojo 1.0 was released and stable. This work will bescheduled into our standard release schedule. Customers will be able to use Dojo 1.0 intheir applications and web sites
jquery interview questions and answers
Questions : 1 What is jQuery ?
Answers : 1 It's very simple but most valuable Question on jQuery means jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, animating, event handling, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. Jquery is build library for javascript no need to write your own functions or script jquery all ready done for you
Questions : 2 How you will use Jquery means requirement needed for using jquery
Answers : 2
Nothing more need to do just olny download jquery library(.js file) from any of the jquery site Download jquery and just linked with your html pages like all other javascript file
like below :
< script src="jquery.js" language="javascript" type="text/javascript">
Questions : 3 what the use of $ symbol in Jquery
Answers : 3
$ Symbol is just replacement of jquery means at the place of $ you may use jquery hence $ symbol is used for indication that this line used for jquery
Questions : 4 How do you select an item using css class or ID and get the value by use of jquery
Answers : 4 If an element of html like < div> , < p> or any tag have ID MyId and class used MyClass then we select the element by below jquery code
$('#MyId') for ID and for classs $('.MyClass') and for value
var myValue = $('#MyId').val(); // get the value in var Myvalue by id
Or for set the value in selected item
$('#MyId').val("print me"); // set the value of a form input
Questions : 5 How to get the server response from an AJAX request using Jquery?
Answers : 5
When invoking functions that have asynchronous behavior We must provide a callback function to capture the desired result. This is especially important with AJAX in the browser because when a remote request is made, it is indeterminate when the response will be received.
Below an example of making an AJAX call and alerting the response (or error):
$.ajax({
url: 'pcdsEmpRecords.php',
success: function(response) {
alert(response);
},
error: function(xhr) {
alert('Error! Status = ' + xhr.status);
}
});
Questions : 6 How do you update ajax response with id " resilts"
Answers : 6
By using below code we can update div content where id 'results' with ajax response
function updateStatus() {
$.ajax({
url: 'pcdsEmpRecords.php',
success: function(response) {
// update div id Results
$('#results').html(response);
}
});
}
Questions : 7 How do You disable or enable a form element?
Answers : 7
There are two ways to disable or enable form elements.
Set the 'disabled' attribute to true or false:
// Disable #pcds
$('#pcds').attr('disabled', true);
// Enable #pcds
$('#pcds').attr('disabled', false);
Add or remove the 'disabled' attribute:
// Disable #pcds
$("#pcds").attr('disabled', 'disabled');
// Enable #x
$("#pcds").removeAttr('disabled');
Questions : 8 How do you check or uncheck a checkbox input or radio button?
Answers : 8
There are two ways to check or uncheck a checkbox or radio button.
Set the 'checked' attribute to true or false.
// Check #pcds
$('#pcds').attr('checked', true);
// Uncheck #pcds
$('#pcds').attr('checked', false);
Add or remove the 'checked' attribute:
// Check #pcds
$("#pcds").attr('checked', 'checked');
// Uncheck #pcds
$("#pcds").removeAttr('checked');
Questions : 9 How do you get the text value of a selected option?
Answers : 9
Select elements typically have two values that you want to access. First there's the value to be sent to the server, which is easy:
$("#pcdsselect").val();
// => 1
The second is the text value of the select. For example, using the following select box:
<select id="pcdsselect">
<option value="1">Mr</option>
<option value="2">Mrs</option>
<option value="3">Ms</option>
<option value="4">Dr</option>
<option value="5">Prof</option>
</select>
If you wanted to get the string "Mr" if the first option was selected (instead of just "1"), you would do that in the following way:
$("#mpcdsselect option:selected").text();
// => "Mr"
JavaScript and AJAX interview questions
1. Why so JavaScript and Java have similar name?
A. JavaScript is a stripped-down version of Java
B. JavaScript's syntax is loosely based on Java's
C. They both originated on the island of Java
D. None of the above
2. When a user views a page containing a JavaScript program, which machine actually executes the script?
A. The User's machine running a Web browser
B. The Web server
C. A central machine deep within Netscape's corporate offices
D. None of the above
3. ______ JavaScript is also called client-side JavaScript.
A. Microsoft
B. Navigator
C. LiveWire
D. Native
4. __________ JavaScript is also called server-side JavaScript.
A. Microsoft
B. Navigator
C. LiveWire
D. Native
5. What are variables used for in JavaScript Programs?
A. Storing numbers, dates, or other values
B. Varying randomly
C. Causing high-school algebra flashbacks
D. None of the above
6. _____ JavaScript statements embedded in an HTML page can respond to user events such as mouse-clicks, form input, and page navigation.
A. Client-side
B. Server-side
C. Local
D. Native
7. What should appear at the very end of your JavaScript?
The <script LANGUAGE="JavaScript">tag
A. The </script>
B. The <script>
C. The END statement
D. None of the above
8. Which of the following can't be done with client-side JavaScript?
A. Validating a form
B. Sending a form's contents by email
C. Storing the form's contents to a database file on the server
D. None of the above
9. Which of the following are capabilities of functions in JavaScript?
A. Return a value
B. Accept parameters and Return a value
C. Accept parameters
D. None of the above
10. Which of the following is not a valid JavaScript variable name?
A. 2names
B. _first_and_last_names
C. FirstAndLast
D. None of the above
11. ______ tag is an extension to HTML that can enclose any number of JavaScript statements.
A. <SCRIPT>
B. <BODY>
C. <HEAD>
D. <TITLE>
12. How does JavaScript store dates in a date object?
A. The number of milliseconds since January 1st, 1970
B. The number of days since January 1st, 1900
C. The number of seconds since Netscape's public stock offering.
D. None of the above
13. Which of the following attribute can hold the JavaScript version?
A. LANGUAGE
B. SCRIPT
C. VERSION
D. None of the above
14. What is the correct JavaScript syntax to write "Hello World"?
A. System.out.println("Hello World")
B. println ("Hello World")
C. document.write("Hello World")
D. response.write("Hello World")
15. Which of the following way can be used to indicate the LANGUAGE attribute?
A. <LANGUAGE="JavaScriptVersion">
B. <SCRIPT LANGUAGE="JavaScriptVersion">
C. <SCRIPT LANGUAGE="JavaScriptVersion"> JavaScript statements…</SCRIPT>
D. <SCRIPT LANGUAGE="JavaScriptVersion"!> JavaScript statements…</SCRIPT>
16. Inside which HTML element do we put the JavaScript?
A. <js>
B. <scripting>
C. <script>
D. <javascript>
17. What is the correct syntax for referring to an external script called " abc.js"?
A. <script href=" abc.js">
B. <script name=" abc.js">
C. <script src=" abc.js">
D. None of the above
18. Which types of image maps can be used with JavaScript?
A. Server-side image maps
B. Client-side image maps
C. Server-side image maps and Client-side image maps
D. None of the above
19. Which of the following navigator object properties is the same in both Netscape and IE?
A. navigator.appCodeName
B. navigator.appName
C. navigator.appVersion
D. None of the above
20. Which is the correct way to write a JavaScript array?
A. var txt = new Array(1:"tim",2:"kim",3:"jim")
B. var txt = new Array:1=("tim")2=("kim")3=( "jim")
C. var txt = new Array("tim","kim","jim")
D. var txt = new Array="tim","kim","jim"
21. What does the <noscript> tag do?
A. Enclose text to be displayed by non-JavaScript browsers.
B. Prevents scripts on the page from executing.
C. Describes certain low-budget movies.
D. None of the above
22. If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?
A. "New Text"?
B. para1.value="New Text";
C. para1.firstChild.nodeValue= "New Text";
D. para1.nodeValue="New Text";
23. JavaScript entities start with _______ and end with _________.
A. Semicolon, colon
B. Semicolon, Ampersand
C. Ampersand, colon
D. Ampersand, semicolon
24. Which of the following best describes JavaScript?
A. a low-level programming language.
B. a scripting language precompiled in the browser.
C. a compiled scripting language.
D. an object-oriented scripting language.
25. Choose the server-side JavaScript object?
A. FileUpLoad
B. Function
C. File
D. Date
26. Choose the client-side JavaScript object?
A. Database
B. Cursor
C. Client
D. FileUpLoad
27. Which of the following is not considered a JavaScript operator?
A. new
B. this
C. delete
D. typeof
28. ______method evaluates a string of JavaScript code in the context of the specified object.
A. Eval
B. ParseInt
C. ParseFloat
D. Efloat
29. Which of the following event fires when the form element loses the focus: <button>, <input>, <label>, <select>, <textarea>?
A. onfocus
B. onblur
C. onclick
D. ondblclick
30. The syntax of Eval is ________________
A. [objectName.]eval(numeric)
B. [objectName.]eval(string)
C. [EvalName.]eval(string)
D. [EvalName.]eval(numeric)
31. JavaScript is interpreted by _________
A. Client
B. Server
C. Object
D. None of the above
32. Using _______ statement is how you test for a specific condition.
A. Select
B. If
C. Switch
D. For
33. Which of the following is the structure of an if statement?
A. if (conditional expression is true) thenexecute this codeend if
B. if (conditional expression is true)execute this codeend if
C. if (conditional expression is true) {then execute this code>->}
D. if (conditional expression is true) then {execute this code}
34. How to create a Date object in JavaScript?
A. dateObjectName = new Date([parameters])
B. dateObjectName.new Date([parameters])
C. dateObjectName := new Date([parameters])
D. dateObjectName Date([parameters])
35. The _______ method of an Array object adds and/or removes elements from an array.
A. Reverse
B. Shift
C. Slice
D. Splice
36. To set up the window to capture all Click events, we use which of the following statement?
A. window.captureEvents(Event.CLICK);
B. window.handleEvents (Event.CLICK);
C. window.routeEvents(Event.CLICK );
D. window.raiseEvents(Event.CLICK );
37. Which tag(s) can handle mouse events in Netscape?
A. <IMG>
B. <A>
C. <BR>
D. None of the above
38. ____________ is the tainted property of a window object.
A. Pathname
B. Protocol
C. Defaultstatus
D. Host
39. To enable data tainting, the end user sets the _________ environment variable.
A. ENABLE_TAINT
B. MS_ENABLE_TAINT
C. NS_ENABLE_TAINT
D. ENABLE_TAINT_NS
40. In JavaScript, _________ is an object of the target language data type that encloses an object of the source language.
A. a wrapper
B. a link
C. a cursor
D. a form
41. When a JavaScript object is sent to Java, the runtime engine creates a Java wrapper of type ___________
A. ScriptObject
B. JSObject
C. JavaObject
D. Jobject
42. _______ class provides an interface for invoking JavaScript methods and examining JavaScript properties.
A. ScriptObject
B. JSObject
C. JavaObject
D. Jobject
43. _________ is a wrapped Java array, accessed from within JavaScript code.
A. JavaArray
B. JavaClass
C. JavaObject
D. JavaPackage
44. A ________ object is a reference to one of the classes in a Java package, such as netscape.javascript .
A. JavaArray
B. JavaClass
C. JavaObject
D. JavaPackage
45. The JavaScript exception is available to the Java code as an instance of __________
A. netscape.javascript.JSObject
B. netscape.javascript.JSException
C. netscape.plugin.JSException
D. None of the above
46. To automatically open the console when a JavaScript error occurs which of the following is added to prefs.js?
A. user_pref(" javascript.console.open_on _error", false);
B. user_pref("javascript.console.open_error ", true);
C. user_pref("javascript.console.open_error ", false);
D. user_pref("javascript.console.open_on _error", true);
47. To open a dialog box each time an error occurs, which of the following is added to prefs.js?
A. user_pref("javascript.classic.error_alerts", true);
B. user_pref("javascript.classic.error_alerts ", false);
C. user_pref("javascript.console.open_on _error ", true);
D. user_pref("javascript.console.open_on _error ", false);
48. The syntax of a blur method in a button object is ______________
A. Blur()
B. Blur(contrast)
C. Blur(value)
D. Blur(depth)
49. The syntax of capture events method for document object is ______________
A. captureEvents()
B. captureEvents(args eventType)
C. captureEvents(eventType)
D. captureEvents(eventVal)
50. The syntax of close method for document object is ______________
A. Close(doc)
B. Close(object)
C. Close(val)
D. Close()
Subscribe to:
Posts (Atom)
Popular Posts
-
Note: This is about session management in ATG applications running on third-party application servers The J2EE specification defines th...
-
1.ShippingCalculatorImpl extends ShippingPricingCalculator Methods : a) getAvailablemethods ( List pMethods, ShippingGroup pShippingGro...
-
The following example defines a page that contains a registration form. Embedded comments explain how the form works. <%@ taglib uri=...
-
Create Endeca App: 1. Go To => C:\Endeca\ToolsAndFrameworks\3.1.1\deployment_template\bin 2. Open Command Prompt from th...
-
What is an ATG Repository?? A repository is a data access layer that defines a generic representation of a data store. It simplifies the...