New Tutorials:   JAVASCRIPT    SASS/SCSS    PL/SQL  

Damon Stark damon Author

I am a Student at Massachusetts Institute of Technology. Live in Cambridge and I love playing Guitar and Building Weapons(Ooops, joking. I am not that Stark)


damon's Answers


damon

damon

Hello srikanth4109

This is actually a good question, I think there is no direct way to do that. See when we send an email, we never send the email to a user, we send email to an email server, in your case it will be hosted on xyz.com

The emails are stored on the server and can be accessed by an email client using SMTP and POP3 protocols, which allows the email client to connect with the email server and collect the email data linked to a particular account. Hence the emails are always on the server, the email client just presents a copy of the emails to the user.

Now when you say the organization must not know about it, hence we cannot also explicitly connect to the computer of the employee using their email address, because in that case too, we are using the company network to do so. But that is worth a shot.

Python is a good language to learn Network programming to do a lot of such things.

And there is a tutorial on Studytonight for that, http://www.studytonight.com/network-programming-in-python/

Still, if you find a better solution, do share it with us too.

Q :  How to send an email to a person who is working in an organisation without knowing to organisation

3 years ago

damon

damon

exit(0) indicates successful program termination & it is fully portable, While
exit(1) (usually) indicates unsuccessful termination. However, it's usage is non-portable.

0 and EXIT_SUCCESS are the values specified by the standard to indicate successful termination, however, only EXIT_FAILURE is the standard value for returning unsuccessful termination. 1 is used for the same in many implementations though.

Q :  For what purpose exit(1) and exit(0) are used ?

4 years ago

damon

damon

A Full Stack Developer is someone who is responsible for handling everything related to a web app development. You must know how to setup the hosting environment, running services like Apache Web Server(or, any other Web Server like nginX), configuring the server for best performance, setting up the DB, working out the front end of the Web App, and the Admin Panel for it. And last but not the list, taking care of the backend, which will require knowledge of any scripting language along with a Database.

These days, ever growing number of frameworks have made all this very easy to setup. Taking example of Django, if you know Python, which is again easy to learn, you can very easily setup a project, with well defined package structure, Data Objects, Django will automatically create an Admin Panel, and a lot of plugins are available for setting up other things.

A very good example of usefulness of such frameworks is, in Django if you want to create an eCommerce website, you can simply install Saleor project, and it will provide you with everything an eCommerce demands for, hence work made simple (http://getsaleor.com/). The same is the case with other frameworks like Ruby on Rails, Laravel etc.

Front End is no more a hassle, since Bootstrap. Readymade styled components provided by Bootstrap, Materializecss etc frameworks have made front end development very easy and at the same time standardised it globally.

If you can, it will be great to learn Angular JS or jQuery or any other framework you feel comfortable with, to harness the power of Javascript.

Hope this helps :) Feel free to ask more.

Q :  How to become a full stack web developer?

4 years ago

damon

damon

Transaction Isolation is all about queries, and the consistency and completeness of the data retrieved by queries. Isolation gives the querying user the feeling that he owns the database. It does not matter that hundreds or thousands of concurrent users work with the same database and the same schema.

While many other users are querying data, updating existing and inserting new data, Isolation guarantees that any user at a given point of time will get the complete, consistent picture of data, irrespective of the actions of other users upon the same database.

Lets take an example : User A, started a SELECT query to select list of some products from a database. And it takes about 5 minutes for the query to successfully run and return the resultset. After 2 minutes from this, another User B, updates some products and commits the change. The question here is, will user A's query return the updated data or the old data. This depends on Isolation levels.

1. READ UNCOMMITTED: User A will see the change made by User B. This isolation level is called dirty reads, which means that read data is not consistent with other parts of the table or the query, and may not yet have been committed.

2. READ COMMITTED: User A will not see the change made by User B. This is because in the READ COMMITTED isolation level, the rows returned by a query are the rows that were committed when the QUERY was started.

3. REPEATABLE READ: User A will not see the change made by User B. This is because in the REPEATABLE READ isolation level, the rows returned by a query are the rows that were committed when the TRANSACTION was started.

4. SERIALIZABLE : This is similar to Repeatable Read Isolation level.

Source : http://highscalability.com/blog/2011/2/10/database-isolation-levels-and-their-effects-on-performance-a.html

Q :  What are isolation levels in database transactions?

4 years ago

damon

damon

C is a programming language. http://www.studytonight.com/c/overview-of-c.php

Q :  What is c

4 years ago

damon

damon

C++ is a good choice. And you definitely don't have to be an expert in C before jumping to C++. Can you shed some light on what sort of games are you planning to create?

Q :  Should I start with C++ with a basic knowledge of C?

4 years ago

damon

damon

When a class is inherited, the subclass inherits the methods and variables of super class but not constructors. As Constructors are not a member of the class like variables and methods defined inside the class.

When constructors are not inherited, there will never be a situation when the constructor will be overridden. Now as we know, in Java, final is used by super class to prevent sub class from inheriting its member, why to make Constructor final, when it is by default not inherited. Constructor is by default final.

Along with final, a constructor cannot be abstract, static, final, native, strictfp, or synchronized.

Q :  Why Can't you make a Constructor final ?

4 years ago

damon

damon

For this you will have to use two for loops. First one to traverse over the Linked list nodes one by one and the second for loop will run inside the first one, to compare and find if any duplicate entry exist for any particular node, if it exists, then remove the duplicate entry.

Q :  Write a function that removes all duplicate elements from a linked list?

4 years ago

damon

damon

I think One pointer would be enough, which will keep the address of the the next node always.
http://www.studytonight.com/data-structures/linear-linked-list

Q :  How many pointers are required to implement a simple Linked list?

4 years ago

damon

damon

You can do so by making a method or another class Friend of the first class, then you can access the private member. Study about friend functions in C++ from here : http://www.studytonight.com/cpp/types-of-member-function.php

Q :  How can i access private members out side of the class

4 years ago

damon

damon

Try :

SELECT * FROM ALL_role_privs;

or
SELECT * FROM DBA_role_privs;

Q :  Oracle query to view all users with roles

4 years ago

damon

damon

Your question is not clear. Can you explain the problem a little.

Q :  A->FC,C->D,B->E

4 years ago

damon

damon

ISO and OSI are entirely different. ISO stands for International organization of Standardization, and OSI stands for Open System Interconnection.

ISO is the name of an organization which handles the International Standards, while OSI is a networking reference model. You can learn networking from : http://www.studytonight.com/computer-networks/

Q :  Whats the difference between ISO and OSI

4 years ago

damon

damon

Here : http://www.studytonight.com/java/constructor-in-java.php

You will find good examples here. If you face any problem in understanding anything, do ask.

Q :  Write an appropriate java program illustrating how a constructor can be used to initialise one or more field?

4 years ago

damon

damon

For the best of my knowledge :
This will require both DB and scripting for implementation.

Member table :
member_id as PRIMARY KEY AUTO_INCREMENT
name VARCHAR
address VARCHAR
membership_type CHAR (This will have value L or S, L for Long term and S for short term)

Events Table :
event_id as PRIMARY KEY AUTO_INCREMENT
member_id_fk FORIEGN KEY to Member table field member_id
event_name VARCHAR
event_description VARCHAR

Additional to this you can add any more info you want to add. Checking whether a user can or cannot create an event will have to be checked at server side. Before inserting an event, or before allowing any logged in Member to create event check the Member Type, if its L allow him/her to create, if its S simply show them a message that you cannot create an event but you can participate.

Q :  Any one here who can help me modeling of it

4 years ago

damon

damon

Did you go through : http://www.studytonight.com/data-structures/time-complexity-of-algorithms

Its a nice and simple explanation. You can post any Doubt if you face in that. I will be happy to help.

Q :  What is time and space complexity trade off??

4 years ago

damon

damon

What in Polymorphism are you not getting. Share what you understood and where are you facing problem?

Q :  Polymorphism

4 years ago

damon

damon

I havent done it, but this article has explained it in details : https://thethemefoundry.com/blog/html-wordpress/

There is also a Wordpress plugin to do so : https://wordpress.org/plugins/cms2cms-html-to-wp-convertor/

If you face any problem, do comment we can discuss.

Q :  How to Convert HTML to Wordpress?

4 years ago

damon

damon

Hope this works :

void selectionSort(int arr[], int n) {
int i, j, minIndex, tmp;
for (i = 0; i < n - 1; i++) {
minIndex = i;
for (j = i + 1; j < n; j++)
if (arr[j] < arr[minIndex])
minIndex = j;
if (minIndex != i) {
tmp = arr[i];
arr[i] = arr[minIndex];
arr[minIndex] = tmp;
}
}
}

Q :  Can any one give the selection sort program?

4 years ago

damon

damon

Hey Shubham, Still need the program ?

Q :  Urgent require this program

4 years ago

damon

damon

I found this link : http://tinyurl.com/84x2x

Go through this, if you still have any doubts then we can discuss it here.

Q :  What is a greedy algorithm?

4 years ago

damon

damon

As found here : http://www.cse.iitk.ac.in/users/dheeraj/cs425/lec11.html/

Routing is the process of forwarding of a packet in a network so that it reaches its intended destination. The main goals of routing are:

1. Correctness: The routing should be done properly and correctly so that the packets may reach their proper destination.

2. Simplicity: The routing should be done in a simple manner so that the overhead is as low as possible. With increasing complexity of the routing algorithms the overhead also increases.

3. Robustness: Once a major network becomes operative, it may be expected to run continuously for years without any failures. The algorithms designed for routing should be robust enough to handle hardware and software failures and should be able to cope with changes in the topology and traffic without requiring all jobs in all hosts to be aborted and the network rebooted every time some router goes down.

4. Stability: The routing algorithms should be stable under all possible circumstances.

5. Fairness: Every node connected to the network should get a fair chance of transmitting their packets. This is generally done on a first come first serve basis.

6. Optimality: The routing algorithms should be optimal in terms of throughput and minimizing mean packet delays. Here there is a trade-off and one has to choose depending on his suitability.

Q :  Explain routing

4 years ago

damon

damon

Here, follow this link : http://www.studytonight.com/c/arrays-in-c.php

If you face any problem in any program, share it here so that I can explain it to you.

Q :  Sir please tell me about array pogrammes

4 years ago

damon

damon

Thanks Tejas, For the detailed explanation.

Q :  If Set is unordered then why LinkedHashSet is ordered

4 years ago

damon

damon

A friend function is a function that can access a class's private members while not being a member of that class. (You can also have friend classes)

A function is defined virtual so that polymorphism can work: if you have a pointer to the base class and invoke a virtual function, the derived class's version of the function is called. Without virtual functions you would have to cast a pointer to a base class to a pointer to a derived class to invoke the intended function.

Q :  Compare virtual and friend function

4 years ago

damon

damon

I found a very useful and easy-to-understand PDF file, explaining Cryptography in Computer Network in a very visual way...

http://www.cs.iit.edu/~cs549/lectures/CNS-1.pdf

Hope it helps you get an idea.

Q :  Cryptography

4 years ago

damon

damon

The one answer that I have read at a lot of places is In Circular Queue we utilize memory efficiently, because in Linear Queue when we delete any element only the front is incremented by 1, but that position is not used later. So when we perform more add and delete operations, memory wastage increases.
But in Circular Queue memory is utilized, if we delete any element, that position is used later on, because it is circular.

Q :  What are the advantages of circular queue?when it is considered to be full.

5 years ago

damon

damon

You can also use the MIT App Inventor tool to build a simple Android App. We have a great series of tutorials for the same on Studytonight, check it out : http://www.studytonight.com/android-app-using-mit-appinventor/

Q :  How to create your own app on android

5 years ago

damon

damon

To avoid duplicate data entry in Oracle, simply add UNIQUE constraint to the column to which you wish to avoid duplicate data entry.

This will add UNIQUE Constraint to a column :

ALTER TABLE <table_name> ADD UNIQUE (<column_name>)


To add UNIQUE constraint to multiple columns :
ALTER TABLE <table_name> ADD CONSTRAINT <constraint_name> UNIQUE (column1, column2, column3)

You can name the Constraint and add it to multiple columns, and when you want to remove the Constraint simply DROP the above created constraint :
ALTER TABLE <table_name> DROP CONSTRAINT <constraint_name> 

Q :  How to avoid duplicate data entry in oracle?

5 years ago

damon

damon

JDBC tutorials are already available on Studytonight : http://www.studytonight.com/java/introduction-to-jdbc.php

Hope it helps. If there is anything missing, do inform.

Q :  Sir can u provide jdbc tutorial

5 years ago

damon

damon

The question is incomplete. You should at least check whether everything is correctly written before posting. Question is just for Introduction and in description you must write in the details. Not simply copy paste everything in the Question textbox.

Q :  Write a C program which uses Unix system calls to create a new process. The childprocess should create an empty file called ‘abc’ and then terminate. The parent process should wait for the child proce

5 years ago

damon

damon

Can you please be a little more descriptive about your question so that I can help you.

Q :  Languages for application development

5 years ago

damon

damon

Do you mean a Project to design a Database Management System itself or a Project which involves Data Management, like School Management System or Library Management System etc. Both are different, as by the first I understand that you are willing to build your own native DBMS with your set of rules. And in the latter, you plan on using the concepts of DBMS for a project.

Q :  What are the steps followed as you develop a database management system?

5 years ago

damon

damon

Can you share more details like the operating system you are using, is it a 32 bit or 64 bit machine etc, so i get a clearer picture of what might be causing the problem.

Check this link : http://tinyurl.com/zh6ve4j

Q :  How to run a c program in command prompt ?

5 years ago

damon

damon

Hey ravinyati87, we advice you to find some local teacher around you. Or use the free tutorials available online.

@mahadev60 How will you teach someone remotely ?

Q :  Pls someone help me to learn core java

5 years ago

damon

damon

Example :

struct Book
{
char name[10];
int price;
}

int main()
{
struct Book b;
struct Book* ptr = &b;
ptr->name = "Dan Brown"; //Accessing Structure Members
ptr->price = 500;
}


Find the complete tutorial here : http://www.studytonight.com/c/pointers-to-structure-in-c.php

Q :  C program using pointer to structure to initialise the members in a structure.

5 years ago

damon

damon

You can either scan an entire line:

Scanner s = new Scanner(System.in);
String str = s.nextLine();


Which is something I guess you do not want to do.

For character, simply do,
char c = (char) System.in.read();

Q :  How to ask character as input from user and print it

5 years ago

damon

damon

I would suggest you better keep the check in whatever server side scripting language you are using, Java or Php.

Having checks in SQL, or making any Table column to not accept a past date, is not the right approach as per me.

If you still want, you can check if the date you want to insert is less than sysdate, then fail it.

Q :  What is the query for finding invalid date?

5 years ago

damon

damon

Follow the link : http://studytonight.com/java

No one can explain Java to you in an answer, you will have to study yourself.

Q :  Explain about java briefly?

5 years ago

damon

damon

In the above case :

printf("hello") > printf("bye") ? printf("hi"),printf("dear") : printf("sorry") , printf("sir");


expression1 is
printf("hello") > printf("bye")


expression2 is
printf("hi"),printf("dear")


while expression3 is
printf("sorry")


and the last
printf("sir")
is not part of this, as it is after the comma.

So the final output is : hellobyehidearsir


Hope it helps. Feel free to ask if any doubt.

Q :  Please explain the output of the following c program:

5 years ago

damon

damon

printf() function returns the number of characters printed. Hence printf("hello") will return 5 and printf("bye") will return 3. Clearly 5 is greater than 3, so the ternanry operator ( ? : ) will fall back to the first expression, i.e. the one before the colon.

Study about the Ternary(Conditional) Operator here : http://www.studytonight.com/c/operators-in-c.php

Going further,
If we take ternary operator as, expression1 ? expression2 : expression3
then, if expression1 returns true, expression2 will be executed and if false then expression3 will be executed.

Q :  Please explain the output of the following c program:

5 years ago

damon

damon

You can simply use if-else comparison if you wish to compare only three integers.

Get inputs for all the 3 integers from user. If x, y and z are the 3 integers, then


if(x > y && x > z) {
printf("x is the largest");
}
else if(y > x && y > z) {
printf("y is the largest");
}
else if(z > y && z > x) {
printf("z is the largest");
}

Q :  How to write program for comparing three intergers?

5 years ago

damon

damon

Microsoft Access is a DBMS (also known as Database Management System) from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools.

Q :  MS access

5 years ago

damon

damon

By consistency it means, A transaction either creates a new and valid state of data, or, if any failure occurs, returns all data to its state before the transaction was started.

Q :  Can anyone please describe me what is consistency in transaction(ACID Properties) in an effectiveway

5 years ago

damon

damon

Every time you write to the file, start with a new line. I guess that would make it look better.
You can use
(new line) or (tab) etc for the same

Q :  I have to assemble data in a file properly with multiple entries using C program

5 years ago

damon

damon

Herodotus is known as the "Father of History". What is History? It is nothing but a collection of past discoveries, events etc.
Herodotus was the first known individual who actually started keeping records of the past events. He kept record of the achievements of others. Keeping those records, ordered and safe, was an achievement in itself.
Hope it helps you in understanding.

Q :  Who was herodotus

5 years ago

damon

damon

Go for Visual Studio.

Q :  What will be the perfect software for programmingin c

5 years ago

damon

damon

INT should not give an error. Assign INTEGER(10) where 10 specifies the number of digits allowed.

You can use VARCHAR2 if you wish to have + signs with number, but if you use VARCHAR2 then you will have to apply validations. Like user must only enter digits and not alphabets, and they must not enter a number larger than 10 digits.

Q :  Datatype for mobile no. in SQl?

5 years ago

damon

damon

Other than the topologies mentioned by you, we have :

1. Point to Point
2. Tree
3. Daisy Chain

Get the details from here : https://en.wikipedia.org/wiki/Network_topology

Q :  How many Network topologies?

5 years ago

damon

damon

Yes, you cannot access the private members directly. But you can make functions to access them. Like in the above case, make two methods :

1. To set the value of side
2. To fetch the value of side

Such functions are called getters and setters.

public:
void setSide(int side) {
this.side = side;
}

int getSide() {
return this.side;
}

Now you can simply call getSide with the object, and it will give you the value of side property.

Q :  How to access the private member in the parameterized constructors???

5 years ago

damon

damon

The flush method flushes the output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

The buffering is mainly done to improve the I/O performance.

Q :  What is the use of flush() in java?

5 years ago

damon

damon

Google it buddy. If you do not understand there, then we can discuss.

Q :  What is immutability in Strings?..Please explain with examples

5 years ago

damon

damon

pon.xml is a configuration file to compile and build Maven projects. Where as web.xml is a Deployment Descriptor in JAVA EE. They are totally different.

Study about POM : http://www.studytonight.com/maven/pom-in-maven

Study about web.xml : http://www.studytonight.com/servlet/creating-servlet-in-netbeans.php

Q :  Exact diff bt pom and web.xml

5 years ago

damon

damon

There is absolutely no difference. They are all same for the compiler. Found a nice explanation here http://stackoverflow.com/questions/7799561/what-is-the-difference-between-int-ptr-and-int-ptr-in-c

Q :  What is the difference among int *ptr, int* ptr and int * ptr

5 years ago

damon

damon

In what format are you saving the date of birth. Please specify that.

Q :  How to get age from dateofbirth using sql command?

5 years ago

damon

damon

Hey sidney, you are at the right place at the right time. You dont need to know anything to develop Apps.

Go through this tutorial http://www.studytonight.com/android-app-using-mit-appinventor/

It will teach you step by step, how to develop Android App using free MIT Tool. You just need Internet connection and gmail account.

And if you face any problem you can ask your question here.

Q :  Basic knowledge to develop a mobile app?

5 years ago

damon

damon

They do not have a user interface to interact with them.

Q :  Operating system

5 years ago

damon

damon

Yes we do have devices without Operating System, like our internet Modem, its a device without any O.S or Transistors, Radios etc they are all devices without an Operating System

Q :  Operating system

5 years ago

damon

damon

Hibernate Object/Grid Mapper (OGM) provides Java Persistence (JPA) support for NoSQL solutions. It reuses Hibernate ORM’s engine but persists entities into a NoSQL datastore instead of a relational database.

Just an introduction, you can easily find the complete documentation for this on Internet. If you face any problem then you can ask here.

Q :  Any one knows about Hibernate OGM?

5 years ago

damon

damon

Now copy pasting has been enabled on the website. You can easily find a lot of services online to convert webpages into pdf, use any of them.

Q :  How to download notes from your site ?

5 years ago

damon

damon

Its "Holmes" not Homes, and we all know quite well who he was like you do. Please avoid asking these questions here.

In the Ask a Question section, it is just written to give people an example.

Q :  Who was sherlock homes?

5 years ago

damon

damon

Can you please ask the question with an example to your problem. I am not able to understand the question itself.

Q :  How to find the accurate relationships between two entities?

5 years ago

damon

damon

Pointer is not a data structure because data structures are used for collecting data in form of nodes or anything, whereas pointer is a variable or a data type to store an address.

I found a very interesting discussion here...
http://www.linuxquestions.org/questions/programming-9/is-pointer-a-data-type-or-what-29548/

Q :  Is pointer a data structure?

5 years ago

damon

damon

Destructor will be called automatically when the scope of an instance ends, or you can call it explicitly by deleting the instance yourself.

If there is other way, please do share.

Q :  Explain two ways of invoking a destructor

5 years ago

damon

damon

PHP is the language to communicate with the server, that is why it is also called Server side scripting language.
If you need your SLAMBOOK to interact with the Database etc, you need PHP, otherwise you can simply create it using HTML, CSS etc.

Php can be easily integrated, create a file with (.php) extenstion, and write normal HTML code in it, like you write in your (.html) files.

For the Php code, you must enclose it within,

<?php 
// php code here
?>


So this is how you can do it. Try out with the below code,
<?php
echo "Hello! I am using Php";
?>


This will print 'Hello! I am using Php' wherever you add this code. You can add this code between header tags in HTML to make it a heading.

Feel free to ask any question.

Q :  How to do php connectivity of html files?

6 years ago

damon

damon

I am not quite getting your problem. As the MANIFEST file is created along with the JAR, why are you getting error.

Are you adding something to your MANIFEST file. Please go through the following link to modify the MANIFEST FILE Correctly.
https://docs.oracle.com/javase/tutorial/deployment/jar/modman.html

And to know more about the MANIFEST FILE, go through the below mentioned link :
https://docs.oracle.com/javase/tutorial/deployment/jar/defman.html

If possible do explain your problem in details. Thanks.

Q :  What is the proper way to create manifest file ?

6 years ago

damon

damon

Following is the program,

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int a[100],i,n,item,s=0;
cout << "Enter No. of Elements :";
cin >> n;

cout<<"\nEnter List of Elements :\n";
for(i=1; i<=n; i++)
{
cin>>a[i];
}

cout << "\nEnter Element you want to Search : ";
cin >> item;

for(i=1; i<=n; i++)
{
if(a[i] == item)
{
cout << "\nData Found at Location : "<< i;
s = 1;
break;
}
}
if(s == 0)
{
cout << "Data Not Found";
}
getch();
}


- First we ask for number of elements to be entered in the list on which we will perform Linear Search.
- Then we enter the list, using the FOR loop we save it.
- Then we ask the user to enter the element to be searched,
- We use the FOR loop to iterate over the list and compare all the elements of the list with the element to be searched, wherever we find a match, we print that position.

Q :  Linear search code

6 years ago

damon

damon

GO through this lesson http://www.studytonight.com/java/connecting-to-mysql.php

You must search in the Search Bar provided above before asking question.

Q :  How to connect java with mysql

6 years ago

damon

damon

There are different types of Information Systems :
1. Manual Information System
2. Sequential Information System
3. File Based Information System
4. Database based Information System

Q :  What is an information system

6 years ago

damon

damon

Information System in a Computer is anything where useful information can be saved and retrieved. Records, Files, Tapes, Database etc

Q :  What is an information system

6 years ago

damon

damon

"how to insert some applications or code" What do you mean by this ?

Q :  What is the easiest code to use insertion in datastruct?

6 years ago

damon

damon

You cannot use a destructor, it is automatically called when an object needs to be destroyed. But you can provide definition for a destructor, following is the syntax.

class A
{
public:
~A() { //do something inside destructor }
};

Q :  What is a destructor

6 years ago

damon

damon

Defining an array is not specific for Bubble Sort, You can define an array for bubble sort like you do it usually in the used language,

If you are using C++, then

int a[6] = {5, 1, 6, 4, 7, 8};

You can increase the value, by changing the number of value in array declaration,
int a[number_of_elements]


If you are using Java, then
int[] arr = {10, 20, 30, 40};

Q :  How array is define in bubble sort?

6 years ago

damon

damon

On this page you can find complete explanation of 'static' keyword http://www.studytonight.com/java/modifier-in-java.php

Q :  What is the static

6 years ago

damon

damon

If you have a numbers table in your database (always a good tool to have) then you can easily do this with the T-SQL below:

declare @num1 int = 20;
declare @num2 int = 40;

select n.num as commonFactor
from dbo.Nums as n
where (n.num < case when @num1 > @num2 then @num1 else @num2 end)
and @num1 % n.num = 0
and @num2 % n.num = 0


Source : http://stackoverflow.com/questions/23280886/sql-printing-common-factors-of-two-numbers

Q :  SQL SERVER 2012

6 years ago

damon

damon

PrintStackTrace is used to print the complete trace of the exception, doing so will let you easily debug the source of the error. You can see the Java class from where the exception was thrown along with the line number of the code.

So printing the stack trace is good to reach to the source of error.

Q :  What is the use of PrintStackTrace in Exception Handling?

6 years ago

damon

damon

We need to provide a return statement in a function only if it is declared to do so. I mean if you write a function like,

void funtionOne() { ... }
as you mentioned 'void' before the function name this means, the function should not have any return statement, hence function will not return anything.

But if you write it like,
int functionTwo() { ... }
Now, in this, as you have mentioned 'int' before the function name, this means the function must return an integer.
Similarly if you write,
char functionThree() { ... }
Now this function must return a character. So this is why some function requires to return while some not.
Hope it helps :)

Q :  My question is for c++

6 years ago

damon

damon

Who said Java is only used for Mobile Applications. Java is not PURE Object Oriented because it supports Primitive datatype such as int, byte, long... etc, to be used, which are not objects. Contrast with a pure OOP language like Smalltalk, where there are no primitive types, and boolean, int and methods are all objects.
But Java is capable for being used to produce any Software you want. It is a very strong language.

Q :  Why java is only use for mobile applications??

6 years ago

damon

damon

Class is a Logical definition while an Object is its physical existence. I think here you will find the best explanation, http://www.studytonight.com/cpp/class-and-objects.php

If you have any doubt after studying this, you can ask it.

Q :  What is object and class in brefily with example ?

6 years ago

damon

damon

Because a Java boolean doesn't necessarily map to a native boolean(dependent on OS).

In C language the size on data types depends on the OS of the machine, same is with Linux too.

I read the following note somewhere :

A boolean variable is one that has only two values; true and false. The storage required depends on the underlying implementation, and could be as small as one bit, or as large as a full word in the underlying hardware. You should not be concerned with the size of a boolean variable, because the size is immaterial to the program, and because any such consideration would represent non-portable programming practices.

Q :  Why boolean is independent on jvm??

6 years ago

damon

damon

@isurunix : I think you are right on this, this seems to be in the First Normal Form. But I think 4 tables can me made out of the following relationship I->Answer, Do->The, Not->Know can be made into different independent tables.
While PUZZLE(Huh, Why, I, Do, Not) can be in the main table.
Doing this it can be pushed to the Second Normal Form.

Q :  In which normal form the relationship is in ?

6 years ago

damon

damon

I do not know whether there is any such command available. Get an Antivirus for this buddy.

Q :  What is cmmonad typed in the cmd prompt tom find the virus in windows7

6 years ago

damon

damon

String[]args (mentioned as argument for main method) is a String array type and it's contain arguments entered at the command line.

If you have a class

public class Foo {
public static void main(String[] args) {
if (args.length < 2) {
System.out.println("Write your name and a site you like when you run this class");
} else {
System.out.println("Yo " + args[0] + ", so you like " + args[1] + "?");
}
}
}


once you compile this and run it with:

java Foo Robert Studytonight

you get:

Yo Robert, so you like Studytonight?

Hence strings passed while running java class are all added to the String array which is available inside main method.

Q :  How argument is passed with help of command line argument to the main function?

6 years ago

damon

damon

Can you please explain it a little bit more, the question looks interesting :)

Q :  In which normal form the relationship is in ?

6 years ago

damon

damon

I wouldn't say C++ is not used to develop software, there are are tonnes of software designed on C++.
- Adobe Photoshop is developed in C++
- Some features of Apples OS X is developed in C++
- Symbian OS was based on C++
- Mozilla Browser is based on C++
- In all major Mobile companies producing softwares, C++ is used.

Yes i agree, Java has become the commercial choice of the software industry because of some of its features like Multithreading, Generics etc and ease of use etc. But C++ is also used a lot.

Q :  Why c++ is not used to write softwares

6 years ago

damon

damon

Generics in Java are an entirely compile-time construct - the compiler turns all generic uses into casts to the right type. This is to maintain backwards compatibility with previous JVM runtimes.

This:

List<ClassA> list = new ArrayList<ClassA>();
list.add(new ClassA());
ClassA a = list.get(0);


gets turned into (roughly):

List list = new ArrayList();
list.add(new ClassA());
ClassA a = (ClassA)list.get(0);


So, anything that is used as generics has to be convertable to Object (in this example get(0) returns an Object), and the primitive types aren't. So they can't be used in generics.

Q :  Why generics does not work primitive types

6 years ago

damon

damon

A Transaction means, everything or nothing. Which means, if you perform Task A, Task B and Task C in one transaction, then if all 3 completes successfully then only the transaction will complete successfully.

In case Task A and B completes successfully but Task C fails, then all the changes done by Task A and B will also be reverted, because all 3 task are in one Transaction.

In case of Database, If you have a program where, you need to run one Insert statement and then one Update statement. And if any one of them fails, you would want to remove the changes done by the other one, in such case we use transactions.

In DBMS transaction, the changes in one transaction are committed only when all the SQL queries run successfully, else all the changes are rolled back.

In MySQL, we first set the Auto Commit feature as off using command AUTO_COMMIT(false).

Then we run all the sql queries, and if all of them are executed successfully, then we commit() all the changes to DB, if even one fails, we rollback changes done by all.

So, in short, Transaction means, Everything or Nothing :)

Hope this helps you.

Q :  What is database transaction?

6 years ago

damon

damon

Try googling "Transmission Mediums in Computer network" you will get to Studytonight's Lesson. From there you ca study about them, and then if you face any problem, please ask it with a little bit more precision.

Q :  What is Transmission Mediums in Computer network

6 years ago

damon

damon

you can use the gcj command to run java code in Linux environment. You can also use java command to run java code, provided java in installed on the machine. You can use java -version command to check whether java is installed or not.

If your Main class is in a package called FileManagement, then try:

java -cp . FileManagement.Main

Q :  How can we run java on linux platform

6 years ago

damon

damon

In your previous question here(http://www.studytonight.com/studyroom/question.php?que_id=629), i have answered similar question.

In this problem you just to look around how you can check whether a number i Armstrong number or not. Try it yourself, you will learn better.

Post your code here, so that i can correct it.

Q :  Using c++

6 years ago

damon

damon

I would suggest you to go through http://www.studytonight.com/c/c-input-output-function.php

You will find that, scanf() function returns the number of items successfully read by it, while printf() function returns the number of items printed.

For example printf("Studytonight"); is printing 12 characters, hence it will return 12.

Q :  Int i; printf("%d",scanf("%d",&i));

6 years ago

damon

damon

class Number {
private :
int number;

public:
int get_data() {
return number;
}
void put_data(int i) {
number = i;
}

boolean isZero(int number) {
if(number == 0) return true;
else return false;
}
};

int main() {
Number N;
N.put_data(10); //setting number value as 10
cout << N.get_data(); //print value 10
}


In the class we have a property named number, which is private, therefore you cannot access it directly and you will have to use the put_data() and get_data() functions to set and get the values.

isZero() function will return true, if the number is zero and will return false if not. Hope this helps.

Q :  C++ anser plzz

6 years ago

damon

damon

Can you please specify more details, like what error you are getting, which OS you are using, try to look what processes are running by opening Task Manager, which services are running. Ctrl + Shift + esc will open the window which will show running services, from there only you can see the processes also. Close the ones that you do not require.

Q :  Which error is the mostly occur in os?

6 years ago

damon

damon

As we know that String in Java is immutable, hence, every time you execute substring() function on a string a new string object is created and stored in Heap.

Q :  How substring() method of String class working ?

6 years ago

damon

damon

If your question is about adding Foreign Key to an existing column, then the following example will help you.

If you have two tables 'table_A' and 'table_B' and you want to make ID column of A foreign key to ID column of B, use the following query.

ALTER TABLE table_B ADD CONSTRAINT FK_table_A_ID FOREIGN KEY (ID) REFERENCES table_A(ID);

Q :  Apply foreign key

6 years ago

damon

damon

Directory Management and File System is one and the same thing, so go through the Lesson on File System Management in Operating System. You can find it on Studytonight too. http://www.studytonight.com/operating-system/file-system

Q :  What is Directory Management In operating System?

6 years ago

damon

damon

One such data structure would be B-Tree. B-Tree stores data in sorted manner in it. And it is fast also, time complexity is very less, i guess logarithmic time. You can also use Min-Heap and Max-Heap, to find highest and lowest element.

Q :  Which data structure is best suited for storing the scores such that highest score remains at top?

6 years ago

damon

damon

.iso and .cso are file types, usually used for large files like games etc. CSO is usually compressed, file ISO has the complete file as it is. Daemon Tools is a software that can be used to read ISO or CSO files.

Q :  What is ISO or CSO??

6 years ago

damon

damon

A literal constant is a value typed directly into your program, like

int x = 10;

10, is directly assigned to x, hence this is a literal constant. Value of x will always be 10. Because 10 will never change itself.

A symbolic constant, on the other hand is, comes into picture with pre processor compilers, for example,
#define SEVEN 7
int x = SEVEN;

In this case, SEVEN will be processed by the pre compiler, and the compiler will never see the Symbol SEVEN, the compiler will see,
int x = 7;

The benefit of using symbolic constants is that, when you need to change value of SEVEN to 8, then you just need to do that only at the top of the program.

Hope this helps :)

Q :  What is difference between literal constant and symbolic constants in c language?

6 years ago

damon

damon

Go through this lesson http://www.studytonight.com/java/abstract-class.php

and do ask your doubts in case you are not able to understand it properly.

Q :  What is abstract class

6 years ago

damon

damon

Thats not a necessity that every program is developed in Java, there are other languages like Scala, Python, C# etc which are also used for software and program development.

Java is just a bit more popular because of its features.

Q :  Why every program are developed in java ?

6 years ago

damon

damon

If you are talking about prefix and postfix operator usage, like increment using ++ operator.

i++;  //this is post increment
++i; //this is pre increment

i++ means, the value of i is returned first, then the increment is done.
while in case of ++i, increment is done first and then the value is returned.

Hope this helps. Please feel free to ask any question.

Q :  What is the pre-fixes and post-fixes in c++?

6 years ago

damon

damon

User defined functions are the functions that a user creates, it can be anything as per your requirements.

While a standard function is already a part of standard Library of the language, like ceil(), sqrt () etc are standard function of C language already in the language :)

Q :  Explain user defined function and standard function

6 years ago

damon

damon

Pl/SQL is a procedural way of writing normal SQL queries. Nothing else. Like C language is a procedural language and we write programs in logical steps, similarly we can write SQL queries in steps also, this is done by PL/SQL.

As Query becomes procedural there are many new features that comes into picture, PL/SQL offers that. This is the basic introduction of PL/SQL to let you know what it is :)

Q :  Not very much clear about pl/sql

6 years ago

damon

damon

Early Binding is normal Compile time resolution, while Late binding is runtime. When you use references of objects, they are resolved at runtime.

Get more details from here http://www.studytonight.com/cpp/virtual-functions.php

Or just Google it.

Q :  What is binding(early and late)..???

6 years ago

damon

damon

Inheritance in programming language is same as in us humans. Like a child inherits characteristics from its parent, similarly when a class extends another class, it will inherit the properties and methods defined in that class.

If a class A has a variable x, and a method foo(), then another class B that extends (inherits) class A, will have access to variable x and method foo(). class B can also have its own variable y and method bar() also.

The only catch is that, the private members of class A, will never be inherited.

The protected and public members will be inherited. You must go through Studytonight's Java Lessons to understand it :)

You can ask your doubt :)

Q :  About inheritance

6 years ago

damon

damon

There are no steps in particular, but if you understand the Entity diagrams and their elements, you can easily create entity Model for your problem.

Study ER diagram with some beginner examples from here http://www.studytonight.com/dbms/er-diagram.php

And for advanced level examples, refer this link http://www.inf.unibz.it/~franconi/teaching/2000/ct481/er-modelling/

Q :  What are the steps involved in entity modelling

6 years ago

damon

damon

The key reason is that you can only extend one class in Java, hence if you extend Thread class you cannot extend any other class, but if you implement Runnable interface you are still open to extend any other class, hence this gives you freedom.

Also,
- When you extend Thread class, your thread creates unique object and associate itself with it.

- When you implement Runnable interface, the same object is shared with multiple threads.

Hope it helps :)

Q :  Why there are two ways for creating a thread in java?

6 years ago

damon

damon

Are you saying you want the output of your program to be saved in a file ? Or do you want to create files using your program ?

Please explain.

Q :  How can i use files in C++?

6 years ago

damon

damon

Follow the link http://www.studytonight.com/java/java-swing.php

And do search a bit, before asking such plain questions. You must ask your doubts here. Please help us build a good community here.

Q :  Help me to understand swing

6 years ago

damon

damon

Can you please explain your problem in detail.

Q :  How to create reports of database if the forms are created in java?

6 years ago

damon

damon

In a relational database, denormalization is an approach to speeding up read performance (data retrieval) in which the administrator selectively adds back specific instances of redundant data after the data structure has been normalized. A denormalized database should not be confused with a database that has never been normalized.

Q :  What is denormalization

6 years ago

damon

damon

The points that you have mentioned are enough from your perspective as you know about the project, but for me, after going through your points, i am not able to understand anything.

What exactly in the project about ?
Is it like you have to choose any model, then prepare a normalized DB for it and then create a form to insert data in it ?
Am i right ?

Q :  Need a simple project which have made on oracle 9i database

6 years ago

damon

damon

If you import any package, then all the java files in the package are imported and are treated as java files of your current project. Hence if you current project already has a java class with main method, and another class has a main method defined in the imported package, then the execution will be ambiguous.

You can have two classes with main methods in your project, but only 1 will be the main class for your project, and you should decide which one will be, by declaring it in the manifest file.

Q :  Packages?

6 years ago

damon

damon

You can find that on Studytonight itself, why asking question for that, use the search box above to do that http://www.studytonight.com/dbms/database-normalization.php

Q :  Dbms concepts

6 years ago

damon

damon

Yes, we can pass parameters to constructors. You can have many constructors with different arguments, which is called overloaded constructors.

Q :  Can we pass a parameter in a constructor?

6 years ago

damon

damon

You can find it here on study tonight.

Q :  Want material for data structures

6 years ago

damon

damon

This query will return. The number of distinct salary values present in emp table. For example if emp table has 10 rows. And 3 employees have salary 10000, 3 employees have salary 12000, and remaining 4 have salary 15000. Then your select query will return 3. Because in all total 3 distinct salary values are present in emp table.

Q :  Sql functions

6 years ago

damon

damon

Of course you can do that. Not just in java but in any programming language. Arguments and return type are not related. A method might not have any argument but can still return a value.

Q :  Methods in java

6 years ago

damon

damon

Hey, i think Strong and Weak Equivalence is something related to the parameters we provide in our query to SELECT or UPDATE to find the exact same row, that we are targeting.

Please share with us the Answer, if you have figured it out.

Q :  What is Strong and Weak Equivalence

6 years ago

damon

damon

You can study it in details from here http://www.tutorialspoint.com/mongodb/

Q :  What is mongodb

6 years ago

damon

damon

What problem are you getting. Is it 'No suitable driver found' ?

Q :  No suitable driver found

6 years ago

damon

damon

Infinite times, main() function will keep calling itself.

Q :  I have a one question about c programing plz tell me what will be out put...?

6 years ago

damon

damon

Whats the error, what is your program, Please mention something. Don't just ask such questions.

Q :  How to work jdk

6 years ago

damon

damon

You should simply Google this my friend and you will find this.

Q :  Please explain the difference between structural and procedural languages? Also give example

6 years ago

damon

damon

You can also ask your doubts if you face any problem.

Q :  How to find a conanical cover? Give its calculation?

6 years ago

damon

damon

No difference, nothing at all, they are the same, incur the same amount of work -- do the same thing, take the same amount of resources.

Q :  What is the diffrence between count(*)&count(1)?

6 years ago

damon

damon

here is a very interesting article on the same topic http://micklr.com/what-do-you-prefer-sql-or-nosql/

Q :  Which do you prefer SQL or NoSQL ?

6 years ago

damon

damon

throws key word is used with the declaration of a method, to let users know that this method can throw specified exception.

While 'throw' is used to throw a specific exception, and yes you do need a "catch" to catch that exception.

Q :  Can we declare throws without catch in exceptionhandling

6 years ago

damon

damon

You can use the anchor tag to allow a file to get downloaded. In HTML5 there is a new attribute introduced 'download' where in you can specify the path of the file, and it will be downloaded.

 < a href="path_of_your_file"  download > 

Q :  How do we access a file on the server side from the client side in html5?

6 years ago

damon

damon

Linked Lists are same in C, like they are in C++ or any other language. Data linked in an ordered way.

Q :  Where are linked lists in c

6 years ago

damon

damon

check out the DBMS tutorial on Studytonight !

Q :  How to do a normalization table in database?

6 years ago