Posts

Spring Bean Scopes

Spring Bean Scope In the spring bean configurations, bean attribute called 'scope' defines what kind of object has to created and returned. There are 5 types of bean scopes available, they are: 1) singleton:  Returns a single bean instance per Spring IoC container. 2) prototype:  Returns a new bean instance each time when requested. 3) request:  Returns a single instance for every HTTP request call. 4) session:  Returns a single instance for every HTTP session. 5) global session:  global session scope is equal as session scope on portlet-based web applications. If no bean scope is specified in bean configuration file, then it will be by default 'singleton'. The scope of a bean defines the life cycle and visibility of that bean in the contexts in which it is used. Spring defines 5 types of scopes: singleton prototype request session globalSession When defining a <bean> in Spring, you have the option of declaring a s...

HTML Forms

HTML Forms Text Box: The size Attribute The size attribute specifies the size (in characters) for the input field. The maxlength Attribute The maxlength attribute specifies the maximum allowed length for the input field. <form action="">           First Name: <input type="text" name="firstname" value="Piyush" size="40"><br/>           Last Name: <input type="text" name="lastname" maxlength="10"> </form> Example: <form action="" method="">   First name:<input type="text" name="fname"><br>   Last name: <input type="text" name="lname"><br>   E-mail: <input type="email" name="email" ><br>   <input type="submit"> </form> Combo Box/List Box: The <select> Element The <select>...

Memory Allocation in C/C++

Memory Allocation in C/C++ What is memory Allocation? There are two ways via which memories can be allocated for storing data. The two ways are: 1.       Compile time allocation or static allocation of memory: where the memory for named variables is allocated by the compiler. Exact size and storage must be known at compile time and for array declaration the size has to be constant. 2.       Run time allocation or dynamic allocation of memory: where the memory is allocated at run time and the allocation of memory space is done dynamically within the program run and the memory segment is known as heap or the free store. In this case the exact space or number of item does not have to be known by the compiler in advance. Pointers play a major role in this case. What is Dynamic memory allocation? Programmers can dynamically allocate storage space while the program is running, but programmers cannot create new v...