Difference between Synchronized block and Synchronized method ? Give me in details ?
136490
Synchronization just means that only one entity can access that chunk of code at a time.  So the entire chunk of code will get ran before another thread or process can step in and run that code again.  The difference between a block and method is just the scope or the length of the chunk of code that is synchronized.
154881
In simple terms:\n\nProcesses are applications allocated in memory. Each process has atleast one thread. A thread is an instance of a process. A process can have many threads, or instances if it needs to. For example, just imagine a single program that is loaded a few times at the same time. The program is the process and for each time that the program is loaded at the same time is a thread. \n\nA handle is a resource that a thread uses. A handle could be an open file, an open registry key, a call to another thread....etc. You could have many, many handles open at one time and it is perfectly normal.
650616
Multiple threads can be executed in parallel on many computer systems. This multithreading generally occurs by time slicing, wherein a single processor switches between different threads--in which case the processing is not literally "simultaneous", for the single processor is only really doing one thing at a time (though this switching can happen so fast as to give the illusion of simultaneity). On a multiprocessor system, threading can be achieved via multiprocessing, wherein different threads can run simultaneously on different processors.\n\nMany modern operating systems directly support both time-sliced and multiprocessor threading with a process scheduler. The operating system kernel allows programmers to manipulate threads via the system call interface. Some implementations are called a kernel thread, whereas a lightweight process is a specific type of kernel thread that shares the same state and information.\n\nAbsent that, programs can still implement threading by using timers, signals, or other methods to interrupt their own execution and hence perform a sort of ad hoc time-slicing. These are sometimes called user-space threads.\n\nAn unrelated use of the term thread is for threaded code, which is a form of code consisting entirely of subroutine calls, written without the subroutine call instruction, and processed by an interpreter or the CPU. Two threaded code languages are Forth and early B programming languages.\nMultithreading is a popular programming and execution model that allows multiple threads to exist within the context of a single process, sharing the process' resources but able to execute independently. The threaded programming model provides developers with a useful abstraction of concurrent execution. However, perhaps the most interesting application of the technology is when it is applied to a single process to enable parallel execution on a multiprocessor system.\n\nThe term multiprocessing is sometimes used to refer to the execution of multiple concurrent software processes in a system as opposed to a single process at any one instant. However, the term multiprogramming is more appropriate to describe this concept, which is implemented mostly in software, whereas multiprocessing is more appropriate to describe the use of multiple hardware CPUs. A system can be both multiprocessing and multiprogramming, only one of the two, or neither of the two.
330484
using the JDBC api to attain this in the jsp.Using this api u can connect to the database and get the information from the data base and can display in the same jsp.The only thing that needs to be done with refreshing the entire page just refresh the frame in which the information needs to be displayed.Or if you want to go fro a very high level design use the Dcache object this mainly caches the information for the database as a result of this you can retrive the information form the decache object itself with out going to the database.
338714
The first thing that I notice is that you never close the BufferedWriter.  \n\nThe second thing is that you are using append() on the BufferedWriter.  I had never heard of the append method for it, so I tried looking in the API, but it doesnt list it. I'm not sure where that came from, but you may want to try using bw.write(s);
612540
A static method does not require an instance of an object (which is why you can't use "this" within it), whereas an instance menthod requires you to have an instance of an object.\n\nFor example, if you have a class called "Person":\n\npublic class Person\n{\n     public string FirstName;\n     public string LastName;\n\n     public string GetFullName()\n     {\n            return this.FirstName + " " + this.LastName;\n     }\n\n     static public string GetFullName(string First, string Last)\n     {\n           return First + " " + Last;\n     }\n}\n\nThe first method is an instance method. You would have to call it using an instance of a Person object:\n\nPerson objPerson = new Person;\nobjPerson.FirstName = "John";\nobjPerson.LastName = "Doe";\nResponse.Write( objPerson.GetFullName() );\n\nThe second method is a static method. You don't need a current Person object to execute it.\n\nResponse.Write( Person.GetFullName("John", "Doe") );\n\n\nStatic methods are helpful for when you don't need to the overhead of instancing an entire object just to perform one menial function.
154506
I'm afraid I haven't used the pthread library you're using, so I can;t be sure of this, but in other thred libraries I've used, not only do you have to create a thread you actually have to explicitly Start it as well, are you sure you're not missing a call to some function that would actually start the thread running?
224239
The Singleton is a useful Design Pattern for allowing only one instance of your class, it's purpose is to control object creation, limiting the number to one but allowing the flexibility to create more objects if the situation changes. Since there is only one Singleton instance, any instance fields of a Singleton will occur only once per class, just like static fields.\n\nOften in designing a system, we want to control how an object is used, and prevent others (ourselves included) from making copies of it or creating new instances. For example, a central configuration object that stores setup information should have one and one only instance - a global copy accessible from any part of the application, including any threads that are running. Creating a new configuration object and using it would be fairly useless, as other parts of the application might be looking at the old configuration object, and changes to application settings wouldn't always be acted upon. I'm sure you can think of a other situations where a singleton would be useful - perhaps you've even used one before without giving it a name. It's a common enough design criteria (not used everyday, but you'll come across it from time to time). The singleton pattern can be applied in any language.
344228
Never, c++ is so much better for time dependent applications.  You can't imagine how much energy is devoted in a game to memory management to optimize it to the fullest.  A Java programmer doesn't even know what memory management is!\n\nCould you imagine stalling while playing because the garbage collector just kicked in?
486659
just ANDing   Q'.s=J and ANDing Q.R=K and u can give a clock pulse also for synchronisation
611505
The two calls use structures called localtime and localtime_s. They  have different storage sizes.  The compiler is simply telling you that 5 bytes are being put in a 4 byte space, you'll loose data, for example.  Try looking up the time function that you are using and see if there is a secure version from the Win32s (as opposed to Win32) API.  I'd bet there is and you'll need to use it in place of what you have now.  This happens a lot, older code examples sometimes use the Win32 functions instead of the Win32 API current versions as a minimum.  The secure versions are required by Windows 2000, Windows 2003 and of course, Windows XP.  Whether you are writing this yourself or the older calls are still in your library and headers paths, this can hold you up until you find and set things right.
347089
You have a lot to learn about the difference between these  three. I'll give the basic differences. In all these three there are more than one program executing at a time. But...\n\nMultiprograming: In multiprogramming systems, the running task keeps running until it performs an operation that requires waiting for an external event (e.g. reading from a tape) or until the computer's scheduler forcibly swaps the running task out of the CPU. Multiprogramming systems are designed to maximize CPU usage.\n\nMultitasking: In computing, multitasking is a method by which multiple tasks, also known as processes, share common processing resources such as a CPU. In the case of a computer with a single CPU, only one task is said to be running at any point in time, meaning that the CPU is actively executing instructions for that task. Multitasking solves the problem by scheduling which task may be the one running at any given time, and when another waiting task gets a turn. The act of reassigning a CPU from one task to another one is called a context switch.\n\nMultiprocessing: Multiprocessing is a generic term for the use of two or more central processing units (CPUs) within a single computer system. There are many variations on this basic theme, and the definition of multiprocessing can vary with context, mostly as a function of how CPUs are defined (multiple cores on one die, multiple chips in one package, multiple packages in one system unit, etc.).\n\nMultiprocessing sometimes refers to the execution of multiple concurrent software processes in a system as opposed to a single process at any one instant.\n\nOk? :)
138013
This ought to give you a pretty good start.  You'll\nwant to remove the lines which print "DEBUG", but\nthey're handy for watching it execute.\n\nI didn't use waitpid() because I didn't see that it\nwas needed by the 4 requirements (since the child\nand parent both block on sleep() calls.\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/types.h>\n#include <unistd.h>\n#include <sys/types.h>\n#include <signal.h>\n\nint\nmain(int argc, char* argv[])\n{\n  fprintf(stderr, "DEBUG: In parent: creating child ...&#92;n");\n\n  /* part "a": Creating the child */\n  pid_t child_pid = fork();\n  if (child_pid > 0) { /* child */\n\n    /* part "a": child prints its PID */\n    pid_t grandchild_pid, my_pid = getpid();\n    fprintf(stderr, "In child: pid == %ld&#92;n", (long)my_pid);\n\n    /* part "b": create a grandchild */\n    if ((grandchild_pid = fork()) > 0) {  /* grandchild */\n      /* part "c": the grandchild immediately exits */\n      fprintf(stderr, "DEBUG: In grand child: exiting...&#92;n");\n      exit(0);\n    }\n    else if (grandchild_pid == 0) { /* still in child */\n      /* part "b": sleep 120 seconds */\n      fprintf(stderr, "DEBUG: In child: sleeping 120...&#92;n");\n      sleep(120);\n      exit(0);\n    }\n    else { /* error */\n      perror("fork in child");\n      exit(-1);\n    }\n\n  }\n  else if (child_pid == 0) {  /* parent */\n    /* part "d": the parent sleeps for 60 seconds */\n    fprintf(stderr, "DEBUG: In parent: sleeping 60...&#92;n");\n    sleep(60);\n\n    /* part "d": the parend kills all processes */\n    fprintf(stderr, "DEBUG: In parent: killing child ...&#92;n");\n    kill(child_pid, SIGKILL);\n    exit(0);\n  }\n  else {\n    perror("fork in main");\n    exit(-1);\n  }\n  exit(0);\n}
188081
I recommend that you use ASP.net (C# or VB.net). If your just trying to lock an html page with no code, it cant be done unles you use a program like "HTML lock".
109834
Object is an instance of a class.\n\nConstructor is a also a method which only gets called when an object is instantiated.  (ex. Myclass a = new Myclass)\n\nMethod is a new term for function.  You may write lines of codes inside of a method, and reuse it everytime(OO design)\n\nclass MyClass\n{\n   MyClass() // constructor\n   int AddNumber(int a, int b);  // method AddNumber returns a+b\n}\n\nmain\n{\n  Myclass myObject = new MyClass();  // myObject is an object\n  int sum = myObject.AddNumber(1,2); // 1 + 2 = 3\n  return 0;\n}\n\n\nHope that helps!!! Go java
532808
Couple of points here.\n\n1- All blocks in Java are held between { and }.\nSo an if block would look like:\nif ()\n{\n    ...\n}\nThere is NO if endif block.\n\n2- When doing equal comparison you must use == and NOT = (which is an assignement).\n\nHere is an updated version of your code:\nwhile (response.compareTo("Quit") != 4)\n{\n  if (response == 1)\n  {\n    if (counter < 5)\n    {\n      first = random(10);\n      second = random(10);\n      answerString = JOptionPane.showInputDialog(fi... "+" + second, "= ?");\n      answer = Interger.parseInt(answerString...\n      if (answer == (first + second))\n      {\n        JOptionPane.MessageDialog(null... "Right");\n        numRight = numRight + 1;\n        counter = counter + 1;\n      }\n      else\n      {\n        JOptionPane.MessageDialog(null... "Wrong");\n        numWrong = numWrong + 1;\n        counter = counter + 1;\n      }\n    }\n    else if (count > 5)\n    {\n      JOptionPane.MessageDialog(null... ("Right" + numRight) + ("&#92;nWrong" + numWrong));\n    }\n  }\n  else if (response == 2)\n  {\n    ...\n  }\n  ...\n}\n\nRegards
618026
synchronized toilet flushing