Mahesh Suryawanshi

Greenhorn
+ Follow
since Jun 22, 2016
Mahesh likes ...
Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Mahesh Suryawanshi

Hi Folks,

I want to maintain the State Like ON/OFF through out the application.

Based on that i want to execute some code, like If state is ON then some block of code get executed then i will make State OFF.

So next time state will be OFF then some code & i will make state ON.

Please help me out how will i implement this feature using Spring boot or some other way to implement.

Thank you
1 year ago

Campbell Ritchie wrote:Surely end would be 2017-10-30...

I am not sure there is anything helpful in the Java™ Tutorials about that. Have you been through the methods of Duration, LocalDateTime and Period to see whether it says anything about weekends? You realise you can get the day of week (Sunday, Monday, Tuesday) from a local date easily enough?



Thank you for response

There a method to check the day something like dateTime.getDayOfWeek().getValue(), but i need to consider the day with time so that i can exclude from the final hours.
1 year ago

Jeanne Boyarsky wrote:You've got step one. You know the total number of hours. Next you need to find the total number of weekend hours.

For that, you'll need some logic. Any thoughts on how to tell if a day is a weekend? Or how to go through all the dates in the range?



Thank you for response

Yeah, thats the tricky part to find weekend hours.

What i think is, May be need to check that given date is weekend or not if yes then add hours if not then skip.

I need to work on that. to find the concrete solution.
1 year ago
Hi Folks,

I will have 2 date's including time, i need to find out the number of hours between the dates excluding Weekends.

For sample example



Suppose it it executed today then output will be 72 hours [startDateTime>> 2017-10-27T19:31:49.793 endDateTime>>2017-10-24T19:31:49.793]

Suppose in between this date's Weekend will come then it should exclude that hours from the output.

Let's say it executed in between Monday & Friday it should consider as 24 hours only excluding Sat & Sun Hours.

Please suggest how to solve this problem.

Thank you


1 year ago

Tim Moores wrote:I don't know that that has anything to do with Spring. The server running the WS needs to have HTTPS enabled; does it?



I think its need to Enable HTTPS in Spring Boot, do configuration stuff to implement SSL.
 
2 years ago
Thank for response

it was error of IDE, i re-install the IDE now working fine.
2 years ago
Hi Folks,

I want to secure REST API, which is build using Spring Boot.

I want that API should be accessible by HTTPS.

Please Help me out how to achieve this in Spring Boot.

Thank you
2 years ago

Tim Moores wrote:It did not change in Java 8. What error are you getting?



Thank you for quick reply



Please see the image for clarity.

my dev environment is JDK 8.
2 years ago
Hi Folks,

The try with resource feature released in JDK 7 will work same in JDK 8 or it's deprecated or something else ?

When i am trying to run the code of try with resource in JDK 8 run time environment is giving me a error as

Resource specification not allowed here for source level below 1.7

1 Quick fixed available in eclipse is : change project compliance and jre to 1.7

Below is source for which i am getting issue:


I was getting error for 1st line in above code.

IDE that i am using is eclipse neon

Please suggest any to solve this

Thank you
2 years ago
Dear Folks,

Want to solve below problem, please help me out to get through it.

In-Memory Cache

Cache should capable of storing any Java Object , but can be used for only Class type (Should throw a compile time error if any other object other than intended is stored)

Every Object should be associated with, the thread which placed it, and a logical key, which can be used to retrieve and used by the same thread or any other thread

Once the thread is dead, all Objects associated with that thread should be removed.

Cache should be stable and compatible in a Multithreaded Environment.

API Design should be loosely coupled

Thank you
Dear Folks

I Want to build a logic for an Object of ArrayList.

Below i will provide Boilerplate for a program for which i want a logic to implement.







1. In the above program there are 2 domain class Employee, Result
2. In the main program inside TestProgram class i have added 8 Object of Employee inside empList ArrayList.
3. if you run the program the output will be as below
List Size : 8
Name: Tom Emp ID: 1
Name: Tom Emp ID: 2
Name: Tom Emp ID: 3
Name: Tom Emp ID: 4
Name: Tom Emp ID: 6
Name: Jerry Emp ID: 7
Name: Jerry Emp ID: 8
Name: John Emp ID: 9
4. The Output i require is in resList ArrayList is
Name: Tom, From ID: 1, To ID: 4, Count: 4
Name: Tom, From ID: 6, To ID: 6, Count: 1
Name: Jerry, From ID: 7, To ID: 8, Count: 1
Name: John, From ID: 9, To ID: 9, Count: 1
5. The logic to generate the output is
If Name is same &  Emp ID is in sequence then update the To ID, if sequence is break then create a separate entry in resList.

Please help me out to solve the problem

If further clarification required please comment

Thank you in advance


2 years ago

Henry Wong wrote:
There are already services that does this for you -- so, this will be a lot of work for something that already exists... but to answer your question, you will have to write code to measure it, which means...

1. You will need a server with really good upload/download speed. Arguably, ridiculously good upload/download speed. It needs to be much faster than your clients, or you will be measuring the speed of the server (and not the client).

2. You need to take lots of measurements -- so, this will take a lot of time. Additionally, you will need a good understanding of statistics too (which is true when you want to have valid data of anything that is measured).

... and ...

3. The process itself is simply sending lots and lots of data. There will be time stamps in this data. And it is simply a matter of looking at the time stamps as you are counting the amount of data. This needs to be done in both directions obviously.  

Henry



Thank you for the reply.

Can you tell me the services that are available?
Dear Folks,

I want to find the download & upload speed.

Expected Output be like:

Download Speed : 8.38Mbps
Upload Speed : 4.24Mbps

Please provide any suggestion to code this requirement.

Thank you
Dear Folks,



When i am running above code i am getting the output i am getting is Called NullPointer

Why is it so?

Please Explain
2 years ago