To split the Even and Odd elements into two different lists, the Java code is as follows −Example Live Demoimport java.util.Scanner; public class Demo{ public static void main(String[] args){ int n, j = 0, k = 0; Scanner s = new Scanner(System.in); System.out.println("Enter the number of elements required :"); n = s.nextInt(); int my_arr[] = new int[n]; int odd_vals[] = new int[n]; int even_vals[] = new int[n]; System.out.println("Enter the elements of the array(even and add numbers) ... Read More
“Private Browsing” a very useful feature of all web browsers have been used very commonly and frequently by internet lovers, such as Internet Explorer, Mozilla Firefox, Google Chrome and Opera.“Private browsing” facilitates users to surf on Internet without leaving any traces in the computer. The browser that uses private browsing doesn’t leave the history of the websites you visit, files you download, forms you fill, your searches, etc.The best thing about “Private browsing” is very much useful for public computer.Private browsing feature is similar to the name of the “Incognito mode” in Google Chrome, “InPrivate” in Internet Explorer, etc.Official Definitions ... Read More
To generate random numbers in a given range, the Java code is as follows −Example Live Demoimport java.util.Random; import java.util.*; public class Demo{ public static void main(String args[]){ Random my_rand = new Random(); List my_list_1 = new ArrayList(); int v_1 = my_rand.nextInt(1000); int v_2 = my_rand.nextInt(967); int v_3 = my_rand.nextInt(1050); int v_4 = my_rand.nextInt(10000); int v_5 = my_rand.nextInt(100); my_list_1.add(v_1); my_list_1.add(v_2); my_list_1.add(v_3); my_list_1.add(v_4); my_list_1.add(v_5); ... Read More
This example demonstrates how do I add a button to PreferenceScreen in android.Step 1 − Create a new project in Android Studio, go to File rArr; New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.javaimport android.os.Bundle; import android.widget.Toast; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); getSupportFragmentManager().beginTransaction().replace(R.id.settings, new SettingsFragment()).commit(); ... Read More
In this tutorial, we are going to write a program that flattens a list that contains sub-lists. Given number flatten the sublists until the given number index as parts. Let's see an example to understand it clearly.Inputlists = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]] number = 2Output[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10]]Let's see the steps to solve the problem.Initialize the list and number.Initialize an empty list.Iterate over the list with range(0, len(lists), number.Get the sublists using slicing lists[i:number].Iterate over the sublists and append the resultant list to the result list.Print the result.Example# ... Read More
Current Facebook page has introduced new chat sidebar and video chat feature. This chat sidebar is placed at the right-side of the Facebook pages. Friends with whom you chat always displays at the chat sidebar, by default.Facebook has also introduced the sidebar ticker for a small period of time. You can also disable Facebook sidebar Ticker. Like this; Facebook always come up with new and changed features, but it does not mean Facebook lover will like those new and changed features. That’s why, we still have an option to revert back to the old Facebook design and this article will ... Read More
In this tutorial, we are going to write a program that groups all the tuples from a list that have same element as a second element. Let's see an example to understand it clearly.Input[('Python', 'tutorialspoints'), ('Management', 'other'), ('Django', 'tutorialspoints'), ('React', 'tutorialspoints'), ('Social', 'other'), ('Business', 'other')]Output{'tutorialspoint': [('Python', 'tutorialspoints'), ('Django', 'tutorialspoints'), ('React', 'tutorialspoints')], 'other’: [('Management', 'other'), ('Social', 'other'), ('Business', 'other')]}We have to group the tuples from the list. Let's see the steps to solve the problem.Initiate a list with required tuples.Create an empty dictionary.Iterate through the list of tuples.Check if the second element of the tuple is already present in the dictionary ... Read More
If, you like to start podcast with excellent audio files and don’t know how to initiate it, also don’t know how Google Hangouts On Air play an important role for podcast?Here is the solution; start podcast with excellent audio files using Google Hangouts on air provides many ways to create audio, video and better SEO.In this post, you will get to know how to create more active podcasts using the built-in features of Google Hangouts on Air.Podcasts with Google Hangouts on AirGenerally, Skype is more than sufficient for interview-based podcasts. For OS, Mac uses eCamm’s Skype Call Recorder andWindow uses ... Read More
In this tutorial, we are going to learn how to use PostgreSQL with Python. You have to install certain thing before going into the tutorial. Let's install them.Install the PostgreSQL with the guide..Install the Python module psycopg2 for PostgreSQL connection and working. Run the command to install it.pip install psycopg2Now, open the pgAdmin. And create a sample database. Next, follow the below steps to get started with database operations.Import the psycopg2 module.Store the database name, username, and password in separate variables.Make a connection to the database using psycopg2.connect(database=name, user=name, password=password) method.Instantiate a cursor object to execute SQL commands.Create queries and ... Read More
No drought, Gmail provides beautiful templates. But, are you tired of selecting the same template for typing, sending and by seeing the same emails every day?Every day, you know what kind of canned reply goes to whom, e.g. a thanking note every day goes to the candidate apply for a job opening. In this case, CC and BCC does not work.Canned response: If you type and send same message every day, canned response takes care of that. You just have to introduce your canned response and adjust the email to personalize it accordingly.Deliver the same message multiple timesChange your settings ... Read More