Hey Any Forums, can you help me out? I'm creating a project for a collage's course (software technologies for the web)...

Hey Any Forums, can you help me out? I'm creating a project for a collage's course (software technologies for the web). I do have in a DB a table called timeBands who has, other then the primary key, two attributes: start time and end time (both TIME type). Now in my tomcat java servlet i need to handle the creation of a time band and i need to check that the user time band doesn't overlaps exisisting ones. For example in DB i do have stored a time band that start at 10:00am and ends at 11:30am. Knowing this, if user input a time band that start at 09:00am at ends at 10:30am then that's an overlap. How do I check in java this kinds of overlap? I treat the times in string inside the servlet. In pic related that's my work so far. Thanks in advance anons, i hope you get a good day!

Attached: file.png (1507x816, 112.94K)

>he doesn't write code in english
fuck off

>making Fascist web technologies
based

fpbp, absolutely disgusting

Uoah user, sorry for the languagge barrier, I didn't think the variable name was that important

it actually is.
the names tell you what type of data they represent, and even their function in the program.
all this stuff you dont need to remember to maintain a mental image of your code is more brain-ghz available to you.

>inb4 brainlet cant cope with variables
ANY cognitive process that can be done away with is reducing one's overall cognitive power.
even if its only 5%, its 5% that could go into making algorythms.

if either side of the time range is within the other range, there is overlap
also,

Attached: TIMERANGESFORANON.png (800x600, 101.7K)

Let the user band be (userStart, userEnd), there's an overlap if userStart or userEnd (or both) are between the timeStart and timeEnd of any existing band.
I haven't written SQL queries in years, but it's something like
select * from timeBands where ( timeStart

Yeah you're right, i'm a fucking idiot. Anyway i do have translated the code.

Attached: file.png (1115x731, 81.28K)

cheers user
and now you know that fact.
so youre not an idiot anymore :)

foe each timeband check if if time < timeband_start || time > timeband_end

>Italian variable names
>out.print
>while(true) {break;}
What fucking shit school are you attending?

it's more of a java barrier than anything else, shit's absolutely disgusting but your monkey tongue doesn't exactly make it better.

>and now you know that fact. so youre not an idiot anymore :)

I hope so, anyway i'm struggling to read what user wrote here though i can see some logic in here.

Maybe, bringing control over a query result is a more simple way, but i don't get the variables name. If some one can tell me how to post code directly in here (tripcode or some other shit) i can post my current SQL code about the timeBands table

>If some one can tell me how to post code directly in here
With

Wow I thought you could nest them at least.
(code)(/code) but replace () with []

>while(true) {break;}
I can agree with this, but i don't know how to generate a string that is not already present in the DB, if you have a good method tell me, so i can get better

>out.print
So i can print while debugging, the prof. said that we need to remain debug shit (but idk why)

>i'm struggling to read what user wrote here
time "bands" are two times, a start and an end, right?

if any one time falls between the start and the end (time >= start && time

sfigato, sta zitto

get all entries, check if entry.end > new_entry.start

You could split both your start-time and end-time string in hours and minutes, multiply the hours * 60 and add that to the minutes. Now you have a numerical representation of time (assuming there are no bands that leap over the next day). With that you can compare the times in your database with the ones the user inputs. (ie if ((input_start < band_start && input_end < band_start) || (input_start > band_end))

Attached: ss.png (1170x584, 21.81K)

whoops >////

Attached: ss2.png (1248x584, 95.04K)