Reliable way to get UTC time online? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Does anybody know where I can get the current plain-and-simple-no-nonsense UTC time accurately and really quickly? Our system clocks are variable due to a number of factors but we need a guiding light to run one of our applications. I was wondering if there was a free service where I can get the time via HTTP without much overhead (i.e. I prefer not to scrape it off somewhere like Google search's with a lot of other data because the application would be looking it up quite often). Does anyone know a reliable service for this?

Depends how accurate you want to get and how much you trust the source.
Possibilities include:
http://www.timeapi.org/utc/now
http://timezonedb.com/api
http://json-time.appspot.com/time.json

It really depends on how accurate you want the time to be. If it is to synchronise apps/servers, then using a http request to an external server may not be the best approach as you have to take network latency into account. i.e. the time returned may be in the past if the round trip for the request is slowed down by the network, especially if your going via a proxy. And if the apps are running on different machines, with variable network latency the times will not be synced.
An alternative approach would be to ensure that the machines you are running have there systems clocks all synced. A common solution for this is NTP (Network Time Protocol), which allows servers to keeps there clocks updated accurately.
Here a resource for NTP configuration on Linux, I am sure Google will find you more.

Related

Looking for a crash-safe queue in java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm building a Java application that will run on a battery-powered, cellular-enabled device (not a mobile phone by the way), and needs to send commands to a server.
These commands are in the form of JSON-objects, so they can easily be serialized and deserialized.
As internet connectivity may not be completely reliable, and the battery of the device may run out, I need a way of saving my commands to disk in case the battery runs out (which could, in some cases, cause power to switch off without warning).
The commands can be 'worth' a few euros a piece, so it's important that I take every precaution (within certain bounds of course) to make sure no commands are lost. Sending a command twice is not a problem, as every command is tagged with a GUID, and my server will make sure duplicates are ignored. The queue may contain up to a thousand commands, but most of the time it will be empty.
What I'm actually looking for is a Queue-like (FIFO) object with a backing file store that is made to survive an instant crash. I need to be able to peek at the next in line, and remove it after processing is finished.
Up to now, I've been working with MapDB 3.0, but the documentation is a bit confusing as to how to create a queue-like object. And besides, it seems to be a bit much for what I'm trying to achieve
You could have a directory of files. One file per message. The file name could be a timestamp or name which records the ordered. A directory with 1000 files should still perform ok.
Once you close the file, it should be persisted to disk, although exact how safe any operation is will depend on the device and how it is implemented.

Triggereing 1K android apps on some event - Suggestions [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
We have a strange requirement where we have to trigger 1k android apps for a digital wall having devices. We do not have WLAN/INTERNET connection.We want to run an animation in all the devices , synced together.For this we need a trigger to initiate android apps.
I was working with Sound frequency check, but not sure if it is feasible to trigger each and everyone without lag.
Please provide any other suggestions.
You can use a time-based trigger. I expect that you have at least connection to a your mobile provider network which you can use to synchronize clocks. Once you do that, you can use any means of communication with the devices to notify them about the next time to run your animation at a given time.
For example, you could send a SMS message with the time to all devices containing the time when to trigger the animation. There will be a lag before all messages are delivered but if the trigger time is in future further than maximum lag, you will still achieve synchronization.
Or you can use another sensor, such as microphone, camera, maybe even Bluetooth. If you write your application to be triggered by a clap or flash, all devices may trigger at a reasonably similar time (especially if they were the same model with the same installed apps). It depends on how much precision you require. If e.g. sound is not precise enough, you can improve synchronization with time again - set the animation to run at the nearest second/ten seconds/... boundary after the trigger event.
All in all, it depends on your exact requirements (precision, ...) and you will probably need to do some experimenting. Internet connection would probably be the most precise trigger, though. Almost all Android devices have access to WiFi and setting up an access point is not difficult

What technologies should we use to process terra bytes of data in real time? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
We have a website which generates MB/TB of data which needs to be mined. What technologies should we use to process terra bytes of data in real time ? Hadoop , Cassandra are good for batch processing; but not for real time.
Real-time; means process the data as it is happening and show reports on that.
Any ideas or suggestions ?
Have you looked into the Storm project? It's used by Twitter. It's like real-time Hadoop.
We use it for one of our stream processing project. It's awesome. Documentation, development, deployment, scalability awesome. We recently ran a 20K message/sec with processing (storing in Cassandra, modifying and broadcasting, calculating mean), it worked reliably and like magic. Definitely worth giving a shot. The mailing list is very friendly, I rarely had to use it to ask a question.
You can process TBs of data with the same technologies as you can process 1 MB of data, but it will take longer.
I don't see how you intend to use the data in "real time" and I suspect you mean real world.
If you mean quickly, then you need to summarise the data for human consumption. You can only present to the user kilo-bytes or mega-bytes of information at once.
Using memory mapped files can make this more efficient if you have a need to load the data all at once. This can be used to process tens of millions of records per second.
Check this page: http://hadoop.apache.org/
There are listed related frameworks/libraries to work with large amount of data in distributed environment.

Are there any simple and effective Open Source Java database-backed queue libraries? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I have a few different apps which need robust database-backed job/task queues, and so far I've had trouble identifying any promising candidates. I'd love some suggestions!
BTW, by database-backed I intend something which persists job data and status to a JDBC DB for reliability purposes.
Oh, I'm specifically looking for a library. I'm aware of systems such as ActiveMQ and JMS-based systems. But I need my apps to remain self-contained and not turn into entire platforms. (I've also always had some trouble making the conceptual leap to modeling jobs/tasks as messages.)
Thanks,
Avi
I recommend you take another look at ActiveMQ. While it is by default a standalone application, you can also embed it in your application, making it "self-contained". I've done this using ActiveMQ's Spring support but you can also do it programmatically by simply instantiating the correct classes in your app. ActiveMQ is lightweight and offers several persistence mechanisms.
Regarding whether there is a dissonance with thinking of "messages" as "jobs", I guess it depends on what you mean by "job". If I hand you a piece of paper that says "mow the lawn" and you think of that as a job, then messages can be jobs. If instead you don't have a job until you actually start mowing the lawn, then they are not.
Perhaps you may want to look at Spring Batch, which uses a job-based domain model. It too is embeddable and has persistence, retry, etc. built in.

computing performance [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I need to find out the time a function takes for computing the performance of the application / function.
is their any open source Java APIs for doing the same ?
You're in luck as there are quite a few open source Java profilers available for you.
Take a look at the official TPTP plugin for Eclipse. This pretty much does all you describe and a (frikkin') whole lot more. I can really recommend it.
I don't know if there are APIS, but you normally use the funciton currenttimemillis for that... You measure the time at the beggining, then again at the end of the execution and voila!!! you got your time substracting
Hiperic provide a GPLv2 licenced tool for monitoring all sort of system resources called SIGAR (System Information Gatherer and Reporter).
This tool is used to provide things like adaptive load balancing in GridGain (a grid computing framework).
http://www.hyperic.com/products/sigar.html
Have a look to this question : Which java profiling tool do you use and which tool you think is the best ?
If it's just one function you care about, wrap a million-iteration loop around it, and time it with a stopwatch. Then seconds translate to microseconds.
On the other hand, if you want to speed it up, all you need is this.

Categories

Resources