Use Android Text-to-Speak from Singleton

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

201 Views

Before getting into example, we should know what singleton design pattern is.  A singleton is a design pattern that restricts the instantiation of a class to only one instance. Notable uses include controlling concurrency, and creating a central point of access for an application to access its data store.This example demonstrates How to use Android TEXT TO SPEAK from SingletonStep 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 ... Read More

IselIgnored Attribute in JSP

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

7K+ Views

The isELIgnored attribute gives you the ability to disable the evaluation of Expression Language (EL) expressions which has been introduced in JSP 2.0.The default value of the attribute is true, meaning that expressions, ${...}, are evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated but rather treated as static text.Following directive sets an expression not to be evaluated −

Test XPath Expression in JSP

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

254 Views

The tag evaluates a test XPath expression and if it is true, it processes its body. If the test condition is false, the body is ignored.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultselectThe XPath expression to be evaluatedYesNonevarName of the variable to store the condition's resultNoNonescopeScope of the variable specified in the var attributeNoPageExampleFollowing is an example that show the use of the tag −           JSTL x:if Tags               Books Info:                           ... Read More

Create Label-Value Tuple in Java

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

103 Views

You can create a LabelValue tuple using the with() method or using just the constructor. Let us first see what we need to work with JavaTuples. To work with LabelValue class in JavaTuples, you need to import the following packageimport org.javatuples.LabelValue;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. Refer the below guide for all the steps to run JavaTuplesSteps: How to run JavaTuples program in EclipseThe following is an example to create ... Read More

Add Elements to AbstractCollection Class in Java

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

133 Views

To add elements to the AbstractCollection class, use the add() method. For example −absCollection.add("These"); absCollection.add("are"); absCollection.add("demo");To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;The following is an example to add elements to AbstractCollection class in Java −Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo {    public static void main(String[] args) {       AbstractCollection absCollection = new ArrayList();       absCollection.add("These");       absCollection.add("are");       absCollection.add("demo");       absCollection.add("elements");       System.out.println("Displaying elements in the AbstractCollection: " + absCollection);    } }OutputDisplaying elements in the AbstractCollection: [These, ... Read More

List All Collections in the Mongo Shell

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

7K+ Views

To list all collections in Mongo shell, you can use the function getCollectionNames().The syntax is as follows −db.getCollectionNames();You can use another command which is collections. The syntax is as follows −show collections;To list all collections in Mongo, use the above two functions. The query is as follows −> db.getCollectionNames();The following is the output −[    "ConvertStringToDateDemo",    "IdUpdateDemo",    "ProductsInformation",    "addFieldDemo",    "addNewFieldToEveryDocument",    "arrayInnerElementsDemo",    "arrayLengthGreaterThanOne",    "arrayOfArraysDemo",    "caseInsensitiveDemo",    "changeDataType",    "changeType",    "charactersAllowedDemo",    "charactersDemo",    "checkFieldContainsStringDemo",    "checkSequenceDemo",    "combinationOfArrayDemo",    "conditionalSumDemo",    "convertStringToNumberDemo",    "copyThisCollectionToSampleDatabaseDemo",    "countDemo",    "createSequenceDemo",    "distinctCountValuesDemo",    "distinctRecordDemo", ... Read More

Check Replication Type in MySQL

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

444 Views

To check replication type, you can use SHOW GLOBAL VARIABLES command. The syntax is as follows −SHOW GLOBAL VARIABLES LIKE 'binlog_format';The above syntax returns either ROW, MIXED or STATEMENT. The default resultant is ROW.Now you can implement the above syntax to check replication type. The query is as follows −mysql> SHOW GLOBAL VARIABLES LIKE 'binlog_format';Here is the output −+---------------+-------+ | Variable_name | Value | +---------------+-------+ | binlog_format | ROW | +---------------+-------+ 1 row in set (0.10 sec)Here is the query to switch from ROW to STATEMENT −mysql> SET GLOBAL binlog_format = 'STATEMENT'; Query OK, 0 rows affected (0.04 ... Read More

Set Find Function in C++ STL

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

603 Views

Set find() function in C++ STL returns an iterator to the element which is searched in the set container. The iterator points to the position just after the last element in the set, if the element is not found.AlgorithmBegin    Define function printS() to print elements of set container.    initialize an empty set container s. Insert some elements in s    set container. Call function to print elements of set container.    Call the set find() function to find an element from s set container.    If element is in the set then       Print elememt is ... Read More

Optimization Tips for Python Code

Nitya Raut
Updated on 30-Jul-2019 22:30:25

338 Views

Though we all know python is not as fast or efficient as other complied languages. However, there are many big companies which shows us that python code can handle much bigger workload which shows it’s not that slow. In this section, we are going to see some of the tips that one should keep in mind so that a correct python program runs even faster and more efficient.Tip 1: Go for built-in functionsThough we can write efficient code in python, but it’s very hard to beat built-in functions(which are written in C). Below image shows the list of python built-in ... Read More

Send Message Through WhatsApp in Android

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

1K+ Views

This example demonstrate about sending message through WhatsApp in 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.Step 3 − Add the following code to src/MainActivity.java import android.app.Activity; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity {    TextView textView;    @Override    public void onCreate(Bundle savedInstanceState) {       ... Read More

Advertisements