Map Viewer (QML)
This is a large example covering many basic uses of maps, positioning, and navigation services in Qt Location. This page is divided into sections covering each of these areas of functionality with snippets from the code.
Running the Example
To run the example from Qt Creator, open the Welcome mode and select the example from Examples. For more information, visit Building and Running an Example.
The example can work with any of the available geo services plugins. However, some plugins may require additional plugin parameters in order to function correctly. Plugin parameters can be passed on the command line using the --plugin
argument, which takes the form:
--plugin.<parameter name> <parameter value>
Refer to the documentation for each of the geo services plugins for details on what plugin parameters they support. The default plugin used by this example is Qt Location Open Street Map Plugin, which does not require any parameters.
Overview
QML types shown in this example:
- Displaying a map
- Finding an address
- Directions and travel routes
Displaying a Map
Drawing a map on-screen is accomplished using the Map type, as shown below.
Map { id: map zoomLevel: (maximumZoomLevel - minimumZoomLevel)/2 center { // The Qt Company in Oslo latitude: 59.9485 longitude: 10.7686 } }
In this example, we give the map an initial center coordinate with a set latitude and longitude. We also set the initial zoom level to 50% (halfway between the maximum and minimum).
Finding an Address (Geocoding)
To locate a certain address or place on the map uses a process called geocoding. In order to perform a geocode operation, we first need to adjust our Map object to be able to receive the result.
Receiving results of geocoding is done through a GeocodeModel:
GeocodeModel { id: geocodeModel plugin: map.plugin onStatusChanged: { if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error)) map.geocodeFinished() } onLocationsChanged: { if (count == 1) { map.center.latitude = get(0).coordinate.latitude map.center.longitude = get(0).coordinate.longitude } } }
To display the contents of the GeocodeModel we use a MapItemView:
MapItemView { model: geocodeModel delegate: pointDelegate }
MapItemView uses an object called a "delegate" to act as a template for the items it creates. This can contain any map object desired, but in this case we show a MapCircle:
Component { id: pointDelegate MapCircle { id: point radius: 1000 color: "#46a2da" border.color: "#190a33" border.width: 2 smooth: true opacity: 0.25 center: locationData.coordinate } }
With these three objects, we have enough to receive Geocode responses and display them on our Map. The final piece is to send the actual Geocode request.
To send a geocode request, first we create an Address object, and fill it in with the desired parameters.
Address { id :fromAddress street: "Sandakerveien 116" city: "Oslo" country: "Norway" state : "" postalCode: "0484" }
Then we set "geocodeModel.query" to the filled in Address, and call update() on the GeocodeModel.
// send the geocode request geocodeModel.query = fromAddress geocodeModel.update()
Directions and Travel Routes
Similar to the GeocodeModel, Qt Location also features the RouteModel type, which allows information about routes (for example driving directions) between two or more points, to be received and used with a Map.
Here again, we instantiate the RouteModel as a property of our Map:
RouteModel { id: routeModel plugin : map.plugin query: RouteQuery { id: routeQuery } onStatusChanged: { if (status == RouteModel.Ready) { switch (count) { case 0: // technically not an error map.routeError() break case 1: map.showRouteList() break } } else if (status == RouteModel.Error) { map.routeError() } } }
To display the contents of a model to the user, we need a view. Once again we will use a MapItemView, to display the Routes as objects on the Map:
MapItemView { model: routeModel delegate: routeDelegate }
To act as a template for the objects we wish the view to create, we create a delegate component:
Component { id: routeDelegate MapRoute { id: route route: routeData line.color: "#46a2da" line.width: 5 smooth: true opacity: 0.8 } }
With the model, view and delegate now complete, the only missing component is some kind of control over the model to begin the Route request process. In the simplest case, we can fill out a Route request using two already available coordinates:
property variant fromCoordinate: QtPositioning.coordinate(59.9483, 10.7695) property variant toCoordinate: QtPositioning.coordinate(59.9645, 10.671)
In the next snippet, we show how to set up the request object and instruct the model to update. We also instruct the map to center on the start coordinate for our routing request.
// clear away any old data in the query routeQuery.clearWaypoints(); // add the start and end coords as waypoints on the route routeQuery.addWaypoint(startCoordinate) routeQuery.addWaypoint(endCoordinate) routeQuery.travelModes = RouteQuery.CarTravel routeQuery.routeOptimizations = RouteQuery.FastestRoute routeModel.update(); // center the map on the start coord map.center = startCoordinate;
This is all that is required to display a Route on the Map. However, it is also useful to be able to retrieve the written directions and explanation of the travel route. In the example, these are displayed in a ListView element. To create this content, we use a standard ListModel and ListView pair. The data in the ListModel is built from the routeModel's output:
ListView { interactive: true model: ListModel { id: routeInfoModel } header: RouteListHeader {} delegate: RouteListDelegate{ routeIndex.text: index + 1 routeInstruction.text: instruction routeDistance.text: distance } }
Inside the RouteModel, as you can see above, we add an onStatusChanged handler, which calls the showRouteList()
which updates the routeInfoModel
:
routeInfoModel.clear() if (routeModel.count > 0) { for (var i = 0; i < routeModel.get(0).segments.length; i++) { routeInfoModel.append({ "instruction": routeModel.get(0).segments[i].maneuver.instructionText, "distance": Helper.formatDistance(routeModel.get(0).segments[i].maneuver.distanceToNextInstruction) }); } }
Files:
- mapviewer/helper.js
- mapviewer/mapviewer.qml
- mapviewer/forms/Geocode.qml
- mapviewer/forms/GeocodeForm.ui.qml
- mapviewer/forms/Locale.qml
- mapviewer/forms/LocaleForm.ui.qml
- mapviewer/forms/Message.qml
- mapviewer/forms/MessageForm.ui.qml
- mapviewer/forms/ReverseGeocode.qml
- mapviewer/forms/ReverseGeocodeForm.ui.qml
- mapviewer/forms/RouteAddress.qml
- mapviewer/forms/RouteAddressForm.ui.qml
- mapviewer/forms/RouteCoordinate.qml
- mapviewer/forms/RouteCoordinateForm.ui.qml
- mapviewer/forms/RouteList.qml
- mapviewer/forms/RouteListDelegate.qml
- mapviewer/forms/RouteListHeader.qml
- mapviewer/map/CircleItem.qml
- mapviewer/map/ImageItem.qml
- mapviewer/map/MapComponent.qml
- mapviewer/map/MapSliders.qml
- mapviewer/map/Marker.qml
- mapviewer/map/MiniMap.qml
- mapviewer/map/PolygonItem.qml
- mapviewer/map/PolylineItem.qml
- mapviewer/map/RectangleItem.qml
- mapviewer/menus/ItemPopupMenu.qml
- mapviewer/menus/MainMenu.qml
- mapviewer/menus/MapPopupMenu.qml
- mapviewer/menus/MarkerPopupMenu.qml
- mapviewer/main.cpp
- mapviewer/mapviewer.pro
- mapviewer/mapviewer.qrc


-
Initial Patient Population =
- AND: "Diagnosis, Active: Diabetes" starts before or during "Measurement Period"
- AND: "Patient Characteristic Birthdate: birth date" >= 18 year(s) starts before start of "Measurement Period"
- AND: "Patient Characteristic Birthdate: birth date" <= 75 year(s) starts before start of "Measurement Period"
- AND:
- OR: "Encounter, Performed: Office Visit"
- OR: "Encounter, Performed: Face-to-Face Interaction"
- OR: "Encounter, Performed: Preventive Care Services - Established Office Visit, 18 and Up"
- OR: "Encounter, Performed: Preventive Care Services-Initial Office Visit, 18 and Up"
- OR: "Encounter, Performed: Home Healthcare Services"
- OR: "Encounter, Performed: Annual Wellness Visit"
- during "Measurement Period"
-
Denominator =
- AND: "Initial Patient Population"
-
Denominator Exclusions =
- AND NOT: "Occurrence A of Diagnosis, Active: Gestational Diabetes" ends before start of "Measurement Period"
- AND: "Occurrence A of Diagnosis, Active: Gestational Diabetes" starts before or during "Measurement Period"
-
Numerator =
- AND:
- AND: "Physical Exam, Performed: Visual Exam of Foot"
- AND:
- OR: "Physical Exam, Performed: Sensory Exam of Foot"
- OR: "Physical Exam, Performed: Pulse Exam of Foot"
- during "Measurement Period"
-
Denominator Exceptions =
-
"Diagnosis, Active: Diabetes" using "Diabetes Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>1)"
-
"Diagnosis, Active: Gestational Diabetes" using "Gestational Diabetes Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>0)"
-
"Encounter, Performed: Annual Wellness Visit" using "Annual Wellness Visit Grouping Value Set (2.16.840.1.113883.3.526.3.1240)"
-
"Encounter, Performed: Face-to-Face Interaction" using "Face-to-Face Interaction Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>8)"
-
"Encounter, Performed: Home Healthcare Services" using "Home Healthcare Services Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>6)"
-
"Encounter, Performed: Office Visit" using "Office Visit Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>1)"
-
"Encounter, Performed: Preventive Care Services - Established Office Visit, 18 and Up" using "Preventive Care Services - Established Office Visit, 18 and Up Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>5)"
-
"Encounter, Performed: Preventive Care Services-Initial Office Visit, 18 and Up" using "Preventive Care Services-Initial Office Visit, 18 and Up Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>3)"
-
"Patient Characteristic Birthdate: birth date" using "birth date LOINC Value Set (2.16.840.1.113883.3.560.100.4)"
-
"Physical Exam, Performed: Pulse Exam of Foot" using "Pulse Exam of Foot Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>5)"
-
"Physical Exam, Performed: Sensory Exam of Foot" using "Sensory Exam of Foot Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>4)"
-
"Physical Exam, Performed: Visual Exam of Foot" using "Visual Exam of Foot Grouping Value Set (2.16.840.1.113883.3.464.1<IP_ADDRESS>3)"
-
"Patient Characteristic Ethnicity: Ethnicity" using "Ethnicity CDC Value Set (2.16.840.1.114<IP_ADDRESS>7)"
-
"Patient Characteristic Payer: Payer" using "Payer Source of Payment Typology Value Set (2.16.840.1.114<IP_ADDRESS>91)"
-
"Patient Characteristic Race: Race" using "Race CDC Value Set (2.16.840.1.114<IP_ADDRESS>6)"
-
"Patient Characteristic Sex: ONC Administrative Sex" using "ONC Administrative Sex Administrative Sex Value Set (2.16.840.1.1137<IP_ADDRESS>)"


This page demonstrates a React component that renders a form that can be display labels and error messages in more than one language.
I intentially left it sparse and free of styling in order to focus on the construction and behavior of these React components.
Source code is found here.
See the Wiki for more info.


Try out our Premium Member services: Virtual Legal Assistant, Query Alert Service and an ad-free experience. Free for one month and pay only if you like it.
1 MCRC-41389-2018 The High Court Of Madhya Pradesh MCRC-41389-2018 (M/S ANAND MINING CORPORATION Vs MADHYA PRADESH POLLUTION CONTROL BOARD) 1 Jabalpur, Dated : 12-10-2018 Shri Abhijeet Awasthy, counsel for the applicants. Shri Ashish Shroti, counsel for the respondent/Board.
Learned counsel for the respondent/Board submits that his name has not been reflected in the cause list, therefore, he prays for time.
The Co-ordinate Bench of this Court in case of M.Cr.C.
No.22745/2016 under the Water (Prevention and Control of Pollution Act, 1974) in relation to Khasra Nos.372, 495, 496 and 497 admeasuring 26.002 hectare, situated at Village Pratappur, Tehsil Sihora, District Jabalpur passed on 09.05.2018, whereby the Criminal Complaint Case No.681/2012 filed by the Board against the applicant M/s. Anand Mining Corporation Vs. M.P. Pollution Control Board has been quashed.
It is contended that Board has filed another complaint against the applicant/Company under the Environmental Protection Act, 1986 with regard to Khasra Nos. 372, 495, 496 and 497 situated at Village Pratappur, Tehsil Sihora. Though, Khasra numbers have not been mentioned in the complaint and its partners have been arrayed in M.Cr.C. No.22745/2016.
Keeping in view the order dated 09.05.2018 passed in M.Cr.C. No.22745/2016, further proceedings of Criminal Case No.1205/2012 (Special Case No.29/2018) pending before the JMFC, 21st ADJ, Bhopal shall remain stayed only for two weeks.
List after two weeks.
C.C. as per rules.
(SUSHIL KUMAR PALO) JUDGE pn Digitally signed by PANKAJ NAGLE Date: 2018.10.12 18:06:42 +05'30'


USG TigerApps
Student-built, student-maintained apps built over the years, designed to improve your campus experience. Managed and maintained by the Princeton USG IT Committee. If you have any questions or comments, or are interested in joining, please contact us!
Princeton Pounce
TigerTrade
Student Room Guide
ReCal
Tigerbook
College Facebook Search
EasyPCE


The agony and ecstasy of 100meg broadband
24 Mar 2012Before I descend into a massive rant, let me preface this post with this: I hate BT. I always have, and I probably always will. They are generally the most incompetent, uncooperative company on the planet.
Let me take you back to October 2011. I was perusing the BT website looking for BT Infinity - their brand name for up to 40meg VDSL. I popped in my postcode and was told that I was in a trial area for FTTP at a stonking 100meg. Obviously I thought about the pain I was letting myself in for, having to deal with BT, but I was sure that I could cope with it if I was getting such insanely fast Internet at the end of it.
If only I knew how painful it was going to be.
My first install date was in November. This was cancelled a couple of days before the appointment with no real reason given. The exact same happened in December (that’s two days of holiday wasted now, if your counting). I was then given an install date in January. Cancelled. I was told they needed to dig through a neighbour’s garden.
February comes around, and I get another appointment. I was fully expecting this one to be cancelled as well. The day came, and with no word from BT to the contrary, I thought I was finally going to be able to have my lovely fast Internet connection. 9am came and went. 10am. 11am. I was starting to get worried. 12pm. Still no sign. After 1pm passed, I gave BT a call to see what the chuff was happening. “No one is scheduled to come to you today” the person on the end of the phone tells me. But I have an email and a text message confirming the appointment I say. “Computer error” the person tells me. Bloody great, I’ve wasted a (third) day’s holiday because they can’t make their computers work properly. At this point, I’m livid. If there was a BT monkey within grabbing distance, I’d have throttled them. I ask to speak to someone so I could make a complaint.
Magically, this improved the service I got (a little bit anyway). I started getting update calls most days. March rolls around, and they’ve finally completed the outside digging, and they make an appointment for a man to come around and install the modem. The chap arrives at 10am, and it all looks like its going well. He announces that he’s finished and now we can test it. We just need to wait for a little green light on the modem to stop flashing and we’re away.
It keeps flashing.
It kept flashing for over a week.
On Thursday, it stopped flashing, so I plugged the modem into my network, and it worked! I was getting insanely fast speeds, way more than I was paying for - I was really happy with it. I got a call from BT on Friday saying they’ve found the fault and would like to come over and finish the install. “No need!” I tell them, I’ve got it hooked up and it’s Internetting like a champ. The man says that’s fantastic, and that he’ll close the order.
An hour later I got an email and a text message telling me that an engineer was coming on Monday.
Oh dear.
Having had a day of woe at work (several servers deciding to throw their toys out of the pram at once), I called them the day after. “The appointment can’t be changed Mr Gilbert. You were told about it yesterday (lie #2 if you’re counting). You have to have an engineer look at it. We can’t close the order without someone making sure its ok (lord knows how I’ve managed this far if I can’t tell when an Internet connection is working!) No, you can’t have a weekend appointment.” I was fuming at this point. I categorically told the lady that after four months and four wasted days of holiday, there was no way on this earth that I was taking another day off for something that clearly doesn’t require an engineer to come and poke at my networking kit.
My complaint and order remain open. (I do at least have BLOODY FAST INTERNETZ!!!!!1111!!!!!!!)


{% extends "cog/common/layout_center.html" %} {% block main %} {% load cog_utils %}
Some CoG projects allow you to search and download data archived on Earth System Grid Federation (ESGF) data nodes. In order to access this data, you will need to have a valid ESGF OpenID. If you don't wish to access any data, and you have a CoG username and password, use the CoG Login option below.
To get a CoG login, see this page. New CoG accounts will generate ESGF OpenIDs. If you would like to access ESGF data, the options are explained below.
You can download ESGF data using your existing CoG login. Once you are logged in, edit your CoG profile to insert one (or more) ESGF OpenIDs. To obtain an ESGF OpenID, see this page. To download data from ESGF, you will have to login again with your ESGF OpenID.
You can use any valid ESGF OpenID to log onto CoG and ESGF at the same time. This method is recommended if you plan on downloading data from ESGF, since you will not be asked to enter your password again. If this is the first time you are using your ESGF OpenID on CoG, you will be asked to provide some additional information to create a new CoG account.


[
next
] [
prev
] [
prev-tail
] [
tail
] [
up
]
Contents
Abstract
1
General Overview
2
Code Distribution
3
Configuring and Building MLD2P4
3.1
Prerequisites
3.2
Optional third party libraries
3.3
Configuration options
3.4
Bug reporting
3.5
Example and test programs
4
Multigrid Background
4.1
AMG preconditioners
4.2
Smoothed Aggregation
4.3
Smoothers and coarsest-level solvers
5
Getting Started
5.1
Examples
6
User Interface
6.1
Method init
6.2
Method set
6.3
Method hierarchy
_build
6.4
Method smoothers
_build
6.5
Method build
6.6
Method apply
6.7
Method free
6.8
Method descr
6.9
Auxiliary Methods
6.9.1
Method: dump
6.9.2
Method: clone
6.9.3
Method: sizeof
6.9.4
Method: allocate
_wrk
6.9.5
Method: free
_wrk
7
Adding new smoother and solver objects to MLD2P4
8
Error Handling
A
License
References
[
next
] [
prev
] [
prev-tail
] [
front
] [
up
]


The Rotation Game
问题描述 :
The rotation game uses a # shaped board, which can hold 24 pieces of square blocks (see Fig.1). The blocks are marked with symbols 1, 2 and 3, with exactly 8 pieces of each kind.
Initially, the blocks are placed on the board randomly. Your task is to move the blocks so that the eight blocks placed in the center square have the same symbol marked. There is only one type of valid move, which is to rotate one of the four lines, each consisting of seven blocks. That is, six blocks in the line are moved towards the head by one block and the head block is moved to the end of the line. The eight possible moves are marked with capital letters A to H. Figure 1 illustrates two consecutive moves, move A and move C from some initial configuration.
Initially, the blocks are placed on the board randomly. Your task is to move the blocks so that the eight blocks placed in the center square have the same symbol marked. There is only one type of valid move, which is to rotate one of the four lines, each consisting of seven blocks. That is, six blocks in the line are moved towards the head by one block and the head block is moved to the end of the line. The eight possible moves are marked with capital letters A to H. Figure 1 illustrates two consecutive moves, move A and move C from some initial configuration.
输入:
The input consists of no more than 30 test cases. Each test case has only one line that contains 24 numbers, which are the symbols of the blocks in the initial configuration. The rows of blocks are listed from top to bottom. For each row the blocks are listed from left to right. The numbers are separated by spaces. For example, the first test case in the sample input corresponds to the initial configuration in Fig.1. There are no blank lines between cases. There is a line containing a single `0′ after the last test case that ends the input.
输出:
For each test case, you must output two lines. The first line contains all the moves needed to reach the final configuration. Each move is a letter, ranging from `A’ to `H’, and there should not be any spaces between the letters in the line. If no moves are needed, output `No moves needed’ instead. In the second line, you must output the symbol of the blocks in the center square after these moves. If there are several possible solutions, you must output the one that uses the least number of moves. If there is still more than one possible solution, you must output the solution that is smallest in dictionary order for the letters of the moves. There is no need to output blank lines between cases.

迭代加深搜索是逐渐加深搜深度，和BFS比较，不需要大量内存存取状态，但是耗时增加，因为好多都是重复搜索。
因为迭代加深搜索适用于对内存要求高，但是对时限要求不太高的题目。
而IDA*就是在在迭代加深搜索中加入估价函数，就是DFS中的剪枝。
对于这题来说算不上IDA*，就是迭代深搜加了个剪枝。
由于 每做一步，8个位置只变了一个，估价函数就是至少有几个位置不满足。
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<vector> #include<cmath> #include<map> #include<string> #define inf 1<<30 #define eps 1e-7 #define LD long double #define LL long long #define maxn 1005 using namespace std; int central[8]={6,7,8,11,12,15,16,17}; //中间8个方格的位置 int rotation[4][7]={{0,2,6,11,15,20,22},{1,3,8,12,17,21,23},{10,9,8,7,6,5,4},{19,18,17,16,15,14,13}};//分别是每7个按顺序列好 int to[8]={0,1,2,3,1,0,3,2}; //8种转换分别对应于哪7个方块 int rev[8]={5,4,7,6,1,0,3,2}; //每一种转换的相反转换是哪个 int ope[maxn]; //存储转换操作 int a[24]; //原始序列 bool flag; //是否有解 int depth; //当前搜索深度 int get_h(int *m){ //得到估价函数h int a=0,b=0,c=0; for(int i=0;i<8;i++) if(m[central[i]]==1) a++; else if(m[central[i]]==2) b++; else if(m[central[i]]==3) c++; return 8-max(a,max(b,c)); } void change(int *b,int kind){ if(kind<4){ int tmp=b[rotation[to[kind]][0]]; for(int i=0;i<6;i++) b[rotation[to[kind]][i]]=b[rotation[to[kind]][i+1]]; b[rotation[to[kind]][6]]=tmp; } else{ int tmp=b[rotation[to[kind]][6]]; for(int i=6;i>0;i--) b[rotation[to[kind]][i]]=b[rotation[to[kind]][i-1]]; b[rotation[to[kind]][0]]=tmp; } } void IDAstar(int *b,int tmp_depth,int father){ //当前序列，当前深度，父节点 if(get_h(b)>tmp_depth) //这就是利用估价函数的剪枝，h的值表示至少还需要多少步，如果在当前深度完成不了就剪掉 return; if(flag) //如果已经有解就退出 return; if(tmp_depth==0&&get_h(b)==0){ //深度为0，且为目标状态 flag=true; for(int j=depth;j>0;j--) printf("%c",ope[j]+'A'); printf("\n%d\n",b[6]); return; } for(int i=0;i<8;i++){ int tmp[24]; if(rev[i]==father) //避免死循环，相反操作两次则抵消 continue; for(int i=0;i<24;i++) tmp[i]=b[i]; change(tmp,i); ope[tmp_depth]=i; dfs(tmp,tmp_depth-1,i); } } int main(){ while(scanf("%d",&a[0])!=EOF&&a[0]){ for(int i=1;i<24;i++) scanf("%d",&a[i]); if(get_h(a)==0){ printf("No moves needed\n%d\n",a[6]); //wa两次，不需要操作也需要输出中心数字 continue; } flag=false; for(depth=get_h(a);;depth++){ //迭代加深，至少需要h(a)步，很好理解 dfs(a,depth,-1); if(flag) //有解则退出 break; } } return 0; }
解题报告转自：http://blog.csdn.net/acm_cxlove/article/details/7745575
(adsbygoogle = window.adsbygoogle || []).push({});
GT是讲什么的啊
<EMAIL_ADDRESS>gcc环境
这一题的代码这样提交时错误的~少考虑了很多情况
程序只能输出一个子序列
学习了
正在练习，很有帮助
加了星号 (*) 表示跳过此数据不读入. 因为scanf是不读取本行回车的


DO NOT OVERWRITE THIS FILE. IF WRITING NEW DOCUMENTATION COPY ME FIRST.
Module Template
This file provides a template structure of MINOS module documentation. A recommended structure is given looking at the outcome variables used, justification and definition of explanatory variates, definition of methods used, and coefficients.
Data
Describing the data used in a transition model. What outcome variables will be used? What data type are they? What is their range? Are there any odd shaped distributions such as zero-inflated or polymodal? What explanatory variates are going to be used. Again similar data description is helpful. Justification of why all variables are used in terms of how the outcome influences SF12 and how explanatory variates influence the outcome. Any data sources should be defined here.
Methods
What methods are used to create the transition model. This is usually pretty brief. Pre-established methods such as logistic regression are usually used. Describe any model assumptions and requirements. Any software packages in R. or otherwise should be stated here. Any visualisation and post-hoc model goodness of fit tests should be defined here. Expected model results can be defined here. Should a variable have a certain coefficient? Should this model perform better versus something else?
Coefficients
Any model coefficients are displayed here in tables. Easiest way to do this is to create tex tables using texreg directly in R. These tex tables can be converted to Markdown and then imported directly. Don’t make your own tables if you value your time whatsoever. Worth investigating htmlreg in R and if these html tables can be imported directly into sphinx. Probably.


Why are you here?
Recently, In every industry, everyone is talking about machine learning. In last few years, ML popularity increases exponentially.
A graph shows the popularity of machine learning topic from 2004. As shown from 2012 to 2016 it increases by 400%. Every day hundreds of researcher publishing papers about how ML can be used in different domains. ML has a large number of use cases from simple sales prediction to complex medical image processing.
Continue reading
Every developer needs to perform refactoring in his Professional career. You need Refactoring when you feel your code is not maintainable or scalable. With complex design some time is it very hard to develop a new feature and refactoring is essential. Refactoring is a very critical task because it can open a door for bugs.
Continue reading
It’s been almost 2 years since my Professional career started. In these years, I always have some struggle to decide stable development setup which works for me. I went through many blogs to decide stable setup but didn’t work for me. The main reason for this is my custom workflow. I have my preferences which may not work for others. This post will give some clarification of tools which are on my laptop.
Continue reading


All Files (100.0% covered at 4.28 hits/line)
40 files in total.
565 relevant lines.
565 lines covered and
0 lines missed
- 1
module ApplicationCable
- 1
class Channel < ActionCable::Channel::Base
end
end
- 1
module ApplicationCable
- 1
class Connection < ActionCable::Connection::Base
end
end
- 1
class ApplicationController < ActionController::Base
- 1
protect_from_forgery with: :exception
end
- 1
module ApplicationHelper
end
- 1
class ApplicationJob < ActiveJob::Base
end
- 1
class ApplicationMailer < ActionMailer::Base
- 1
default from<EMAIL_ADDRESS>- 1
layout 'mailer'
end
- 1
class Activity < ApplicationRecord
- 1
has_one :Invoice, dependent: :destroy
- 1
validates :name, presence: true
- 1
validates :description, presence: true
end
- 1
class ApplicationRecord < ActiveRecord::Base
- 1
self.abstract_class = true
end
- 1
class Client < ApplicationRecord
- 1
has_many :Invoices, dependent: :destroy
- 1
validates_email_format_of :email, :message => 'is not looking good'
- 1
validates :email, presence: true
- 1
validates :address, presence: true
- 1
validates :p_iva, presence: true, partita_iva_format: true
- 1
validates :cf, codice_fiscale_format: true, :presence => true, :if => :condition_testing?
#controllo se si sta inserendo public_authority oppure no, in caso affermativo il codice fiscale non è richiesto
- 1
def condition_testing?
- 156
self.public_authority == false
end
#se è public_authority l'iva è a 0 altrimenti a 22
- 1
after_initialize do
- 221
set_iva
end
- 1
def set_iva
- 221
if self.public_authority == false
- 102
self.iva = 22
else
- 119
self.iva = 0
end
end
end
- 1
class Invoice < ApplicationRecord
- 1
belongs_to :client
- 1
belongs_to :activity
- 1
validates :date_of_issue, presence: true
- 1
validates :hours_standard, :numericality => {:greater_than =>0}
- 1
validates :rate_hour_standard, :numericality => {:greater_than =>0}
- 1
validates :hours_extra, :numericality => {:greater_than_or_equal_to =>0}
- 1
validates :rate_hour_extra, :numericality => {:greater_than_or_equal_to =>0}
- 1
before_save {
- 23
iva = (self.client.iva) || 0
- 23
self.total_amount = rate + (rate * iva)/100
}
- 1
def rate
- 46
(self.hours_standard * self.rate_hour_standard + self.hours_extra * self.rate_hour_extra)
end
end
- 1
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
- 1
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
- 1
require_relative 'boot'
- 1
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
- 1
Bundler.require(*Rails.groups)
- 1
ENV['RAILS_ADMIN_THEME'] = 'rollincode'
- 1
module Gestionale
- 1
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- 1
config.load_defaults 5.1
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
end
end
- 1
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
- 1
require 'bundler/setup' # Set up gems listed in the Gemfile.
# Load the Rails application.
- 1
require_relative 'application'
# Initialize the Rails application.
- 1
Rails.application.initialize!
- 1
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
- 1
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
- 1
config.eager_load = false
# Configure public file server for tests with Cache-Control for performance.
- 1
config.public_file_server.enabled = true
- 1
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}
# Show full error reports and disable caching.
- 1
config.consider_all_requests_local = true
- 1
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
- 1
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
- 1
config.action_controller.allow_forgery_protection = false
- 1
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
- 1
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
- 1
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
- 1
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
- 1
Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
- 1
Rails.application.config.action_dispatch.cookies_serializer = :json
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
- 1
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` as its `secret_key`
# by default. You can change it below and use your own secret key.
# config.secret_key = '51216c14e5e9f74ac091659fc84e0e68bbfc5b7b9087dbfa0091da2b219b74cef07710116a0554158a0ea62c412cae4ac81624b4c4befa3f7bb19fab3cb46918'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
- 1
config.mailer_sender =<EMAIL_ADDRESS># Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# Configure the parent class responsible to send e-mails.
# config.parent_mailer = 'ActionMailer::Base'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
- 1
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [:email]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
- 1
config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
- 1
config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Auth is enabled. False by default.
# It can be set to an array that will enable http authentication only for the
# given strategies, for example, `config.http_authenticatable = [:database]` will
# enable it only for database authentication. The supported strategies are:
# :database = Support basic authentication with authentication key + password
# config.http_authenticatable = false
# If 401 status code should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application'
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
- 1
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
# requests for sign in and sign up, you need to get a new CSRF token
# from the server. You can disable this option at your own risk.
# config.clean_up_csrf_token_on_authentication = true
# When false, Devise will not attempt to reload routes on eager load.
# This can reduce the time taken to boot the app but if your application
# requires the Devise mappings to be loaded during boot time the application
# won't boot properly.
# config.reload_routes = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
# using other algorithms, it sets how many times you want the password to be hashed.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments. Note that, for bcrypt (the default
# algorithm), the cost increases exponentially with the number of stretches (e.g.
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
- 1
config.stretches = Rails.env.test? ? 1 : 11
# Set up a pepper to generate the hashed password.
# config.pepper = 'acc0c25d4d790ea78e60f218f85b550033a65f896d5ee1e41bcbadb66e3c747bedce41b67d72562f7b7945628d6ca3c8c9f22d37bec5b9a97a83782ee2b307ae'
# Send a notification to the original email when the user's email is changed.
# config.send_email_changed_notification = false
# Send a notification email when the user's password is changed.
# config.send_password_change_notification = false
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
# config.allow_unconfirmed_access_for = 2.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
# their account within 3 days after the mail was sent, but on the fourth day
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
# config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
# db field (see migrations). Until confirmed, new email is stored in
# unconfirmed_email column, and copied to email column on successful confirmation.
- 1
config.reconfirmable = true
# Defines which key will be used when confirming an account
# config.confirmation_keys = [:email]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# Invalidates all the remember me tokens when the user signs out.
- 1
config.expire_all_remember_me_on_sign_out = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
# Range for password length.
- 1
config.password_length = 6..128
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
- 1
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [:email]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
# config.last_attempt_warning = true
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [:email]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
- 1
config.reset_password_within = 6.hours
# When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset.
# config.sign_in_after_reset_password = true
# ==> Configuration for :encryptable
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
# You can use :sha1, :sha512 or algorithms from others authentication tools as
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
# for default behavior) and :restful_authentication_sha1 (then you should set
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
#
# Require the `devise-encryptable` gem when using anything other than bcrypt
# config.encryptor = :sha512
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
- 1
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
# is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as:
#
# mount MyEngine, at: '/my_engine'
#
# The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine
#
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
end
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
- 1
Rails.application.config.filter_parameters += [:password]
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
- 1
RailsAdmin.config do |config|
- 1
require Rails.root.join('lib', 'rails_admin', 'rails_admin_pdf.rb')
- 1
RailsAdmin::Config::Actions.register(RailsAdmin::Config::Actions::Pdf)
### Popular gems integration
## == Devise ==
- 1
config.authenticate_with do
- 189
warden.authenticate! scope: :user
end
- 1
config.current_user_method(&:current_user)
- 1
config.navigation_static_links = {
'Ooctopuss' => 'http://www.github.com/ooctopuss'
}
- 1
config.navigation_static_label = "My Links"
- 1
RailsAdmin.config do |config|
- 1
config.main_app_name = ["OOCTOPUSS", "Billing system"]
end
## == Cancan ==
# config.authorize_with :cancan
## == Pundit ==
# config.authorize_with :pundit
## == PaperTrail ==
# config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
## == Gravatar integration ==
## To disable Gravatar integration in Navigation Bar set to false
# config.show_gravatar = true
- 1
config.actions do
- 1
dashboard # mandatory
- 1
index # mandatory
- 1
new
- 1
export
- 1
bulk_delete
- 1
show
- 1
edit
- 1
delete
- 1
pdf do
- 1
only ['Invoice']
end
## With an audit adapter, you can add:
# history_index
# history_show
end
- 1
RailsAdmin.config do |config|
- 1
config.total_columns_width = 2000
end
- 1
config.model Invoice do
- 1
configure :total_amount do
- 1
read_only true
end
end
- 1
config.model Client do
- 1
configure :iva do
- 1
read_only true
end
end
end
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
- 1
ActiveSupport.on_load(:action_controller) do
- 2
wrap_parameters format: [:json]
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
- 1
Rails.application.routes.draw do
- 1
devise_for :users
- 1
mount RailsAdmin::Engine => '/', as: 'rails_admin'
- 1
root 'sessions#new'
- 1
resources :clients
- 1
resources :invoices
- 1
resources :activities
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
#login
- 1
Given ("I am a new, authenticated user") do
#visit('/users/sign_up') # ensure that at least
- 61
FactoryBot.create(:user)
end
- 1
And("I am logged in") do
- 61
visit('/users/sign_in')
- 61
fill_in "Email", with<EMAIL_ADDRESS>- 61
fill_in "Password", with: 'f4k3p455w0rd'
- 61
click_on 'Log in'
end
#valid client
- 1
Given("I am on the list of clients") do
- 10
visit('/client/new')
end
- 1
When("I click on {string}") do |string|
- 110
%{I press (string)}
end
- 1
When("I fill in the form with valid data") do
- 1
fill_in 'client_name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: 'RSSMRA85T10A562S'
- 1
fill_in 'P iva', with: '07643520567'
- 1
click_on 'Save'
end
- 1
Then("I should see the new client in the list") do
- 3
client = Client.last
- 3
expect(page).to have_content(client.name)
end
#invalid email
- 1
When("I fill in the form with an invalid email") do
- 1
fill_in 'client_name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with: 'piovegmail.com'
- 1
fill_in 'Cf', with: 'RSSMRA85T10A562S'
- 1
fill_in 'P iva', with: '07643520567'
- 1
click_on 'Save'
end
- 1
Then("I should see an error") do
- 28
expect(page).to have_xpath("//input[@required='required']")
#expect(page).to have_css('Email is not looking good')
end
#address blank
- 1
When("I dont't fill in the form an address") do
- 1
fill_in 'Name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: ''
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: 'RSSMRA85T10A562S'
- 1
fill_in 'P iva', with: '07643520567'
- 1
click_on 'Save'
end
#invalid cf
- 1
When("I fill in the form with an invalid cf") do
- 1
fill_in 'Name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: 'RSSMR'
- 1
fill_in 'P iva', with: '07643520567'
- 1
click_on 'Save'
end
#invalid p_iva
- 1
When("I fill in the form with an invalid p_iva") do
- 1
fill_in 'Name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: 'RSSMRA85T10A562S'
- 1
fill_in 'P iva', with: '07647'
- 1
click_on 'Save'
end
#cf blank
- 1
When("I leave the cf blank") do
- 1
fill_in 'Name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: ''
- 1
fill_in 'P iva', with: '07643520567'
- 1
click_on 'Save'
end
#valid client
- 1
Given("I am on the list of public authority clients") do
- 1
visit('/client/new')
end
- 1
When("I fill in the form with valid data for public authority") do
- 1
fill_in 'client_name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: 'RSSMRA85T10A562S'
- 1
fill_in 'P iva', with: '07643520567'
- 1
check 'Public authority'
- 1
click_on 'Save'
end
#invalid email
- 1
When("I fill in the form with an invalid email for public authority") do
- 1
fill_in 'client_name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with: 'piovegmail.com'
- 1
fill_in 'Cf', with: 'RSSMRA85T10A562S'
- 1
fill_in 'P iva', with: '07643520567'
- 1
check 'Public authority'
- 1
click_on 'Save'
end
#address blank
- 1
When("I dont't fill in the form an address for public authority") do
- 1
fill_in 'Name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: ''
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: 'RSSMRA85T10A562S'
- 1
fill_in 'P iva', with: '07643520567'
- 1
check 'Public authority'
- 1
click_on 'Save'
end
#invalid p_iva
- 1
When("I fill in the form with an invalid p_iva for public authority") do
- 1
fill_in 'Name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: 'RSSMRA85T10A562S'
- 1
fill_in 'P iva', with: '07647'
- 1
check 'Public authority'
- 1
click_on 'Save'
end
#cf blank
- 1
When("I leave the cf blank for public authority") do
- 1
fill_in 'Name', with: 'Matteo'
- 1
fill_in 'Surname', with: 'Piovesan'
- 1
fill_in 'Business name', with: 'piove srl'
- 1
fill_in 'Address', with: 'via roma'
- 1
fill_in 'Email', with<EMAIL_ADDRESS>- 1
fill_in 'Cf', with: ''
- 1
fill_in 'P iva', with: '07643520567'
- 1
check 'Public authority'
- 1
click_on 'Save'
end
#valid activity
- 1
Given("I am on the list of activities") do
- 3
visit('/activity/new')
end
- 1
When("I fill in the form with valid info") do
- 1
fill_in 'Name', with: 'Activity1'
- 1
fill_in 'Description', with: 'Activity 1 '
- 1
click_on 'Save'
end
#name blank
- 1
When("I dont't fill in the form a name") do
- 1
fill_in 'Name', with: ''
- 1
fill_in 'Description', with: 'Activity 1 '
- 1
click_on 'Save'
end
#description blank
- 1
When("I dont't fill in the form a description") do
- 1
fill_in 'Name', with: 'act'
- 1
fill_in 'Description', with: ''
- 1
click_on 'Save'
end
- 1
Then("I should see the new activity in the list") do
- 1
activity = Activity.last
- 1
expect(page).to have_content(activity.name)
end
- 1
Given("I am on the list of Invoices") do
- 8
visit('/invoice/new')
end
- 1
And("I have the client")do
- 21
@client = FactoryBot.create(:client, name: 'Matteo', surname: 'Piovesan',business_name: 'piove srl', address: 'via roma', email<EMAIL_ADDRESS>cf: 'RSSMRA85T10A562S', p_iva: '07643520567', public_authority: false, iva: '' )
end
- 1
And ("I have an activity") do
- 21
@activity = FactoryBot.create(:activity)
end
- 1
When("I fill in the form with valid dat") do
- 1
fill_in 'Hours standard', with: '20'
- 1
fill_in 'Rate hour standard', with: '10'
- 1
fill_in 'Hours extra', with: '2'
- 1
fill_in 'Rate hour extra', with: '20'
- 1
fill_in 'Date of issue', with: 'November 29, 2017 16:36'
- 1
fill_in 'Recessed date', with: 'December 07, 2017 16:36'
- 1
fill_in 'Penalty clause', with: ''
- 1
select @client.name , from: "Client"
- 1
select @activity.name , from: "Activity"
- 1
click_on 'Save'
end
- 1
Then("I should see the new Invoice in the list") do
- 1
invoice = Invoice.last
- 1
expect(page).to have_content(invoice.id)
end
- 1
When("I fill in the form with a hours_standard smaller or equal to 0") do
- 1
fill_in 'Hours standard', with: '-2'
- 1
fill_in 'Rate hour standard', with: '10'
- 1
fill_in 'Hours extra', with: '2'
- 1
fill_in 'Rate hour extra', with: '20'
- 1
fill_in 'Date of issue', with: 'November 29, 2017 16:36'
- 1
fill_in 'Recessed date', with: 'December 07, 2017 16:36'
- 1
fill_in 'Penalty clause', with: ''
- 1
select @client.name , from: "Client"
- 1
select @activity.name , from: "Activity"
- 1
click_on 'Save'
end
- 1
Then("I should see an error for invoice for hours standard") do
- 1
expect(find_field('Hours standard').value).to be < '0'
end
- 1
When("I fill in the form with a rate_hour_standard smaller or equal to 0") do
- 1
fill_in 'Hours standard', with: '20'
- 1
fill_in 'Rate hour standard', with: '-2'
- 1
fill_in 'Hours extra', with: '2'
- 1
fill_in 'Rate hour extra', with: '20'
- 1
fill_in 'Date of issue', with: 'November 29, 2017 16:36'
- 1
fill_in 'Recessed date', with: 'December 07, 2017 16:36'
- 1
fill_in 'Penalty clause', with: ''
- 1
select @client.name , from: "Client"
- 1
select @activity.name , from: "Activity"
- 1
click_on 'Save'
end
- 1
Then("I should see an error for invoice for rate hour standard") do
- 1
expect(find_field('Rate hour standard').value).to be < '0'
end
- 1
When("I fill in the form with a hours_extra smaller than 0")do
- 1
fill_in 'Hours standard', with: '20'
- 1
fill_in 'Rate hour standard', with: '10'
- 1
fill_in 'Hours extra', with: '-2'
- 1
fill_in 'Rate hour extra', with: '20'
- 1
fill_in 'Date of issue', with: 'November 29, 2017 16:36'
- 1
fill_in 'Recessed date', with: 'December 07, 2017 16:36'
- 1
fill_in 'Penalty clause', with: ''
- 1
select @client.name , from: "Client"
- 1
select @activity.name , from: "Activity"
- 1
click_on 'Save'
end
- 1
Then("I should see an error for invoice for hour extra") do
- 1
expect(find_field('Hours extra').value).to be <= '0'
end
- 1
When("I fill in the form with a rate_hour_standard smaller than 0") do
- 1
fill_in 'Hours standard', with: '20'
- 1
fill_in 'Rate hour standard', with: '10'
- 1
fill_in 'Hours extra', with: '2'
- 1
fill_in 'Rate hour extra', with: '-20'
- 1
fill_in 'Date of issue', with: 'November 29, 2017 16:36'
- 1
fill_in 'Recessed date', with: 'December 07, 2017 16:36'
- 1
fill_in 'Penalty clause', with: ''
- 1
select @client.name , from: "Client"
- 1
select @activity.name , from: "Activity"
- 1
click_on 'Save'
end
- 1
Then("I should see an error for invoice for rate hour extra") do
- 1
expect(find_field('Rate hour extra').value).to be <= '0'
end
- 1
When("I dont't fill in the form a date_of_issue") do
- 1
fill_in 'Hours standard', with: '20'
- 1
fill_in 'Rate hour standard', with: '10'
- 1
fill_in 'Hours extra', with: '2'
- 1
fill_in 'Rate hour extra', with: '20'
- 1
fill_in 'Date of issue', with: ''
- 1
fill_in 'Recessed date', with: 'December 07, 2017 16:36'
- 1
fill_in 'Penalty clause', with: ''
- 1
select @client.name , from: "Client"
- 1
select @activity.name , from: "Activity"
- 1
click_on 'Save'
end
- 1
When("I don't select a valid client") do
- 1
fill_in 'Hours standard', with: '20'
- 1
fill_in 'Rate hour standard', with: '10'
- 1
fill_in 'Hours extra', with: '2'
- 1
fill_in 'Rate hour extra', with: '20'
- 1
fill_in 'Date of issue', with: 'November 29, 2017 16:36'
- 1
fill_in 'Recessed date', with: 'December 07, 2017 16:36'
- 1
fill_in 'Penalty clause', with: ''
- 1
select @activity.name , from: "Activity"
- 1
click_on 'Save'
end
- 1
When("I don't select a valid activity")do
- 1
fill_in 'Hours standard', with: '20'
- 1
fill_in 'Rate hour standard', with: '10'
- 1
fill_in 'Hours extra', with: '2'
- 1
fill_in 'Rate hour extra', with: '20'
- 1
fill_in 'Date of issue', with: 'November 29, 2017 16:36'
- 1
fill_in 'Recessed date', with: 'December 07, 2017 16:36'
- 1
fill_in 'Penalty clause', with: ''
- 1
select @client.name , from: "Client"
- 1
click_on 'Save'
end
- 1
Given ("I am on the list of invoices") do
- 1
visit('/invoice')
end
- 1
And("I have an invoice") do
- 1
@client2 =FactoryBot.create(:client, name: 'Fabio', surname: 'Zan',business_name: 'zan srl', address: 'via romana', email<EMAIL_ADDRESS>cf: 'ZMNLGD84A01H501Y', p_iva: '03190700546', public_authority: false, iva: '' )
- 1
@activity2 =FactoryBot.create(:activity, name: 'attività 2', description: 'Attività due' )
- 1
@invoice=FactoryBot.create(:invoice, client:@client2, activity:@activity2)
end
- 1
And ("I press on download") do
- 1
visit('/invoice/'+ @invoice.id.to_s+'/pdf')
end
- 1
Given("there is a client") do
- 11
@client = FactoryBot.create(:client, name: 'Matteo', surname: 'Piovesan',business_name: 'piove srl', address: 'via roma', email<EMAIL_ADDRESS>cf: 'RSSMRA85T10A562S', p_iva: '07643520567', public_authority: false, iva: '' )
end
- 1
Given("I am viewing the details of a client") do
- 21
visit('/client/'+ @client.id.to_s+'/edit')
end
- 1
When("I change the name to {string}") do |string|
- 4
fill_in 'Name', with: string
end
- 1
Then ("I am on the page of the client") do
- 13
click_on 'Save'
end
- 1
And ("the name of the client is {string}")do |string|
- 2
expect(page).to have_content(string)
end
- 1
When("I change the surname to {string}") do |string|
- 2
fill_in 'Surname', with: string
end
- 1
And ("the surname of the client is {string}")do |string|
- 2
expect(page).to have_content(string)
end
- 1
When("I change the business name to {string}") do |string|
- 2
fill_in 'Business name', with: string
end
- 1
And ("the business name of the client is {string}")do |string|
- 2
expect(page).to have_content(string)
end
- 1
When("I change the address to {string}") do |string|
- 4
fill_in 'Address', with: string
end
- 1
And ("the address of the client is {string}")do |string|
- 2
expect(page).to have_content(string)
end
- 1
When("I change the email to {string}") do |string|
- 4
fill_in 'Email', with: string
end
- 1
And ("the email of the client is {string}")do |string|
- 2
expect(page).to have_content(string)
end
- 1
When("I change the cf to {string}") do |string|
- 3
fill_in 'Cf', with: string
end
- 1
And ("the cf of the client is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
When("I change the p_iva to {string}") do |string|
- 4
fill_in 'P iva', with: string
end
- 1
And ("the p_iva of the client is {string}")do |string|
- 2
expect(page).to have_content(string)
end
- 1
Given ("there is a public authority client") do
- 10
@client = FactoryBot.create(:client, name: 'Matteo', surname: 'Piovesan',business_name: 'piove srl', address: 'via roma', email<EMAIL_ADDRESS>cf: 'RSSMRA85T10A562S', p_iva: '07643520567', public_authority: true, iva: '' )
end
- 1
Given("there is an activity") do
- 4
@activity = FactoryBot.create(:activity)
end
- 1
Given("I am viewing the details of an activity") do
- 4
visit('/activity/'+ @activity.id.to_s+'/edit')
end
- 1
Then ("I am on the page of the activity") do
- 2
click_on 'Save'
end
- 1
And ("the name of the activity is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
When("I change the description to {string}") do |string|
- 2
fill_in 'Description', with: string
end
- 1
And ("the description of the activity is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
And("I have second client") do
- 13
@client2 =FactoryBot.create(:client, name: 'Fabio', surname: 'Zan',business_name: 'zan srl', address: 'via romana', email<EMAIL_ADDRESS>cf: 'ZMNLGD84A01H501Y', p_iva: '03190700546', public_authority: false, iva: '' )
end
- 1
And("I have second activity") do
- 13
@activity2 =FactoryBot.create(:activity, name: 'attività 2', description: 'Attività due' )
end
- 1
Given("there is an invoice") do
- 13
@invoice=FactoryBot.create(:invoice, client:@client, activity:@activity)
end
- 1
Given("I am viewing the details of an invoice") do
- 13
visit('/invoice/'+ @invoice.id.to_s+'/edit')
end
- 1
When("I change the hours_standard to {string}") do |string|
- 2
fill_in 'Hours standard', with: string
end
- 1
Then ("I am on the page of the invoice") do
- 8
click_on 'Save'
end
- 1
And ("the hours_standard of the invoice is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
When("I change the hours_extra to {string}") do |string|
- 2
fill_in 'Hours extra', with: string
end
- 1
And ("the hours_extra of the invoice is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
When("I change the rate_hour_standard to {string}") do |string|
- 2
fill_in 'Rate hour standard', with: string
end
- 1
And ("the rate_hour_standard of the invoice is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
When("I change the rate_hour_extra to {string}") do |string|
- 2
fill_in 'Rate hour extra', with: string
end
- 1
And ("the rate_hour_extra of the invoice is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
When("I change the date_of_issue to {string}") do |string|
- 2
fill_in 'Date of issue', with: string
end
- 1
And ("the date_of_issue of the invoice is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
When("I change the penalty_clause to {string}") do |string|
- 1
fill_in 'Penalty clause', with: string
end
- 1
And ("the penalty_clause of the invoice is {string}")do |string|
- 1
expect(page).to have_content(string)
end
- 1
When("I select another client") do
- 1
select @client2.name , from: "Client"
end
- 1
Then ("the client is the new client selected") do
- 1
invoice = Invoice.last
- 1
expect(page).to have_content(invoice.id)
end
- 1
When("I select another activity") do
- 1
select @activity2.name , from: "Activity"
end
- 1
Then ("the activity is the new activity selected") do
- 1
invoice = Invoice.last
- 1
expect(page).to have_content(invoice.id)
end
- 1
require 'rails_admin/config/actions'
- 1
require 'prawn'
- 1
module RailsAdmin
- 1
module Config
- 1
module Actions
- 1
class Pdf < Base
- 1
RailsAdmin::Config::Actions.register(self)
- 1
register_instance_option :member do
- 69
true
end
- 1
register_instance_option :pjax? do
- 23
false
end
- 1
register_instance_option :controller do
- 1
Proc.new do
- 1
pdf = Prawn::Document.new
- 1
pdf.font "Helvetica"
- 1
pdf.define_grid(:columns => 5, :rows => 8, :gutter => 10)
- 1
pdf.grid([0,0], [1,1]).bounding_box do
- 1
pdf.text<EMAIL_ADDRESS>:size => 18
- 1
pdf.text "Invoice No<EMAIL_ADDRESS>:align => :left
- 1
pdf.text "Date: #{Date.today.to_s}", :align => :left
- 1
pdf.move_down 10
- 1
pdf.text "Attn<EMAIL_ADDRESS><EMAIL_ADDRESS>"
- 1
pdf.text<EMAIL_ADDRESS>- 1
pdf.text "Email<EMAIL_ADDRESS>end
- 1
pdf.grid([0,3.6], [1,4]).bounding_box do
# Assign the path to your file name first to a local variable.
- 1
logo_path = File.expand_path('../../../public/logo4.png', __FILE__)
# Displays the image in your PDF. Dimensions are optional.
- 1
pdf.image logo_path, :width => 200 , :height =>85, :position => :center
# Company address
- 1
pdf.move_down 10
- 1
pdf.text "OOCTOPUSS COMPANY", :align => :left
end
- 1
pdf.text "Details of Invoice", :style => :bold_italic
- 1
pdf.stroke_horizontal_rule
- 1
temp_arr = [{:name => "Ore standard", :price =><EMAIL_ADDRESS>$"}, {:name => "Ore extra", :price =><EMAIL_ADDRESS>$"}]
- 1
pdf.move_down 10
- 1
items = [["Description","N° hour", "Price"]]
- 1
items += temp_arr.each_with_index.map do |item, i|
- 2
[item[:name],if (i==0) then<EMAIL_ADDRESS>else<EMAIL_ADDRESS>end,item[:price],]
end
- 1
<EMAIL_ADDRESS>- 1
<EMAIL_ADDRESS>- 1
<EMAIL_ADDRESS>- 1
<EMAIL_ADDRESS>- 1
total_free = h_s * r_h_s + h_e * r_h_e
- 1
items += [["","", ""]]
- 1
items += [["Penalty clause",""<EMAIL_ADDRESS>$ "]]
- 1
items += [["","", ""]]
- 1
items += [["Subtotal (without taxes)","", "#{total_free} $"]]
- 1
items += [["Tax rate ",""<EMAIL_ADDRESS>- 1
items += [["Total (with taxes)",""<EMAIL_ADDRESS>$"]]
- 1
pdf.table items, :header => true,:column_widths => { 0 => 350,1 =>55, 3 => 100}, :row_colors => ["FFFFFF"] do
- 1
style(columns(3)) {|x| x.align = :right }
end
- 1
pdf.move_down 40
- 1
pdf.text "Details of Invoice: Activity", :style => :bold_italic
- 1
pdf.stroke_horizontal_rule
- 1
pdf.move_down 20
- 1
pdf.text "Description: "
- 1
pdf.text<EMAIL_ADDRESS>- 1
pdf.move_down 60
- 1
pdf.text<EMAIL_ADDRESS>- 1
pdf.text "Date Signature/Company Stamp"
- 1
pdf.move_down 10
- 1
pdf.stroke_horizontal_rule
- 1
pdf.bounding_box([pdf.bounds.right - 50, pdf.bounds.bottom], :width => 60, :height => 20) do
- 1
pagecount = pdf.page_count
- 1
pdf.text "Page #{pagecount}"
end
- 1
pdf.render_file("Pdf_invoices/#{@object.class.to_s.demodulize}_#{<EMAIL_ADDRESS>- 1
File.open("Pdf_invoices/#{@object.class.to_s.demodulize}_#{<EMAIL_ADDRESS>'r') do |f|
- 1
send_data f.read.force_encoding('BINARY'), :filename => "#{@object.class.to_s.demodulize}_#{<EMAIL_ADDRESS>:type => "application/pdf", :disposition => "attachment"
end
end
end
- 1
register_instance_option :link_icon do
- 23
'fa fa-file-pdf-o'
end
end
end
end
end
- 1
FactoryBot.define do
- 1
factory :activity do
- 1
name 'Attivita 1'
- 1
description 'Piovesan'
end
end
- 1
FactoryBot.define do
- 1
factory :client do
- 1
name 'Matteo'
- 1
surname 'Piovesan'
- 1
business_name 'piove srl'
- 1
address 'via roma'
- 1
email<EMAIL_ADDRESS>- 1
cf 'RSSMRA85T10A562S'
- 1
p_iva '07643520567'
- 1
public_authority false
- 1
iva ''
end
end
- 1
FactoryBot.define do
- 1
factory :invoice do
- 1
hours_standard '10'
- 1
rate_hour_standard '15'
- 1
hours_extra '2'
- 1
rate_hour_extra '20'
- 1
date_of_issue 'October 10, 2017 22:30'
- 1
recessed_date 'October 31, 2017 22:30'
- 1
penalty_clause ''
- 1
client
- 1
activity
end
end
- 1
FactoryBot.define do
- 1
factory :user do
- 1
email<EMAIL_ADDRESS>- 1
password 'f4k3p455w0rd'
# if needed
# is_active true
end
end


Scientific Explanations
Please read through these descriptions of scientific phenomena and rate each of the descriptions on a scale from -3 (very unsatisfying) to +3 (very satisfying) with 0 representing neutral.
(2) Subjects read a fact about a type of bird (for example, “All sparrows have livers”) and had to decide whether this fact was true of all birds. For half of the facts, the birds used were stereotypical members of the category (sparrows, robins), and the birds were more rare for the other half of the facts (peacocks, penguins). The researchers found that subjects were more likely to answer correctly when the facts used stereotypical birds than when the facts used rare birds, even though logically there should be no difference. They replicated this effect with other kinds of animals, such as mammals and reptiles. They conclude that people are better at reasoning about stereotypical animals than rare animals.
-
1. Researchers claim that people perform this way because information about stereotypical animals is more readily accessed and manipulated than information about rare animals.
- 2. Researchers claim that people perform this way because the facts that used rare animals were harder for people to answer correctly, leading to more incorrect answers on these questions.
- 3. Researchers determined that people perform this way by examining the patterns of activation in subjects’ brains as they performed this task. Information about stereotypical animals is stored in a certain way by CA3 brain cells, which have been shown to mediate memory. This makes the information more readily accessed and manipulated than information about rare animals.
- 4. Researchers determined that people perform this way by examining the patterns of activation in subjects’ brains as they performed this task. The facts that used rare animals were stored in a certain way by CA3 brain cells, which have been shown to mediate memory. This makes it harder for people to answer correctly, leading to more incorrect answers on these questions.
 Researchers used a camera to track where the babies were looking. The babies saw a hand reach out and place one doll on the stage. Then a screen was raised, hiding the doll. A hand reached out again and placed a second doll on the stage, out of sight behind the screen. Then the screen dropped. In some cases, there were two dolls on the stage, as there should be, and in some cases there was only one doll. The researchers found that the babies looked much longer at the stage when there was only one doll than when there were two dolls. This looking-time difference between one doll and two dolls lead the researchers to conclude that babies can calculate 1 + 1 = 2.
- 1. The researchers claim this happens because the babies had formed an expectation about how many dolls there should be on the stage. The babies knew there should be two dolls, and their surprise at seeing only one led to their looking longer.
- 2. The researchers claim this happens because the amount of time the babies spent looking at the stage is directly proportional to how much they liked the display. The researchers used this timing data to calculate babies’ preference for the single doll.
- 3. The researchers claim that scans of the babies’ brains show that this happens because the part of babies’ brains known to be involved in math, the parietal lobe, governed the babies’ expectations about how many dolls there should be on the stage. The babies knew there should be two dolls, and their surprise at seeing only one led to their looking longer.
- 4. The researchers claim scans of the babies’ brains show that this happens because the part of babies’ brains known to be involved in math, the parietal lobe, governed the amount of time the babies spent looking at the stage. This time is directly proportional to how much they liked the display, and the researchers used this timing data to calculate babies’ preference for the single doll.
(4) Subjects watched two short videos involving a pair of animated balls. In one video, the balls moved randomly around the screen. In the other video, one ball appeared to chase the other around the screen. The researchers analyzed subjects’ descriptions of the two videos. They found that the subjects couldn’t stop referring to intentions, desires, and goals in their descriptions of the “chasing” video. The subjects used different types of words, usually related to motion, when describing the other video. The researchers conclude that people think about goal-directed action differently than random action.
- 1. Researchers claim that this difference occurs because, when people see motion that appears to be goal-directed, they automatically attribute beliefs and desires to the object performing that motion, even if they know that it’s been programmed to move that way.
- 2.
- 3. Researchers claim that this difference occurs because subjects’ brains showed different patterns of activation in the two conditions. Area MT of the visual system is able to interpret different kinds of motion, so when people see motion that appears to be goal-directed, they automatically attribute beliefs and desires to the object performing that motion, even if they know that it’s been programmed to move that way.
- 4. Researchers claim that this difference occurs because subjects’ brains showed different patterns of activation in the two conditions.
(5) Subjects sat in front of a computer screen and watched a rapidly presented series of pictures, half of which were faces and half of which were places. Half of the subjects had to press a button each time they saw a face, and the other half of the subjects pressed a button for places. Researchers analyzed the response times and discovered that the patterns of response times were different for faces than for places.
- 1. The researchers claim this happens because people use different processes to recognize faces than they use to recognize places.
- 2. The researchers claim this happens because the subjects’ responses were contingent on whether they saw a face or a place on the screen.
- 3. An examination of the activation patterns in subjects’ brains shows that the extrastriate cortex (known to be involved in processing complex visual stimuli) uses different processes to recognize faces than they use to recognize places.
- 4. An examination of the activation patterns in subjects’ brains shows that the extrastriate cortex (known to be involved in processing complex visual stimuli) responded contingently on whether they were responding to a face or a place on the screen.
(6) A group of three-year-old children participated in this task. They were shown a set of five objects, four of which were familiar to them and one of which was new. An experimenter asked them to point to each of the familiar objects, which they did correctly. Then the experimenter asked them to point to the “blicket,” a name that the children had not heard before. The children reliably pointed to the novel object and not to any of the familiar objects.
- 1. The researchers claim that children applied the new name to the unfamiliar object because children assume that a single object can have only one name. All of the other objects already had names, so they applied the word “blicket” to the new object.
- 2. The researchers claim that children applied the new name to the unfamiliar object because the word “blicket” was new to the children. They needed to pick one of the objects to which to apply this name, and therefore chose the new object.
- 3. Researchers examined children’s brain activation as they performed this task, and concluded that children applied the new name to the unfamiliar object because of the way brain’s language area in the left temporal lobe assigns labels. Children assume that a single object can have only one name. All of the other objects already had names, so they applied the word “blicket” to the new object.
- 4. Researchers examined children’s brain activation as they performed this task, and concluded that children applied the new name to the unfamiliar object because of the way brain’s language area in the left temporal lobe assigns labels. The word “blicket” was new to the children. They needed to pick one of the objects to which to apply this name, and therefore chose the new object.
(7) Subjects saw a picture of a complex object made out of wooden cubes glued together. After looking at this object, they saw a new picture, which was either a different object entirely or the first object rotated so that it was seen from a different angle. Subjects had to judge whether this second object was the same one as the first. The researchers discovered that subjects responded faster to objects that have been rotated only a few degrees, and subjects take longer to respond when the object has been rotated more. The researchers discovered that the time it takes subjects to respond to the test question is proportional to how much the object has been rotated.
- 1. The researchers claim that this result shows that subjects are rotating the object in their imagination before answering the question.
- 2. The researchers claim that this result shows that objects rotated only a few degrees elicited quicker responses from the subjects.
- 3. The researchers claim that brain scans of these subjects show that subjects are rotating the object in their imagination before answering the question. This may be the result of a specific group of brain processes in the occipital lobe, an area known to be involved in mental imagery.
- 4. The researchers claim that brain scans of these subjects show that objects rotated only a few degrees elicited quicker responses from the subjects. This may be the result of a specific group of brain processes in the occipital lobe, an area known to be involved in mental imagery.
(8) A group of Democrats and a group of Republicans viewed campaign ads for both Democratic and Republican candidates. The subjects then answered a series of questions about the content of the ads. Researchers found that all subjects showed highly negative response patterns to the ads for the opposite party, but highly positive response patterns to their own party’s ads.
- 1. The researchers claim that this happens because political party affiliation affects how people think about candidates.
- 2. The researchers claim that this happens because people tend to avoid responding with praise to opposite-party ads.
- 3. By examining subjects’ brain activation as they performed this task, researchers concluded that this happens because of how a brain structure called the amygdala, known to be involved in emotional processing, responds in this task: political party affiliation affects how people think about candidates.
- 4. By examining subjects’ brain activation as they performed this task, researchers concluded that this happens because of how a brain structure called the amygdala, known to be involved in emotional processing, responds in this task: people to tend to avoid responding with praise to opposite-party ads.
(9) A group of subjects over the age of 60 saw a 4 x 4 grid on a computer screen. Some of the squares in the grid contained pictures. After two minutes, the grid disappeared. Subjects then engaged in three tests. First, they were shown a set of pictures and were asked if any of the pictures had been in the original grid (object test). Second, they were shown a grid with dots in some of the squares and asked if any of these squares had contained pictures in the original grid (location test). Third, they saw a grid with pictures in some of the squares and were asked whether any of those pictures had appeared in those locations in the original grid (object + location test). Researchers found that the subjects were good at the first two tests but performed poorly on the third test.
- 1. The researchers claim that this happens because, as we get older, we have trouble remembering multiple pieces of linked information at once.
- 2. The researchers claim that this happens because, as we get older, we retain the ability to perform well on some specific types of tasks but not others.
- 3. Brain scans indicate that this happens because, as we get older, the memory centers in the medial temporal lobe change in specific ways. We therefore have trouble remembering multiple pieces of linked information at once.
- 4. Brain scans indicate that this happens because, as we get older, the memory centers in the medial temporal lobe change in specific ways. We therefore retain the ability to perform well on some specific types of tasks but not others.
 For each face, subjects had to judge whether it was the same as or different from the face that came before it. Subjects also filled out a questionnaire about their contact with people of other races. Researchers found that the subjects were better at recognizing the white faces than the black faces in general. They also found that subjects with less other-race contact were worse at recognizing the black faces. They conclude that it is more difficult in general to recognize faces of races different from one’s own, which they call “the other-race effect.”
- 1. The researchers claim that the other-race effect is caused by a lack of experience with other races.
- 2. The researchers claim that the other-race effect is caused by an inability to recognize faces of other races.
- 3. Scans of the subjects’ brains show that the other-race effect is caused by the way the fusiform face area in the brain responds to faces when people lack experience with other races.
- 4. Scans of the subjects’ brains show that the other-race effect is caused by the way the fusiform face area in the brain responds to faces when people are unable to recognize faces of other races.
(11) Subjects sat at a computer screen. They saw a rapidly flashing series of pictures of faces. Somewhere in this series of faces there were two pictures of houses. Subjects had to press a button each time they saw a house. When the two houses were far apart in the sequence, the subjects were very good at this task. But when the houses were presented close together in the sequence, subjects failed to press the button for the second house. The researchers call this phenomenon “attentional blink.”
- 1. The researchers claim that this phenomenon occurs because the subjects were still processing the first house and missed seeing the second house because they did not have enough attentional resources left.
- 2. The researchers claim that this phenomenon occurs because the second house appeared later in the sequence than the first house, and this temporal relationship between the two houses caused the attentional blink.
- 3. Researchers examined subjects’ brain activation as they performed this task. They concluded that this phenomenon occurs because of how areas in the frontal lobe, previously shown to mediate attention, functioned in response to the stimuli. The subjects were still processing the first house and missed seeing the second house because they did not have enough attentional resources left.
- 4. Researchers examined subjects’ brain activation as they performed this task. They concluded that this phenomenon occurs because of how areas in the frontal lobe, previously shown to mediate attention, functioned in response to the stimuli. The second house appeared later in the sequence than the first house, and this temporal relationship between the two houses caused the attentional blink.
(12) A group of subjects performed the same set of cognitive tests twice, once while thinking about God and once while thinking about a famous person. The researchers found that, when the subjects were thinking about God, their test results showed the same response pattern typical of religious tendencies regardless of their personal beliefs. The results showed a different cognitive pattern when they weren’t thinking about God.
- 1. The researchers conclude that this happens because the tendency to believe in God is universal and innate in all people, and will therefore manifest itself in the same way in all people.
- 2. The researchers conclude that this happens because thinking about God causes a certain pattern of responses that is distinct from the pattern caused by thoughts about other people.
- 3. Researchers conclude that this happens by examining the activation in subjects’ brains as they performed this task. The tendency to believe in God is universal and innate in the right prefrontal cortex, an area devoted to forming beliefs. It will therefore manifest itself in the same way in all people.
- 4. Researchers conclude that this happens by examining the activation in subjects’ brains as they performed this task. Thinking about God causes a certain pattern of responses in the right prefrontal cortex, an area devoted to forming beliefs. These are distinct from the patterns caused by thoughts about other people.
(13) Researchers tested subjects using a linguistic association task. Subjects heard a target word and had to say the first word that came to mind. The researchers discovered that words spoken within the first 500 ms after hearing the target were words that sounded like the target word. Words spoken after the first 500 ms were words that had a similar meaning to the target word.
- 1. The researchers conclude that this happens because people categorize words first according to their sounds and later according to their meanings.
- 2. The researchers conclude that this happens because two different types of words were associated with the target word at two different times.
- 3. Patterns of brain activation in these subjects lead researchers to conclude that this happens because Broca’s area, a part of the brain’s language system, categorizes words first according to their sounds and later according to their meanings.
- 4. Patterns of brain activation in these subjects lead researchers to conclude that this happens because Broca’s area, a part of the brain’s language system, associates two different types of words with the target word at two different times.
(14) Researchers recruited equal numbers of male and female participants. The participants took a series of spatial reasoning tasks and were interviewed. The researchers determined that men are better at spatial reasoning in general. From the interviews, they discovered that the men had played more sports in their childhood on average than the women.
- 1. The researchers conclude that the difference in involvement in sports explains the gender difference in spatial reasoning abilities.
- 2. The researchers conclude that women’s poor performance relative to men’s explains the gender difference in spatial reasoning abilities.
- 3. Brain scans of the right premotor area, known to be involved in spatial relational tasks, indicate that the difference in involvement in sports causes different types of brain responses. This explains the gender difference in spatial reasoning abilities.
- 4. Brain scans of the right premotor area, known to be involved in spatial relational tasks indicate that women’s poor performance relative to men’s causes different types of brain responses. This explains the gender difference in spatial reasoning abilities.
(15) Researchers examined a group of children who had been separated from their mothers. They observed the children and used a sophisticated coding system to determine the children’s emotional states from their behavior and facial expressions. They found that the children behaved differently when they were crying and upset than when they were happy and engaged in a task.
- 1. The researchers conclude that different emotional states cause different types of behavior.
- 2. The researchers conclude that some children become upset when separated from their mothers.
- 3, From looking at the activation of the children’s brains in this task, the researchers concluded that the brain’s frontal lobes, known to contain the emotional processing centers, affected how the children act. This indicates that different emotional states cause different types of behavior.
- 4. From looking at the activation of the children’s brains in this task, the researchers concluded that the brain’s frontal lobes, known to contain the emotional processing centers, affected how the children act. This indicates that some children become upset when separated from their mothers.
(16) Subjects were asked to imagine a series of objects that were make-believe (for example, a unicorn) or that were real but not present in the room (for example, a mountain). As the subjects created mental images of the various objects, they were asked questions about their images and told to respond as quickly as possible, without reflecting on their answers. They were also asked the same questions about objects they could actually see in the room (for example, a pen). From an analysis of the responses to these questions and of the times it took subjects to respond, the researchers found a similar pattern of responses and response times for all three types of objects.
- 1. The researchers claim that this happens because imagining an object, whether real or make-believe, uses the same process as seeing a real object.
- 2. The researchers claim that this happens because imagining an object, whether real or make-believe, results in the same array of responses as seeing a real object.
- 3. Patterns of brain activation in the visual cortex lead researchers to conclude this happens because imagining an object, whether real or make-believe, uses the same process as seeing a real object.
- 4. Patterns of brain activation in the visual cortex lead researchers to conclude that this happens because imagining an object, whether real or make-believe, results in the same array of responses as seeing a real object.
(17) A group of subjects were given a pair of 3D glasses which had one red lens and one green lens. As they looked at a special picture through the red lens only, they saw a house. Through the green lens, they saw a face. During the study, the subjects looked at the picture with both eyes, one looking through the red lens and one through the green lens. Scientists asked them to press a button to report what they were currently seeing over a period of several minutes. The scientists discovered that the two images switched off — sometimes people saw a face, sometimes a house, but never both at once. This phenomenon is called “binocular rivalry.”
- 1. The researchers claim that binocular rivalry happens because we can only process one complete image at a time.
- 2. The researchers claim that binocular rivalry happens because the two images alternate with each other over time.
- 3. Patterns of activation in subjects’ brains indicate that binocular rivalry happens because we can only process one complete image at a time in V1, the visual area of the brain.
- 4. Patterns of activation in subjects’ brains indicate that binocular rivalry happens because the two images alternate with each other over time in V1, the visual area of the brain.
(18) Subjects were asked to examine a list of facts and study them for a later test (the studying phase). During this studying phase, they also had to say all their thoughts aloud as scientists recorded their speech with sophisticated voice-analysis software. Subjects were later given a test on the facts that they studied. When the scientists examined the subjects’ voices from the studying phase, they found that there was a different pattern of vocal activity when a subject later remembered the fact than when the subject did not.
- 1. The researchers claim that this happens because the process we go through while learning information is the primary factor that affects our memory of that information.
- 2. The researchers claim that this happens because some types of vocal activity during the studying phase are correlated with memory for the information being studied.
- 3. The researchers claim that brain scans from these subjects show that the process we go through while learning information is important. This process is the primary factor that affects the way the information is stored in and retrieved from the hippocampus, the primary brain area involved in memory.
- 4. The researchers claim that brain scans from these subjects show that some types of vocal activity during the studying phase are important. This activity is correlated with the way the information is stored in and retrieved from the hippocampus, the primary brain area involved in memory.
What picture was part of the article you read?
fMRISchematic
Machine
References
Weisberg, D.S., Keil, F.C., Goodstein, J., Rawson, E. & Gray, J.R. (2008). The seductive allure of neuroscience explanations. Journal of Cognitive Neuroscience, 20(3), 470-477.


We're sorry but cinecoqui doesn't work properly without JavaScript enabled. Please enable it to continue.


NEW MASTER
PRACTICAL, STRONG AND ECONOMICAL
DESIGN
Renault Master has been designed for you, the professional! The passenger compartment is fitted out to meet your needs, in terms of both comfort and working space.
BUSINESS FEATURES
A real compromise between comfort and loading capacity, Renault Master offers a broad range of possibilities.
COMFORT AND TECHNOLOGY
Bring your mobile devices and tablets into your driving environment with the Renault R&GO app.
SAFETY
Enjoy a relaxed drive with the three functions of the ESP electronic stability programme.
MASTER AT A GLANCE
MEDIA GALLERY
Discover Master from every angle.
A COMPLETE RANGE
MEDIA GALLERY
Everything you need: available as a van, crew cab, chassis cab, platform cab and dropside. To complete its range of traction models, Renault Master is available in single or twin-wheel versions.
MASTER PASSENGER AT A GLANCE
Need more seats?
Whether you're transporting people or goods, Master Passenger adapts to your needs! You won't believe the simplicity of its 6-seater or 9-seater modular design. And with a spacious luggage compartment (2.8m3 (L1H1) or 4.7m3 (L2H2)), stowing loads will no longer be like playing a game of Tetris.
Driving position
Both practical and comfortable, the Master's cab provides the perfect space for driving. Improved soundproofing, air conditioning, Renault's innovative swivelling tabletop for your computer or files and a driving position for all body shapes mean guaranteed driving pleasure…
Relax and let the Carminat TomTom® navigation system guide you. With the live Services option, you can get the latest traffic news in real time and see the location of mobile speed cameras.
Made-to-measure comfort
With 20% reclining backrests and more than 65cm of legroom, the Master Passenger caters to your comfort!
And let's not forget the individual lighting and ventilation, with optional air conditioning and additional heating.
Factory converted & bespoke products
Renault Conversions
READY TO TAKE MASTER FOR A SPIN?
Go even further
I'd like to
Renault 4+ Package
Renault Pro+ Network
Quality Commitment
*Model shown MASTER FWD LM35 £33,669.