Sfoglia il codice sorgente

fixed firefox drag and drop; read file as iso 8859-1; added an utf-8 example

tags/1.0.6^0
Robin Thoni 8 anni fa
parent
commit
e6f98e9f83
3 ha cambiato i file con 380 aggiunte e 3 eliminazioni
  1. 15
    2
      app/app.js
  2. 38
    1
      app/controllers/home.controller.js
  3. 327
    0
      app/examples/CorQCM12-utf8.tex

+ 15
- 2
app/app.js Vedi File

@@ -44,6 +44,19 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
44 44
         return {
45 45
             restrict : "A",
46 46
             link: function (scope, elem) {
47
+                function processEvent(evt)
48
+                {
49
+                    if (evt != null) {
50
+                        evt.stopPropagation();
51
+                        evt.preventDefault();
52
+                        evt.dataTransfer.effectAllowed = 'copy';
53
+                        evt.dataTransfer.dropEffect = 'copy';
54
+                    }
55
+                    return false;
56
+                }
57
+                elem.bind('dragover', processEvent);
58
+                elem.bind('dragenter', processEvent);
59
+                elem.bind('dragstart', processEvent);
47 60
                 elem.bind('drop', function(evt) {
48 61
                     evt.stopPropagation();
49 62
                     evt.preventDefault();
@@ -51,17 +64,17 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
51 64
                     var files = evt.dataTransfer.files;
52 65
                     for (var i = 0, f; f = files[i]; i++) {
53 66
                         var reader = new FileReader();
54
-                        reader.readAsText(f);
67
+                        reader.readAsText(f, 'ISO-8859-1');
55 68
 
56 69
                         reader.onload = (function(file) {
57 70
                             return function(e) {
58 71
                                 scope.$apply(function() {
59
-
60 72
                                     scope.setDraggedContent(e.target.result, file);
61 73
                                 });
62 74
                             };
63 75
                         })(f);
64 76
                     }
77
+                    return false;
65 78
                 });
66 79
             }
67 80
         }

+ 38
- 1
app/controllers/home.controller.js Vedi File

@@ -4,7 +4,8 @@ angular.module('app')
4 4
 
5 5
             $scope.Data = {
6 6
                 Input: "",
7
-                Output: ""
7
+                Output: "",
8
+                Filename: "qcm.html"
8 9
             };
9 10
 
10 11
             $scope.questions = [];
@@ -96,14 +97,50 @@ angular.module('app')
96 97
                     });
97 98
                     $scope.Data.Output += "\n";
98 99
                 });
100
+
101
+                $scope.saveFile($scope.Data.Filename, $scope.Data.Output, "text/html");
99 102
             };
100 103
 
101 104
             $scope.setDraggedContent = function(data, file)
102 105
             {
106
+                $scope.Data.Filename = file.name.replace(/\.tex$/, ".html");
103 107
                 $scope.Data.Input = data;
104 108
                 $scope.convert();
105 109
             };
106 110
 
111
+            $scope.saveFile = function(filename, data, mime)
112
+            {
113
+                //this will remove the blank-spaces from the title and replace it with an underscore
114
+                filename = filename.replace(/ /g,"_");
115
+
116
+                if (navigator.msSaveBlob) {
117
+                    navigator.msSaveBlob(new Blob(data, { type: mime + ';' }), filename);
118
+                }
119
+                else
120
+                {
121
+                    //Initialize file format you want csv or xls
122
+                    var uri = 'data:' + mime + ',' + escape(data);
123
+
124
+                    // Now the little tricky part.
125
+                    // you can use either>> window.open(uri);
126
+                    // but this will not work in some browsers
127
+                    // or you will not get the correct file extension
128
+
129
+                    //this trick will generate a temp <a /> tag
130
+                    var link = document.createElement("a");
131
+                    link.href = uri;
132
+
133
+                    //set the visibility hidden so it will not effect on your web-layout
134
+                    link.style.visibility = "hidden";
135
+                    link.download = filename;
136
+
137
+                    //this part will append the anchor tag and remove it after automatic click
138
+                    document.body.appendChild(link);
139
+                    link.click();
140
+                    document.body.removeChild(link);
141
+                }
142
+            };
143
+
107 144
             $scope.addMacro("\\RR", "\\mathbb{R}");
108 145
             $scope.addMacro("\\CC", "\\mathbb{C}");
109 146
             $scope.addMacro("\\QQ", "\\mathbb{Q}");

+ 327
- 0
app/examples/CorQCM12-utf8.tex Vedi File

@@ -0,0 +1,327 @@
1
+\documentclass[8pt,a4paper]{article}
2
+
3
+\usepackage{amsmath,amssymb}
4
+\usepackage{ifthen}
5
+\usepackage[frenchb]{babel}
6
+\usepackage [latin1]{inputenc}
7
+\usepackage [T1]{fontenc}
8
+\usepackage{fancybox}
9
+\usepackage{pstcol,pst-text}
10
+\usepackage{fancyhdr}
11
+\frenchspacing
12
+
13
+
14
+\def\baselinestretch{1.1}
15
+\hoffset=-1.5cm \textwidth=16cm \parindent=0pt
16
+
17
+\newcommand{\creerlentete}[6]{%
18
+%#1\hfill \today \\ %etablissement et date
19
+#1\hfill  \\ %etablissement et date
20
+#2\\[0.5cm] %cursus
21
+\centerline{\bfseries #5}\\[0.4cm] % intitule
22
+Dur\'ee : #3\\
23
+Documents et calculatrices %autorisés ou non
24
+\ifthenelse{\equal {#4}{oui}}{}{non} autoris\'es \vspace{0.5cm}
25
+\hrule
26
+%Les conseils
27
+\ifthenelse{\not \equal {#6}{}} {\vspace{0.2cm} \emph{#6}
28
+\vspace{0.2cm} \hrule}{} \vspace{0.2cm} }
29
+\newcounter{NumeroExo}
30
+\newcommand{\exo}
31
+{ \stepcounter{NumeroExo} \arabic{NumeroExo} }
32
+
33
+\newcommand{\repqcm}[4]
34
+{
35
+\begin{flushright}
36
+\begin{tabular}{| c | c |}
37
+\hline #1 & \quad \quad \\ \hline #2 & \quad \\ \hline #3 & \quad
38
+\\ \hline #4 & \quad \\ \hline
39
+\end{tabular}
40
+\end{flushright}
41
+}
42
+
43
+\newcounter{numQuestion}[section]
44
+\newenvironment{question}{
45
+\begin{tabular}{l |p{13cm}}
46
+{\it Question \stepcounter{numQuestion} \arabic{section} .
47
+\arabic{numQuestion}} & } {\end{tabular} \\}
48
+
49
+\setlength\parindent{0pt}
50
+
51
+\font\sevenrm=cmbx7 \font\tenmsb=msbm10 at 11pt
52
+\font\sevenmsb=msbm7 at 8pt \font\fivemsb=msbm5 at 6pt
53
+\newfam\msbfam
54
+\textfont\msbfam=\tenmsb \scriptfont\msbfam=\sevenmsb
55
+\scriptscriptfont\msbfam=\fivemsb
56
+\def\Bbb#1{{\tenmsb\fam\msbfam#1}}
57
+\def\RR{\Bbb R}
58
+\def\CC{\Bbb C}
59
+\def\BB{\Bbb B}
60
+\def\NN{\Bbb N}
61
+\def\QQ{\Bbb Q}
62
+\def\ZZ{\Bbb Z}
63
+\def\PP{\Bbb P}
64
+\def\EE{\Bbb E}
65
+\def\KK{\Bbb K}
66
+\def\TT{\Bbb T}
67
+\def\GG{\Bbb G}
68
+\def\SS{\Bbb S}
69
+%
70
+%
71
+%       Lettres Bold Roman
72
+%
73
+\font\elevencmb=cmb10 at 11pt \font\eightcmb=cmb10 at 8pt
74
+\font\sixcmb=cmb10 at 6pt
75
+\newfam\cmbfam
76
+\textfont\cmbfam=\elevencmb \scriptfont\cmbfam=\eightcmb
77
+\scriptscriptfont\cmbfam=\sixcmb
78
+\def\brom#1{{\elevencmb\fam\cmbfam#1}}
79
+%
80
+%
81
+% _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
82
+%
83
+%       2) Lettres gothiques:
84
+
85
+\font\teneuf=eufm10 at 12pt \font\seveneuf=eufm7 at 8pt
86
+\font\fiveeuf=eufm5 at 6pt
87
+\newfam\euffam
88
+\textfont\euffam=\teneuf \scriptfont\euffam=\seveneuf
89
+\scriptscriptfont\euffam=\fiveeuf
90
+\def\goth#1{{\teneuf\fam\euffam#1}}
91
+%
92
+\newfont{\secgoth}{eufm10 at 16pt}
93
+% _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  _ _
94
+%
95
+%     3) Lettres rondes (script):
96
+
97
+\font\tenrsf=rsfs10 at 11 pt \font\sevenrsf=rsfs7 at 8 pt
98
+\font\fiversf=rsfs5 at 6pt
99
+\newfam\rsffam
100
+\textfont\rsffam=\tenrsf \scriptfont\rsffam=\sevenrsf
101
+\scriptscriptfont\rsffam=\fiversf
102
+\def\rond#1{{\tenrsf\fam\rsffam#1}}
103
+%
104
+\def\ical#1{\!\scriptscriptstyle \cal#1}
105
+\def\irond#1{\!\scriptscriptstyle \rond#1}
106
+% _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
107
+%    5) "Signes etranges mais bien utiles"; voir le tableau de iftimo:
108
+%
109
+\font\tenmsa=msam10 at 11pt \font\sevenmsa=msam8
110
+\font\fivemsa=msam6
111
+\newfam\msafam
112
+\textfont\msafam=\tenmsa \scriptfont\msafam=\sevenmsa
113
+\scriptscriptfont\msafam=\fivemsa
114
+\def\extra#1{{\tenmsa\fam\msafam#1}}
115
+
116
+\def\di{\displaystyle}
117
+\def\dd{\mbox{d}}
118
+
119
+\renewcommand{\theenumi}{\alph{enumi}}
120
+\begin{document}
121
+\pagestyle{fancy} \lhead{{\bf Mathématiques}\\ {Corrigé du QCM N°12}}
122
+
123
+\rhead{{\small S4 15/16}\\ {\sc Epita}}
124
+
125
+
126
+
127
+\begin{center}
128
+{\Huge {\bf {Corrigé du QCM N°12}}} \\
129
+\bigskip  \large{lundi 15 février 2016}
130
+\end{center}
131
+
132
+
133
+
134
+$I$ désigne un intervalle de $\RR$. Toutes les fonctions sont, sauf indication contraire, définies sur $I$.
135
+
136
+\medskip
137
+
138
+\section*{Question 11}
139
+Soit $(f_n)$ une suite de fonctions dérivables sur $[a,b]$, convergeant simplement vers $f$ sur $[a,b]$ où $(a,b) \in \RR^2$ avec $a < b$. Alors
140
+
141
+\medskip
142
+\begin{enumerate}
143
+  \item [a.] $f$ est continue sur $[a,b]$
144
+
145
+  \medskip
146
+  \item [b.] $\di \int_ a^b f_n(t)\dd t \xrightarrow[n \to +\infty]{} \di \int_a^b f(t)\dd t$
147
+
148
+  \medskip
149
+  \item [c.] pour tout $x \in [a,b]$, $f'_n(x) \xrightarrow[n \to +\infty]{} f'(x)$
150
+
151
+  \medskip
152
+  \item [\pscirclebox{d.}] rien de ce qui précède
153
+\end{enumerate}
154
+
155
+
156
+
157
+
158
+
159
+\section*{Question 12}
160
+Soit $(f_n)$ la suite de fonctions définie pour tout $x \in \,]0,1]$
161
+par $f_n(x)=\di \frac{ne^x}{e^x+nx}\cdot$ Alors
162
+
163
+\medskip
164
+\begin{enumerate}
165
+  \item [a.] $(f_n)$ converge simplement vers la fonction nulle sur
166
+  $]0,1]$
167
+  \medskip
168
+  \item [b.] $(f_n)$ converge simplement vers la fonction $f : x \mapsto 1$ sur $]0,1]$
169
+  \medskip
170
+  \item [\pscirclebox{c.}] $(f_n)$ converge simplement vers la fonction $f : x \mapsto \di \frac{e^x}{x}$ sur $]0,1]$
171
+  \medskip
172
+  \item [d.] $(f_n)$ converge simplement vers la fonction $f : x \mapsto \di \frac1x$ sur $]0,1]$
173
+  \medskip
174
+  \item [e.] rien de ce qui précède
175
+\end{enumerate}
176
+
177
+
178
+
179
+
180
+\section*{Question 13}
181
+Soit $(f_n)$ la suite de fonctions définie pour tout $x \in \,]0,1]$
182
+par $f_n(x)=\di \frac{ne^x}{e^x+x}\cdot$ Alors
183
+
184
+\medskip
185
+\begin{enumerate}
186
+  \item [a.] $(f_n)$ converge simplement vers la fonction nulle sur
187
+  $]0,1]$
188
+  \medskip
189
+  \item [b.] $(f_n)$ converge simplement vers la fonction $f : x \mapsto 1$ sur $]0,1]$
190
+  \medskip
191
+  \item [c.] $(f_n)$ converge simplement vers la fonction $f : x \mapsto \di \frac{e^x}{x}$ sur $]0,1]$
192
+  \medskip
193
+  \item [d.] $(f_n)$ converge simplement vers la fonction $f : x \mapsto e^x$ sur $]0,1]$
194
+  \medskip
195
+  \item [\pscirclebox{e.}] rien de ce qui précède
196
+\end{enumerate}
197
+
198
+
199
+
200
+
201
+\section*{Question 14}
202
+Soit $(f_n)$ la suite de fonctions définie pour tout $x \in \RR$ par $f_n(x)=x^n$. Alors
203
+
204
+\medskip
205
+\begin{enumerate}
206
+  \item [a.] $(f_n)$ converge simplement vers la fonction nulle sur
207
+  $[0,1]$.
208
+  \medskip
209
+  \item [\pscirclebox{b.}] $(f_n)$ converge simplement vers la fonction nulle sur
210
+  $[0,1[$.
211
+  \medskip
212
+  \item [\pscirclebox{c.}] $(f_n)$ converge simplement vers la fonction nulle sur
213
+  $]0,1[$.
214
+  \medskip
215
+  \item [\pscirclebox{d.}] $(f_n)$ converge simplement vers la fonction nulle sur
216
+  $[0,a]$ où $a \in \, ]0,1[$
217
+  \medskip
218
+  \item [e.] rien de ce qui précède
219
+\end{enumerate}
220
+
221
+
222
+
223
+
224
+
225
+
226
+\section*{Question 15}
227
+Soit $A=[0,1[$. Alors $\text{Sup}(A)=1$.
228
+
229
+\medskip
230
+\begin{enumerate}
231
+  \item [\pscirclebox{a.}] vrai
232
+  \item [b.] faux
233
+\end{enumerate}
234
+
235
+
236
+
237
+\section*{Question 16}
238
+Soient $(E,<,>)$ un espace préhilbertien réel et $F$ un sev de $E$. Alors
239
+
240
+\medskip
241
+\begin{enumerate}
242
+  \item [a.] $E=F \oplus F^{\bot}$
243
+
244
+  \medskip
245
+  \item [b.] $F=F^{\bot\bot}$
246
+
247
+  \medskip
248
+  \item [\pscirclebox{c.}] rien de ce qui précède
249
+\end{enumerate}
250
+
251
+
252
+
253
+\section*{Question 17}
254
+Soient $(E,<,>)$ un espace euclidien, $(e_1,...,e_n)$ une base
255
+orthonormée quelconque de $E$ et $x \in E$ quelconque. Alors
256
+
257
+\medskip
258
+\begin{enumerate}
259
+  \item [a.] $x=\di \sum_{i=1}^n (<x,e_i>)^2 e_i$
260
+  \medskip
261
+  \item [b.] $x=\di \sum_{i=1}^n (<x-e_i,e_i>)^2 e_i$
262
+  \medskip
263
+  \item [\pscirclebox{c.}] $x=\di \sum_{i=1}^n <x,e_i> e_i$
264
+  \medskip
265
+  \item [d.] $x=\di \sum_{i=1}^n <x-e_i,e_i>e_i$
266
+  \medskip
267
+  \item [e.] rien de ce qui précède
268
+\end{enumerate}
269
+
270
+
271
+\section*{Question 18}
272
+Soient $(E,<,>)$ un espace euclidien, $B=(e_1,\cdots,e_n)$ une base orthogonale de $E$, $x=\di \sum_{i=1}^{n} \lambda _ie_i \in E$ où les $\lambda _i$ sont des scalaires. Alors pour tout $j \in \{1,\cdots,n\}$, on a
273
+
274
+\medskip
275
+\begin{enumerate}
276
+  \item [a.] $<x,e_j>=\lambda _j$
277
+
278
+  \medskip
279
+  \item [b.] $<x,e_j>=0$
280
+
281
+  \medskip
282
+  \item [\pscirclebox{c.}] $<x,e_j>=\lambda _j <e_j,e_j>$
283
+
284
+  \medskip
285
+  \item [d.] rien de ce qui précède
286
+\end{enumerate}
287
+
288
+
289
+
290
+\section*{Question 19}
291
+Soient $(E,<,>)$ un espace préhilbertien réel et $A$ une partie quelconque de $E$.
292
+Alors
293
+
294
+\medskip
295
+\begin{enumerate}
296
+  \item [a.] $A^{\bot}=\{x \in A,\ \forall y \in E, \ <x,y>=0\}$
297
+  \medskip
298
+  \item [b.] $A^{\bot}=\{x \in A,\ \forall y \in A, \ <x,y>=0\}$
299
+  \medskip
300
+  \item [\pscirclebox{c.}] $A^{\bot}=\{x \in E,\ \forall y \in A, \ <x,y>=0\}$
301
+  \medskip
302
+  \item [d.] $A \subset A^{\bot}$
303
+  \medskip
304
+  \item [e.] rien de ce qui précède
305
+\end{enumerate}
306
+
307
+
308
+
309
+\section*{Question 20}
310
+Soient $E$ un $\RR$-ev, $\varphi$ une forme bilinéaire symétrique et positive sur $E$, $(x,y) \in E^2$ et $t \in \RR$. Alors
311
+
312
+\medskip
313
+\begin{enumerate}
314
+  \item [\pscirclebox{a.}] $\varphi(x+ty,x+ty) \in \RR_+$
315
+
316
+  \medskip
317
+  \item [\pscirclebox{b.}] $\varphi(x+ty,x+ty)=\varphi(y,y)t^2+2\varphi(x,y)t+\varphi(x,x)$
318
+
319
+  \medskip
320
+  \item [\pscirclebox{c.}] $\varphi(x+ty,x+ty)=\varphi(y,y)t^2+\varphi(x,y)t+\varphi(y,x)t +\varphi(x,x)$
321
+
322
+  \medskip
323
+  \item [d.] rien de ce qui précède
324
+\end{enumerate}
325
+
326
+
327
+\end{document}

Loading…
Annulla
Salva