Rage of Demons: Session 4

In the previous session the players had reached the duergar city of Gracklstugh, and had started to explore the Whorlstone Tunnels. Unfortunately their companion who had told them that they could find a way to the surface had turned out to be a mad serial killer who had just wanted to get to the tunnels for his own reasons. But they continued to search the tunnels, having been asked to find out about the Grey Ghosts, a thieves guild of renegade duergar and derro.

After some exploration they found an alchemist of the Grey Ghosts and some duergar, which they captured. Having also found a shortcut back to the city, they brought the prisoners to the Keepers of the Flame. There they found out that the Keepers suspected the Grey Ghosts of having stolen a red dragon egg from Themberchaud, the dragon of the city, and were told to go back and look for it.

This time the group collected some of the mushrooms that could grow or shrink people, and used them to explore the narrower tunnels. That way they managed to sneak up on a group of enemies they hadn’t really been looking for: Cultists of Demogorgon, who were doing a ritual that apparently was responsible for the curse that made the giants sprout a second head and go rampant. They killed the cultists and reversed the ritual.

Finally they found the dragon egg with the leader of the Grey Ghosts near a strange obelisk, guarded by a spectator. The Grey Ghost turned out to be annoying due to his Blink spell. But in the end they killed him and his pet spectator, and got the red dragon egg. They found that the obelisk was a teleport out of the city, so if they had wanted they could have kept the egg and raised a dragon baby. But instead they brought the egg to the dragon (and not his keepers), who promptly destroyed the egg, as he suspected his keepers to use it to replace him.

So they left the city and traveled north towards Neverlight Grove. They only had two NPC companions left, who were myconids and wanted to go home. And Blingdenstone, the deep gnome city north of Neverlight Grove, was their best hope of finding a way back to the surface.

[Note that this journal entry is somewhat abbreviated, as there was a lot of dungeon exploring and fighting going on, which I didn’t want to recount in detail.]

Microsoft SQL Server Installation

MS SQL Server


Microsoft SQL Server is a Relational Database Management System (RDBMS) developed by Microsoft. It is a highly scalable product that can be run on anything from a single laptop, to a network of high-powered cloud servers, and anything in between.

Of course, by “anything”, it still needs to satisfy the usual hardware and software requirements, but these requirements are reasonably modest, considering what SQL Server is capable of.
SQL Server is the 1 of the most-used database in the world. Well, according to Microsoft it is! But they could be right – it’s certainly widely used.

While it’s core function is that of an RDBMS, SQL Server has become much more than that. SQL Server 2014 includes built-in business intelligence tools, as well as a range of analysis and reporting tools. 
This is on top of the database management tools such as database creation, backup, replication, security, and more.

MS Sql Server provides different server type as per users requirement i.e  Database Engine, Analysis service, Reporting service,Integration Service.

Database Engine :
SQL Server comes with a number of tools to help you with your database administration and programming tasks.
Some typical database administration and programming tasks could include: 

Fig 1 : MS SQL Server Architecture

  • Create & maintain databases
  • Create & maintain tables
  • Create & maintain other database objects such as stored procedures, views, etc
  • Create & maintain and schedule data backups
  • Replication (eg, create a copy of database.
  • Create & maintain users, roles, etc
  • Optimization tasks

2. Edition’s

SQL Server 2014 comes in three principal editions and three specialized editions. The edition you choose will depend on your (or your organization’s) requirements. 
You could also download an trial evaluation copy of SQL Server 2014 for 180 days.

Principal Editions :                                            Special Editions

1. Enterprise Edition                                             1. Developer Edition (viz. Compact Edition)

2. Standard Edition                                               2. Web Edition
3. Business Intelligence Edition                            
3. Express Edition

Download SQL Server Express Edition :


Versions of Express Edition :

1. SQL Server Express
This is the core Express database server. Use this if you need to accept remote connections or administer remotely and do not need the tools or advanced services.
2. SQL Server Management Studio
Does not contain the SQL Server database, only the tools to manage SQL Server instances, including LocalDB, SQL Express, SQL Azure, etc. Use this if you already have the SQL Server database and only need the management tools.
3. SQL Server Express with Tools
Contains the core SQL Server database along with the tools to manage SQL Server instances including SQL Server Express, LocalDB, and SQL Azure.
4. SQL Server Express LocalDB (MSI installer)
Lightweight version of SQL Server Express that has all its programmability features yet it runs in user mode and has a fast, zero-configuration installation. No management tools are included.
5. SQL Server Express with Advanced Services
Includes the database engine, Express Tools, Reporting Services, Full Text Search, management tools, and all the components of SQL Server Express.

3. Installation

SQL Server supports two types of installation −
  • Standalone
  • Cluster based
  1. Check if your account is in admin group to run setup.exe file.
  2. Software location.
  • Which version, edition, SP and hotfix if any.
  • Service accounts for database engine, agent, SSAS, SSIS, SSRS, if any.
  • Named instance name if any.
  • Location for binaries, system, user databases.
  • Authentication mode.
  • Collation setting.
  • List of features.


  1. Setup support files.
  2. .net framework 4.0.
  3. SQL Server native client.
  4. Windows installer 4.5/later version.
  5. Windows PowerShell 2.0.


Step 1 : Double click on the installation file (SQLEXPRWT_x64_ENU   & SQLManagementStudio_x64_ENU.exe)

Step 2 : 1.When prompted to Choose Directory for Extracted Files, click OK to use the default directory, or click Browse… and select a different directory:

Step 3 :You will be asked to perform a new stand-alone installation, click New SQL Server standalone installation or add features to an existing installation:

Step 4 :
Accept the licence terms and click Next:

Step 5: At the Feature Selection screen, select or deselect the features you’d like to include or exclude

Step 6 : Specify the instance path (or leave it at the default) and click Next:

Step 7 : On the Server configuration screen, you can specify user accounts and startup type, or simply leave it at the default configuration

Step 8 : Once complete, you may be asked to restart your computer. Click OK and restart the computer.

Fig 2 : Install Window
Step 9 : Select SQL Server feature installation option and click Next.

Step 10 : Select Database engine services checkbox and click Next.

Step 11 : Click Next on the above screen and the following screen appears.

Step 12 : Make sure the correct collation selection is checked in previous step and click Next.

Step 13 : Make sure authentication mode selection and administrators are checked and click Data Directories.

Step 14 : Click Next on the above screen.

Step 15 : Make sure to check the above selection correctly and click Install.

Rupert Murdoch Seems to Have Forgotten That He Fired Bill O’Reilly

The only sexual-harassment problem they’ve had at Fox News was Roger Ailes, he said.

In light of the news that the Walt Disney Company had reached a deal to acquire most of 21st Century Fox, executive co-chairman Rupert Murdoch spoke to Sky News TV about the move and other business matters at the empire.

But when the topic of sexual harassment allegations came up and whether they affected the network, Murdoch called the accusations “nonsense.”

“It’s all nonsense,” he said. “There was a problem with our chief executive, over the year, isolated incidents.” Former Fox News CEO Roger Ailes stepped down in 2016 after over 20 women accused him of sexual harassment, and News Corp paid $45 million in settlements related to those allegations. Upon his departure, Ailes was awarded a $40 million exit package.

Murdoch told Sky News TV, “As soon as we investigated he was out of the place in hours — well three or four days. And there has been nothing else since then.”

Since then, since Ailes left News Corp, there has actually been quite a bit else.

The network’s biggest star, Bill O’Reilly was fired in April following numerous sexual harassment allegations and after the New York Times discovered that Fox had paid at least $13 million in settlements over complaints made against him. The network also terminated host Eric Bolling in September, after Huff Post reported that Bolling had sent unsolicited pictures of his genitalia to at least three female colleagues. Host Chris Payne was also suspended this summer after allegations of sexual harassment. He was later reinstated.

Murdoch claims the accusations were “largely political because we are conservative. The liberals are going down the drain. NBC is in deep trouble.”

The media industry, like Hollywood, the food industry and politics, has come under scrutiny for a culture of predation by men in power and systematic sexual misconduct. From NBC’s Matt Lauer, to CBS’s Charlie Rose, to PBS’s Tavis Smily, allegations of sexual harassment or assault have not been confined to conservatives. But to ignore how pervasive allegations specifically at Fox News have been is a very selective understanding of this current moment.

“There are really bad cases and people should be moved aside,” Murdoch said. “There are other things — which probably amount to a bit of flirting.” According to Sky News, the 86-year-old said that he did not believe sexual misconduct allegations had “affected investor sentiment towards his businesses.”



Related Stories

  • Sean Hannity Has a Long, Revolting History of Undermining Women Who Report Sexual Abuse
  • 12 Most Insane Rules From the Biggest Neo-Nazi Website on the Internet
  • Rupert Murdoch’s Appalling Corporate Legacy: An International Empire of Sexual Harassment and Law Breaking

Multiplayer today

In the movie Full Metal Jacket one character says that he wants to go to interesting places, meet interesting people, and kill them. When I look at the list of Steam’s best selling games in 2017, it appears that this is what most people want: Multiplayer gaming today appears to be nearly exclusively about going to interesting virtual places, meeting interesting people online, and then killing them. In games that have some form of collaboration (to kill other players), collaboration is often the weakest point of the game, leading to much toxicity and hate. Hate towards your team mates, not the opponents, mind you. I’m a bit depressed about what our gaming behavior says about us as the human race.

Where are the massively multiplayer online city building games? Multiplayer online survival games in which people cooperate instead of torturing each other? Why did MMORPGs basically die out as a genre on Steam? How did humanity evolve and create civilization in real life, but fail to do so in virtual worlds? I really think that game designers missed something big here: In real life the incentives obviously favor collaboration over bashing each others head in; how great could a video game be if it could manage to reproduce those incentives and create virtual worlds in which people want to cooperate?

JSON – PHP : work BeaUtifuLLy

JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Conventions used by JSON are known to programmers, which include C, C++, Java, Python, Perl, etc.

  • JSON stands for JavaScript Object Notation.
  • The format was specified by Douglas Crockford.
  • It was designed for human-readable data interchange.
  • It has been extended from the JavaScript scripting language.
  • The filename extension is .json.
  • JSON Internet Media type is application/json.
  • The Uniform Type Identifier is public.json.

Uses of JSON

  • It is used while writing JavaScript based applications that includes browser extensions and websites.
  • JSON format is used for serializing and transmitting structured data over network connection.
  • It is primarily used to transmit data between a server and web applications.
  • Web services and APIs use JSON format to provide public data.
  • It can be used with modern programming languages.

Characteristics of JSON

  • JSON is easy to read and write.
  • It is a lightweight text-based interchange format.
  • JSON is language independent.

Why use JSON?

Since the JSON format is text only, it can easily be sent to and from a server, and used as a data format by any programming language.
JavaScript has a built in function to convert a string, written in JSON format, into native JavaScript objects:
So, if you receive data from a server, in JSON format, you can use it like any other JavaScript object.

JSON Syntax:

JSON syntax is derived from JavaScript object notation syntax:
  • Data is in name/value pairs
  • Data is separated by commas
  • Curly braces hold objects
  • Square brackets hold arrays
Below is a simple example −
"book": [

"language": "Java",
"creator": "James Gosling"

"language": "PHP",
"creatoR": "Rasmus Lerdorf"


Let’s see how to encode and decode JSON objects using PHP programming language.

JSON Functions

PHP has some built-in functions to handle JSON.

Encoding JSON in PHP (json_encode)

PHP json_encode() function is used for encoding JSON in PHP. This function returns the JSON representation of a value on success or FALSE on failure.
string json_encode ( $value [, $options = 0 ] )
value − The value being encoded. This function only works with UTF-8 encoded data.

The following example shows how to convert an array into JSON with PHP −
$myObj->course = "Rocky Jagtiani";
$myObj->age = 39;
$myObj->city = "Chembur";

$Suven = json_encode($myObj);

echo $Suven;

While executing, this will produce the following result −

{"name":"Rocky Jagtiani","age":39,"city":"Chembur"}

PHP Array:
Arrays in PHP will also be converted into JSON when using the PHP function json_encode():
$myArr = array("Java", "Web Technology", "Android", "Digital Marketing");

$myJSON = json_encode($myArr);

echo $myJSON;

this will produce the following result −

["Java","Web Technology","Android","Digital Marketing"]

Decoding JSON in PHP (json_decode)
PHP json_decode() function is used for decoding JSON in PHP. This function returns the value decoded from json to appropriate PHP type.
mixed json_decode ($json [,$assoc = false [, $depth = 512 [, $options = 0 ]]])

json_string − It is an encoded string which must be UTF-8 encoded data.
assoc − It is a boolean type parameter, when set to TRUE, returned objects will be converted into associative arrays.
depth − It is an integer type parameter which specifies recursion depth
options − It is an integer type bitmask of JSON decode, JSON_BIGINT_AS_STRING is supported.
The following example shows how PHP can be used to decode JSON objects −
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';

var_dump(json_decode($json, true));

While executing, it will produce the following result −
object(stdClass)#1 (5) {
["a"] => int(1)
["b"] => int(2)
["c"] => int(3)
["d"] => int(4)
["e"] => int(5)

array(5) {
["a"] => int(1)
["b"] => int(2)
["c"] => int(3)
["d"] => int(4)
["e"] => int(5)

Error-Handling and Testing

If the JSON value could not be parsed or a nesting level deeper than the given (or default) depth is found, NULL is returned from json_decode. This means that no exception is raised by json_encode/json_deocde directly.
So how can we identify the cause of the error? The json_last_error function helps here. json_last_error returns an integer error code that can be one of the following constants (taken from here):
JSON_ERROR_NONE: No error has occurred.
JSON_ERROR_DEPTH: The maximum stack depth has been exceeded.
JSON_ERROR_CTRL_CHAR: Control character error, possibly incorrectly encoded.
JSON_ERROR_SYNTAX: Syntax error.
JSON_ERROR_UTF8: Malformed UTF-8 characters, possibly incorrectly encoded (since PHP 5.3.3).

Want to Learn Web Technologies?

“Hey Google” command for Assistant on Home now rolling out to phones too

There’s an advert currently doing the rounds for Google Home devices that plays up the smart speaker’s ability to recognize more natural sentences rather than rigid command lines. It’s not hard to see the advert as a thinly veiled shot at Amazon’s Echo smart speakers and Alexa’s stricter dialogue patterns.

To some extent this is true, as Google Assistant has been positioned as a friendly, more conversational digital butler ever since it first arrived on the first-generation Pixel phones last year. Yet unfortunately, actually kicking off the chat has always been a little clumsy due to the Assistant’s awkward ‘hotword’: “OK Google”.

Home users thankfully have a little more choice and can say “Hey Google” instead, but on smartphones it’s been “OK Google” ever since the dark days of Google Now. As of today, though, it seems that Google is rolling out the “Hey Google” command for Assistant on phones too.

More: What is Google Assistant? How can you use it?

Android Police reports that some users have begun receiving a notification prompting them to retrain their voice model settings to account for the new hotword. The feature began rolling out for some users back in October, but it appears this is happening on a universal scale.

I didn’t receive the notification personally, but after updating the Voice settings manually on my Pixel 2 XL I found that both “OK Google” and “Hey Google” are now both recognized by Assistant. You can do this yourself by heading to your Settings menu and then tapping Google > Search > Voice > Voice Match > Retain voice model.

Having two phrases instead of one on multiple devices is a step in the right direction for Assistant, but I still can’t shake the feeling that the insistence on using two specific, arbitrary phrases undermines Google’s claim that Assistant offers a more natural experience than its rivals – especially when you can wake Alexa with a single word or rename it entirely.

Which hotword will you be using, “OK Google” or “Hey Google”? Let us know in the comments.

Jared Kushner and Ivanka Trump Reportedly Face New Financial Disclosures Lawsuit

The couple allegedly made significant omissions on their disclosure forms.

President Donald Trump’s daughter Ivanka and his son-in-law Jared Kushner were hit with a new lawsuit on Sunday alleging they made significant omissions on their federal financial disclosure forms.

Politico reported Sunday night that Washington lawyer Jeffrey Lovitky filed a complaint in U.S. District Court in Washington alleging that the two White House aides neglected to share information about some 30 investment funds in which they are invested. They also are accused of hiding the value of two investment vehicles in which they’re involved as well as income derived from them.

A large number of the holdings Kushner did report, the complaint states, are not listed in full detail due to “prior confidentiality agreements.”

However, Lovitky’s complaint said these agreements do not apply under the Ethics in Government Act (EIGA).

“The [Ethics in Government Act] does not allow a reporting individual to refuse to disclose the underlying assets of an investment vehicle, on the basis that such disclosure would violate a pre-existing confidentiality agreement. Nor does the EIGA allow a reporting individual to refuse to disclose the amount of income derived from any underlying asset of an investment vehicle, on the basis that such disclosure would violate a pre-existing confidentiality agreement,” said the suit.

Politico’s Josh Gerstein described Lovitky as “a health care finance lawyer who sometimes files civil rights cases.” He filed a similar suit against Pres. Trump himself earlier this year.

Kushner and Ms. Trump have been hit with repeated accusations of hiding information from federal regulators including charges that they failed to disclose millions of dollars of art in their possession. Kushner has had to revise his reports of meetings with foreign operatives and Russian banking officials multiple times, adding “more than 100 names” to the list last July.

Read the full report here.


Related Stories

  • Trump Didn’t Invite a Single Jewish Democratic Congressperson to the White House Hanukkah Party
  • Ivanka Trump and Jared Kushner Engaged in ‘Unethical’ Helicopter Use: Report
  • Treasury Secretary Steve Mnuchin Seriously Claims Ignorance of CDC Banned Words Report

Using Street View and Geocoding in your Android app

Today, Google Maps is easily one of the world’s most popular mapping services, allowing millions of users to plan their journeys, discover new places to visit, and get a taste of what it’s really like to walk around places they may have never even visited.

We’ve already looked at how you can use the Google Maps API to retrieve and display the user’s location, but this powerful API isn’t limited to sticking a pin in a map!

In this article, we’ll be looking at some of the additional features that are included in the Google Maps API. By the end of this article, you’ll know how to:

  • Give your users the freedom to switch between all the different Google Maps styles: Normal, Satellite, Terrain and Hybrid.
  • Convert the device’s longitude and latitude coordinates into a more user-friendly street address, and display this information as part of your UI.
  • Display 360-degree, interactive panoramas of locations across the globe, by adding Street View support to your app.

Creating a basic Google Maps app

Before we can implement any of these features, we need to create a project that displays a basic Google Maps fragment.

To get this setup out of the way as quickly as possible, I’ll be using Android Studio’s ‘Google Maps Activity’ template and generating a debug API key, which is required if your project is going to display any Google Maps content. Just be aware that debug API keys aren’t particularly secure, so before publishing an application you must always generate a new API key based on your project’s release certificate.

  • Create a new project using the ‘Google Maps Activity’ template.
  • Open your project’s res/values/google_maps_api.xml file. This file contains a URL with all the information the Google API Console needs to generate an API key. Find this URL, and copy/paste it into your web browser.
  • Make sure ‘Create a project’ is selected in the Console’s dropdown menu, and then click ‘Continue.’
  • Click ‘Create API key.’
  • The API Console will prompt you to restrict the API key. A restricted API will only work on a platform that supports that type of application, which tends to make your key more secure. Unless you have a specific reason not to, you should select ‘Restrict key.’
  • Under ‘Key restriction,’ make sure ‘Android apps’ is selected, and then click ‘Save.’
  • Copy your API key, and then switch back to Android Studio.
  • Open your project’s google_maps_api.xml file and paste your API key into the YOUR_KEY section:

<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_KEY</string>
  • Open your module-level build.gradle file and add the Google Maps dependencies:

dependencies {
compile 'com.google.android.gms:play-services-maps:11.6.2'
compile 'com.google.android.gms:play-services-location:11.6.2'

If your project refuses to compile, then make sure your development environment is up to date, by opening the Android SDK Manager and installing any available updates – in particular make sure you have the latest versions of Google Play Services and Google Repository.

This is the bare minimum required to display Google Maps content, so at this point you may want to take this project for a spin by installing it on your physical smartphone or tablet, or an AVD (Android Virtual Device). If you’re testing this project on an AVD, then you’ll need to use a system image that includes the Google APIs.

Currently this project displays a map with a marker permanently set to Sydney, Australia. This isn’t exactly going to wow your users, so let’s look at a few different ways of making this project more interesting.

Displaying the user’s address with reverse geocoding

When you include Google Maps content in your application, you typically display the user’s current location via a marker, but there’s plenty of scenarios where it’s more useful to display location as a street address. For example, if you’re booking a taxi the old-fashioned way (i.e by calling the taxi company) or arranging to meet a friend, then knowing the street you’re currently on is going to be pretty useful!

While your users could work this out for themselves by zooming in on their location marker and looking at the surrounding labels, you can provide a much better experience by presenting this information to them. This process of converting a set of longitude and latitude values into a street address, is known as reverse geocoding.

In this section, we’re going to add a button to our application that, when tapped, retrieves the device’s longitude and latitude, reverse geocodes these coordinates into an approximate street address, and then presents this information to the user.

Update your layout

Let’s start with the easy stuff, and update our user interface. When you create a project using the Google Maps Activity template, the activity_maps.xml file contains a SupportMapFragment that fills the entire screen.

I’m going to expand on this layout to include a ‘Get My Location’ button that, when tapped, updates a TextView with the reverse geocoded data.

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
tools:context="com.jessicathornsby.google_maps.MapsActivity" >


android:background="#ffffff" >

android:gravity="left" />



Create your strings

Next, define the string resources that we’ll be using throughout this project:

//Create the button label//

<string name="get_location">Get my location</string>
<string name="address_text">"Address: %1$s"</string>

The second string resource is a placeholder that contains the following:

  • %1. A placeholder for a value. This value will either be a formatted address or a message that an error has occurred.
  • $s. The format of the placeholder value, i.e a String.

You convert latitude and longitude values into a physical address using the getFromLocation() method, which returns a list of Address objects.

The level of detail returned by getFromLocation() will vary depending on the location. Sometimes reverse geocoding may return a full address, right down to the house number; sometimes it’ll return the name of the nearest building – and occasionally it may return no information at all.

While the latter is unlikely, your application shouldn’t crash if it does encounter this scenario. Here, I’m creating a String just in case this app can’t match the coordinates to any known address:

<string name="no_address">Cannot retrieve address at this time</string>

On devices running Android 6.0 (API level 23) and higher, applications need to request permissions at runtime, and the user can then accept or deny each request, on a permission-by-permission basis.

If the user denies a permission request, then you need to communicate the impact this will have on your application. In this project, I’m going to display the following text as part of a toast:

<string name="location_permission_denied">Location permission denied. Current location unavailable.</string>

When working on your own Android projects, you may also want to disable or remove parts of your application that rely on the denied permission, for example removing items from menus, or “greying out” certain UI controls.

Add the Internet permission

Reverse geocoding requires an Internet connection, so open your project’s Manifest and add the Internet permission:

<uses-permission android:name="android.permission.INTERNET" />

Create an AyncTask

Since reverse geocoding uses the network, it has the potential to block Android’s main thread. To avoid Application Not Responding (ANR) errors and application crashes, you must perform the reverse geocoding operation off the main thread. There’s various ways of creating background threads, but I’m going to use an AsyncTask.

Create a new Java class (I’m naming mine ReverseGeo) and implement the AsyncTask:

import android.location.Address;
import java.util.ArrayList;
import android.os.AsyncTask;
import android.content.Context;
import android.location.Location;
import android.location.Geocoder;
import java.util.List;
import java.util.Locale;
import java.io.IOException;
import android.text.TextUtils;

* Created by jessicathornsby on 06/12/2017.

class ReverseGeo extends AsyncTask<Location, Void, String> {

private Context mContext;

//Add a parameter for the onTaskComplete interface that we’ll be creating shortly//

private OnTaskComplete mListener;

ReverseGeo(Context applicationContext, OnTaskComplete listener) {
mListener = listener;
mContext = applicationContext;


//Publish the results of our AsyncTask; in this instance that’s the returned address//


//Override the onPostExecute() method//

protected void onPostExecute(String address) {

//Once the AsyncTask has finished,
//call onTaskComplete and update your UI with the returned address//


//Implement AsyncTask’s doInBackground() method,
//where we’ll convert the Location object into an address//

protected String doInBackground(Location... params) {

//Create a Geocoder object, which is a class that can perform geocoding operations//

Geocoder mGeocoder = new Geocoder(mContext,

//Localize the address//


//Obtain a Location object//

Location location = params[0];

//Create an empty List of Address objects, which will eventually contain the returned address//

List<Address> addresses = null;

//Create a String to hold the formatted address//

String printAddress = "";

//Obtain the list of addresses for the current location, using getFromLocation//

try {
addresses = mGeocoder.getFromLocation(

//Specify the maximum number of addresses that the TextView should display//


//Catch any exceptions, for example if the network is unavailable//

} catch (IOException ioException) {
printAddress = mContext.getString(R.string.no_address);


//If the geocoder can't match the coordinates to an address, then return an empty list//

if (addresses.size() == 0) {
if (printAddress.isEmpty()) {

//If the address list is empty, then display the no_address string//

printAddress = mContext.getString(R.string.no_address);

} else {

//If the list isn’t empty, then create an ArrayList of strings//

Address address = addresses.get(0);
ArrayList<String> addressList = new ArrayList<>();

//Fetch the address lines, using getMaxAddressLineIndex,
//and then and combine them into a String//

for (int i = 0; i <= address.getMaxAddressLineIndex(); i++) {

printAddress = TextUtils.join(


//Return the printAddress object//

return printAddress;

//Create the OnTaskComplete interface, which takes a String as an argument//

interface OnTaskComplete {
void onTaskComplete(String result);

Implement ReverseGeo in MapsActivity

Next, we need to implement ReverseGeo in our project’s automatically-generated MapsActivity class, and then override the onTaskComplete() method. I’m also implementing the onClickListener so our application can respond to the user tapping the ‘Get My Location’ button.

import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.Manifest;
import android.content.pm.PackageManager;
import android.widget.TextView;
import android.widget.Toast;
import android.view.View;

public class MapsActivity extends AppCompatActivity implements
ReverseGeo.OnTaskComplete {

private static final int MY_PERMISSIONS_REQUEST_LOCATION = 1;
private Button button;
private TextView textview;
private boolean addressRequest;

//Create a member variable of the FusedLocationProviderClient type//

private FusedLocationProviderClient mFusedLocationClient;
private LocationCallback mLocationCallback;

protected void onCreate(Bundle savedInstanceState) {

button = findViewById(R.id.button);
textview = findViewById(R.id.textview);

//Initialize mFusedLocationClient//

mFusedLocationClient = LocationServices.getFusedLocationProviderClient(

//Create the onClickListener//

button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {

//Call getAddress, in response to onClick events//

if (!addressRequest) {


//Create a LocationCallback object//

mLocationCallback = new LocationCallback() {


//Override the onLocationResult() method,
//which is where this app receives its location updates//

public void onLocationResult(LocationResult locationResult) {
if (addressRequest) {

//Execute ReverseGeo in response to addressRequest//

new ReverseGeo(MapsActivity.this, MapsActivity.this)

//Obtain the device's last known location from the FusedLocationProviderClient//


//Implement getAddress//

private void getAddress() {
if (ActivityCompat.checkSelfPermission(this,
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]
} else {
addressRequest = true;

//Request location updates//


//If the geocoder retrieves an address, then display this address in the TextView//



//Specify the requirements for your application's location requests//

private LocationRequest getLocationRequest() {
LocationRequest locationRequest = new LocationRequest();

//Specify how often the app should receive location updates, in milliseconds//

return locationRequest;

public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {

switch (requestCode) {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {

//If the permission request has been granted, then call getAddress//

} else {

public void onTaskComplete(String result) {
if (addressRequest) {

//Update the TextView with the reverse geocoded address//


Testing your reverse geocoding application

Let’s put this application to the test:

  • Install the updated project on your Android device.
  • Make sure you’re connected to the Internet.
  • Tap the ‘Get My Location’ button.
  • Grant the ACCESS_FINE_LOCATION request; the TextView should update to display an estimated street address.

Since we’re requesting the ACCESS_FINE_LOCATION permission at runtime, we need to test how our application handles rejection:

  • Launch your device’s ‘Settings’ application.
  • Tap ‘Apps.’
  • Select the maps application from the list.
  • Select ‘Permissions.’
  • Push the ‘Location’ slider into the ‘Off’ position.
  • Launch your maps application.
  • Tap the ‘Get My Location’ button.
  • When prompted, deny the ACCESS_FINE_LOCATION request; the application should respond by displaying a toast.

You should also test how your application functions when it has access to your location, but can’t match the coordinates to any known address. If you’re using a physical Android device, then you can test this scenario using a third party app:

  • Download an application that can spoof your location, such as the free ‘Fake GPS’ app.
  • Use this application to trick your device into believing you’re somewhere that doesn’t have a street address – the middle of the ocean is usually a safe bet!
  • Switch back to your maps application, and tap ‘Get My Location.’ The TextView should display the no_address string.

If you’re testing this project on an AVD, then you can change the device’s coordinates using the strip of buttons that appear alongside the emulator:

  • Click the three-dotted menu icon (where the cursor is positioned in the following screenshot).

  • Select ‘Location’ from the left-hand menu.
  • Enter a new set of longitude/longitude values, and click ‘Send.’
  • Press the application’s ‘Get My Location’ button; the TextView should update to display the no_address string.

Adding different map types

Any Google Maps content you include in your app will use the “normal” map style by default – but “normal” isn’t the only option!

The Google Maps API supports a few different map styles:

  • MAP_TYPE_SATELLITE. A Google Earth satellite photograph, without road or feature labels.
  • MAP_TYPE_HYBRID. A satellite photograph with road and feature labels.
  • MAP_TYPE_TERRAIN. A topographic map featuring contour lines, labels and perspective shading, with some labels.

To display anything other than a “normal” map, you’ll need to use the setMapType method:

mMap = googleMap;

Alternatively, why not give your users the freedom to switch between map styles?

In this section, we’re going to add a dropdown menu that allows your users to move between the normal, hybrid, terrain and satellite map styles, with ease.

Start by creating a menu resource:

  • Control-click your project’s ‘res’ directory and select ‘New > Android Resource File.’
  • Give this resource a name; I’m using ‘maps_menu.’
  • Open the ‘Resource type’ dropdown and select ‘Menu.’
  • Click ‘OK.’
  • Copy/paste the following code into this file:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://ift.tt/nIICcg"
<item android:id="@+id/normal"
<item android:id="@+id/hybrid"
<item android:id="@+id/satellite"
<item android:id="@+id/terrain"

Open your project’s strings.xml file and define all the menu labels:

<string name="normal">Normal map</string>
<string name="terrain">Terrain map</string>
<string name="hybrid">Hybrid map</string>
<string name="satellite">Satellite map</string>

Next, you’ll need to implement the menu in your MapsActivity. To make this process clearer, I’ve removed all geocoding-specific code from this Activity.

import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.maps.GoogleMap;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;

public class MapsActivity extends AppCompatActivity implements
OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks {

private GoogleMap mMap;

protected void onCreate(Bundle savedInstanceState) {

//Obtain the SupportMapFragment//

SupportMapFragment mapFragment = SupportMapFragment.newInstance();
.add(R.id.map, mapFragment).commit();

//Override the onCreateOptionsMenu() method//

public boolean onCreateOptionsMenu(Menu menu) {

//Inflate the maps_menu resource//

MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.maps_menu, menu);
return true;

//Override the onOptionsItemSelected() method//

public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.normal:

//Use setMapType to change the map style based on the user’s selection//

return true;
case R.id.hybrid:
return true;
case R.id.terrain:
return true;
case R.id.satellite:
return true;
return super.onOptionsItemSelected(item);

public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;

if (ContextCompat.checkSelfPermission(this,
== PackageManager.PERMISSION_GRANTED) {

public void onConnected(Bundle bundle) {
//To do//

public void onConnectionSuspended(int i) {


Install the updated application on your physical Android device or AVD, open the menu, and test all the different map styles.

Adding Street View to your project

Even examining the same location across multiple map styles can’t quite compare to the experience of exploring that location from a first-person perspective – which is where Street View comes in.

In this final section, I’ll show you how to provide a tangible sense of what a location is really like, by integrating Street View into our application.

Let’s start by updating our layout:

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
tools:context="com.jessicathornsby.google_maps.MapsActivity" >


android:background="#ffffff" >

android:text="Street View"
android:gravity="left" />



Next, I’m going to create a StreetViewActivity, where I’ll implement the Street View service. When you include a Street View panorama in your application, all the standard Street View actions are included by default, which is why the following code doesn’t contain any manual implementations of panning and zooming gestures, or navigating to adjacent panoramas, as you already get all this functionality for free!

Since I’m displaying the Street View panorama inside an Android View, I’m using StreetViewPanoramaView, which is a subclass of the View class. To display a panorama inside a Fragment, you’d use StreetViewPanoramaFragment instead.

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.ViewGroup.LayoutParams;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.StreetViewPanoramaOptions;
import com.google.android.gms.maps.StreetViewPanoramaView;

public class StreetViewActivity extends AppCompatActivity {

//Define the LatLng value we’ll be using for the paranorma’s initial camera position//

private static final LatLng LONDON = new LatLng(51.503324, -0.119543);
private StreetViewPanoramaView mStreetViewPanoramaView;
private static final String STREETVIEW_BUNDLE_KEY = "StreetViewBundleKey";

protected void onCreate(Bundle savedInstanceState) {

//Configure the panorama by passing in a StreetViewPanoramaOptions object//

StreetViewPanoramaOptions options = new StreetViewPanoramaOptions();
if (savedInstanceState == null) {

//Set the panorama’s location//


mStreetViewPanoramaView = new StreetViewPanoramaView(this, options);
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

Bundle mStreetViewBundle = null;
if (savedInstanceState != null) {
mStreetViewBundle = savedInstanceState.getBundle(STREETVIEW_BUNDLE_KEY);


Don’t forget to add the StreetViewActivity to your Manifest:

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
<activity android:name=".StreetViewActivity"></activity>

Finally, we need to implement launchStreetView in our MapsActivity, so that android:onClick=”launchStreetView” triggers the StreetViewActivity class:

import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.maps.GoogleMap;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import android.content.Intent;
import android.view.View;

public class MapsActivity extends AppCompatActivity implements
OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks {

private GoogleMap mMap;

protected void onCreate(Bundle savedInstanceState) {

SupportMapFragment mapFragment = SupportMapFragment.newInstance();
.add(R.id.map, mapFragment).commit();

public boolean onCreateOptionsMenu(Menu menu) {

MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.maps_menu, menu);
return true;

public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.normal:
return true;
case R.id.hybrid:
return true;
case R.id.terrain:
return true;
case R.id.satellite:
return true;
return super.onOptionsItemSelected(item);

public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;

if (ContextCompat.checkSelfPermission(this,
== PackageManager.PERMISSION_GRANTED) {

public void onConnected(Bundle bundle) {
//To do//

public void onConnectionSuspended(int i) {


public void launchStreetView(View view) {
Intent intent = new Intent(MapsActivity.this, StreetViewActivity.class);

Install this project on your Android device, and give the ‘Street View’ button a tap. Your application should respond by launching a new Activity displaying a 360 degree panorama of the London Eye.

Wrapping Up

In this article, we explored a few ways of enhancing your app’s Google Maps content, by adding support for Street View, multiple map styles, and reverse geocoding – but these are still just a few of the features that the Google Maps API has to offer.

What Google Maps features have you used in your own projects? Let us know in the comments below!

Why Even the Idea That Neocon Senator Tom Cotton Might Run Trump’s CIA Is Scary

The Strangelovian senator apparently subscribes to a world war without end.

In a recent profile of Tom Cotton, the Wall Street Journal’s Jason Willick characterized the 40-year-old junior Republican senator from Arkansas as “hawkish and realistic” and described his worldview as “tinged with idealism.” Yet it was unclear what the unabashedly Strangelovian Cotton did to earn such a charitable description, as he rattled off a series of opinions that amounted to a call for world war without end.

Cotton told Willick he favored arming Japan and South Korea with nuclear weapons to counter North Korea, an unprecedented escalation that would bring the region a stride closer to armageddon. China, according to Cotton, is a “rival in every regard” that must be isolated economically and confronted militarily with aggressive freedom of navigation operations in the South China Sea. (The senator ignored a recent Rand assessment that found the US could easily find itself outmatched in a duel with the Chinese military.) From eastern Europe to Asia to the Middle East, Cotton urged regime change operations to replace governments that resisted Pax Americana with “countries that share our principles.” On Iran, Cotton would accept nothing short of war, imagining a cakewalk that would only require “several days” of bombing, as he has previously said.

Cotton’s comments are worth considering in light of his status as a rumored potential CIA director in the Trump administration. Reports recently surfaced of a coming reshuffle that would move Mike Pompeo, a longtime stooge of the Koch brothers and evangelical Muslim basher, from CIA to Secretary of State, dislodging the insufficiently loyal Rex Tillerson, who Trump has trashed as “weak on everything.” While the Cotton rumor has been tamped down in recent days, if Cotton truly is next in line for the CIA, a key agency of the US empire stands to fall into the hands of a militant neoconservative whose worldview was formed through prolonged cultivation in a right-wing hothouse.

Cotton would hardly be the first ideologue to take the helm at Langley. During the 1950s, Allen Dulles used the CIA as a vehicle to recruit a collection of Nazi war criminals and mafia henchmen for covert anti-communist campaigns across Europe, develop the failed mind control program MK ULTRA and plot assassinations and international intrigues in order to topple popular governments. Then there was Bill Casey, who painted the Soviet Union as the puppet master of international terrorism in order to justify secretly funding Central American death squads through the world’s most unsavory third parties.

But Cotton is in a class of his own, not because he is an unbridled zealot, but because he would be the first fully developed product of the neoconservative movement to rise to such a sensitive position. If appointed, he is almost certain to militarize intelligence in the service of the Saudi-Israeli axis and drive their destabilizing anti-Iranian agenda to terrifying extremes.      

The path to power, from Harvard to Iraq

Cotton’s grooming as a neocon cadre began at Harvard University, where he won a fellowship from the Claremont Institute, a right-wing think tank in California that fused the anti-gay kulturkampf with libertarian “starve the beast” economics. At the Harvard Crimson, Cotton emerged as a prolific voice of preppy reaction, promoting divorce-proof “covenant marriages” as a remedy for social decay, upholding political apathy as a virtue and activism as a vice, and hailing the valor of professional golfers. Cotton’s senior thesis at Harvard was an ode to the most elitist, anti-democratic themes contained in the Federalist Papers. “Inflammatory passion and selfish interest characterizes most men, whereas ambition characterizes men who pursue and hold national office,” Cotton wrote of the Founding Fathers. “Such men rise from the people through a process of self-selection since politics is a dirty business that discourages all but the most ambitious.”

His own ambition vaulted him into the ranks of the U.S. Army as it barreled across Iraq and sent the country spiraling into a sectarian bloodbath. From inside armored personnel carriers and behind the barrel of a gun, Cotton experienced his only substantive engagement with the people of the global south. It was clearly a formative period that left him brimming with hostility. “One thing I learned in the Army is that when your opponent is on his knees, you drive him to the ground and choke him out,” he reflected this October. Though he failed to earn any special distinction on the battlefield, Cotton resorted to opinion writing to earn a bit of fame back home.

In January 2006, New York Times correspondents Eric Lichtblau and James Risen revealed the existence of a warrantless CIA program that examined the financial records of American citizens suspected of terrorist involvement. The story appeared almost simultaneously in several other papers, triggering a public tantrum from Vice President Dick Cheney. From his garrison in Iraq, Cotton saw a perfect opportunity to rally the conservative shock troops back in the States. He fired off an indignant email to the New York Times and cc’ed a right-wing blog, Powerline, for good measure. Citing his credentials as a Harvard Law grad and former law clerk, Cotton demanded Lichtblau, Risen and their editor, Bill Keller, be jailed under the Espionage Act: “By the time we return home, maybe you will be in your rightful place: not at the Pulitzer announcements, but behind bars,” he thundered at the journalists.

George W. Bush’s approval rating was hovering around 30 percent by this point, public support for the war had evaporated and Americans were coming home by the thousands in wheelchairs and coffins. But here was a young platoon leader—a Harvard Law grad, no less—willing to defend the war on terror against the treasonous nabobs of negativism. When Powerline published the letter, Cotton became an instant folk hero among right-wing Iraq war dead-enders. Before he had even returned home to his family’s cattle farm in Arkansas, his political career had been made.

The great neocon hope

Cotton first entered Congress in 2012 as a representative from the formerly Democratic Arkansas district that contained Bill Clinton’s hometown. Iran-bashing became his hobby horse, prompting him to introduce an extreme “Corruption of Blood” bill that would have forbidden trade with the relatives of Iranian individuals who were under sanctions, from their great-grandchildren to their nieces and uncles. Panned as an outrageous violation of the Constitution, the bill died on the House floor, an embarrassing rebuke to the self-styled constitutional law expert. (Article III of the Constitution forbids punishing the relatives of those convicted of treason, while the Fifth Amendment grants due process even to non-citizens charged with crimes.) 

Cotton struck out the following year on a campaign to unseat incumbent Democratic Sen. Mark Pryor. On the stump, he demonstrated all the charisma of a filing cabinet, compensating for his lifeless delivery with incendiary warnings that a coalition of ISIS terrorists and Mexican drug cartels would overrun the country unless the southern border was sealed off with a Maginot-style wall. Cotton won in a landslide, sailing into the Senate on the strength of surging anti-Obama sentiment and piles of cash from Likudnik oligarchs.

As Eli Clifton and Jim Lobe reported, the second largest source of funding for Cotton’s senate campaign was Paul Singer, the pro-Israel venture capitalist who has bankrolled a who’s who of neocon outfits in Washington. Cotton also benefited from nearly a million dollars in supportive advertising from the Emergency Committee for Israel, a right-wing group founded by the face of the neocon movement, Bill Kristol. ECI operated for a time out of the offices of the Committee for the Liberation of Iraq, the group that drummed up support for regime change in Iraq. This office also housed Orion Strategies, the lobbying firm that has represented the governments of Taiwan and the Republic of Georgia, two of the key US-backed bulwarks against China and Russia.

A relentless drive toward war with Iran

In the Senate, Cotton’s obsession with Iran deepened by the day. Within weeks of his swearing-in, he orchestrated an explosive letter signed by 46 Republican senatorial colleagues and addressed to the “Leadership of the Islamic Republic of Iran.” Published on Senate letterhead, the missive aimed to convince Iranian Supreme Leader Ali Khamenei to disregard the power of President Barack Obama to implement the internationally brokered P5+1 nuclear non-proliferation negotiations. The arguably unprecedented stunt led to accusations that Cotton had violated the Logan Act, which forbade diplomatic freebooting.

While the White House fumed, Cotton tweeted a translated version of his letter to Khamenei, Foreign Minister Javad Zarif and President Hassan Rouhani. But in his haste, it appeared Cotton had acted without the help of a native Farsi speaker and simply run the letter through Google translate: “We hope while the nuclear negotiations are progressing this letter enriching your knowledge of our constitutional system and mutual clear understanding elevating,” the concluding line read.

A day after the diplomatic fiasco, Cotton scrambled off to a private event with the National Defense Industrial Association, the lobbying arm of America’s top arms merchants. Cotton’s rhetoric on Iran was music to the ears of the weapons industry. “The policy of the United States should be regime change in Iran,” he declared. “I don’t see how anyone can say America can be safe as long as you have in power a theocratic despotism.” The senator found a natural ally in Riyadh, the political vortex of theocratic despotism. “This arms deal sends the right message to both friend and foe alike,” Cotton stated, describing it as a step “to maintain peace in the region.”

Cotton has insisted that “there are no mythical moderates” among Iran’s leadership. Even worse, according to him, was the fact that the Iranian government was “already in control of Tehran.” While Cotton melted down over the Iranian government’s presence in its own capital, most Iranians seem to have accepted that the United States was comfortably in control of Washington.

Trump’s open embrace of the Saudi-Israeli axis has elevated Cotton’s influence, transforming him into the administration’s congressional Iran whisperer. While advising efforts to whittle away at the Iran nuclear deal, he has co-sponsored legislation to make it easier to reimpose sanctions despite Iran’s faithful compliance with the agreement. Cotton’s presence in the Senate is so central to the neocon agenda that the Weekly Standard’s Fred Barnes has argued against his promotion to CIA director. But as Cotton made clear in his senior thesis long ago, he views himself as a man of destiny driven to the heights of power by limitless ambition. Before long, the world could become a laboratory for his own “inflammatory passion.”


Related Stories

  • Here’s How Trump Is Pitting Local Police Against the FBI
  • Trump Is Really Trying to Set the World on Fire
  • Evangelical Leader Who Criticized Trump Is Swamped with Death Threats from the ‘Christian Machine’

Test Your SQL Basics – Part_1

The SQL SELECT Statement Questions

1. Determine the output of the below query
SELECT ‘6+9’  FROM dual;
A) 15
B) 6+9
C) 6
D) 9

2. At least how many clauses must be present in a SELECT statement?
A) 0 (Zero)
B) 1
C) 2
D) 5

3. Which of the following statement is correct?
A) EVERY table expression is a part of SELECT statement
B) Each SELECT statement does not consist of a table expression
C) Every SELECT statement is built from a table expression
D) All of the above

4. Which of the following are the optional clauses?

5. Which of the following is the last clause that is executed in a query?

6. Which of the following is the correct basic syntax of SELECT clause?
A) SELECT column1, column2,….columnx WHERE table_name;
B) SELECT column1, column2,….columnx
C) SELECT column1, column2,…columnx ORDER BY table_name;
D) SELECT column1, column2,…columnx FROM table_name;

7. Determine the output of the below query
SELECT 36/2-5*10 FROM dual;
A) 130
B) -32
C) -120
D) 175

8. Determine the output of the below query
SELECT sal + NULL FROM emp WHERE empno = 7369;
A) sal + NULL
C) 0
D) 1250

9. Which command is used to display the structure of a table?

10. Predict the output of the below query
SELECT 50 || 0001 FROM dual
A) 500001
B) 51
C) 501
D) 5001

1-B,   2-B,   3-C,   4-B,  5-D,   6-D,   7-B,   8-B,   9-C,  10-C

function myFunction() { var x = document.getElementById(‘myDIV’); if (x.style.display === ‘block’) { x.style.display = ‘none’; } else { x.style.display = ‘block’; } }

Restricting and Sorting Data Questions

1. What are the elements NOT contained in the WHERE clause predicate of the SELECT query?
A) Comparison operator
B) Comparison condition
C) Column Name
D) Table Name

2. Which of the following values can NOT be returned after evaluation of WHERE clause condition?

3. Which of the following statements are correct about the WHERE clause?
A) Column Alias can be used in WHERE clause to refer a column
B) Comparison operator is an optional element in WHERE clause condition
C) Functions can be used as operands in the WHERE clause
D) There can be multiple WHERE clause in a SELECT query

4. From the below operators, which one of them holds the highest precedence level?
A) Division (/)
B) Multiplication (*)
C) Brackets ( () )
D) Subtraction

5. What does the selection of columns in a SELECT statement known as?
A) Retrieval
B) Selection
C) Projection
D) Limiting

6. Which of the following WHERE clauses will NOT fit in the below SELECT query?
SELECT ename, deptno, sal  FROM emp;
B) WHERE SAL IN (‘1000′,’4000′,’2000’);

7. Choose the WHERE clause that extracts the DNAME values containing the character literal “er” from the DEPT table.
A) WHERE DNAME IN (‘%e%r’);

8. Which of the following is used to end a SQL query?
A) :
B) ;
C) .
D) /

9. What is the default date format in Oracle?

10. Which of the following clause defines a Membership condition?

1-D,   2-A,   3-C,   4-C,  5-C,   6-C,   7-B,   8-(B,D),   9-D,  10-D

function unris() { var x = document.getElementById(‘myDIV2’); if (x.style.display === ‘block’) { x.style.display = ‘none’; } else { x.style.display = ‘block’; } }

Using Single-Row Functions Questions

1. What will be the outcome of the following query?
SELECT ROUND(144.23,-1) FROM dual;
A) 140
B) 144
C) 150
D) 100

2. Which of the following statements is true regarding the COUNT function?
A) COUNT (*) counts duplicate values and NULL values in columns of any data type.
B) COUNT function cannot work with DATE datatypes.
C) COUNT (DISTINCT job_id) returns the number of rows excluding rows containing duplicates and NULL values in the job_id column.
D) A SELECT statement using the COUNT function with a DISTINCT keyword cannot have a WHERE clause.

3. Which of the following commands is used to count the number of rows and non-NULL values in Oracle database?

4. What will be the outcome of the query given below?
SELECT 100+NULL+999 FROM dual;
A) 100
B) 999
D) 1099

5. Determine the output of the below query.
SELECT RPAD(ROUND(‘78945.45′),10,’*’) FROM dual;
A) 78945*****
B) **78945.45
C) The function RPAD cannot be nested with other functions
D) 78945.45****

6. Which of the following commands allows you to substitute a value whenever a NULL or non-NULL value is encountered in an SQL query?

7. What is true about the NULLIF function in Oracle DB?
A) NULLIF(expr1,expr2) will return expr2 if the two expressions are NOT NULL.
B) NULLIF(expr1,expr2) will return 0 if the two expressions are NULL.
C) NULLIF(expr1,expr2) will return NULL if the two expressions are equal.
D) Expr1 can be NULL in NULLIF(expr1, expr2)

8. Which of the following is not a property of functions?
A) Perform calculations on data
B) Convert column data types
C) Modify individual data items
D) None of the above

9. Which of the following are also called Group functions?
A) Single row functions
B) Multi group functions
C) Multiple row functions
D) Single group functions

10. What is true about Number functions?
A) They return both Character as well as Number values
B) They can’t accept expressions as input
C) Number functions can’t be nested.
D) They accept Number arguments and return Number values only.

1-A,   2-A,   3-D,   4-C,  5-A,   6-C,   7-C,   8-D,   9-C,  10-D

function resti() { var x = document.getElementById(‘myDIV3’); if (x.style.display === ‘block’) { x.style.display = ‘none’; } else { x.style.display = ‘block’; } }

Conditional Expressions Questions

1. What is true about data types in Oracle DB?
A) They are given to columns for sorting purposes.
B) They are given to columns for a structured representation in a table.
C) They are given to columns to constrain the nature of the data it can store.
D) They are not mandatory.

2. Which of the following functions simplify working with columns that potentially contain null values?
A) Nested functions
B) General functions
C) Conditional functions
D) None of the above

3. How many input parameters are mandatory in NVL function?
A) 0
B) 1
C) 2
D) 3

4. What will be the output of the following query?
SELECT NVL(1234) FROM dual;
A) 1234
B) 1000
D) ORA-00909:invalid number of arguments error

5. What happens during an implicit conversion in Oracle DB?
A) Oracle DB implicitly converts one data type to the expected data type
B) The user has to convert the data type to the expected data type
C) Oracle DB doesn’t convert any data type
D) Implicit conversion can be controlled by the user

6. Which of the following expressions can be used explicitly for a conversion of a NUMBER to a CHAR?
B) Use TO_DATE and then convert the date to a NUMBER
D) Such conversion is not possible

7. Which of the following are the functions for explicit conversion provided by Oracle to convert one data type to the other?
D) All of the above

8. Which of the following is true about the following statement in Oracle DB?
TO_CHAR(date, ‘frmt’)
A) The fmt can be written in double quotes as well as single quotes.
B) Case of the fmt doesn’t matter in this function
C) Fmt can include any character or NUMBER
D) The fmt has to be enclosed in single quotes and has to be a valid date format.

9. How many maximum places for display will Oracle DB allocate to the Month element in the following statement?
SELECT TO_CHAR (sysdate, ‘fmMonth’) FROM dual;
A) 5
B) 6
C) 7
D) 9

10. What is true about the COALESCE function in Oracle DB?
A) It can take only 2 arguments
B) All the arguments in the COALESCE function can be of different data types
C) All the arguments in the COALESCE function should be of the same data type
D) None of the above

1-C,   2-B,   3-C,   4-D,  5-A,   6-A,   7-D,   8-D,   9-D,  10-C

function condi() { var x = document.getElementById(‘myDIV4’); if (x.style.display === ‘block’) { x.style.display = ‘none’; } else { x.style.display = ‘block’; } }

Learn Database Programming?