Various Build Actions in Visual Studio

Hello everyone, In this post we are going to learn about various Build Actions of Visual Studio. The Build Action property indicates what Visual Studio does with a file when a build is executed. 

Actually you can change build action of each and every file in any visual studio project. Each build action has its own functionality as described below:

  • None: The file is not included in the project output group and is not compiled in the build process. An example is a text file that contains documentation, such as a Readme file.
  • Compile: The file is compiled into the build output. This setting is used for code files.
  • Content: Allows you to retrieve a file (in same dir as assembly) as a stream via Application.GetContentStream( uri ). For this method to work, it needs a AssemblyAssociatedContentFile custom attribute which VS graciously adds when you mark a file as “Content”
  • Embedded resource: embeds the file in an exclusive assembly manifest resource.
  • Resource (wpf only): embeds the file in a shared (by all files in the assembly with similar setting) assembly manifest resource named AppName.g.resources.
  • Page (wpf only): Used to compile a xaml file into baml. The baml is then embedded with the same technique as Resource (i.e. available as `AppName.g.resources)
  • ApplicationDefinition (wpf only): Mark the XAML/class file that defines your application. You specify the code-behind with the x:Class=”Namespace.ClassName” and set the startup form/page with StartupUri=”Window1.xaml”
  • SplashScreen (wpf only): An image that is marked as SplashScreen is shown automatically when an WPF application loads, and then fades
  • DesignData: Compiles xaml viewmodels so that usercontrols can be previewed with sample data in visual studio (uses mock types)
  • DesignDataWithDesignTimeCreatableTypes: Compiles xaml viewmodels so that usercontrols can be previewed with sample data in visual studio (uses actual types)
  • EntityDeploy: (Entity Framework): used to deploy the Entity Framework artifacts
  • CodeAnalysisDictionary: A xml file containing custom word dictionary for spelling rules

 

Common Questions / Issues associated with understanding Build Action:

  1. My class under App_Code / App_Data is not accessible in Visual Studio .NET
  2. Cannot reference App_Code in .NET

Resolution:

The above questions mostly asked with the ASP.NET development, The answer is simple change the Build Action of the files under App_Data from Content to Compile.

If you have trouble to find build action, kindly follow the steps below.
  1. Select the file under App_Code / App_Data
  2. Go to Properties window
  3. Change Build Action to Compile

How your brain decides blame and punishment

[dropcap]Juries [/dropcap]in criminal cases typically decide if someone is guilty, then a judge determines a suitable level of punishment. New research confirms that these two separate assessments of guilt and punishment — though related — are calculated in different parts of the brain. In fact, researchers found that they can disrupt and change one decision without affecting the other.

New work by researchers at Vanderbilt University and Harvard University confirms that a specific area of the brain, the dorsolateral prefrontal cortex, is crucial to punishment decisions. Researchers predicted and found that by altering brain activity in this brain area, they could change how subjects punished hypothetical defendants without changing the amount of blame placed on the defendants.

“We were able to significantly change the chain of decision-making and reduce punishment for crimes without affecting blameworthiness,” said René Marois, professor and chair of psychology at Vanderbilt and co-principal author of the study. “This strengthens evidence that the dorsolateral prefrontal cortex integrates information from other parts of the brain to determine punishment and shows a clear neural dissociation between punishment decisions and moral responsibility judgements.”

The research titled “From Blame to Punishment: Disrupting Prefrontal Cortex Activity Reveals Norm Enforcement Mechanisms” was published on Sept. 17 in the journal Neuron.

The Experiment

The researchers used repetitive transcranial magnetic stimulation (rTMS) on a specific area of the dorsolateral prefrontal cortex to briefly alter activity in this brain region and consequently change the amount of punishment a person doled out.

“Many studies show the integrative function of the dorsolateral prefrontal cortex in relatively simple cognitive tasks, and we believe that this relatively basic process forms the foundation for far more complex forms of behavior and decision-making, such as norm enforcement,” said lead author Joshua Buckholtz, now an assistant professor of psychology at Harvard.

The researchers conducted experiments with 66 volunteer men and women. Participants were asked to make punishment and blameworthiness decisions in a series of scenarios in which a suspect committed a crime. The scenarios varied by harm caused (ranging from property loss to grievous injury and death) and how culpable the suspect was for the act (fully responsible or not, due to mitigating circumstances.) Half of the subjects received active rTMS while the other half of the subjects received a sham or placebo version of rTMS.

Level of Harm

Across all participants and all trials, both culpability and level of harm were significant predictors of the amount of punishment the subjects deemed appropriate. But subjects receiving active rTMS chose significantly lower punishments for fully culpable suspects than did those subjects receiving sham rTMS, particularly in scenarios that resulted in low to moderate harm. Additional analyses suggested that the effect was due to impaired integration of signals for harm and culpability.

“Temporarily disrupting the dorsolateral prefrontal cortex function appears to alter how people use information about harm and culpability to render these decisions. In other words punishment requires that people balance these two influences, and the rTMS manipulation interfered with this balance, especially under conditions in which these factors are dissonant, such as when the intent is clear but the harm outcome is mild,” said Buckholtz.

Implications

The research team’s main goal in this work is to expand the knowledge of how the brain assesses and then integrates information relevant to guilt and punishment decisions. It will also advance the burgeoning interdisciplinary study of law and neuroscience.

“This research gives us deeper insights into how people make decisions relevant to law, and particularly how different parts of the brain contribute to decisions about crime and punishment. We hope that these insights will help to build a foundation for better understanding, and perhaps one day better combatting, decision-making biases in the legal system,” said co-author Owen Jones, professor of law and biological sciences at Vanderbilt and director of the MacArthur Foundation Research Network on Law and Neuroscience.


Story Source:

The above post is reprinted from materials provided by Vanderbilt University. The original item was written by Amy Wolf. Note: Materials may be edited for content and length.


Journal Reference:

  1. Joshua W. Buckholtz, Justin W. Martin, Michael T. Treadway, Katherine Jan, David H. Zald, Owen Jones, René Marois. From Blame to Punishment: Disrupting Prefrontal Cortex Activity Reveals Norm Enforcement Mechanisms. Neuron, 2015; DOI: 10.1016/j.neuron.2015.08.023

Porsche’s New Electric Concept Car Could Give Tesla Trouble

 

[dropcap]Porsche[/dropcap] might not be saying it directly, but anyone taking even a quick glance can see the Germans are taking aim at Tesla with the freshly unveiled Mission E concept at the Frankfurt Motor Show. With over 590 horsepower, this electric sedan doesn’t have quite as much electric grunt as a Model S, but the claimed 310.7 miles of range would outdo even the latest take on Elon Musk’s four-door with a 90 kWh battery. For those keeping track, a Ludicrous Speed-equipped Tesla might still be the ultimate victor in a drag race because the E’s sprint to 62 takes “under 3.5 seconds.”

To power the Mission E, Porsche’s engineers use two permanent magnet synchronous motors, and they are similar to what’s found on the company’s 919 Hybrid LMP1 racecar. In a single unit, the devices can both accelerate and recover braking energy. All-wheel drive with torque vectoring and four-wheel steering help the electric sedan lap the Nordschleife in less than eight minutes, the company claims.

[tie_slideshow]

[tie_slide]

Porsche-Missiohn-E-front-view

Drive System:

The drive system of the Mission E is entirely new, yet it is typical Porsche, i.e. proven in motor racing. Two permanent magnet synchronous motors (PMSM) – similar to those used in this year’s Le Mans victor, the 919 hybrid – accelerate the sports car and recover braking energy.

[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-rear

Driving Range:

It is not just passionate sportiness that makes up a Porsche but also a high level of everyday practicality. Accordingly, the Mission E can travel over 500 km on one battery charge, and it can be charged with enough energy for around 400 km more driving range in about fifteen minutes.

[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-at-frankfurt-2015

A moveable body segment on the front left wing in front of the driver’s door gives access to the charging port for the innovative “Porsche Turbo Charging” system. Via the 800-volt port, the battery can be charged to approximately 80 per cent of its capacity in around 15 minutes – a record time for electric vehicles

[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-concept-frankfurt-1

Design:

A new type of matrix LED headlights in the brand’s typical four-point light design captures the viewer’s gaze. Integrated as an element hovering in the airflow of the air inlet, they lend a futuristic character to the front end.
[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-dashboard

Display and Control Concept:

A new world based on an innovative display and control concept opens up before the driver. It is intuitive, fast and free of distractions – created for the sports car of tomorrow. The filigree driver’s display is curved, low-profile and free-standing. The instrument cluster shows five round instruments – they can be recognized as Porsche, but they are displayed virtually in OLED technology

[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-foot-rest

[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-interior

Holographic display:

The entire dashboard is chock full of new ideas. Its division into two three-dimensionally structuring layers reinforces the impression of lightness and clarity. The upper layer integrates the driver’s display, and between the levels there is a holographic display that extends far into the passenger’s side. It shows individually selectable apps, which are stacked in virtual space and arranged by priority with a three-dimensional effect.

[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-interior-1

The driver – or passenger – can use these apps to touch-free control primary functions such as media, navigation, climate control, contacts and vehicle. The desired symbol is activated by gestures that are detected by sensors. A grasping gesture means select, while pulling means control. Moreover, driver or passenger can use a touch display on the centre console to control secondary functions such as detailed information menus.

[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-side

Driving dynamics:

The battery mounted in the car’s underbody, which is based on the latest lithium-ion technology, runs the whole length between the front and rear axles. This distributes its weight to the two drive axles uniformly, resulting in exceptionally good balance. 

[/tie_slide]

[tie_slide]

Porsche-Missiohn-E-tail-light

The body as a whole is made up of a functional mix of aluminium, steel and carbon fibre reinforced polymer. The wheels are made of carbon: the Mission E has wide tyres mounted on 21-inch wheels in front and 22-inch wheels at the rear.

[/tie_slide]

[/tie_slideshow]

Capable of hitting 124 mph in less than 12 seconds, the Mission E is undoubtedly quick, but its speed in charging is especially impressive too. The concept utilizes an 800-volt system that Porsche claims can charge the sedan to 80 percent in just 15 minutes, assuming you can find a source for that much energy. That would be enough to offer about 249 miles of range in less time than getting a cup of coffee at a busy Starbucks. The E could also use a traditional 400-volt charger or power up inductively.

The Mission E’s design looks like a futuristic Panamera as filtered through the style of the 918 and a next-gen Star Wars Stormtrooper helmet. In an especially cool touch, the charging port is hidden in a movable panel ahead of the driver’s door on the front fender. Also, like like lots of four-door concepts in recent memory, the design sports suicide doors with no B-pillars. To keep weight to a minimum, the body mixes aluminum, steel, and carbon-fiber reinforced polymer. Also present are carbon-fiber wheels. Inside, drivers get instruments that track their eyes so that the gauges always remain visible. There’s a video below, but stay tuned for a closer look at the Mission E from the show floor in Frankfurt.

SQL Join Tables with Group By and Order By

In this post of easy lesson series, we are going to discuss the usage of GROUP BY and ORDER BY clause within a JOIN clause. First of all you need to know what is a sql join clause.

A SQL join clause combines records from two or more tables in a relational database. It creates a set that can be saved as a table or used as it is. A JOIN is a means for combining fields from two tables (or more) by using values common to each.

Sample table : agents

+------------+----------------------+--------------------+------------+-----------------+---------+
| AGENT_CODE | AGENT_NAME           | WORKING_AREA       | COMMISSION | PHONE_NO        | COUNTRY |
+------------+----------------------+--------------------+------------+-----------------+---------+
| A007       | john doe             | Bangalore          |       0.15 | 077-25814763    |         |
| A003       | Lawrence             | London             |       0.13 | 075-12458969    |         |
| A008       | Christlin            | New York           |       0.12 | 044-25874365    |         |
| A011       | Kowsik Prasanth      | Bangalore          |       0.15 | 077-45625874    |         |
| A010       | Jones Rajakumar      | Chennai            |       0.14 | 007-22388644    |         |
| A012       | Lucida               | San Jose           |       0.12 | 044-52981425    |         |
| A005       | Anderson             | Brisban            |       0.13 | 045-21447739    |         |
| A001       | Dinesh Kumar         | Bangalore          |       0.14 | 077-12346674    |         |
| A002       | Mukesh               | Mumbai             |       0.11 | 029-12358964    |         |
| A006       | McDen                | London             |       0.15 | 078-22255588    |         |
| A004       | Ivan                 | Torento            |       0.15 | 008-22544166    |         |
| A009       | Benjamin             | Hampshair          |       0.11 | 008-22536178    |         |
+------------+----------------------+--------------------+------------+-----------------+---------+

Sample table : orders

   ORD_NUM ORD_AMOUNT ADVANCE_AMOUNT ORD_DATE  CUST_CODE       AGENT_CODE      ORD_DESCRIPTION
---------- ---------- -------------- --------- --------------- --------------- -----------------
    200114       3500           2000 15-AUG-08 C00002          A008
    200122       2500            400 16-SEP-08 C00003          A004
    200118        500            100 20-JUL-08 C00023          A006
    200119       4000            700 16-SEP-08 C00007          A010
    200121       1500            600 23-SEP-08 C00008          A004
    200130       2500            400 30-JUL-08 C00025          A011
    200134       4200           1800 25-SEP-08 C00004          A005
    200115       2000           1200 08-FEB-08 C00013          A013
    200108       4000            600 15-FEB-08 C00008          A004
    200103       1500            700 15-MAY-08 C00021          A005
    200105       2500            500 18-JUL-08 C00025          A011
    200109       3500            800 30-JUL-08 C00011          A010
    200101       3000           1000 15-JUL-08 C00001          A008
    200111       1000            300 10-JUL-08 C00020          A008
    200104       1500            500 13-MAR-08 C00006          A004
    200106       2500            700 20-APR-08 C00005          A002
    200125       2000            600 10-OCT-08 C00018          A005
    200117        800            200 20-OCT-08 C00014          A001
    200123        500            100 16-SEP-08 C00022          A002
    200120        500            100 20-JUL-08 C00009          A002
    200116        500            100 13-JUL-08 C00010          A009
    200124        500            100 20-JUN-08 C00017          A007
    200126        500            100 24-JUN-08 C00022          A002
    200129       2500            500 20-JUL-08 C00024          A006
    200127       2500            400 20-JUL-08 C00015          A003
    200128       3500           1500 20-JUL-08 C00009          A002
    200135       2000            800 16-SEP-08 C00007          A010
    200131        900            150 26-AUG-08 C00012          A012
    200133       1200            400 29-JUN-08 C00009          A002
    200132       4000           2000 15-AUG-08 C00013          A013
    200100       1000            600 08-JAN-08 C00015          A003
    200110       3000            500 15-APR-08 C00019          A010
    200107       4500            900 30-AUG-08 C00007          A010
    200112       2000            400 30-MAY-08 C00016          A007
    200113       4000            600 10-JUN-08 C00022          A002
    200102       2000            300 25-MAY-08 C00012          A012
To get ‘agent_code’ and ‘agent_name’ columns from the table ‘agents’ and sum of ‘advance_amount’ column from the table ‘orders’ after a joining, with following conditions –

1. ‘agent_code’ of ‘agents’ and ‘orders’ must be same,

2. the same combination of ‘agent_code’ and ‘agent_name’ of ‘agents’ table must be within a group,

3. ‘agent_code’ of ‘agents’ table should arrange in a order, default is ascending order,

the following sql statement can be used :

SELECT agents.agent_code,agents.agent_name, SUM(orders.advance_amount) FROM agents,orders  WHERE agents.agent_code=orders.agent_code GROUP BY agents.agent_code,agents.agent_name ORDER BY agents.agent_code;

the following sql statement is equivalent version of the above statement (see the JOIN keyword):

SELECT agents.agent_code,agents.agent_name, SUM(orders.advance_amount) FROM agents INNER JOIN orders ON orders.agent_code = agents.agent_code GROUP BY agents.agent_code,agents.agent_name ORDER BY agents.agent_code;

Above queries may look different but the working principles and output are the same. So both the queries will give the following output when you run them independently.

NOTE: The column name utilized by the ORDER BY clause should be contained in either an aggregate function or the GROUP BY clause.

Output

AGENT_CODE AGENT_NAME                               SUM(ORDERS.ADVANCE_AMOUNT)
---------- ---------------------------------------- --------------------------
A001       Dinesh Kumar                                                    200
A002       Mukesh                                                         3500
A003       Lawrence                                                       1000
A004       Ivan                                                           2100
A005       Anderson                                                       3100
A006       McDen                                                           600
A007       John Doe                                                        500
A008       Christlin                                                      3300
A009       Benjamin                                                        100
A010       Jones Rajakumar                                                3700
A011       Kowsik Prasanth                                                 900
A012       Lucida                                                          450

Change your walking style, change your mood

Man walking (stock image). Subjects in this study who were prompted to walk in a more depressed style, with less arm movement and their shoulders rolled forward, experienced worse moods than those who were induced to walk in a happier style. Credit: © connel_design / Fotolia
Man walking (stock image). Subjects in this study who were prompted to walk in a more depressed style, with less arm movement and their shoulders rolled forward, experienced worse moods than those who were induced to walk in a happier style.
Credit: © connel_design / Fotolia

Our mood can affect how we walk — slump-shouldered if we’re sad, bouncing along if we’re happy. Now researchers have shown it works the other way too — making people imitate a happy or sad way of walking actually affects their mood.

Subjects who were prompted to walk in a more depressed style, with less arm movement and their shoulders rolled forward, experienced worse moods than those who were induced to walk in a happier style, according to the study published in the Journal of Behavior Therapy and Experimental Psychiatry.

CIFAR Senior Fellow Nikolaus Troje (Queen’s University), a co-author on the paper, has shown in past research that depressed people move very differently than happy people.

“It is not surprising that our mood, the way we feel, affects how we walk, but we want to see whether the way we move also affects how we feel,” Troje says.

He and his colleagues showed subjects a list of positive and negative words, such as “pretty,” “afraid” and “anxious” and then asked them to walk on a treadmill while they measured their gait and posture. A screen showed the subjects a gauge that moved left or right depending on whether their walking style was more depressed or happier. But the subjects didn’t know what the gauge was measuring. Researchers told some subjects to try and move the gauge left, while others were told to move it right.

“They would learn very quickly to walk the way we wanted them to walk,” Troje says.

Afterward, the subjects had to write down as many words as they could remember from the earlier list of positive and negative words. Those who had been walking in a depressed style remembered many more negative words. The difference in recall suggests that the depressed walking style actually created a more depressed mood.

The study builds on our understanding of how mood can affect memory. Clinically depressed patients are known to remember negative events, particularly those about themselves, much more than positive life events, Troje says. And remembering the bad makes them feel even worse.

“If you can break that self-perpetuating cycle, you might have a strong therapeutic tool to work with depressive patients.”

The study also contributes to the questions asked in CIFAR’s Neural Computation & Adaptive Perception program, which aims to unlock the mystery of how our brains convert sensory stimuli into information and to recreate human-style learning in computers.

“As social animals we spend so much time watching other people, and we are experts at retrieving information about other people from all sorts of different sources,” Troje says. Those sources include facial expression, posture and body movement. Developing a better understanding of the biological algorithms in our brains that process stimuli — including information from our own movements — can help researchers develop better artificial intelligence, while learning more about ourselves in the process.


Story Source:

The above post is reprinted from materials provided by Canadian Institute for Advanced Research. Note: Materials may be edited for content and length.


Journal Reference:

  1. Johannes Michalak, Katharina Rohde, Nikolaus F. Troje. How we walk affects what we remember: Gait modifications through biofeedback change negative affective memory bias. Journal of Behavior Therapy and Experimental Psychiatry, 2015; 46: 121 DOI: 10.1016/j.jbtep.2014.09.004

In the fond hope – Idiom Thaatha

In the fond hope

The meaning of the idiom in the fond hope is to denote a person’s hope that is foolish and not likely to happen in real life, but still clung on to.

Examples

  1. Every slum dweller’s life is spent in the fond hope that their lives would change for the better in a short while.
  2. The class teacher’s fond hope was that all her students should pass with a first class.

Pressure of Constant Social Media Causes Anxiety

Dr Cleland Woods explained: "Adolescence can be a period of increased vulnerability for the onset of depression and anxiety, and poor sleep quality may contribute to this. It is important that we understand how social media use relates to these. Evidence is increasingly supporting a link between social media use and wellbeing, particularly during adolescence, but the causes of this are unclear." Credit: © sanyasm / Fotolia
Dr Cleland Woods explained: “Adolescence can be a period of increased vulnerability for the onset of depression and anxiety, and poor sleep quality may contribute to this. It is important that we understand how social media use relates to these. Evidence is increasingly supporting a link between social media use and wellbeing, particularly during adolescence, but the causes of this are unclear.”
Credit: © sanyasm / Fotolia

The need to be constantly available and respond 24/7 on social media accounts can cause depression, anxiety and reduce sleep quality for teenagers says a study being presented September 11, 2015, at a British Psychological Society conference in Manchester.

The researchers, Dr Heather Cleland Woods and Holly Scott of the University of Glasgow, provided questionnaires for 467 teenagers regarding their overall and night-time specific social media use. A further set of tests measured sleep quality, self-esteem, anxiety, depression and emotional investment in social media which relates to the pressure felt to be available 24/7 and the anxiety around, for example, not responding immediately to texts or posts

Dr Cleland Woods explained: “Adolescence can be a period of increased vulnerability for the onset of depression and anxiety, and poor sleep quality may contribute to this. It is important that we understand how social media use relates to these. Evidence is increasingly supporting a link between social media use and wellbeing, particularly during adolescence, but the causes of this are unclear.”

Analysis showed that overall and night-time specific social media use along with emotional investment were related to poorer sleep quality, lower self-esteem as well as higher anxiety and depression levels.

Lead researcher Dr Cleland Woods said “While overall social media use impacts on sleep quality, those who log on at night appear to be particularly affected. This may be mostly true of individuals who are highly emotionally invested. This means we have to think about how our kids use social media, in relation to time for switching off.”

The study is presented at the BPS Developmental and Social Psychology Section annual conference taking place from the 9 to 11 September at The Palace Hotel in Manchester.


Story Source:

The above post is reprinted from materials provided by British Psychological Society. Note: Materials may be edited for content and length.

Easy Lesson On : Active FTP vs Passive FTP

Contents:

 

Introduction

One of the most commonly seen questions when dealing with firewalls and other Internet connectivity issues is the difference between active and passive FTP and how best to support either or both of them. Hopefully the following text will help to clear up some of the confusion over how to support FTP in a firewalled environment.

 

The Basics

FTP is a TCP based service exclusively. There is no UDP component to FTP. FTP is an unusual service in that it utilizes two ports, a ‘data’ port and a ‘command’ port (also known as the control port). Traditionally these are port 21 for the command port and port 20 for the data port. The confusion begins however, when we find that depending on the mode, the data port is not always on port 20.

 

Active FTP

In active mode FTP the client connects from a random unprivileged port (N > 1023) to the FTP server’s command port, port 21. Then, the client starts listening to port N+1 and sends the FTP command PORT N+1 to the FTP server. The server will then connect back to the client’s specified data port from its local data port, which is port 20.

From the server-side firewall’s standpoint, to support active mode FTP the following communication channels need to be opened:

  • FTP server’s port 21 from anywhere (Client initiates connection)
  • FTP server’s port 21 to ports > 1023 (Server responds to client’s control port)
  • FTP server’s port 20 to ports > 1023 (Server initiates data connection to client’s data port)
  • FTP server’s port 20 from ports > 1023 (Client sends ACKs to server’s data port)

When drawn out, the connection appears as follows:active-ftp-winged-post

In step 1, the client’s command port contacts the server’s command port and sends the command PORT 1027. The server then sends an ACK back to the client’s command port in step 2. In step 3 the server initiates a connection on its local data port to the data port the client specified earlier. Finally, the client sends an ACK back as shown in step 4.

The main problem with active mode FTP actually falls on the client side. The FTP client doesn’t make the actual connection to the data port of the server–it simply tells the server what port it is listening on and the server connects back to the specified port on the client. From the client side firewall this appears to be an outside system initiating a connection to an internal client–something that is usually blocked.

 

Active FTP Example

Below is an actual example of an active FTP session. The only things that have been changed are the server names, IP addresses, and user names. In this example an FTP session is initiated from area1.wingedpost.com (192.168.150.80), a linux box running the standard FTP command line client, to area2.wingedpost.com (192.168.150.90), a linux box running ProFTPd 1.2.2RC2. The debugging (-d) flag is used with the FTP client to show what is going on behind the scenes. Everything in red is the debugging output which shows the actual FTP commands being sent to the server and the responses generated from those commands. Normal server output is shown in black, and user input is in bold.

There are a few interesting things to consider about this dialog. Notice that when the PORT command is issued, it specifies a port on the client (192.168.150.80) system, rather than the server. We will see the opposite behavior when we use passive FTP. While we are on the subject, a quick note about the format of the PORT command. As you can see in the example below it is formatted as a series of six numbers separated by commas. The first four octets are the IP address while the last two octets comprise the port that will be used for the data connection. To find the actual port multiply the fifth octet by 256 and then add the sixth octet to the total. Thus in the example below the port number is ( (14*256) + 178), or 3762. A quick check with netstat should confirm this information.

area1: {/home/p-t/wingedpost/public_html} % ftp -d area2
Connected to area2.wingedpost.com.
220 area2.wingedpost.com FTP server ready.
Name (area2:wingedpost): wingedpostuser
---> USER wingedpostuser
331 Password required for wingedpostuser.
Password: TmpPass
---> PASS XXXX
230 User wingedpostuser logged in.
---> SYST
215 UNIX Type: L8
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
ftp: setsockopt (ignored): Permission denied
---> PORT 192,168,150,80,14,178
200 PORT command successful.
---> LIST
150 Opening ASCII mode data connection for file list.
drwx------   3 wingedpostuser    users         104 Jul 27 01:45 public_html
226 Transfer complete.
ftp> quit
---> QUIT
221 Goodbye.

 

Passive FTP

In order to resolve the issue of the server initiating the connection to the client a different method for FTP connections was developed. This was known as passive mode, or PASV, after the command used by the client to tell the server it is in passive mode.

In passive mode FTP the client initiates both connections to the server, solving the problem of firewalls filtering the incoming data port connection to the client from the server. When opening an FTP connection, the client opens two random unprivileged ports locally (N > 1023 and N+1). The first port contacts the server on port 21, but instead of then issuing a PORT command and allowing the server to connect back to its data port, the client will issue the PASV command. The result of this is that the server then opens a random unprivileged port (P > 1023) and sends P back to the client in response to the PASV command. The client then initiates the connection from port N+1 to port P on the server to transfer data.

From the server-side firewall’s standpoint, to support passive mode FTP the following communication channels need to be opened:

  • FTP server’s port 21 from anywhere (Client initiates connection)
  • FTP server’s port 21 to ports > 1023 (Server responds to client’s control port)
  • FTP server’s ports > 1023 from anywhere (Client initiates data connection to random port specified by server)
  • FTP server’s ports > 1023 to remote ports > 1023 (Server sends ACKs (and data) to client’s data port)

When drawn, a passive mode FTP connection looks like this:passive-ftp-wingedpost

In step 1, the client contacts the server on the command port and issues the PASV command. The server then replies in step 2 with PORT 2024, telling the client which port it is listening to for the data connection. In step 3 the client then initiates the data connection from its data port to the specified server data port. Finally, the server sends back an ACK in step 4 to the client’s data port.

While passive mode FTP solves many of the problems from the client side, it opens up a whole range of problems on the server side. The biggest issue is the need to allow any remote connection to high numbered ports on the server. Fortunately, many FTP daemons, including the popular WU-FTPD allow the administrator to specify a range of ports which the FTP server will use.

The second issue involves supporting and troubleshooting clients which do (or do not) support passive mode. As an example, the command line FTP utility provided with Solaris does not support passive mode, necessitating a third-party FTP client, such as ncftp. 
NOTE: This is no longer the case–use the -p option with the Solaris FTP client to enable passive mode!

With the massive popularity of the World Wide Web, many people prefer to use their web browser as an FTP client. Most browsers only support passive mode when accessing ftp:// URLs. This can either be good or bad depending on what the servers and firewalls are configured to support.

 

Passive FTP Example

Below is an actual example of a passive FTP session. The only things that have been changed are the server names, IP addresses, and user names. In this example an FTP session is initiated from area1.wingedpost.com (192.168.150.80), a linux box running the standard FTP command line client, to area2.wingedpost.com (192.168.150.90), a linux box running ProFTPd 1.2.2RC2. The debugging (-d)  flag is used with the FTP client to show what is going on behind the scenes. Everything in red is the debugging output which shows the actual FTP commands being sent to the server and the responses generated from those commands. Normal server output is shown in black, and user input is in bold.

Notice the difference in the PORT command in this example as opposed to the active FTP example. Here, we see a port being opened on the server (192.168.150.90) system, rather than the client.

area1: {/home/p-t/wingedpost/public_html} % ftp -d area2
Connected to area2.wingedpost.com.
220 area2.wingedpost.com FTP server ready.
Name (area2:wingedpost): wingedpostuser
---> USER wingedpostuser
331 Password required for wingedpostuser.
Password: TmpPass
---> PASS XXXX
230 User wingedpostuser logged in.
---> SYST
215 UNIX Type: L8
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> passive
Passive mode on.
ftp> ls
ftp: setsockopt (ignored): Permission denied
---> PASV
227 Entering Passive Mode (192,168,150,90,195,149).
---> LIST
150 Opening ASCII mode data connection for file list
drwx------   3 wingedpostuser    users         104 Jul 27 01:45 public_html
226 Transfer complete.
ftp> quit
---> QUIT
221 Goodbye.

 

Summary

The following chart should help admins remember how each FTP mode works:

 Active FTP :
     command : client >1023 -> server 21
     data    : client >1023 <- server 20

 Passive FTP :
     command : client >1023 -> server 21
     data    : client >1024 -> server >1023

A quick summary of the pros and cons of active vs. passive FTP is also in order:

Active FTP is beneficial to the FTP server admin, but detrimental to the client side admin. The FTP server attempts to make connections to random high ports on the client, which would almost certainly be blocked by a firewall on the client side. Passive FTP is beneficial to the client, but detrimental to the FTP server admin. The client will make both connections to the server, but one of them will be to a random high port, which would almost certainly be blocked by a firewall on the server side.

Luckily, there is somewhat of a compromise. Since admins running FTP servers will need to make their servers accessible to the greatest number of clients, they will almost certainly need to support passive FTP. The exposure of high level ports on the server can be minimized by specifying a limited port range for the FTP server to use. Thus, everything except for this range of ports can be firewalled on the server side. While this doesn’t eliminate all risk to the server, it decreases it tremendously.

References

An excellent reference on how various internet protocols work and the issues involved in firewalling them can be found in the O’Reilly and Associates book, Building Internet Firewalls, 2nd Ed, by Brent Chapman and Elizabeth Zwicky. 
Note : This book is VERY old and the information contained therein may be outdated!

Finally, the definitive reference on FTP would be RFC 959, which sets forth the official specifications of the FTP protocol. RFCs can be downloaded from numerous locations, including http://www.faqs.org/rfcs/rfc959.html.

Bigger, older cousin to Earth discovered

This artist's concept compares Earth (left) to the new planet, called Kepler-452b, which is about 60 percent larger in diameter. Credit: NASA/JPL-Caltech/T. Pyle
This artist’s concept compares Earth (left) to the new planet, called Kepler-452b, which is about 60 percent larger in diameter.
Credit: NASA/JPL-Caltech/T. Pyle

[dropcap]NASA[/dropcap]’s Kepler mission has confirmed the first near-Earth-size planet in the “habitable zone” around a sun-like star. This discovery and the introduction of 11 other new small habitable zone candidate planets mark another milestone in the journey to finding another “Earth.”

The newly discovered Kepler-452b is the smallest planet to date discovered orbiting in the habitable zone — the area around a star where liquid water could pool on the surface of an orbiting planet — of a G2-type star, like our sun. The confirmation of Kepler-452b brings the total number of confirmed planets to 1,030.

“On the 20th anniversary year of the discovery that proved other suns host planets, the Kepler exoplanet explorer has discovered a planet and star which most closely resemble the Earth and our Sun,” said John Grunsfeld, associate administrator of NASA’s Science Mission Directorate at the agency’s headquarters in Washington. “This exciting result brings us one step closer to finding an Earth 2.0.”

Kepler-452b is 60 percent larger in diameter than Earth and is considered a super-Earth-size planet. While its mass and composition are not yet determined, previous research suggests that planets the size of Kepler-452b have a good chance of being rocky.

While Kepler-452b is larger than Earth, its 385-day orbit is only 5 percent longer. The planet is 5 percent farther from its parent star Kepler-452 than Earth is from the Sun. Kepler-452 is 6 billion years old, 1.5 billion years older than our sun, has the same temperature, and is 20 percent brighter and has a diameter 10 percent larger.

“We can think of Kepler-452b as an older, bigger cousin to Earth, providing an opportunity to understand and reflect upon Earth’s evolving environment,” said Jon Jenkins, Kepler data analysis lead at NASA’s Ames Research Center in Moffett Field, California, who led the team that discovered Kepler-452b. “It’s awe-inspiring to consider that this planet has spent 6 billion years in the habitable zone of its star; longer than Earth. That’s substantial opportunity for life to arise, should all the necessary ingredients and conditions for life exist on this planet.”

To help confirm the finding and better determine the properties of the Kepler-452 system, the team conducted ground-based observations at the University of Texas at Austin’s McDonald Observatory, the Fred Lawrence Whipple Observatory on Mt. Hopkins, Arizona, and the W. M. Keck Observatory atop Mauna Kea in Hawaii. These measurements were key for the researchers to confirm the planetary nature of Kepler-452b, to refine the size and brightness of its host star and to better pin down the size of the planet and its orbit.

The Kepler-452 system is located 1,400 light-years away in the constellation Cygnus. The research paper reporting this finding has been accepted for publication in The Astronomical Journal.

In addition to confirming Kepler-452b, the Kepler team has increased the number of new exoplanet candidates by 521 from their analysis of observations conducted from May 2009 to May 2013, raising the number of planet candidates detected by the Kepler mission to 4,696. Candidates require follow-up observations and analysis to verify they are actual planets.

Twelve of the new planet candidates have diameters between one to two times that of Earth, and orbit in their star’s habitable zone. Of these, nine orbit stars that are similar to our sun in size and temperature.

“We’ve been able to fully automate our process of identifying planet candidates, which means we can finally assess every transit signal in the entire Kepler dataset quickly and uniformly,” said Jeff Coughlin, Kepler scientist at the SETI Institute in Mountain View, California, who led the analysis of a new candidate catalog. “This gives astronomers a statistically sound population of planet candidates to accurately determine the number of small, possibly rocky planets like Earth in our Milky Way galaxy.”

These findings, presented in the seventh Kepler Candidate Catalog, will be submitted for publication in the Astrophysical Journal.

Scientists now are producing the last catalog based on the original Kepler mission’s four-year data set. The final analysis will be conducted using sophisticated software that is increasingly sensitive to the tiny telltale signatures of Earth-size planets.


Story Source:

The above post is reprinted from materials provided by NASA. Note: Materials may be edited for content and length.

Untangling the mechanics of knots

The researchers carried out experiments to test how much force is required to tighten knots with an increasing number of twists. They then compared their observations with their theoretical predictions, and found that the theory accurately predicted the force needed to close a knot, given its topology and the diameter and stiffness of the underlying strand. Credit: © highwaystarz / Fotolia
The researchers carried out experiments to test how much force is required to tighten knots with an increasing number of twists. They then compared their observations with their theoretical predictions, and found that the theory accurately predicted the force needed to close a knot, given its topology and the diameter and stiffness of the underlying strand.
Credit: © highwaystarz / Fotolia

Got rope? Then try this experiment: Cross both ends, left over right, then bring the left end under and out, as if tying a pair of shoelaces. If you repeat this sequence, you get what’s called a “granny” knot. If, instead, you cross both ends again, this time right over left, you’ve created a sturdier “reef” knot.

The configuration, or “topology,” of a knot determines its stiffness. For example, a granny knot is much easier to undo, as its configuration of twists creates weaker forces within the knot, compared with a reef knot. For centuries, sailors have observed such distinctions, choosing certain knots over others to secure vessels — largely by intuition and tradition.

Now researchers at MIT and Pierre et Marie Curie University in Paris have analyzed the mechanical forces underpinning simple knots, and come up with a theory that describes how a knot’s topology determines its mechanical forces.

The researchers carried out experiments to test how much force is required to tighten knots with an increasing number of twists. They then compared their observations with their theoretical predictions, and found that the theory accurately predicted the force needed to close a knot, given its topology and the diameter and stiffness of the underlying strand.

“This is the first time, to the best of our knowledge, that precision model experiments and theory have been tied together to untangle the influence of topology on the mechanics of knots,” the researchers write in a paper appearing in the journal Physical Review Letters.

Pedro Reis, the Gilbert W. Winslow Career Development Associate Professor in Civil Engineering and Mechanical Engineering, says the new knot theory may provide guidelines for choosing certain knot configurations for a given load-bearing application, such as braided steel cables, or surgical stitching patterns.

“Surgeons, of course, have a great deal of experience, and they know this knot is better for this stitching procedure than this knot,” Reis says. “But can we further inform the process? While maybe these knots are used, we might show that some other knots, done in a certain way, may be preferable.”

A twisted theory

Reis’ colleague, French theoretician Basile Audoly, originally took on the problem of relating a knot’s topology and mechanical forces. In previous work, Audoly, with his own colleague Sébastien Neukirch, had developed a theory based on observations of tightening a very simple, overhand knot, comprising only one twist. They then verified the theory with a slightly more complex knot with two twists. The theory, they concluded, should predict the forces required to tighten even more complex knots.

However, when Reis, together with his students Khalid Jawed and Peter Dieleman, performed similar experiments with knots of more than two twists, they found that the previous theory failed to predict the force needed to close the knots. Reis and Audoly teamed up to develop a more accurate theory for describing the topology and mechanics of a wider range of knots.

The researchers created knots from nitonol, a hyper-elastic wire that, even when bent at dramatic angles, will return to its original shape. Nitonol’s elasticity and stiffness are well known.

To generate various topologies, the researchers tied knots with multiple overhand twists, creating increasingly longer braids. They then clamped one end of each braid to a table, used a mechanical arm to simultaneously pull the knot tight, and measured the force applied. From these experiments, they observed that a knot with 10 twists requires about 1,000 times more force to close than a knot with just one.

“When Pedro Reis showed me his experiments on knots with as much as 10 twists, and told me that they could resist such a high force, this first appeared to me to be far beyond what simple equations can capture,” Audoly says. “Then, I thought it was a nice challenge.”

From shoelaces to surgery

To come up with a theory to predict the forces observed, Reis and Audoly went through multiple iterations between the experiments and theory to identify the ingredients that mattered the most and simplify the model. Eventually, they divided the problem in two parts, first characterizing the knot’s loop, then its braid. For the first part, the researchers quantified the aspect ratio, or shape of a loop, given the number of twists in a braid: The more twists in a braid, the more elliptical the loop.

The team then studied the forces within the braid. As a braid, or twist, is symmetric, the researchers simplified the problem by only considering one strand of the braid.

“Then we write an energy for the system that includes bending, tension, and friction for that one helical strand, and we are able to determine the shape,” Audoly says. “Once we have the shape, we can match it to this loop, and ultimately we get the overall force displacement response of the system.”

To test the theory, Reis plugged the experiments’ measurements into the theory to generate predictions of force.

“When we put the data through the machinery of the theory, the predictions and the dataset all collapse onto this master curve,” Reis says. “Once we have this master curve, you can give me a bending stiffness and diameter of a strand, and the number of turns in the knot, and I can tell you what force is required to close it. Also, we now understand how the knot locks itself up when more turns are added.”

Reis envisions multiple applications for the group’s theory, both significant and mundane.

“This theory helps us predict the mechanical response of knots of different topologies,” Reis says. “We’re describing the force it requires to close a loop, which is an indicator of the stiffness of the knot. This might help us to understand something as simple as how your headphones get tangled, and how to better tie your shoes, to how the configuration of knots can help in surgical procedures.”


Story Source:

The above post is reprinted from materials provided by Massachusetts Institute of Technology. The original item was written by Jennifer Chu. Note: Materials may be edited for content and length.