abstract algebra: what is subring?

subring defined by:

if R is a ring,

1) I is subset of R

2) I is also a ring

example:

let R = Z  (integer)

I = 2Z is subring of R, since 2Z is also a ring,

is (2Z + 1) also a subring of R?, no

proof:

let a, b in Z

=> 2*a + 1 in 2Z + 1

=> 2*b + 1 in 2z + 1

let (2*a  + 1 )  + (2*b + 1)

=> 2*a + 2*b + 1 + 1

=> 2(a + b) + 2

=> 2(a + b + 1)

=> 2(a + b + 1) is not in 2Z + 1

hence 2(a + b + 1) is not closed under addition

so 2Z + 1 is not a ring,

abstract algebra: what is ring?

ring is defined by

1) two operator: addition(+) and multiplication(*)
if a, b in R, then a + b in R
if a, b in R, then a*b in R
2) there exists 0 such that if a in R, then a + 0 = a
there exists additive inverse -a such that if a in R, then a + (-a) = 0examples of ring:

Integer, real number, complex number.

[ad] Empty ad slot (#1)!

how read file line by line in java

import java.io.*;
class FileRead
{
public static void main(String args[])
{
try{
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("textfile.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null)   {
// Print the content on the console
System.out.println (strLine);
}
//Close the input stream
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}

linux remove file based on date(e.g based on month)

ls -lah | grep ‘May’ | awk ‘ { print $12 } ‘ > name.txt
rm `cat name.txt`

Database Management Systems (3rd Edition). Raghu Ramakrishnan and Johannes Gehrke

Database Management Systems (3rd Edition). Raghu Ramakrishnan and Johannes Gehrke

Mysql order by two columns

SELECT first_name FROM table_name ORDER BY salary, age

how to change ubuntu default shell

here is the command to change ubuntu default shell

use your favorite editor to open /etc/passwd file

vim /etc/passwd

find your user name

change /bin/sh or /bin/bash or vice versa

save the change

logout your shell and login again

done!