Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

s ravi chandran

Ranch Hand
+ Follow
since Dec 20, 2010
s ravi likes ...
Java jQuery
I am a  java developer. Working in Financial domain with an investment bank.
Bangalore
Cows and Likes
Cows
Total received
6
In last 30 days
0
Total given
0
Likes
Total received
11
Received in last 30 days
0
Total given
30
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by s ravi chandran

I would say machine learning is what I want to focus on.

AI is not for me at the moment. Its too complex to be used for any solution.

Will try to get into some books in the section. Will also check the site. Maybe it might click for me.
Thanks for your suggestions. I will try some of these.
1 year ago
Thanks for the response. Any pointers where I can find such projects.

I learn faster when actually doing coding.
Sorry for pitching in so late to this thread.

But I too would like to get started with Machine Learning. I think it can give me some new insight to problem solving.

What would be best way ahead for me? Doing course or is there any place I can get started with simple problems in this domain?
Not sure if you have solved this problem yet.
Why are you using scanLeft specifically?

Here is something I think you might be looking for:

But if you are updating an array, there are definitely better ways to do it.
Benefit of functional programming is no side effects.
1 year ago
Hi,

Our scala section is very less active. How can we make bring in more participation from other folks. I know there are a lots of knowledgeable people who are learning functional programming. it would be a great asset for this forum to have them bring in more their expertise. We also have less questions being asked in this section.

What would be the best way ahead ?

Thanks
1 year ago

Stephan van Hulst wrote:Your post does not make sense to me. Are you saying that you don't care about the exact difference in time? The difference in time depends on the date, time and time zone. If you care about the exact difference, you should care about time zone rules.



I do care about the time. I was only focusing more on getting exact duration at start and moving on from there.

As I said, this is an edge case which I did not specifically handle.

Will go through this scenario and how it is going to impact my application.
1 year ago
I got the point that time will shift at those particular instances.

I am not handling this edge case specifically.

The point being time duration is what effectively defines the trigger point. If application start time is already passed then difference will be some negative value, in which case I run the task immediately.

Exact time defined by user or current time do not have any direct implications on task trigger. Its just the difference in them that is used.

Campbell,
Can I conclude that ZonedDateTime by itself provides time adjustment to us without any intervention from our end?
1 year ago
Well, I take the time difference between the application start time and current time and schedule the task. So, no matter what time variations happen after this scheduling, it won't effect the task execution.

The important aspect here is the duration between current time retrieved and user defined application time.
1 year ago

Stephan van Hulst wrote:What Dave means is, what do you intend your application to do when the user has selected a time zone that uses daylight saving time, and has selected a time that is either invalid for the date the clock is adjusted, or ambiguous?

For instance, if the user has selected 2:30 AM as the time to perform the task, in the timezone Europe/Amsterdam, what do you expect your application to do on October 29th 2017? And on March 25th 2018? Will the task be performed twice? Will it be performed at all? Will the application crash?


For invalid time and timezone I take the system defaults.  The time check happens only once during application start, it will not repeat again for that day. The task will also trigger only once per application start. So after that whatever changes happen to clock adjustment, this check will not get triggered.
1 year ago

Stephan van Hulst wrote:Your code is not correct. The application time consists of the wrong date if LocalDate.now() is a different date than the date of the current day in the entered time zone. You need to use the current date of the time zone.

You don't need to jump over difficult hurdles to get the current time. Just use Instant.now().


Thanks. I was actually focussing on getting ZonedDateTime to have the correct time. I am using your logic now.
1 year ago

Dave Tolls wrote:I notice in your example you are using GMT.
What happens between the end of March and the end of October each year?
Is the user going to be OK with whatever it is running an hour later than they had specified?


That is just test value. Actual timezone will be read from configuration which application uses to startup.

Also, these settings change as per required. Like EDT to EST changes.
1 year ago

Stephan van Hulst wrote:Okay, I think I understand what you mean.

You want a certain task to run every day at a certain time. The user enters that time as a local time in a certain time zone. Every day, you can do this:



Thanks for the response. Sorry for the obscurity. I was typing all this from my phone, hence no code possible.

I did solve it eventually similar to what you suggested. Your code looks much precise.

I tried this:

Will update my code with your solution.

My solution also handles the case where application starts after the userEnteredTime. I think this should be the same for your solution also.
1 year ago
Not sure how to put it. Basically my time is fixed and date is variable. The task is supposed to be triggered at this particular time everday. No matter when the application started.

So i take the duration between time when application started and time when that task is to be triggered and schedule it. I thought of getting new Date() and setting task time to this and convert it to instant.

But I think there should be a better way to do this.

Does this make my problem clear?
1 year ago