martes, 28 de enero de 2014

Ubuntu Interaction and Perl

            PURPOSE: The purpose of this lab is to interact with Unix by using a virtual machine and learn to create a script on Perl that reads through a file, counts the number of files, adds the size of each file, and gets the average file size.


  PHASE 1:
a.      What OS variant is the Unix Virtual Machine
There are around 18 variants of linux most of them are free. In the ALIAS Lab we have Ubuntu.
            Available variants:
1.      Basilisk
2.      BeatrIX
3.      Berry Linux
4.      Damn Small Linux
5.      FreeSBIE
6.      Gnoppix
7.      Kanotix
8.      Knoppix
9.      Luit
10.  Mandrake Move
11.  Mepis
12.  Morphix
13.  PCLinuxOS Preview
14.  Sam (
15.  SLAX
16.  Suse 9.1 and 9.2
17.  Ubuntu Live (Debian)
18.  Xfld


Ubuntu: uses a Linux kernel, and its origin is based on Debian. Ubuntu is oriented to the user novel and average, with a strong focus on the easiness of use and to improve the user experience. It is composed of multiple software and normally distributed under a free license software or open source.


b.      What is the basic IP configuration?
By typing the ifconfig command on Linux shows the actual configuration of our pc, also with this we are able to see or configure the parameters of the network interfaces such as the IP address (dynamic or static) and the netmask.


c.          Can you access the internet? How?
It is possible to connect though eth0 which is the first Ethernet adapter or an Ethernet card, which is associated to an IP address, MAC address and other information about the networks. The network adapter interfaces a computer to a network


d.         How does the OS compare to the OS you use on a daily basis

1. UBUNTU VS. WINDOWS 7

1.1 UBUNTU

It is an free operating system that can be used by different types of users, a user with no prior experience in Windows or Ubuntu probably will find more friendly and easier to Ubuntu, because it is very easy to use and is also free. In other words, any person can go to the Ubuntu page, and download it to your computer easily, without any restriction, since it has no license. In addition to using it, you can study it, modify it, copy it to different external devices, and redistribute it freely. Not required it to do so, because even if it is free, it can be sold commercially.

We can assure that it is one of the operating systems that most leverages our computer, that with it we can run much faster than with other operating systems business tasks. This is due to that Ubuntu doesn't require great features to work.

ü  It is a free (open Source) software

ü  This system is based on the Debian distribution

ü  Available in 3 architectures: Intel x 86, AMD64, Power PC and other distributions.

ü  The Ubuntu developers are based in large measures of work in the communities of Debian and Gnome, both in the distributions of packages and in the graphic environment, and KDE environments.

ü  The stable versions are released every 6 months and are kept up-to-date on security up to 18 months after its release.

ü  The official desktop is Gnome and it is synchronized by their releases.

ü  All releases of Ubuntu are provided free of charge. Distribution CDs are sent free of charge to anyone requesting it. You can also download from the Ubuntu page, ISO images of discs by direct transfer or under license from Bittorrent.

ü  Language: Multilanguage.


1.2 WINDOWS 7

This version is designed for use on PCs, including desktops in homes and offices, laptops, tablet PCs, and media equipment center.
Unlike the great architectural leap and characteristics which suffered its predecessor Windows Vista to Windows XP, Windows 7 was conceived as an incremental and focused update of Vista and its NT 6.0 core, which allowed to maintain some degree of compatibility with applications and hardware that this was already supported. However, among the goals of development for Windows 7 importance was given to improve the graphical interface to make it more accessible to the user and include new features that would make tasks easier and faster, at the same time that efforts would be made to achieve a more lightweight, stable and fast system.


ü  Proprietary operating system (Shared Source) is not open source.

ü  The Windows 7 client versions were released in versions for Architecture 32-bit and 64-bit Home Basic, Home Premium, Professional and Ultimate editions. However, these product Server versions were released exclusively for 64-bit architecture.

ü  It has 6 NT kernel

ü  It is not free, since it has a Microsoft EULA license

ü  Language: Multilanguage.


v  PHASE 2:

Installation of Perl

1) Go to the following website: http://www.activestate.com/activeperl/downloads
2)Choose the appropriate version for your OS.


2) Once you have downloaded the program run it.
3) Click next to begin with the setup wizard.
4) Accept the license terms and click next 
5) Select the features and click next
6) Choose the setup options and click next
7) Click Install
8) Click finish to finish installation

Screenshot for finishing the installation.




Appendix A

#!/usr/bin/perl

open(FILES, "files") or die "Can't open files\n";    #Open the file named files or show a message

my $numberFiles = 0;                                       #Variable that will count the number of files
my $fileSizeTotal = 0;                                        #variable that will store the size of each file
my $averageFileSize = 0;                                   #variable that will hold the average

while(<FILES>)                                             #reads the file record by record until no more records are found
{
     chomp $_;                                              #clear off the newlines from the end of each line
    ($date, $time, $ampm, $filesize, $filename) = split(" ", $_);   #splits up a string and places it into an array  
    print "$filesize\t\t$filename\n";                      #prints the value of $_ to show that it was read.
    $numberFiles++;                                                #the counter is incremented
    $fileSizeTotal+=$filesize;                                   #adds file sizes
}

$averageFileSize = $fileSizeTotal/$numberFiles;    # calculates the average by dividing the total file size by the number of files

print("\nTotal Files: $numberFiles    Average file size: $averageFileSize\n");  #prints the result

close(FILES);      #closes the file






















Geology Essay Questions Part 4

Answers to Test 4 Essay questions.

Q: What influence (if any) does plate tectonics have on climate patterns?
A: Mountain ranges are formed due to the process of plate tectonics. These mountains are responsible for forming rain shadow deserts.

Q: Near Mount Everest base camp, at about 5000 meters, there is half as much oxygen in the air as there is at sea level. Why? Explain.
A: The higher you go; the air becomes less dense because gravity pulls air molecules down so more molecules concentrate near the surface of the earth than at higher elevations.

Q: You are given a six month assignment by your employer to work at a remote location in Australia. In order to pack as lightly as possible, you try to research the climate of the small town in Australia, but there is little data since no major cities are located within 300 miles. What are some geographic or other considerations that might help you “predict” what general weather patterns exist at the location?.
A: What is the geology of the area? Are there mountains ranges? Is the area flat? Any body of water nearby? What type(s) of rocks are present there?. Vegetation/plants present there?. Geographic location in terms of latitude and longitude of the location? You are told that there are no major cities close by. What is the population? Are there lots of cars? Lots of pollution from burning of fossil fuels? We have more rainfall in cities because of burning of fossil fuels (due to high population etc) and thus warming the air. Since it is far from the city, most likely there will not be much rainfall.

A: Is it beneficial or harmful to have ozone in the troposphere?. Why or why not?.
Q: Harmful, because ozone in the troposphere reacts with automobile exhaust to produce smog which is a pollutant.

A: Where do you expect to have more rain?. In a city or the countryside? And why?
Q: In the city, because cities are warmer due to factors in the urban environment (burning fossil fuels etc). The warm air rising over a city creates a low pressure zone and as a result, precipitation is greater in the city.

A: The Sea of Cortez lies in a subtropical region between the Baja Peninsula and the west coast of Mexico. Most of the surrounding land is desert, and the one large river, the Colorado, empties only a small amount of water into the sea. In contrast, the Strait of Georgia lies off the temperate coast of British Columbia and is fed by melting glaciers and many streams. Which of these two bodies of water will have a higher salinity and why?. Give two reasons to compare them.
A: The Sea of Cortez is saltier because freshwater input is low because the only river, the Colorado, empties only a small amount of water into the sea compared to the Strait of Georgia that is fed by melting glaciers and many streams diluting its salinity. The Sea of Cortez is also saltier because of high evaporation due to the surrounding desert while the Strait of Georgia is less saline because it is situated in a temperate climate.


Geology Essay Questions Part 3

Answers to Test 3 Essay questions.
Q: Equatorial regions receive the most heat, while Polar Regions receive the least. Therefore, what air pressures would you expect to be characteristic of these regions?
A: low pressures in the equatorial regions, high pressures in the Polar Regions

Q: Give three reasons why it is very difficult and expensive to clean a tainted or contaminated aquifer.
A: Aquifers are underground, groundwater flows very slowly so most contaminant persist in a groundwater aquifer longer, and oxygen which reacts to decompose many contaminants is less abundant in groundwater.

Q: What can lithified sand dunes tell us?
A: Dunes indicate that they were deposited by wind, and they reflect the direction of prevailing winds when they were deposited.

Q: If glacial ice were considered a rock, what type of rock would it be, and why?
A: Glacial ice would be a metamorphic rock, because it deforms as pressure and temperature change.

Q: Briefly explain what property of water makes hydrologic cycling possible.
Q: Water changes phase from liquid to solid to vapor all within the normal range of Earth's surface temperatures.

Q: Since levees can protect many areas during floods, why are they controversial?. Give two reasons.
A: In addition to being expensive, levees in many cases make problems worse, by restricting the flow of water that otherwise would have spread over a floodplain.

Q: In what four ways can water be temporarily stored, from a few years to a few thousand years, on land areas, before returning to the oceans?
A: Water can be stored in lakes, snow fields, glaciers, or as groundwater.
Q: What are the three major uses for groundwater?
A: irrigation, industry, domestic needs


Geology Essay Questions Part 2

Answers to Test 2 essay questions

Q: Why are earthquakes more likely to occur in Tokyo, Anchorage, and Los Angeles than they are in New York, London, or Paris?

A: Because Tokyo, Anchorage and Los Angeles are cities that lie along or very near the margins of plates; while New York, London or Paris are farther from the edges.


Q: Name three of the many things that plate tectonics theory explains?
A: Plate tectonics explains, at least to some extent, all of the following phenomena: the distribution of earthquakes and volcanoes, the locations of ore deposits and mountain systems, climate and ocean circulation patterns, and the geographic distribution, evolution and extinction of life forms.


Will you rather be chased by a pahoehoe or aa lava? Explain.

A: I will rather be chased by Aa, because pahoehoe can move rapidly due to its lower viscosity; while Aa moves slowly because it has a high viscosity.


Q: Why do earthquakes of similar size often have such large differences in their destructiveness? Why are they so different in the number of people they kill?

A: Earthquakes do more damage in places where the population density is high and the structures are not especially well built. More people are killed if they are out on the road and at work than if they are home in bed.

Q: If you observe steeply inclined sedimentary rocks, what can you conclude?

A: The principle of original horizontality states that sediments accumulate in horizontal or nearly horizontal layers. For rock layers to be steeply inclined, they must have been deposited horizontally, been lithified, and then tilted to their present position.


Q: Why are there volcanoes on the west coast of North America, but not on the east coast?


A: The west coast is an active margin of the North American plate; from Northern California northward is a convergent margin. The east coast is a passive margin.

Geology Essay Questions Part 1

Q: When looking at a hand sample of an igneous rock, how would you tell if it is plutonic or volcanic? Give one example of each.
A: If the texture is coarse grain, the magma cooled slowly in the ground, and the rock is plutonic or intrusive. If the texture is fine grained, the magma cooled rapidly at the surface, and the rock is volcanic or extrusive. An example of a plutonic rock is granite/gabbro/diorite/peridotite. Examples of volcanic rocks are rhyolite/basalt/scoria/pumice/obsidian.

Q: If you start with an element with 1,000,000 parent atoms, how many parents and how many daughters will there be after 6 half-lives? Show complete work.
A: 0: P=1,000,000, D=0; 1: P=500,000, D=500,000; 2: P=250,000, D=750,000; 3: P=125,000, D=875,000; 4: P=62,500, D=937,500; 5: P=31,250; D=968,750; 6: P=15,625, D=984,315.
(P=Parent, D=Daughter)

Q: List the four Earth’s systems. What is the fundamental source of energy that drives the three surface systems?
A: Hydrosphere, Geosphere, Biosphere and Atmosphere. The Sun is the source of energy.

Q: What is one way in which geologic knowledge is used to help humans?
A: Finding mineral or energy resources, helping solve environmental problems, or predicting natural hazards.

Q: Why does the metamorphic rock, marble react to hydrochloric acid?
A: Because the mineral in marble is calcite. Calcite is a mineral that reacts to hydrochloric acid.
Q: List five specialties in the science of Geology.
A: Sedimentologist, Hydrogeologist, Geophysicist, Stratigrapher, Petroleum Geologist, Seismologist, Structural Geologist, Mineralogist, Petrologist etc.

Q: List 3 sedimentary structures discussed in your text.
A: bedding/ripple marks/mud cracks/fossils/cross-bedding

Q: What is the most distinctive physical property of the mineral halite?
A: the salty taste

Q: In a given area where you have little knowledge of the local geology (rocks types, fossils, etc.), what type of unconformity would be the most difficult to recognize in an exposed sequence of rocks? Why?
A: Disconformity. This is because the sedimentary layers above and below the unconformity are parallel.

Q: Some of the oldest known rocks, which have been dated at 3.96 billion years, are metamorphic. What does this tell us about the age of Earth?
A: Earth must be older than this, because there had to be a preexisting rock for it to become metamorphosed since metamorphic rocks are rocks that form from other rocks.


miércoles, 25 de diciembre de 2013

Astronomy 5

1. Angular size is the apparent size of an object measured in degrees. Consider two
identical galaxies A and B. A has a redshift of 5,000 km/sec; B has a redshift of 10,000
km/sec. Which of the following is correct?
a. A’s angular size equals B's angular size.
b. A has a larger angular size than B.
c. A has a smaller angular size than B.
d. The redshift (and so distance) has no impact on the angular size.

2. Expanding hot gas radiates and cools. The cosmic microwave background radiation
thus tells us that:
a. The universe evolved from a hot, dense state, and still cooling to this day
b. Colliding galaxies release enormous amounts of radiation.
c. At 2.73 degrees Kelvin, the early universe was extremely cool.
d. Stellar-mass black holes form everywhere.

3. A planet that holds onto light gases such as Hydrogen, thereby allowing noxious
chemicals such as ammonia (NH3) and methane (CH4) to form, must:
a. Have a high atmospheric temperature.
b. Have a low density.
c. Be fairly massive.
d. Have a low atmospheric pressure.

4. Compared to the present day Milky Way Galaxy, the Milky Way of 3 billion years ago
would have had:
a. More gas in the disk
b. More objects in the halo.
c. More metal-rich stars.

5. The most effective technique to find distances to other galaxies is to look at objects in
those galaxies for which we know the:
a. mass.
b. color
c. luminosity.
d. spectral type.
e. orbital velocity about the center of the galaxy.

6. If the brightest stars in elliptical galaxies are red but they are blue in spirals, and if we
know that elliptical galaxies have little gas or dust, then we may infer that:
a. elliptical galaxies are younger than spiral galaxies.
b. elliptical galaxies have larger redshifts than spiral galaxies.
c. elliptical galaxies have little star formation.

7. The activity in the centers of some galaxies (AGN, quasars, etc.) arise from:
a. Very bright star emission
b. Supernova explosions
c. Material falling toward a black hole in an accretion disc
d. Neutron star emission

Use this sketch for questions 8 and 9. The gas cloud is moving toward letter A. For each
question, consider yourself at the position of the letter -- what would you see?



8. From which position will the hot source be reddened?
a. A
b. B
c. C
d. D

9. From which position(s) could you best detect the motion of the gas cloud?
a. A
b. B
c. C
d. A and B
e. A, B, and D

10. Life is less likely to evolve on planets around very massive main sequence stars because
such stars:
a. Pull planets inward because of their high mass.
b. Cease core nucleosynthesis too quickly for bio-evolution.
c. Heat planets until they evaporate the planets’ atmospheres.
d. Engulf planets because of their large radii.

Astronomy 4

Astronomy 1013 Fall 2013 Quiz 4 abc123 ID:_________
1. You observe individual stars in 2 similar star clusters, labeled clusters X and Y.
You collect sufficient spectroscopic data to classify the stars by temperature and
plot the HR diagrams for X and Y. From this you learn that one main sequence
star in X is 10 times brighter than any main sequence star in Y. You conclude:
a) Cluster X is larger than Y
b) Cluster X is older than Y
c) Cluster Y is larger than X
d) Cluster Y is older than X

2. What prevents an object with <~0.08 the mass of the Sun from becoming a star?
a) The core never becomes sufficiently hot for fusion of H to He to occur
b) Nothing - it will become a star, just a small, faint, red one
c) Gravity is too weak so the object comes apart
d) The core becomes hot enough to fuse H to He, but the radiation is trapped

3. A star with a mass of around ____ times the mass of the Sun collapses to a Black
Hole as _______ is overcome by gravity.
a) 3 or more, temperature
b) 3 or more, degeneracy pressure
c) 3 or more, spaghettification
d) 2, degeneracy pressure

4. A neutron star can create pulses of emission due to its very fast:
a) Rotation and magnetic field
b) Velocity toward the Earth
c) Life
d) Motion of electrons in the core

5. Giant stars are more rare than main sequence stars because:
a) They do not form as often as main sequence stars
b) We cannot detect them as easily as we detect main sequence stars
c) The giant stage is very short compared to the main sequence stage
d) Elements heavier than helium are relatively rare

6. The most effective technique to find distances to other galaxies is to look at
objects in those galaxies for which we know the:
a) Spectral type
b) Color
c) Luminosity
d) Mass
e) Orbital velocity about the center of the galaxy

7. As stars in clusters all have similar ages and distances, the primary physical root
cause of their different appearance is their _______.
a) Chemical composition
b) Color
c) Radius
d) Mass
e) Temperature

8. Fusion in the core of a main sequence star changes the chemical composition of
the core. What happens to the chemical composition outside the core?
a) The same changes occur outside the core as within the core
b) We have no way of finding out since the matter is below the star’s surface
c) The chemical composition outside the core changes very little.
d) Convection mixes the chemical elements to form new elements

9. If two stars are on the main sequence, and one is more luminous than the other,
we can be sure that the:
a) More luminous star is the more massive
b) More luminous star will have the longer lifetime
c) Fainter star is the more massive
d) More luminous star will have the redder color

10. A critical thinking question: examine the data to answer the question: which one
of the following answers can reliably be inferred from the data?



a) More police on the streets has raised public anxiety, even though crime rates
fell
b) More police on the streets reduced crime but at the same time fueled public
anxiety
c) Increased numbers of police and lower crime rates have not led to a
reduction in public anxiety about crime.
d) The police are more concerned with fighting real crime than allaying public
anxieties