Masking of Lower and Higher Nibbles of 8-Bit Number in 8085

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

3K+ Views

In this program we will see how to lower and upper nibbles are masked in 8085.Problem StatementWrite 8085 Assembly language program to mask the upper and lower nibble of an 8-bit number. The number is stored at location 8000H. Lower and Upper nibbles will be stored at location 8001H and 8002H.DiscussionThe masking is basically ANDing two numbers. When we want to mask the upper nibble of an 8-bit number say 2D (0010 1101), then we will AND with 0F (0000 1111), so we will get 0D (0000 1101). By masking with F0 (1111 0000), the result will be 20 (0010 ... Read More

Retrieve Queried Element in Object Array in MongoDB Collection

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

316 Views

You can use projection operator $elemMatch to filter in queried element in an object array in MongoDB collection. To retrieve only the queried element in an object array in MongoDB, let us first create a collection with documents object array.The query is as follows:> db.objectArray.insert({"Persons":[    {"PersonName":"Adam", "PersonSalary":25000}, {"PersonName":"Larry", "PersonSalary":27000    }]});    WriteResult({ "nInserted" : 1 }) > db.objectArray.insert({"Persons":[    {"PersonName":"David", "PersonSalary":32000}, {"PersonName":"Carol", "PersonSalary":77000    }]});    WriteResult({ "nInserted" : 1 })Now you can display all the documents with the help of find(). The query is as follows:> db.objectArray.find().pretty();The following is the output:{    "_id" : ObjectId("5c6bfadc68174aae23f5ef53"),    "Persons" ... Read More

Use setProperty Action in JSP

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

1K+ Views

The setProperty action sets the properties of a Bean. The Bean must have been previously defined before this action. There are two basic ways to use the setProperty action −You can use jsp:setProperty after, but outside of a jsp:useBean element, as given below − ... In this case, the jsp:setProperty is executed regardless of whether a new bean was instantiated or an existing bean was found.A second context in which jsp:setProperty can appear is inside the body of a jsp:useBean element, as given below − ... Here, the jsp:setProperty is executed only if ... Read More

Format Date in JSP

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

5K+ Views

The tag is used to format dates in a variety of ways.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueDate value to displayYesNonetypeDATE, TIME, or BOTHNodatedateStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNodefaulttimeStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNodefaultpatternCustom formatting patternNoNonetimeZoneTime zone of the displayed dateNoDefault time zonevarName of the variable to store the formatted dateNoPrint to pagescopeScope of the variable to store the formatted dateNopageThe pattern attribute is used to specify even more precise handling of the date −CodePurposeSampleGThe era designatorADyThe year2002MThe monthApril & 04dThe day of the month20hThe hour(12-hour time)12HThe hour(24-hour time)0mThe minute45sThe second52SThe millisecond970EThe day of the weekTuesdayDThe day of ... Read More

LocalDate getEra Method in Java

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

87 Views

The era for a particular LocalDate can be obtained using the getEra() method in the LocalDate class in Java. This method requires no parameters and it returns the era applicable for the LocalDate.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalDate ld = LocalDate.parse("2019-02-14"); System.out.println("The LocalDate is: " + ld); System.out.println("The era is: " + ld.getEra()); } }OutputThe LocalDate is: 2019-02-14 The ... Read More

SetAtx Method of the Ennead Tuple in Java

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

118 Views

To set Ennead value in Java, you need to use the setAtX() method. Here, X represents the index wherein you need to set the value i.e. for index 1, use setAt1() method. Set the value as the parameter value of the method.Let us first see what we need to work with JavaTuples. To work with Ennead class in JavaTuples, you need to import the following package −import org.javatuples.Ennead;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 ... Read More

Add Date and Time Fields to Get DATETIME Field in MySQL

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

1K+ Views

You can use CONCAT() function to set date and time fields to get DATETIME field.Let us create a demo tablemysql> create table getDateTimeFieldsDemo -> ( -> ShippingDate date, -> ShippingTime time, -> Shippingdatetime datetime -> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into getDateTimeFieldsDemo(ShippingDate, ShippingTime) values('2018-01-21', '09:45:34'); Query OK, 1 row affected (0.16 sec) mysql> insert into getDateTimeFieldsDemo(ShippingDate, ShippingTime) values('2013-07-26', '13:21:20'); Query OK, 1 row affected (0.13 sec) mysql> ... Read More

Handle Orientation Change in Android

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

2K+ Views

This example demonstrate about How to handle orientation change androidStep 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 text view to show orientation changes.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView actionEvent;    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)    @Override    protected void onCreate(Bundle ... Read More

Shift Array Elements to the Right in Java

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

470 Views

Let us first create an int array −int[] arr = { 10, 20, 30, 40, 50, 60, 70, 80, 90 };Now, shift array elements to the right with arraycopy() and placing the elements correctly so that it gets shifted to the right −System.arraycopy(arr, 0, arr, 1, arr.length - 1);Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] argv) throws Exception {       int[] arr = { 10, 20, 30, 40, 50, 60, 70, 80, 90 };       System.out.println("Initial array..."+Arrays.toString(arr));       System.arraycopy(arr, 0, arr, 1, arr.length - 1);       System.out.println("Array after shifting to the right...");       System.out.println(Arrays.toString(arr));    } }OutputInitial array... [10, 20, 30, 40, 50, 60, 70, 80, 90] Array after shifting to the right... [10, 10, 20, 30, 40, 50, 60, 70, 80]

Storage of Integer and Character Values in C

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

1K+ Views

We have used the integer and character variables many times in our program. Here we will see how they are stored in the memory.In C the character values are also stored as integers. In the following code, we shall put 270 into a character type data. So the binary equivalent of 270 is 100001110, but takes only first 8-bits from right. So the result will be (00001110), that is 14. Then stores the value into variable a. It also gives warning for overflow.In the next variable y, we are trying to store negative number say -130. The negative number will ... Read More

Advertisements