Skip to content

Commit 6c0a5df

Browse files
committed
modified ui
2 parents df81920 + c5068a4 commit 6c0a5df

15 files changed

Lines changed: 85 additions & 154 deletions

File tree

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
22
server/solutions/
3-
judge0/result/
4-
solutions/
3+
judge/result/
4+
solutions/
5+
codecamp-front/node_modules/

codecamp-front/src/app/components/register/register.component.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h2 class="card-title">SIGN UP</h2>
2525
</div>
2626
</div>
2727
</div>
28-
28+
2929
<div class="form-group">
3030
<div class="row">
3131
<div class="col-md-3">
@@ -41,7 +41,7 @@ <h2 class="card-title">SIGN UP</h2>
4141
[ngClass]="{'is-invalid': (form.controls.username.errors && form.controls.username.dirty) , 'is-valid': !form.controls.username.errors}"></div>
4242
</div>
4343
</div>
44-
44+
4545
<!-- Email Input -->
4646
<div class="form-group">
4747
<div class="row">
@@ -63,7 +63,7 @@ <h2 class="card-title">SIGN UP</h2>
6363
</div>
6464
</div>
6565
</div>
66-
66+
6767
<div class="form-group">
6868
<div class="row">
6969
<div class="col-md-3">
@@ -80,7 +80,7 @@ <h2 class="card-title">SIGN UP</h2>
8080
</div>
8181
</div>
8282
</div>
83-
83+
8484
<div class="form-group">
8585
<div class="row">
8686
<div class="col-md-3">
@@ -94,7 +94,7 @@ <h2 class="card-title">SIGN UP</h2>
9494
</div>
9595
</div>
9696
</div>
97-
97+
9898
<div class="form-group">
9999
<div class="row">
100100
<div class="col-md-3">
@@ -110,7 +110,7 @@ <h2 class="card-title">SIGN UP</h2>
110110
</div>
111111
</div>
112112
</div>
113-
113+
114114
<div class="form-group">
115115
<div class="row">
116116
<div class="col-md-3">
@@ -129,7 +129,7 @@ <h2 class="card-title">SIGN UP</h2>
129129
</div>
130130
</div>
131131
</div>
132-
132+
133133
<div class="form-group">
134134
<div class="row">
135135
<div class="col-md-3">
@@ -145,7 +145,7 @@ <h2 class="card-title">SIGN UP</h2>
145145
[ngClass]="{'is-invalid': (form.controls.password.errors && form.controls.password.dirty) , 'is-valid': !form.controls.password.errors}"></div>
146146
</div>
147147
</div>
148-
148+
149149
<div class="form-group">
150150
<div class="row">
151151
<div class="col-md-3">
@@ -163,26 +163,26 @@ <h2 class="card-title">SIGN UP</h2>
163163
class="invalid-feedback">Password do not match</div>
164164
</div>
165165
</div>
166-
167-
168-
166+
167+
168+
169169
</div>
170170
<div class="row">
171171
<div class="col-md-9 offset-md-3">
172172
<div class="row">
173173
<div class="col-md-2"><input
174174
[disabled]="!form.valid"
175-
type="submit" class="btn btn-primary"
175+
type="submit" class="btn btn-primary"
176176
value="Sign up">
177-
</div>
177+
</div>
178178
<div class="col-md-10 mt-2">
179-
<p>Already Have an account? <a
179+
<p>Already Have an account? <a
180180
routerLink="/login" >Sign in</a></p>
181181
</div>
182-
183-
</div>
182+
183+
</div>
184184
</div>
185-
185+
186186
</div>
187187
</form>
188188
</div>

judge/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (cluster.isMaster) {
3232
const mongoose = require('mongoose')
3333

3434
mongoose.Promise = global.Promise
35-
mongoose.connect(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/OnlineJudge')
35+
mongoose.connect(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27018/OnlineJudge')
3636

3737
const bodyParser = require('body-parser');
3838
app.use( bodyParser.json() );

judge/compileProblem.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const compileProblem= async (lang , filename)=>{
1717
case "c++":
1818
case "cpp":
1919
file = path.basename(filename,'.cpp')+".out";
20-
console.log(file)
2120
cmd="cd "+"\""+ path.join(__dirname,"result/source") +"\""+ " && g++ -o \"" + path.join(__dirname,"result/binary/")+ "\""+file + " " +filename;
2221
break;
2322
case "java":
@@ -37,29 +36,32 @@ const compileProblem= async (lang , filename)=>{
3736

3837
//Run Compiled if okay the check result
3938

40-
async function runCompiled(lang,file,contest,problem,option){
39+
async function runCompiled(lang,file,contest,problem,option,t0){
4140

4241
var cmd;
4342
switch(lang){
4443
case "c":
45-
cmd= "cd \""+ path.join(__dirname,"result/binary") + "\" && ./" + file + " <\""+ path.join(__dirname,"result/input/")+contest+"/"+problem+".txt\"";
44+
cmd= "cd "+ "\""+ path.join(__dirname,"result/binary") + "\" && ./" + file + " <\""+ path.join(__dirname,"result/input/")+contest+"/"+problem+".txt\"";
4645
break;
4746
case "c++":
4847
case "cpp":
49-
cmd = "cd \""+ path.join(__dirname,"result/binary") + "\" && ./" + file +" <\""+ path.join(__dirname,"result/input/")+contest+"/"+problem+".txt\"";
48+
cmd = "cd "+"\""+ path.join(__dirname,"result/binary") + "\" && ./" + file +" <\""+ path.join(__dirname,"result/input/")+contest+"/"+problem+".txt\"";
5049
break;
5150
case "java":
52-
cmd = "cd \""+ path.join(__dirname,"result/binary") + "\" && java " + file +" <\""+ path.join(__dirname,"result/input/")+contest+"/"+problem+".txt\"";
51+
cmd = "cd "+"\""+ path.join(__dirname,"result/binary") + "\" && java " + file +" <\""+ path.join(__dirname,"result/input/")+contest+"/"+problem+".txt\"";
5352
}
5453

5554
return new Promise((resolve,reject)=>{
5655
exec(cmd,option,(error, stdout, stderr) => {
5756
if (error) {
58-
//console.log(error)
59-
reject(error);
57+
//console.log(error)
58+
let timelimit =0;
59+
const t1 = process.hrtime();
60+
timelimit = (t1[0]-t0[0]);
61+
console.log(timelimit);
62+
reject({error,timelimit});
6063
}
6164
var res=stdout;
62-
6365
resolve(res);
6466
});
6567
})
@@ -107,10 +109,11 @@ const base64tofile = async (base64,lang)=>{
107109
async function compileAndRunProblem(contest,problem,id,lang ,description,option){
108110
const filename= await base64tofile(description,lang);
109111
const file = await compileProblem(lang,filename);
110-
const result= await runCompiled(lang,file,contest,problem,option);
112+
const t0 = process.hrtime();
113+
const result= await runCompiled(lang,file,contest,problem,option,t0);
111114
const serverRes= await serverResult(contest,problem);
112115
const Result = await checkResult(result,serverRes);
113-
console.log(Result);
116+
//console.log(Result);
114117
return Result;
115118

116119
}

judge/result/source/Solution.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#include<stdio.h>
2-
//#include<bits/stdc++.h>
3-
//using namespace std;
4-
int main()
5-
{
6-
printf("Welcome To CodeCamp");
7-
return 0;
8-
}
2+
int main()
3+
{
4+
int n;
5+
scanf("%d",&n);
6+
while(n--)
7+
printf("Hello World\n");
8+
}
9+

judge/result/source/Solution.cpp

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1 @@
1-
<<<<<<< HEAD
2-
<<<<<<< HEAD
3-
4-
#include<bits/stdc++.h>
5-
using namespace std;
6-
7-
int main(){
8-
unsigned long long sum=0;
9-
for(int i=0;i<10000;i++){
10-
for(int j=0;j<10;j++){
11-
sum+=1;
12-
}
13-
}
14-
cout<<sum<<"\n";
15-
return 0;
16-
}
17-
=======
18-
#include<stdio.h>
19-
20-
int main()
21-
{
22-
23-
printf("Welcome To CodeCamp");
24-
25-
}
26-
>>>>>>> 919467b4979028359348c66d8bdf04c06bc03be5
27-
=======
28-
#include<bits/stdc++.h>
29-
#define mod 10001
30-
using namespace std;
31-
typedef long long LL;
32-
int main()
33-
{
34-
int n,a[10000],avg;
35-
LL b[mod],val=0,s=0,m;
36-
cin>>n;
37-
for(int i=0;i<n;i++)
38-
{
39-
cin>>a[i];
40-
s+=a[i];
41-
}
42-
avg=s/n;
43-
b[0]=0;
44-
for(int i = 0; i < n-1; i++){
45-
b[i+1] = b[i]+a[i]-avg;
46-
}
47-
sort(b,b+n);
48-
m = -b[n/2];
49-
for(int i=0;i<n;i++)
50-
{
51-
val += abs(b[i]+m);
52-
}
53-
cout<<val;
54-
return 0;
55-
}
56-
>>>>>>> v-0.1
1+
print("Welcome To CodeCamp")

judge/result/source/Solution.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import java.util.*;
2-
public class Solution {
3-
public static void main(String[] args) {
4-
System.out.print("hii");
5-
}
6-
}
7-
1+
#include<stdio.h>
2+
int main()
3+
{
4+
printf("Welcome To CodeCamp");
5+
}
6+
Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,7 @@
1-
import math
2-
t=int(input())
3-
def fun(a,b,y):
4-
x=ord(a[-1])-ord('0')
5-
res=x**y
6-
print(res%10)
7-
'''m=math.ceil(math.log10(res))
8-
print(m)
9-
res=res%(10**m)
10-
print(res)'''
11-
12-
for _ in range(t):
13-
a,b=map(str,input().split())
14-
if len(b)==1 and int(b)==0:
15-
print(1)
16-
continue
17-
if len(b)<=1:
18-
x=int(b)
19-
else:
20-
l=len(b)
21-
x=(ord(b[-1])-ord('0'))+10*(ord(b[-2])-ord('0'))
22-
23-
if x%4==0:
24-
fun(a,x,4)
25-
else:
26-
fun(a,x,x%4)
27-
28-
1+
import java.util.*;
2+
public class Solution {
3+
public static void main(String[] args) {
4+
System.out.print("Welcome To CodeCamp");
5+
}
6+
}
7+

judge/routes/solution.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ router.get('/:id',(req,res)=>{
3232
encoding:'utf8'
3333
}
3434
judge.compileAndRunProblem(contest,problem,id,language ,description,option).then((result)=>{
35-
console.log(result);
3635
res.send(result);
3736
}).catch((e)=>{
3837
var compileError = /(g[/++/]|gcc|javac)/;
39-
if(e.cmd.toString().match(compileError)){
40-
res.status(200).send('CE' + e);
41-
}else if(e.killed){
38+
if(e.toString().match(compileError)){
39+
res.status(200).send('CE');
40+
}else if(e.timelimit*1000>=option.timeout){
4241
res.status(200).send('TLE');
4342
}else{
4443
res.status(200).send('RE');

server/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const app = express();
1010
const mongoose = require('mongoose')
1111

1212
mongoose.Promise = global.Promise
13-
mongoose.connect(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/OnlineJudge')
13+
mongoose.connect(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27018/OnlineJudge')
1414

1515
const bodyParser = require('body-parser');
1616
app.use(cors())
@@ -54,8 +54,8 @@ app.get('/',(req,res)=>{
5454
res.send()
5555
})
5656

57-
const port = process.env.PORT || 3000;
58-
app.listen(port);
57+
const port = process.env.PORT || 80;
58+
app.listen(port,'0.0.0.0');
5959
console.log('magic is started at ' + port)
6060

6161
module.exports={app}

0 commit comments

Comments
 (0)