Skip to content

Commit 8db3d17

Browse files
committed
escaping now strings to generate a valid json file
1 parent 518a3d3 commit 8db3d17

File tree

4 files changed

+63
-60
lines changed

4 files changed

+63
-60
lines changed

BeliefExplorer.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
function setQuestion(text, done)
2727
{
28+
29+
text = text.replace(/\\n/g, "<br />");
2830
var c = 1;
2931
var cursorBlinks=0;
3032
var cursorChar = "_";
@@ -96,7 +98,7 @@
9698

9799
setAnswers("0");
98100

99-
setQuestion(item.question.replace(/(<.*>)/, itemChosen), function()
101+
setQuestion(item.question.replace(/($.*$)/, itemChosen), function()
100102
{
101103
setAnswers("1")
102104
});
@@ -194,7 +196,6 @@
194196
}
195197
});
196198
})
197-
198199
</script>
199200
</head>
200201
<body>

README.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
## Intro
2-
3-
This tool will help you master the Socratic method.
4-
5-
Debating on certain beliefs often leads to aggressive conversations where nobody changes their mind. Asking Socratic questions is a non confrontational method that helps break through dogmatism and impart the gift of doubt. This often results in drops of confidence in the belief.
6-
7-
## The toolkit
8-
9-
This repo includes:
10-
11-
1) A simple bot that will ask you Socratic questions on your belief [Live Demo](https://aguaviva.github.io/SEMap/BeliefExplorer.html)
12-
2) A conversation editor, to help the bot ask new/better questions. [Live Demo](https://aguaviva.github.io/SEMap/SEMap.html)
13-
14-
## The bot
15-
16-
The bot can help in multiple ways:
17-
18-
1) Have people use it an examine their own beliefs.
19-
2) Teaching the Socratic method much better. Coming up with interesting questions is tricky and like in a game of chess one must consider on the spot all the possible responses of the other player. Online resources just show a couple of examples but if the other part replies something different one is at a loss. This app like a good chess book shows you how to solve many variants of a same game
20-
3) As a reference or as a prompter that suggests you a good question to help your conversation going.
21-
4) Any other thing I had not thought of, but that you think it could be fun/interesting, let me know! :)
22-
23-
The included database will help you examing your beliefs.
24-
25-
## The conversations editor
26-
1+
## Intro
2+
3+
This tool will help you master the Socratic method.
4+
5+
Debating on certain beliefs often leads to aggressive conversations where nobody changes their mind. Asking Socratic questions is a non confrontational method that helps break through dogmatism and impart the gift of doubt. This often results in drops of confidence in the belief.
6+
7+
## The toolkit
8+
9+
This repo includes:
10+
11+
1) A simple bot that will ask you Socratic questions on your belief [Live Demo](https://aguaviva.github.io/SEMap/BeliefExplorer.html)
12+
2) A conversation editor, to help the bot ask new/better questions. [Live Demo](https://aguaviva.github.io/SEMap/SEMap.html)
13+
14+
## The bot
15+
16+
The bot can help in multiple ways:
17+
18+
1) Have people use it an examine their own beliefs.
19+
2) Teaching the Socratic method much better. Coming up with interesting questions is tricky and like in a game of chess one must consider on the spot all the possible responses of the other player. Online resources just show a couple of examples but if the other part replies something different one is at a loss. This app like a good chess book shows you how to solve many variants of a same game
20+
3) As a reference or as a prompter that suggests you a good question to help your conversation going.
21+
4) Any other thing I had not thought of, but that you think it could be fun/interesting, let me know! :)
22+
23+
The included database will help you examing your beliefs.
24+
25+
## The conversations editor
26+
2727
Writing all the possible paths in a regular document works when the number of questions is small, when it grows it gets very complicated. The editor helps to have a birds eye view of the whole conversation and quickly find weak spots or inconsistencies. It is meant to be used by people that have some experience with the Socratic method.
28-
29-
The editor can be used in many ways:
30-
1) To create new bots on the subject you like and share them with others.
31-
2) As a way to self reflect on an idea. The graph helps organize ones ideas in a structured way.
32-
3) With a friend, as a way to have an organized discussion. One would be Socrates, the other one the interlocutor. The goal as in any friendly sport would be to get better and it by just practicing it
33-
34-
## How you can help
35-
36-
I am hoping to get people involved at many levels,
37-
38-
1) just getting some simple feedback
39-
2) getting suggestions for new questions/answers
40-
3) have people to edit themselves the graph or even create a new one for a different topic
41-
42-
The plan is to have no limits, to explore this idea of bringing the Socratic method to the people, have fun, see what happens and hopefully make this world a better place :)
43-
44-
## Credits
45-
46-
Credits for the conversation graph go to Anthony Magnabosco and his fantastic videos where he uses this questions with believers. https://www.youtube.com/user/magnabosco210
28+
29+
The editor can be used in many ways:
30+
1) To create new bots on the subject you like and share them with others.
31+
2) As a way to self reflect on an idea. The graph helps organize ones ideas in a structured way.
32+
3) With a friend, as a way to have an organized discussion. One would be Socrates, the other one the interlocutor. The goal as in any friendly sport would be to get better and it by just practicing it
33+
34+
## How you can help
35+
36+
I am hoping to get people involved at many levels,
37+
38+
1) just getting some simple feedback
39+
2) getting suggestions for new questions/answers
40+
3) have people to edit themselves the graph or even create a new one for a different topic
41+
42+
The plan is to have no limits, to explore this idea of bringing the Socratic method to the people, have fun, see what happens and hopefully make this world a better place :)
43+
44+
## Credits
45+
46+
Credits for the conversation graph go to Anthony Magnabosco and his fantastic videos where he uses this questions with believers. https://www.youtube.com/user/magnabosco210

SEMapDatabase.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ function ValidateCredentials($data)
124124
die( '{"res":"' . $conn->lastErrorMsg() . '"}');
125125
}
126126

127+
header("HTTP/1.1 200 OK");
127128
echo '{"res":"OK"}';
128129
}
129130
else if ($method=="GET")
@@ -136,12 +137,12 @@ function ValidateCredentials($data)
136137
{
137138
if ($counter!=0)
138139
echo ',';
139-
$id = SQLite3::escapeString($row["id"]);
140-
$q = SQLite3::escapeString($row["label"]);
141-
$x = SQLite3::escapeString($row["x"]);
142-
$y = SQLite3::escapeString($row["y"]);
143-
$u = SQLite3::escapeString($row["username"]);
144-
echo '{"id":"'.$id.'", "q":"'.$q.'", "x":'.$x.', "y":'.$y.', "u":"'.$u.'"}';
140+
$id = json_encode($row["id"]);
141+
$q = json_encode($row["label"]);
142+
$x = json_encode($row["x"]);
143+
$y = json_encode($row["y"]);
144+
$u = json_encode($row["username"]);
145+
echo '{"id":'.$id.', "q":'.$q.', "x":'.$x.', "y":'.$y.', "u":'.$u.'}';
145146
$counter++;
146147
}
147148

@@ -156,16 +157,17 @@ function ValidateCredentials($data)
156157
if ($counter!=0)
157158
echo ',';
158159

159-
$id = SQLite3::escapeString($row["id"]);
160-
$s = SQLite3::escapeString($row["source"]);
161-
$t = SQLite3::escapeString($row["target"]);
162-
$l = SQLite3::escapeString($row["answer"]);
163-
$u = SQLite3::escapeString($row["username"]);
164-
echo '{"id":"'.$id.'","s":"'.$s.'","t":"'.$t.'","l":"'.$l.'","u":"'.$u.'"}';
160+
$id = json_encode($row["id"]);
161+
$s = json_encode($row["source"]);
162+
$t = json_encode($row["target"]);
163+
$l = json_encode($row["answer"]);
164+
$u = json_encode($row["username"]);
165+
echo '{"id":'.$id.',"s":'.$s.',"t":'.$t.',"l":'.$l.',"u":'.$u.'}';
165166

166167
$counter++;
167168
}
168169

170+
header("HTTP/1.1 200 OK");
169171
echo '],"res":"OK" }';
170172

171173
}
@@ -211,9 +213,9 @@ function ValidateCredentials($data)
211213
die( '{"res":"' . $conn->lastErrorMsg() . '"}');
212214
}
213215

216+
header("HTTP/1.1 200 OK");
214217
echo '{"res":"OK"}';
215218
}
216219

217-
218220
$conn->close();
219221
?>

SEMap_en.sqlite

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)