SQL

Saturday, 20 February 2016

PL/SQL Excercise 2


6. The Following PL/SQL will provide you all table name from a user table




SP

S

P






TOO MANY ROWS





TOO MANY ROWS





0 ROW NO DATA FOUND







JONES
SMITH

Statement processed.

PL/SQL Excercise 1







ADAMS

Statement processed.





11 Suppliers selected



The above Example also can be written as follows:



This Example canbe witten using a cursor as well.





S1 SMITH 20 LONDON
S2 JONES 10 PARIS
S3 BLAKE 30 PARIS
S4 CLARK 20 LONDON
S5 ADAMS 30 ATHENS





Number of suppliers in LONDON = 2





S1 SMITH 20 LONDON
S4 CLARK 20 LONDON

Statement processed.

PL/SQL







ADAMS

Statement processed.





11 Suppliers selected



The above Example also can be written as follows:



This Example canbe witten using a cursor as well.





S1 SMITH 20 LONDON
S2 JONES 10 PARIS
S3 BLAKE 30 PARIS
S4 CLARK 20 LONDON
S5 ADAMS 30 ATHENS





Number of suppliers in LONDON = 2



Friday, 12 February 2016

Android Example 3: Inner Class, Button and Count

This is the same example as Android Example 2. All I have done is, I just rearrange the code to show you an Private Inner class to show the button's OnClickListener
Step 1:

Create a Blank Activity on Android Studio. Name it anything you like.

Step 2:

Go to the layout folder and only keep activity_main.xml. If any other than activity_main.xml is created, just delete that. Now type the following lines for the layout.



Step3:
Open up your MainActivity.java file and type the following codes



Step 4:

Turn on your Emulator or GenyMotion. Run the Project and here you go .. a simple button functionality.







Android Example 2: Create a simple button with Count

I this Example I will make a simple button in to the main activity window. The button will have an option to press and count how many times you have pressed the button.

Step 1:

Create a Blank Activity on Android Studio. Name it anything you like.

Step 2:

Go to the layout folder and only keep activity_main.xml. If any other than activity_main.xml is created, just delete that. Now type the following lines for the layout.



Step3:
Open up your MainActivity.java file and type the following codes



Step 4:

Turn on your Emulator or GenyMotion. Run the Project and here you go .. a simple button functionality.







Saturday, 6 February 2016

Android Example 1: Create a Simple activity from Scratch

I wish I could go over details here but as I am a bit busy these days, I will just show you example of how to create a single activity from the scratch. So when you create a new Prject on Android Studio, we always find that somme xml files are auto generated + codes inside the main activity but Do we need all lines? What is the minimum requirements to create an activity?So here is the simple answer. Please go through Google android doc page to understand.

Step 1:

Create New Project suppose name is app1. Put the company name as buzz.com. As you enter finish. All files will be auto generated to launch a hello world app.

Step 2:

Delete everything inside MainActivity.java and write folowing:



Save the file.

Here launchOtherActivity method will be triggered when user will press the button. So yes, we have to create a button.


Step 3:

The Button has to be created inside the main activity xml file. Go to your layer folder (app1 -->app-->src-->main-->res --> layout). Delete all auto generated xml files here and create main.xml file and copy following code:


Here android:onClick="launchOtherActivity"/> will call the launchOtherActivity in the MainActivity.java.

Step 4:


Create another xml file for the other activity which is other.xml. Open the other.xml file and write following codes:


Step 5:

Now create OtherActivity.java in the same folder where MainActivity.java is. Copy the following lines to OtherActivity.java:



Step 6:
Now as we have a activity and it's related .xml file we have to add the activity to AndroidManifest.xml. Do not delete any line here but add the following:




so the AndroidManifest.xml will look like :



That's it. Now you will have a working OtherActivity. If you run the application. The output will be:



Thursday, 4 February 2016

GUI 6 Java polygon 1

This a simple java 2d poligon example. They have a common point (150,150) to intersect each other




Monday, 1 February 2016

STL List Container




0 8 9 1 8 7 2 3
0 1 2 3 7 8 8 9