Set Locate to Identify Required Resource Bundle in JSP

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

213 Views

The tag is used to store the given locale in the locale configuration variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueSpecifies a two-part code that represents the ISO-639 language code and an ISO-3166 country code.Yesen_USvariantBrowser-specific variantNoNonescopeScope of the locale configuration variableNoPageExampleResource bundles contain locale-specific objects. Resource bundles contain key/value pairs. When your program needs a locale-specific resource, you keep all the keys common to all the locale but you can have translated values specific to locale. Resource bundles helps in providing content specific to locale.A Java resource bundle file contains a series of key-to-string mappings. The method that we ... Read More

Sort a Stack in Android

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

138 Views

This example demonstrate about How to Sort a stack in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show sorted stack.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.Stack; public class MainActivity extends AppCompatActivity {   ... Read More

SetAtX Method of the Octet Tuple in Java

Smita Kapse
Updated on 30-Jul-2019 22:30:25

134 Views

The setAtX() method is used to set Octet value in Java. Here, X is the index wherein you need to set the value i.e. to set value at index 1, use the setAt1() and value as a parameter.Let us first see what we need to work with JavaTuples. To work with Octet class in JavaTuples, you need to import the following package −import org.javatuples.Octet;Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. ... Read More

std::vector Resize vs std::vector Reserve in C++

Samual Sam
Updated on 30-Jul-2019 22:30:25

3K+ Views

Vectors have the ability to resize itself automatically like dynamic arrays when an element is inserted or deleted, the container handle their storage automatically.The main difference between vector resize() and vector reserve() is that resize() is used to change the size of vector where reserve() doesn’t. reserve() is only used to store at least the number of the specified elements without having to reallocate memory. But in resize() if the number is smaller than the current number then it resizes the memory and deletes the excess space over it.vector::resize()Vector resize() is used to change its size.ExampleSteps in the source code:Begin ... Read More

Restrict UITextField to Take Only Numbers in Swift

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

6K+ Views

In iOS apps sometimes we need to restrict our text field to take only numbers as an input, this can be done in several ways, let’s see some of them.Method 1: Changing the Text Field Type from storyboard.Select the text field that you want to restrict to numeric input.Go to its attribute inspector.Select the keyboard type and choose number pad from there.Method 2: Programmatically limiting inputs to number.Select the text fieldCreate its outlet in the view controller.Conform the view controller to UITextFieldDelegateSet the text field’s delegateAdd the following functionfunc textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool ... Read More

Loop Through Collections with a Cursor in MongoDB

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

2K+ Views

Following is the syntax to loop through collections with cursorvar anyVariableName1; var anyVariableName2= db.yourCollectionName.find(); while(yourVariableName2.hasNext()) {    yourVariableName1= yourVariableName2.next(); printjson(yourVariableName1); };Let us create a collection with documents. Following is the query> db.loopThroughCollectionDemo.insertOne({"StudentName":"John", "StudentAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ca81f2d6669774125247f") } > db.loopThroughCollectionDemo.insertOne({"StudentName":"Larry", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ca8272d66697741252480") } > db.loopThroughCollectionDemo.insertOne({"StudentName":"Chris", "StudentAge":25}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ca8462d66697741252481") } > db.loopThroughCollectionDemo.insertOne({"StudentName":"Robert", "StudentAge":24}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ca8632d66697741252482") }Following is the query to display all documents from a collection with the help of find() method> db.loopThroughCollectionDemo.find().pretty();This will ... Read More

Rename Function in C/C++

Anvi Jain
Updated on 30-Jul-2019 22:30:25

398 Views

The C library function int rename(const char *old_filename, const char *new_filename) causes the filename referred to by old_filename to be changed to new_filenameFollowing is the declaration for rename() function.int rename(const char *old_filename, const char *new_filename)The parameters are old_filename − This is the C string containing the name of the file to be renamed and/or moved, new_filename − This is the C string containing the new name for the file.On success, zero is returned. On error, -1 is returned, and errno is set appropriately.Example#include int main () {    int ret;    char oldname[] = "file.txt";    char newname[] = ... Read More

Generation of Time Delay in 8085

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

30K+ Views

In this section we will see how to generate the time delay using 8085 programs. The delay will be used in different places to simulate clocks, or counters or some other area.When the delay subroutine is executed, the microprocessor does not execute other tasks. For the delay we are using the instruction execution times. executing some instructions in a loop, the delay is generated. There are some methods of generating delays. These methods are as follows.Using NOP instructionsUsing 8-bit register as counterUsing 16-bit register pair as counter.Using NOT instructions:One of the main usage of NOP instruction is in delay generation. ... Read More

Addressing Modes in 8086 Microprocessor

Chandu yadav
Updated on 30-Jul-2019 22:30:25

3K+ Views

In this section we will see the addressing modes of Intel 8086 microprocessor.There are eight addressing modes in 8086 MPU. These modes are:Immediate Addressing ModeRegister Addressing ModeDirect Addressing ModeRegister Indirect Addressing ModeBased Addressing ModeIndexed Addressing ModeBased-Index Addressing ModeBased-Index with displacement addressing modeImmediate AddressingThe addressing mode in which the data operand is a part of the instruction itself is known as immediate addressing mode.MOV CX, 4929 H, ADD AX, 2387 H, MOV AL, FFH  Register AddressingIt means that the register is the source of an operand for an instruction.MOV CX, AX; copies the contents of the 16-bit AX register into; the ... Read More

Fetch Value in a Java Pair Class Tuple

Samual Sam
Updated on 30-Jul-2019 22:30:25

484 Views

Use the getValueX() method to fetch the value from Pair Tuple class in Java at a particular index. For example, getValue0().Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program. If you are using Eclipse IDE to run Pair Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Pair; public class Demo { ... Read More

Advertisements