Thursday, September 29, 2016

Java - Reference Data Type


Several weeks ago, we learned primitive data type, which is some basic knowledge of Java. For example, some data types we often use in our programming assignments, such as char, boolean, int, double, are all primitive data type. However, in addition to primitive data type, there is another important type, which is called reference data type.

A reference type is a data type which is based on a class rather than on one of the primitive types that are built in to the Java language. All objects are reference date types. To declare a variable using a reference type, you simply list the class name as the data type. See the following example:
Date d = new Date(2, 17, 1948);
This statement creates a reference variable d that refers to a Date object. The value of d is the address in memory of that object.

What we should pay attention to is the difference between primitive data type and reference data type. Consider the statements:
int a = 1;
int b = a;
If in later statements, either a or b is changed, the other is not affected. For example,
int a = 2;
Then, a becomes 2 but b is still 1.

However, reference type is different. Consider the following two statements:
Date d = new Date(2, 17, 1948);
Date birthday = d;
The second statement will not create a new object. What is true is that the object has two references in this case. Thus, the statement
d.changeDate();  will automatically change the object referred to by birthday as well.

---------------------------------------------------------------------------------

Writing References:
1.http://www.dummies.com/programming/java/reference-types-in-java/
2.Barron's AP Computer Science A
Picture Reference:
https://www.ntu.edu.sg/home/ehchua/programming/java/images/OOP_PrimitiveVsClass.png

Friday, September 23, 2016

Java - Classes and Objects


To lean Java, we should first know that it is an object-oriented programming language. The concepts of objects and classes are very important, because they are fundamental knowledge we are supposed to understand before we do some more complex programming.

As we began to learn Java several weeks ago, we have already been relatively familiar with Java classes. The accurate definition of a class is that a class is a software blueprint for implementing objects of a given type. For example, let's create a Dog class.
public class Dog { double age; String color; }
Class defines a new type of data, and in this case, Dog is our new data type. "Dog" will be used to declare objects of Dog.



Then, we should created some objects. Object refers to a particular instance of a class where the object can be a combination of variables, functions, and data structures. An object is characterized by its state and behavior. For example, a dog object has states described by its age, color, sex, and so on. It also has behavior, like jumping, running, etc. In fact, an object corresponds to some real-world object represented by the program.

---------------------------------------------------------------------------------


Writing References:
1.https://en.wikipedia.org/wiki/Object_(computer_science)
2.http://www.c4learn.com/java/java-classes-basics/
3.Barron's AP Computer Science A
Picture References:
1.http://img.c4learn.com/2012/03/Creating-Object-of-Class-in-Java-Programmming-Language.png
2.http://cdn2-www.dogtime.com/assets/uploads/gallery/labrador-retriever-dog-breed-pictures/labrador-retriever-dog-pictures-3.jpg

Friday, September 16, 2016

What is Cortana?


Cortana is an intelligent personal assistant developed by Microsoft. Cortana is able to know user's habits, help user to arrange his or her schedule, and answer user's questions. It can be said that Cortana is an attempt in the area of artificial intelligence and machine learning.

What Microsoft truly wants to achieve is the real interactive communication between Cortana and the user rather than the simple conversation just based on the storage. Cortana can record what the user do and what his or her using habits are like. Then it will utilize cloud computing, search engine, and unstructured data to read, analyze and learn the data including file, email, picture, video, etc. In this way, Cortana can understand the meaning of what the user says and thereby achieve communication. For example, if the schedule in phone shows that is going to be a meeting, then, without any operation, Cortana will  set the cellphone in meeting mode.




So far, we have been able to use Cortana at different platforms, such as Windows 10, iOS, Android. We can also choose the languages we like; Cortana is now available in English, French ,German, Italian, Spanish, Chinese, and Japanese. Once we download Cortana, we will be able to manage our busy life and search for information we want more easily and fast by using it.

---------------------------------------------------------------------------------

Picture References:
1.https://scdn.androidcommunity.com/wp-content/uploads/2016/01/cortana.jpg
2.http://cdn1.vox-cdn.com/assets/4222613/cortana-windows-phone-theverge-5_1020.jpg
Writing References:
1.https://en.wikipedia.org/wiki/Cortana_(software)
2.http://baike.baidu.com/link?url=pqi_MVa1S41QP7m8iU4s0_Wy6DOk2HW5I8NVU4z71IpmQsrXuq9YR700D2SOPP3X8mcZCjh0YHf_EBaTVt3klzDyORS0wuxH0s2W0lTMLym

Friday, September 9, 2016

Global Positioning System


Nowadays, almost all drivers use Global Positioning System (GPS). This technology indeed has brought people much convenience. With GPS, drivers no longer need to worry that they may get lost. GPS can easily tell them where they are and how to reach destination. Let's see how this fantastic technology work.

In simple terms, Global Positioning System defines the location of the GPS receiver according to four satellites whose positions are known.




As this picture shows, the receiver is the position we need to define, and the 1, 2, 3, 4 are four satellites we use. Position1, Position2, Position3, Position4 are coordinates of these satellites. d1, d2 d3, d4 are distance from the four satellites to the receiver, respectively. Location is the position of receiver we need to define. The process of defining the location, simply, is using an algorithm GetLocation() to get the value of Location.

Location = GetLocation([Position1, d1], [Position2, d2], [Position3, d3], [Position4, d4]);


So far, Global Positioning System has been widely used, both in civilian and in military.


---------------------------------------------------------------------------------

Picture Reference:
1.http://images.cnblogs.com/cnblogs_com/magicboy110/Windows-Live-Writer/GPS_3B2/GPS_thumb22_thumb.png
2.http://www.extremetech.com/wp-content/uploads/2012/04/gps-satellite-constellation.jpg
Writing Reference:
http://www.cnblogs.com/magicboy110/archive/2010/12/09/1901669.html

Friday, September 2, 2016

Robot Reproduction


As the science develops rapidly, robots are no longer a novel thing to people. However, have you ever heard of that robots can have children? This actually happens in our world. According to Daily Mail, scientists in Amsterdam have invented a new technology which can enable robots to reproduce.

When scientists made two robots meet, the robots could communicate with each other and choose suitable partners. When robots decide to mate, they can use Wifi to send their genomes. In this way, new genomes will be generated and sent to 3D printer, which then prints the components of the new robot. After the components are assembled, the baby robot comes to this world.


Scientists have finished the test of whole life period. When parent robots reproduce, their features are combined randomly. After the child robot was born, it needs to experience the process of learning. The child robot will then grow up and continue to reproduce the new generation. 

Such technology is significant, as it can be used to help human to explore Mars and other dangerous, unknown environments.

---------------------------------------------------------------------------------

Picture Reference:
1.http://a.hiphotos.baidu.com/baike/w%3D480/sign=3dd8434a28a446237ecaa46aa8237246/11385343fbf2b211c3e9bc7ec28065380cd78e3e.jpg
2.http://n6.cmsfile.pg0.cn/group1/M00/3D/5D/Cgqg2FdP1_mASQV1AAYIbZz49q0461.jpg?enable=&w=550&h=325&cut=
Writing Reference:
1.http://baike.baidu.com/link?url=AEOs_Vs_KyOBE-b5zUDPX5JH2b5EXweoqC8ov4OWr0axYQq8HPBP2iVhGaW1MZJx3yKHMLhamnhoco1mqYwqtW1bZpMDis-Gmis1bL0oedG
2.http://www.dailymail.co.uk/sciencetech/article-3620314/Now-robots-KIDS-Researchers-create-machines-mate-wifi-create-3D-printed-baby-experts-say-used-colonise-Mars.html