- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 12
- Posts with Downvotes
- 4
- Downvoting Members
- 11
141 Posted Topics
Here is the code copied from w3schools ([url]http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_suggest):[/url] [CODE]<html> <head> <script type="text/javascript"> function showHint(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState == 4) { … | |
Hi, I wrote this code as is from the JNDI tutorial from sun website. But I am getting this exception while running it: [CODE]import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import java.util.*; /** * Write a description of class FirstJndi here. * * @author (your name) * @version (a version number … | |
Hello, I wanted to see whether 2 directories are identical in terms of content. So what I did was tar the directories and then md5sum-ed them and then compare but the hashes were not identical. I tried to go inside each directory and md5sum-ed each file of each directory and … | |
In my office I have two machines connected two networks - one has IP say 21..... and another has IP say 25... Now the thing is that both of the machines can access Internet. But there is a problem pinging among each other. I have been told that has been … | |
In the J2EE tutorial from sum site, it is often mentioned this term. For example, the timersession example: "Because it's a business method, setTimer is exposed to the local, no-interface view of TimerSessionBean and can be invoked by the client." Thanks. | |
Hi, This is more generic actually. In nunit tests we want to refer to the original project classes. Now if the test classes are under the project directory as in the original source code then they might import the namespace of the source code through 'using'. But then the problem … | |
These two seems to be doing the same kind of thing. What is the difference here? Thanks | |
I have this question. Why do we need flyweight design pattern when we can accomplish the same thing using static variables. The static variable (of a designated class for storing global states) can be used to save states dynamically and which can be accessed by different objects anywhere and anytime. … | |
I was wondering how we can build a remote application where the user interface created using windows form will be running at the client side and the application logic will be running in server side. Sort of like web application but the user interface would be running in stand alone … | |
Why would we need the director pattern? The builder can itself execute the whole construction process instead of going through the director. [CODE] class Pizza { private String dough = ""; private String sauce = ""; private String topping = ""; public static abstract class Builder { private Pizza pizza; … | |
If class A has a virtual method and then class B which is subclasses A, overrides that method. Then class C subclasses B. So now C is supposed to inherit B's overriden method, and not A's virtual method. Then if C wants to override B's one it can't because B's … | |
They listed the design patterns in their book. But did they really invent the design patterns or summarized the works of others in their book? If the later is true then why are they called GOF patterns which credits them for others works? | |
The syntax seems mysterious. Please help here. [CODE]int? count = (from cartItems in storeDB.Carts where cartItems.CartId == shoppingCartId select (int?)cartItems.Count).Sum(); return count ?? 0;[/CODE] Thanks | |
In the following: [CODE]public ActionResult Index() { // Create a list of genres var genres = new List<string> {"Rock", "Jazz", "Country", "Pop", "Disco" }; // Create our view model var viewModel = new StoreIndexViewModel { NumberOfGenres = genres.Count(), Genres = genres }; return View(viewModel); }[/CODE] Why was var genres and … | |
Hi, I came across this code snippet: [CODE]new { genre = genreName }[/CODE] I am not sure what is the name of this thing and how this thing works? Thanks | |
why and when these 2 different tags are used? Thanks | |
Why do we use formCollection? Why can't we just use Request.QueryString instead? Thanks | |
In the add view dialog there is a field called view content. what is the purpose of this field? | |
I created a php script: [ICODE]#!/usr/local/bin/php <html><head><title>PHP Test</title></head> <body> <?php print( "Hello World<br />"); ?> </body></html> [/ICODE] created an htacces file [ICODE]AddHandler cgi-script .php DirectoryIndex index.html index.php [/ICODE] changed the permission [ICODE]chmod 711 hello.php chmod 644 htaccess [/ICODE] This does not work: [url]http://xyz/~username/hello.php[/url] By making the hello.php to hello.txt the … | |
Hi, In j2ee web application, an web application is packaged with deployment descriptor web.xml in war (zipped) format. And then the application is deployed to the web application server so that the server can communicate with the outside world. Now for asp.net the application has to be deployed to the … | |
I wrote this basic web app using jsf. My templates were jsp not jsf. And in the faces-config.xml and everywhere else I used jsp and nowhere I used jsf. But surprisingly it (the servlet container) is being able to correctly locate the thing (jsf files) it is looking for. How … | |
hi, In this example: [CODE]public void init() throws ServletException { bookDB = (BookDBAO) getServletContext() .getAttribute("bookDB"); if (bookDB == null) { throw new UnavailableException("Couldn't get database."); } }[/CODE] As it is not instantiating the BookDBAO instance and the connection with entity manager is done in the constructor: [CODE] public class BookDBAO … | |
I have experience and knowledge in java web application development. How similar is asp.net and c#? How long would it take to master c# and asp.net? If I want to prepare for interview in c#/asp.net. Is it possible to prepare without having any experience? What would be the strategy for … | |
I just used: ant ant deploy and it gave me following error: [code=text] deploy: [echo] localhost [echo] 8080 [echo] order [echo] C:\glassfishv3\glassfish\docs\javaee-tutorial\examples\bp-project\ma in.xml/../../../../../../bin/asadmin.bat [echo] order [echo] SQL92 [exec] Deprecated syntax, instead use: [exec] asadmin --port 4848 --host localhost deploy [options] ... [exec] com.sun.enterprise.admin.cli.CommandException: remote failure: Excep tion while loading the … | |
Hi, I tried to deploy the books example. But in the deploy descriptor it says: [CODE]<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>books</display-name> <listener> <listener-class>com.sun.books.listeners.ContextListener</listener-class> </listener> <servlet> <display-name>books</display-name> <servlet-name>books</servlet-name> <jsp-file>/books.jspx</jsp-file> </servlet> <jsp-config> <jsp-property-group> <display-name>books</display-name> <url-pattern>*.jspx</url-pattern> <el-ignored>false</el-ignored> <scripting-invalid>false</scripting-invalid> <is-xml>true</is-xml> </jsp-property-group> </jsp-config> </web-app>[/CODE] The only jspx file is books.jspx. After the application is … | |
Hi, I was trying to j2ee web service example helloservice. When I was building the simpleclient I got the error: [CODE]wsimport-client-generate-nosecure: wsimport-client-generate-nojvmargs: [echo] C:\glassfishv3\glassfish\docs\javaee-tutorial\examples\bp-project\ma in.xml/../../../../../../glassfish/lib/endorsed [echo] helloservice.endpoint [echo] build/generated/wsimport/client [echo] build/jar [echo] http://localhost:8080/helloservice/HelloService?WSDL [wsimport] Consider using <depends>/<produces> so that wsimport won't do unnece ssary compilation [wsimport] JDK's tools.jar was not … | |
Hi, I thought I have mastered fighting segmentation fault thanks to the assistance of you guys. But still in this days I am getting seg fault. And there is no clue at all. I am writing a suffix tree using a trie. Here is the trace of segmentation fault: [CODE]aba … | |
[CODE]set_child_at (node=0x7fffffffe080, child=0x61e250, index=1) at 10679.c:319 319 if ((*node)->count_children == (*node)->m) (gdb) p *current_node $3 = (trie_node *) 0x0 (gdb) n 324 index = hash_insert((*node)->hv, index, (*node)->m, (*node)->m1); (gdb) n 325 (*node)->children[index] = child; (gdb) p current_node $4 = (trie_node **) 0x61e270 (gdb) p *current_node $5 = (trie_node *) 0x0 … | |
[CODE] set_element* make_set(int key) { set_element* node = (set_element*) malloc(sizeof(set_element)); node->parent = node; node->rank = 0; }[/CODE] In the above code there was no return statement and the function was used like this [CODE]elem1 = make_set(f1);[/CODE] And the code was working as expected. This is very funny. I am not … | |
problem with this code: [CODE]parseIcmPage url, '<ul id="topListFilter"', '<div id="footer">' def parseIcmPage(url, start_point, end_point) data = getHtmlPage url s = data.index(start_point) e = data.index(end_point, s) len = e-s list_str = data.index[s, len] puts list_str, '\n' end[/CODE] [CODE]icm.rb:42: warning: don't put space before argument parentheses ./util.rb:121:in `index': wrong number of arguments … | |
Hi, I am getting this exception: [CODE] javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - ob jectClass: value #0 invalid per syntax]; remaining name 'dc=jndiTest' at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source) at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source) at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source) at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(Unknown Source) at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(Unknown Source) at com.sun.jndi.toolkit.ctx.ComponentContext.p_createSubcontext(Unknown Source) at com.sun.jndi.toolkit.ctx.PartialCompositeContext.createSubcontext(Unk nown Source) at com.sun.jndi.toolkit.ctx.PartialCompositeContext.createSubcontext(Unk nown Source) at … | |
I have say a loop. At the beginning of the loop I want to fill a very large array which is an array of structures. Is there way like memcpy to fill the array without going through for loop. I figure using memcpy instead of for loop would be a … | |
[CODE] public class FirstJndi { public static void main(String[] args) { String name = args[0]; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); try { // Create the initial context Context ctx = new InitialContext(env); // Look up an object Object obj = ctx.lookup(name); System.out.println(name + " is bound to: " … | |
Say I have 2 columns of data. I want to display headers like "hour(24 hour)" and "Power(KW)" and then followed by a number of rows with 2 columns(hour and power). The hour should be under "hour" header and properly aligned and similarly for power. I want that all the data … | |
I want to know how to check gracefully whether 2 sets are distinct or has at least 1 element in common. I don't want to find the common elements. Just knowing whether there is intersection or not is sufficient. May be I can do this using retainsAll but it changes … | |
[CODE] Set s = new HashSet(); if (s.retainAll(anotherSet)) { ... } [/CODE] now it anotherSet is null the code is showing nullPointerExcpetion. How can I make retainAll work whether anotherSet is null or not? | |
what is the difference between them when an entity is considered (EJB)? Thanks. | |
The following example is taken from GWT tutorial ([url]http://code.google.com/webtoolkit/doc/latest/tutorial/codeclient.html):[/url] [CODE]private void addStock() { final String symbol = newSymbolTextBox.getText().toUpperCase().trim(); newSymbolTextBox.setFocus(true); if (!symbol.matches("^[0-9A-Z\\.]{1,10}$")) { Window.alert("'" + symbol + "' is not a valid symbol."); newSymbolTextBox.selectAll(); return; } if (stocks.contains(symbol)) { newSymbolTextBox.selectAll(); return; } int row = stocksFlexTable.getRowCount(); stocks.add(symbol); stocksFlexTable.setText(row, 0, symbol); Button … | |
I installed J2EE SDK in windows 7 machine. But I can't seem to find the location of quite a things. In the J2EE tutorial, they mention there is something called J2EE_HOME. I don't seem to find it. There was a previous installation of J2SE sdk in program files. That is … | |
I was debugging a program and following is the snapshot: [CODE]81 while (j < len_y && suf_arr[j].word[0] == c) (gdb) 184 if (suf_arr[j].len > 1) (gdb) n 186 memcpy(temp_str, suf_arr[j].word+1, suf_arr[j].len-1); (gdb) n 187 ind = search(suf_arr, temp_str, len_y); (gdb) print suf_arr[j].word $13 = 0x7fffffff96d2 "bbit" (gdb) print suf_arr[j].word+1 $14 … | |
I see that there is only source that can be downloaded. As I don't have the root privilege, I can't compile and install apache. What alternative is there that would not require compiling and installing apache? | |
I have some web page which contains accented words (in french/italian etc) which I need to parse/extract and display. But the internationalization is not being taken into consideration so crazy characters are being shown. I searched in google for ruby internationalization but came up with rails internationalization. As you know … | |
I logged into a computer which is not mine. I know there is apache installed because when I type whereis apache it shows /etc/apache it has only a few files. I need to know where the htdocs directory is and also where http.conf file is. How do I accomplish this? … | |
Say I have an xml document contained in the variable xmlDoc Now if I send that to the server using [ICODE]xmlHttp.open("POST", url, true); xmlHttp.onreadystatechange = handleStateChange; xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"); xmlHttp.send(xmlDoc);[/ICODE] How is the serverside php code going to handle this? As form data are retrieved as fn = _POST["firstName"] if the … | |
I tried to use some online resources. All of them covers this much: 1. How to create xmlHttpRequest in cross-browser fashion. 2. How to define onreadystatechange function 3. how to call open and send 4. how to receive and use responsetext and responsexml 5. how to do the server side … | |
[CODE]for (i = 0;i < e;i++) { // take the excuse scanf(" %[^\n]", excuses[i]); excuse_count[i] = 0; while (sscanf(excuses[i], " %[a-zA-z]", word) != EOF) } [/CODE] The input was My dog ate my homework but at the while loop word is getting the word "My" in each loop. In case … | |
[CODE]template<class type> struct _binary_search_tree { type key; struct _binary_search_tree* parent; struct _binary_search_tree* left_child; struct _binary_search_tree* right_child; }; template<class type>void tree_insert(_binary_search_tree<type>** tree, type key); int main() { char number[10]; _binary_search_tree<char*> root; tree_insert(&root, number); }[/CODE] [QUOTE]compile error: 755.c:182: error: no matching function for call to ‘tree_insert(_binary_search_tree<char*>*, char [10])’[/QUOTE] Thanks. | |
I just copied and pasted all the things that has been happening from the shell here: [CODE]lin309-05:~/workspace/acm$ gdb a.out GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute … | |
If the string is input from stdin: [CODE]scanf(" %s %d", R, &n);[/CODE] then is it possible to get the length of R as a by product from scanf as it already has scanned through the input? As you can see there can be spaces in front and after words and … | |
[CODE]// this is overkill Date now = new Date(System.currentTimeMillis()); [/CODE] Why is this overkill? |
The End.