Redan Hassoun

Ranch Hand
+ Follow
since Apr 26, 2016
Redan likes ...
Angular Framework Java Python
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Redan Hassoun

Hi,

I am building an endpoint that fetches Quizzes object list.

The Quiz model looks like this:





And here is an example of the endpoint response:

[
   {
       "createdAt": "2019-08-17T12:00:43.522+0000",
       "updatedAt": "2019-08-17T12:00:43.522+0000",
       "id": "bf013209-9e00-4890-8c74-a40298b51e12",
       "title": "quiz v",
       "description": "This quiz is called quiz v and it is just an example, this text should be the description of the quiz",
       "imageUrl": "https://images.immediate.co.uk/production/volatile/sites/3/2018/04/Screen-Shot-2018-04-05-at-09.20.50-96984e5.png",
       "isPublic": true,
       "assignedUsers": null,
       "creatorId": "620a1b29-94f3-4f55-b55c-51b173d35113",
       "answers": [
           {
               "createdAt": "2019-08-17T12:00:43.522+0000",
               "updatedAt": "2019-08-17T12:00:43.522+0000",
               "id": "69d3ed74-4382-44f4-b874-f9fc9c2f2181",
               "content": "answer x",
               "isCorrect": true,
               "userAnswers": [
                   {
                       "createdAt": "2019-08-17T12:02:31.070+0000",
                       "updatedAt": "2019-08-17T12:02:31.070+0000",
                       "id": "2e749bff-08a8-4f20-8709-7bf3a76cbafe"
                   }
               ]
           }
       ],
       "userAnswers": [
           {
               "createdAt": "2019-08-17T12:02:31.070+0000",
               "updatedAt": "2019-08-17T12:02:31.070+0000",
               "id": "2e749bff-08a8-4f20-8709-7bf3a76cbafe"
           }
       ]
   },
   {
       "createdAt": "2019-08-17T12:00:43.514+0000",
       "updatedAt": "2019-08-17T12:00:43.514+0000",
       "id": "a2c8e185-2bd2-4f2a-b6b5-f5f6139b377d",
       "title": "quiz o",
       "description": "This quiz is called quiz o and it is just an example, this text should be the description of the quiz",
       "imageUrl": "https://images.immediate.co.uk/production/volatile/sites/3/2018/04/Screen-Shot-2018-04-05-at-09.20.50-96984e5.png",
       "isPublic": true,
       "assignedUsers": null,
       "creatorId": "620a1b29-94f3-4f55-b55c-51b173d35113",
       "answers": [
           {
               "createdAt": "2019-08-17T12:00:43.514+0000",
               "updatedAt": "2019-08-17T12:00:43.514+0000",
               "id": "53a398f7-f4ec-48e7-9551-54f2b6f90159",
               "content": "answer x",
               "isCorrect": true,
               "userAnswers": []
           }
       ],
       "userAnswers": []
   }
]




I want to have the ability to add additional information in each item of the response array,
for example, i want to add the "number-of-correct-answers" for each quiz object

But without adding an attribute to the "Quiz" class because it represents the table on DB


How can I achieve this?

My goal is to be able to have an additional information in the JSON response without altering my table


Thanks in advance,
Redan


1 month ago

Stephan van Hulst wrote:How are you keeping track what user is logged in, and where and how do you store what answer a user has given to a particular question?



I am keeping track of the login using a Json Web Token. I have an authentication filter in the server that makes sure the token is valid before the request reaches the Controller.

And regarding storing the data,

I hava a "user_answer" table that stores:    quiz_id  ,   user_id  and quiz_answer_id.


On my current impelementation I have and endpoint that adds an answer to the table and another endpoint that retrieves a quiz.
Both of them take the user id from the token,


But I am wondering if this is a good practice or should I split the request into two requests

(at least the one that retrieves a quiz) :
first get the quiz , then get the answer by user.

2 months ago

Al Hobbs wrote:You should just have one request that the client needs to make.  If the data comes from different places then you should make another endpoint that aggregates the data.



I am using JWT for authenticating users, I tried to take the user id from the token that exists on the request header, and return the  data according to the user.

A user requests a quiz and gets the quiz resource back along with his answer for that quiz.

But I am wondering if this is a good practice or should I split the request into two requests:    first get the quiz , then get the answer by user.


You think splitting the request is a better approach ?

2 months ago
Hi all,
I am building a quiz application using Java Spring and Angular.

On some of my server endpoints, I need to return the data according to which user has sent the request.

For example,

I have a GET request that retrieves a quiz object by id.
and I need to add some additional information on that object for the specific user that requested it (information like: the user's answer).

I am thinking of three ways to do this:
1. To send the user id from the client.
2. To exctract the user id from the token (I am not sure how exactly this can be done)
3. To retrieve the additional information in a separate request.


What do you think the most elegant way to perform this?


Thanks in advance.

2 months ago
Hi Everyone,

I want to develop a desktop application (with Java Spring backend) that has the login ability, and I am interested to use JavaFx to do it, and as far as I know, I can use Jython to write a JavaFx application using Python code.

I am looking for an example\open-source project that includes an implementation of Oauth2 login with Jython,

And I would like to hear your notes (prods and cons) about the idea of writing a JavaFx desktop app using Jython.


Thanks in advance.  
1 year ago
Hi Everyone,

I am starting to develop an android application with Java Spring backend (Spring Boot).

The application is user based and it should contain login functionality,
And I am looking for the best practices to implement login functionality in my application,

Theoretically, as far as I know, when the user logs in, the server should return a session id which has an expiration date, the client saves that session id on the local storage, and each time the client side requests something from the server side, the session id should be attached to the request.
And the user should be prompted to log in again in case if the session is expired or if he logs out.

My questions are as follows :
1)    Is this method used in the real world? if yes, should I create a table on the database to store sessions with their expiration date ( or can spring do this out of the box)?
3)    If this method has some drawback, can you guys please suggest a better way?


Thanks in advance,
Redan.








1 year ago
Hi ,
I am a software engineer, I have graduated and started working on a good high-tech company 4 months ago as a Java Developer,
I work mainly on the server side using Java Spring Framework.  

My job is titled "Software Developer", but what I really do is I fix bugs for customers on the existing code, I don't write too much code,
I just investigate bugs and adjust the code in order to fix them, and in very rare cases I write new features to customers.
My purpose is to be an expert Java developer in the future and to work with a development team (Develop things - not fix existing code).

My questions are:

1. Should I look for another job where I write more code (and not investigate and fix bugs on existing code)?
   In other words, Do this position help me reach my goal or should I find another one to make a better experience?

2. If I stay where I am, but also develop my own applications at home (in parallel to work), will this help me in my next interview or is it just a waste of time?
   Does uploading some good projects to Github and putting them in my CV help me on interviews, will they like it? or does the experience at work make a better impression?
   
I appreciate any advice you guys can provide,
I don't want to stay forever on my current job, And I need to know the best thing to do in order to reach my goal,
and not waste my time doing things that will not help me reach it.


Thanks in advance.



1 year ago
Hi ,

I am developing an android social network application, the application server is implemented using the Spring MVC framework which is connected to a MySql database.

I want to provide the users the ability to upload images, and i am confused on how to implement this, i know that Spring MVC supports uploading files , but i also saw that Google's Fire-base also has an option to upload photos in cloud storage.

My purpose is to implement photo attachment to news feed posts, what do you recommend me to use ?
2 years ago
Hi ,
I am quite new in implementing mobile push notifications , i have an android application (which is connected to a PHP application server) and uses GCM for delivering push notifications , in the application database they
defined the GCM token as the unique identifier for each user in the application ( I know it's a bad idea ).
I am asked to switch to the Firebase cloud service in order to receive push notifications.

The problem is : If i just migrate from GCM to FCM , the existing users of the application will lose access to their accounts , because the GCM token will be gone.

I think the only walk-around is to run both of the services on the application..

Is this possible ?

If it`s not , do i have another solution ?
2 years ago

Tim Moores wrote:If you're afraid of the DB becoming too large, how about keeping it on a server, and accessing it via a REST web service?


The purpose is more learning SQLite and having some idea how it works.
And my question is because i wanna know how it is done in general , like , in big projects where the database is huge.
Do they load the whole database in the first launch from the server ? , i don`t think it makes sense
2 years ago
Hi ,
I am pretty new in Android SQLite. and i`m going to develop an application with a local database;
my question is : if the database is too large it would take too much space on the application storage if we download it from server
on the first launch - and it would take too much time to load.
is it a good convention to have the whole database stored in the local storage of the application ?
or there is some wize method to do that ?
2 years ago
Hi,
I have developed an android application, now i want to test this application for different phones, because different phones have different screen sizes.
I have installed GenyMotion , and also installed Google Play Services in it.
This is the first time i do this kind of tests , so i want to learn from you big guys what is the convention to do this testing for multiple screens, in other words , how android experts do this ? ?  
2 years ago
Hi, i am a beginner in developping android applications...
This is not really a question, i simply have a project to do, and i need an advice from the big guys

The application i am interested to develop has too many features - like: news, reports, payments , messaging ...
My boss suggested an approach that is new for me;
He wants the application to be modular - in other words, we need to have a main application that has a general functionality, and to have the ability to add whatever modules
to the application whenever we want.

For example; assuming a have one feature in the application : NEWS , and a want to add another feature : Payments , so i need to have the ability to build the Payments module as a
separate project, and then simply add this feature to the application by adding this module to the "Used modules list".
This way we can add/remove features in the application by simply adjusting some list which has the different modules used in the application.

Our purpose is to have a dynamic application, so if we have two clients :
1.  A client who wants to see : News and Payments.
2.  A client who wants to see : News and Reports.
Both clients will have the same application but with different modules in each one.

I saw that in Android-Studio the project can be divided into modules, but i want to learn the BEST way to use this thing for my purpose.


So ...
1. Is this a good approach ?
2. Is there a better approach for the same purpose ?
3. How can i implement this ?

3 years ago
hi,
I am a beginner in developing android applications.
I want to build an application that has a local database in it, as i know so far , i should use the SQLite databases. i am ok with that,
but i want to understand how should i manage data synchronization between the application and the server, in other words, my application has a
local database which represents a "cache" for the online database - so it has to be synchronized with changes on it.

What is the best practicies for managing this operation?
In which cases should the application request data from server , and in which cases it simply loads them from the local database ?
I am looking for taking advantage of the local database on the best way.
3 years ago
Does someone have an implementation of the GCC-PHAT Cross-Correlation ?
I am working on a computation of the time delay of arrival (TDOA) of a sound wave between two microphones, and i need an accurate method to solve this problem.
I saw an algorithm in Matlab that can do that which is called generalized cross-correlation (GCC-PHAT).
I am looking for an implementation for this on Java.
Or at least a pseudo code.
3 years ago