Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b7e1b19
signup-login-profile
nawal-ahmad Oct 23, 2021
9820bf9
signup-signin-profile
nawal-ahmad Oct 24, 2021
680942d
post
nawal-ahmad Oct 24, 2021
97234e2
add post
nawal-ahmad Oct 24, 2021
5055045
back to main
abdelqader-alomari Oct 24, 2021
0c065c9
any
abdelqader-alomari Oct 24, 2021
560a7bf
api_get
mohnalkhateeb Oct 24, 2021
c32b928
users, coders
abdelqader-alomari Oct 24, 2021
c6f72ff
add controller and profile for each user by id, all users, follow and…
abdelqader-alomari Oct 24, 2021
119efcb
adding some stuff to github
jamal-eldeen-wari Oct 24, 2021
c1e09c2
gathering all work for end of sunday and edit and test done
abdelqader-alomari Oct 25, 2021
fd9ff10
admin-panel and crud + little styling done
abdelqader-alomari Oct 26, 2021
a903d20
some style and edit
abdelqader-alomari Oct 26, 2021
64694e4
some style and edit
abdelqader-alomari Oct 26, 2021
6640a3c
latests until start of tuesday
abdelqader-alomari Oct 26, 2021
6597a3d
latests until start of tuesday
abdelqader-alomari Oct 26, 2021
4d28e71
tuesday
abdelqader-alomari Oct 26, 2021
50a5127
editor
abdelqader-alomari Oct 26, 2021
50f745d
working on editor + render comments on profile done
abdelqader-alomari Oct 26, 2021
6f3dc34
latest updates
abdelqader-alomari Oct 26, 2021
03716b1
create json file with khair and solving the comments duplicate issue …
nawal-ahmad Oct 27, 2021
2890310
delete folloe button for the i followed and remove logged user from u…
Heba1998 Oct 27, 2021
c3471e1
edit feed, sign in with Heba
nawal-ahmad Oct 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
[
{
"id": 849,
"question": "How to remove the docker container with container id mentioned in the command.",
"description": null,
"answers": {
"answer_a": "$ docker rm -rf 9b6343d3b5a0",
"answer_b": "$ docker -rm rf 9b6343d3b5a0",
"answer_c": "$ docker rm 9b6343d3b5a0",
"answer_d": null,
"answer_e": null,
"answer_f": null
},
"multiple_correct_answers": "false",
"correct_answers": {
"answer_a_correct": "false",
"answer_b_correct": "false",
"answer_c_correct": "true",
"answer_d_correct": "false",
"answer_e_correct": "false",
"answer_f_correct": "false"
},
"correct_answer": "answer_a",
"explanation": null,
"tip": null,
"tags": [
{
"name": "Docker"
}
],
"category": "Docker",
"difficulty": "Easy"
},
{
"id": 26,
"question": "What is a daemon?",
"description": null,
"answers": {
"answer_a": "It is a generic name for e-mail servers on Linux. The most famous one is mailer-daemon",
"answer_b": "It is a program that keeps running on the background after it is called, answering to requests done by users and other programs.",
"answer_c": "It is an antivirus for Linux.",
"answer_d": "It is the generic name for any Linux server.",
"answer_e": null,
"answer_f": null
},
"multiple_correct_answers": "false",
"correct_answers": {
"answer_a_correct": "false",
"answer_b_correct": "true",
"answer_c_correct": "false",
"answer_d_correct": "false",
"answer_e_correct": "false",
"answer_f_correct": "false"
},
"correct_answer": "answer_b",
"explanation": null,
"tip": null,
"tags": [
{
"name": "Linux"
}
],
"category": "Linux",
"difficulty": "Medium"
},
{
"id": 627,
"question": "How can we set infinite execution time for a PHP script?",
"description": null,
"answers": {
"answer_a": "Add set_time_limit() at the beginning of a script",
"answer_b": "Add set_time_limit(infinity) at the beginning of a script",
"answer_c": "Add set_time_limit(0) at the beginning of a script",
"answer_d": null,
"answer_e": null,
"answer_f": null
},
"multiple_correct_answers": "false",
"correct_answers": {
"answer_a_correct": "false",
"answer_b_correct": "false",
"answer_c_correct": "true",
"answer_d_correct": "false",
"answer_e_correct": "false",
"answer_f_correct": "false"
},
"correct_answer": "answer_a",
"explanation": null,
"tip": null,
"tags": [
{
"name": "PHP"
}
],
"category": "Code",
"difficulty": "Medium"
}
]
14 changes: 10 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@ repositories {
}

dependencies {
// implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-websocket'
// implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.springframework.security:spring-security-test'
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testCompileOnly 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
}

test {
Expand Down
115 changes: 115 additions & 0 deletions json.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
[
{
"id": 1,
"school": "Donald Bren School of Information and Computer Sciences",
"title": "Interactive Technology Studio",
"course_level": "Graduate/Professional Only (200+)",
"description": "Technologies, languages, and skills required for creating prototypes to communicate interactive technology concepts. Topics include HTTP, CSS, CSS scripting, AJAX, Design Patterns, Javascript, Javascript libraries such as jQuery, SQL, MVC, and cloud architectures.",
"image":"https://united-pop.com/website/var/tmp/image-thumbnails/0/3214/thumb__diplomaCourseDetail/interactive_audio_designer~-~480w.jpeg"},
{
"id": 2,

"school": "Donald Bren School of Information and Computer Sciences",
"title": "Programming in Java as a Second Language",
"course_level": "Lower Division (1-99)",

"description": "An introduction to the lexical, syntactic, semantic, and pragmatic characteristics of the Java language for experienced programmers. Emphasis on object-oriented programming, using standard libraries, and programming with automatic garbage collection.",
"image":"https://miro.medium.com/max/750/1*HuoU7i1AIvkUSApmIx8XQw.png"},
{
"id": 3,

"school": "Donald Bren School of Information and Computer Sciences",
"title": "Computer Game Development",
"course_level": "Graduate/Professional Only (200+)",

"description": "Introduction to the principles of interactive 2D and 3D computer game development. Concepts in computer graphics, algorithms, software engineering, art and graphics, music and sound, story analysis, and artificial intelligence are presented and are the basis for student work.",
"image":"https://images.ctfassets.net/3s5io6mnxfqz/32WnMVURX2H9rRiNA1qbsg/a93ccb573ad78895d20bccbfdeece606/AdobeStock_345938875.jpeg?fm=jpg&w=900&fl=progressive"},
{
"id": 4,

"school": "Donald Bren School of Information and Computer Sciences",
"title": "Artificial Intelligence in Biology and Medicine",
"course_level": "Upper Division (100-199)",

"description": "Introduction to computational methods in molecular biology, aimed at those interested in learning about this interdisciplinary area. Covers computational approaches to understanding and predicting the structure, function, interactions, and evolution of DNA, RNA, proteins, and related molecules and processes.",
"image" : "https://th.bing.com/th/id/OIP.5snHE-VIA-roO_oqBZDjswHaE8?pid=ImgDet&rs=1"
},
{
"id": 5,

"school": "Donald Bren School of Information and Computer Sciences",
"title": "Digital Image Processing",
"course_level": "Upper Division (100-199)",

"description": "Introduction to the fundamental concepts of digital signal and image processing as applicable in areas such as multimedia, graphics, AI, data mining, databases, vision, or video games. Topics include image representation, space- and frequency-domain transformations, filters, segmentation, and compression.",
"image" : "https://online.stanford.edu/sites/default/files/styles/figure_default/public/2018-03/ee_digitalimageprocessing_ee368.jpg?itok=S2vGmtU4"
},
{
"id": 6,

"school": "School of Physical Sciences",
"title": "Advanced Data Acquisition and Analysis",
"course_level": "Graduate/Professional Only (200+)",

"description": "Introduces students to a variety of practical laboratory techniques, including lock-in, boxcar, coincidence counting, noise filtering, PID control, properties of common transducers, computer interfacing to instruments, vacuum technology, laboratory safety, basic mechanical design, and shop skills. Materials fee.",
"image" : "https://learn.g2.com/hubfs/what-is-advanced-analytics.jpg"
},
{
"id": 7,

"school": "Donald Bren School of Information and Computer Sciences",
"title": "Artificial Intelligence Frontiers: Technical, Ethical, and Societal",
"course_level": "Upper Division (100-199)",

"description": "Explores the frontiers of artificial intelligence and related technologies with a focus on the underlying ethical, legal, and societal challenges and opportunities they create. Encourages critical thinking about these issues.",
"image" : "https://www.insurancejournal.com/app/uploads/2016/01/ethics-580x580.jpg"
},
{
"id": 8,

"school": "The Henry Samueli School of Engineering",
"title": "Biomedical Big Data",
"course_level": "Graduate/Professional Only (200+)",

"description": "Analysis and visualization of large biomedical datasets. Topics covered include cloud computing, learning Structured Query Language (SQL), database normalization and joins, using Google’s BigQuery, using the statistical analysis package R, machine learning algorithms, application of machine learning for classification problems.",
"image" : "https://prod-discovery.edx-cdn.org/media/course/image/63f8ec13-8c6b-4c70-b380-3f95e56a21f6-d8de3c31749c.small.jpg"
},
{
"id": 9,

"school": "Donald Bren School of Information and Computer Sciences",
"title": "Network Security",
"course_level": "Graduate/Professional Only (200+)",

"description": "Introduction to network security, including network threats and attacks, as well as defenses against such attacks. Topics include network infrastructure security, mobile and Wi-Fi security, spam, phishing, firewalls, anonymity, secure email, secure and private cloud computing, and web security.",
"image" : "https://images.anytask.com/resources/user/07b908f2cd365eec/task/1604585232973_secure.png"},
{
"id":10 ,

"school": "Donald Bren School of Information and Computer Sciences",
"title": "Realistic Image Synthesis",
"course_level": "Graduate/Professional Only (200+)",

"description": "Provides an in-depth overview on a core sub-field of computer graphics. Graduate students who take this course are better prepared for conducting research on the related topics in computer graphics, vision, and scientific computing.",
"image" : "https://pbs.twimg.com/media/DVZtj_GUQAAv6mp.jpg"
},
{
"id": 11,

"school": "The Henry Samueli School of Engineering",
"title": "Introduction to Programming",
"course_level": "Lower Division (1-99)",
"description": "An introduction to computers and programming. Python programming syntax/style, types. Numbers and sequences. Control flow. I/O and errors/exceptions. Function calling, parameter passing, formal arguments, return values. Variable scoping. Programming laboratory.",
"image" : "https://www.tuni.fi/sites/default/files/styles/base_landscape_lg/public/media/image/jop_pow_koodaus.png?itok=MbIrLPrF"
},
{
"id": 12,
"school": "Donald Bren School of Information and Computer Sciences",
"title": "Project in Databases and Web Applications",
"course_level": "Upper Division (100-199)",

"description": "Introduces students to advanced database technologies and Web applications. Topics include database connectivity (ODBC/JDBC), extending databases using stored procedures, database administration, Web servers, Web programming languages (Java servlets, XML, Ajax, and mobile platforms).",
"image" : "https://www.midaswebtech.com/wp-content/themes/midas_it/images/web-development.gif"
}

]
1 change: 1 addition & 0 deletions recentquotes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"quoteText":"A lot of people give up just before theyre about to make it. You know you never know when that next obstacle is going to be the last one. ", "quoteAuthor":"Chuck Norris", "senderName":"", "senderLink":"", "quoteLink":"http://forismatic.com/en/2bc6cf0fd5/"}
2 changes: 1 addition & 1 deletion src/main/java/com/example/init/InitApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public class InitApplication {

public static void main(String[] args) {
SpringApplication.run(InitApplication.class, args);
}

}
}
86 changes: 86 additions & 0 deletions src/main/java/com/example/init/controllers/AdminController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.example.init.controllers;

import java.security.Principal;
import java.util.List;

import javax.transaction.Transactional;

import com.example.init.models.Coders;
import com.example.init.repositories.CodersRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.view.RedirectView;

@Controller
public class AdminController {
@Autowired
CodersRepository codersRepository;

@Autowired
BCryptPasswordEncoder bCryptPasswordEncoder;

@GetMapping("/admin")

String admin(Model model) {
List<Coders> coders = codersRepository.findAll();
model.addAttribute("coders", coders);
return "admin";
}

@PostMapping("/admin")
RedirectView addCoder(String email, String username, String password, String firstName, String lastName,
String dateOfBirth, String bio) {

Coders newCoder = new Coders(email, username, bCryptPasswordEncoder.encode(password), firstName, lastName,
dateOfBirth, bio);
codersRepository.save(newCoder);
return new RedirectView("/admin");
}

@GetMapping("/coder")
public String getCoder(@RequestParam long id, Model model, Principal principal) {
Coders coder = codersRepository.findById(id).get();
model.addAttribute("coder", coder);
return "coder";
}

@Transactional
@GetMapping("/del/{id}")
public RedirectView delete(@PathVariable String id, Principal principal, Model model) {
Coders coder = codersRepository.findById(Long.parseLong(id)).orElseThrow();
model.addAttribute("coder", principal.getName());
codersRepository.delete(coder);
return new RedirectView("/admin");
}

@GetMapping("/form/{id}")
public String showUpdateForm(@PathVariable("id") long id, Model model) {
Coders coder = codersRepository.findById(id)
.orElseThrow(() -> new IllegalArgumentException("Invalid user Id:" + id));
model.addAttribute("coder", coder);
return "putForm";
}

@Transactional
@PostMapping("/upd/{id}")
public RedirectView updateUser(@PathVariable("id") long id, Coders coder) {
Coders updatedCoder = codersRepository.findById(id).orElseThrow();
updatedCoder.setEmail(coder.getEmail());
updatedCoder.setUsername(coder.getUsername());
updatedCoder.setPassword(coder.getPassword());
updatedCoder.setFirstName(coder.getFirstName());
updatedCoder.setLastName(coder.getLastName());
updatedCoder.setDateOfBirth(coder.getDateOfBirth());
updatedCoder.setBio(coder.getBio());
codersRepository.save(updatedCoder);
return new RedirectView("/admin");
}

}
30 changes: 30 additions & 0 deletions src/main/java/com/example/init/controllers/CourseController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.example.init.controllers;

import com.example.init.models.Courses;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.io.FileReader;
import java.lang.reflect.Type;
import java.util.List;

@Controller
public class CourseController {

@GetMapping("/courses")
public String getCourses(Model model) throws Exception {

Gson gson = new Gson();
JsonReader reader = new JsonReader(new FileReader(
"json.json"));
Type jsonCasting = new TypeToken<List<Courses>>() {
}.getType();
List<Courses> jsonList = gson.fromJson(reader, jsonCasting);
model.addAttribute("courses", jsonList);
return "courses";
}
}
Loading