file-size | Lightweight filesize to human-readable / proportions | Runtime Evironment library
kandi X-RAY | file-size Summary
kandi X-RAY | file-size Summary
Lightweight filesize to human-readable / proportions w/o dependencies for node.js & browsers.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of file-size
file-size Key Features
file-size Examples and Code Snippets
public static String toHumanReadableSIPrefixesWithEnum(long size) {
final List units = SizeUnitSIPrefixes.unitsInDescending();
if (size < 0)
throw new IllegalArgumentException("Invalid file size: " + size);
Stri
public static String toHumanReadableBinaryPrefixesWithEnum(long size) {
final List units = SizeUnitBinaryPrefixes.unitsInDescending();
if (size < 0)
throw new IllegalArgumentException("Invalid file size: " + size);
public static String toHumanReadableSIPrefixes(long size) {
if (size < 0)
throw new IllegalArgumentException("Invalid file size: " + size);
if (size >= EB) return formatSize(size, EB, "EB");
if (size >= PB
Community Discussions
Trending Discussions on file-size
QUESTION
I'm running Apache ActiveMQ Artemis 2.17.0 inside VM for a month now and just noticed that after around 90 always connected MQTT clients Artemis broker is not accepting new connections. I need Artemis to support at least 200 MQTT clients.
What could be the reason for that? How can I remove this "limit"? Could the VM resources like low memory be causing this?
After restarting Artemis service, all connection are dropped, and I'm able to connect again.
I was receiving this message in logs:
...ANSWER
Answered 2021-Jun-05 at 14:53ActiveMQ Artemis has no default connection limit. I just wrote a quick test based on this which uses the Paho 1.2.5 MQTT client. It spun up 500 concurrent connections using both normal TCP and WebSockets. The test finished in less than 20 seconds with no errors. I'm just running this test on my laptop.
I noticed that your journal-buffer-timeout
is 700000
which seems quite high which means you have a very low write speed of 1.43 writes per millisecond (i.e. a slow disk). The journal-buffer-timeout
that is calculated, for example, on my laptop is 4000
which translates into a write-speed of 250 which is significantly faster than yours. My laptop is nothing special, but it does have an SSD. That said, SSDs are pretty common. If this low write-speed is indicative of the overall performance of your VM it may simply be too weak to handle the load you want. To be clear, this value isn't related directly to MQTT connections. It's just something I noticed while reviewing your configuration that may be indirect evidence of your issue.
The journal-buffer-timeout
value is calculated and configured automatically when the instance is created. You can re-calculate this value later and configure it manually using the bin/artemis perf-journal
command.
Ultimately, your issue looks environmental to me. I recommend you inspect your VM and network. TCP dumps may be useful to see perhaps how/why the connection is being reset. Thread dumps from the server during the time of the trouble would also be worth inspecting.
QUESTION
When uploading very large files over 2GB I am receiving the error;
(416) Requested Range Not Satisfiable.
I was encountering it with .Net API so I tried it with the REST API and I get the same error there. This makes me think that the Forge filesystem may be 32bit which doesn't support files larger than 2GB or maybe the REST API code for resumable defines the range values as int and can't handle a value greater than 2147483648. I've looked for a max file-size limit in the documentation but didn't find one.
Has anyone else encountered this problem or better yet, found a way around it? My file is already zipped so that's not a solution in this case.
...ANSWER
Answered 2021-Jun-04 at 01:56Doh, I found the issue. I was on the right track with the code using an int rather than a long, but it was my code at fault. I would have expected an error when an int gets set to a value exceeding it's max value but that isn't the case so when the range string was calculated I ended up with;
bytes 2139095040--2124414977/3221225472
when I was expecting;
bytes 2139095040-2170552319/3221225472
I suspect the C# code I was updating came from a sample somewhere on the internet so I guess it's worth leaving this question and answer in place, hopefully it will help someone else that runs into the same issue.
QUESTION
I have a cluster of Artemis in Kubernetes with 3 group of master/slave:
...ANSWER
Answered 2021-Jun-02 at 01:56I've taken your simplified configured with just 2 nodes using a non-wildcard queue with redistribution-delay
of 0
, and I reproduced the behavior you're seeing on my local machine (i.e. without Kubernetes). I believe I see why the behavior is such, but in order to understand the current behavior you first must understand how redistribution works in the first place.
In a cluster every time a consumer is created the node on which the consumer is created notifies every other node in the cluster about the consumer. If other nodes in the cluster have messages in their corresponding queue but don't have any consumers then those other nodes redistribute their messages to the node with the consumer (assuming the message-load-balancing
is ON_DEMAND
and the redistribution-delay
is >= 0
).
In your case however, the node with the messages is actually down when the consumer is created on the other node so it never actually receives the notification about the consumer. Therefore, once that node restarts it doesn't know about the other consumer and does not redistribute its messages.
I see you've opened ARTEMIS-3321 to enhance the broker to deal with this situation. However, that will take time to develop and release (assuming the change is approved). My recommendation to you in the mean-time would be to configure your client reconnection which is discussed in the documentation, e.g.:
QUESTION
In my project I'm using Jhipster Spring Boot and I would like to start 2 instances of one microservise at the same time, but on different instances of a database (MongoDB).
In this microservice I have classes, services, rests that are used for collections A, B C,.. for which now I would like to have also history collections A_history, B_history, C_history (that are structured exactly the same like A, B, C) stored in separated instance of a database. It makes no sense to me to create "really separated" microservice since I would have to copy all logic from the first one and end up with doubled code that is very hard to maintain. So, the idea is to have 2 instances of the same microservice, one for A, B, C collections stored in "MicroserviceDB" and second for A_history, B_history, C_history collections stored in "HistoryDB".
I've tried with creating 2 profiles, but when I start from a command line History microservice, it is started ok, but if I also try to start "original" microservice at the same time, it is started but immediately history service becomes "original" microservice. Like they cannot work at the same time.
Is this concept even possible in microservice architecture? Does anyone have an idea how to make this to work, or have some other solution for my problem?
Thanks.
application.yml
...ANSWER
Answered 2021-May-20 at 09:18In general, this concept should be easily achievable with microservices and a suiting configuration. And yes, you should be able to use profiles to define different database connections so that you can have multiple instances running.
I assume you are overwriting temporary build artifacts, that's why it is not working somehow. But that is hard to diagnose from distance. You might consider using Docker containers with a suiting configuration to increase isolation in this regard.
QUESTION
I am setting up a cluster of Artemis in Kubernetes with 3 group of master/slave:
...ANSWER
Answered 2021-May-11 at 23:49First, it's important to note that there's no feature to make a client reconnect to the broker from which it disconnected after the client crashes/restarts. Generally speaking the client shouldn't really care about what broker it connects to; that's one of the main goals of horizontal scalability.
It's also worth noting that if the number of messages on the brokers and the number of connected clients is low enough that this condition arises frequently that almost certainly means you have too many brokers in your cluster.
That said, I believe the reason that your client isn't getting the messages it expects is because you're using the default redistribution-delay
(i.e. -1
) which means messages will not be redistributed to other nodes in the cluster. If you want to enable redistribution (which is seems like you do) then you should set it to >= 0, e.g.:
QUESTION
I've been looking at this for days now and am totally stuck. The page I am working with looks like this:
...ANSWER
Answered 2021-Apr-23 at 02:49perhaps you can use a click event:
QUESTION
I am using the https://github.com/JeremyFagis/dropify plugin for image upload and wish the element show a thumbnail if there is already a file uploaded for the specified image.
I have found the How to set default image in dropify using jquery and ajax only to work but as I am getting images that are saved in the database in base64 format from server this solution didn't solve my issue.
p.s. I am using .Net Core mvc and Javascript/jQuery
...ANSWER
Answered 2021-Apr-15 at 05:09How to set default image in dropify ? ( base64 image format )
To set default image in dropify using a base64 encoded image that is stored in your database, you can refer to the following approach.
QUESTION
I was faced with a broker's (ActiveMQ-Artemis version 2.17.0) behavior unusual for me.
With a large number of messages and when they are quickly sent by the manufacturer, some of the messages reach the queue after the complete execution and the manufacturer has stopped. This is especially evident when the hard drive is normal, not SSD.
As an example, I use the following Apache Camel 2.25.3 route to send messages
...ANSWER
Answered 2021-Apr-14 at 12:10This kind of behavior is expected when sending non-durable messages because non-durable messages are sent in a non-blocking manner. It's not clear whether or not you're sending non-durable messages, but you've also set blockOnDurableSend=false
on your client's URL so even durable messages will be sent non-blocking.
From the broker's perspective the messages haven't actually arrived so there's no way to see the number of messages that have been sent but are not yet in the queue.
If you want to ensure that when the Camel route terminates all messages are written to the queue then you should send durable messages and set blockOnDurableSend=true
(which is the default value).
Keep in mind that blocking will reduce performance (potentially substantially) based on the speed of you hard disk. This is because the client will have to wait for a response from the broker for every message it sends, and for every message the broker receives it will have to persist that message to disk and wait for the hard disk to sync before it sends a response back to the client. Therefore, if your hard disk can't sync quickly the client will have to wait a long time relatively speaking.
One of the configuration parameters that influences this behavior is journal-buffer-timeout
. This value is calculated automatically and set when the broker instance is first created. You'll see evidence of this logged, e.g.:
QUESTION
What I'm trying to do: I have an on_message
event for a 'global chat' command that I have created. This would send messages to any server that was in the json, currently supporting images, multiple lines of text, and custom emojis (as long as the bot shared a server with said emoji).
My problem: As you can see in the image above, one person, 'S o u p', has their profile picture replaced with a duck emoji. For context's sake, their avatar is not that of a duck emoji. However, if you were to look at the most recent message, the profile picture is shown. I believe that the problem lies in the size of the message.author
's avatar. The PIL library may be a good solution, but I do not want to save the image.
Code I have tried:
...ANSWER
Answered 2021-Apr-08 at 17:36You don't need to save image. This is how you send images to discord without saving it:
QUESTION
How can I get the file size of a non-DOM created audio element?
I thought I could use the HTML5 File API – as per Client Checking file size using HTML5? – but it doesn't seem to be working for elements not in the DOM.
I've created an example below – see the line console.log(audio_file.files[0].size);
, which gives an error of:
...TypeError: audio_file.files is undefined
ANSWER
Answered 2021-Mar-27 at 21:04I tried by making a fetch
call and calculated the size of the file from blob.
But downside is, we cant know the size of the file until its completely loaded as the response headers of the given mp3 url didnt have any info related to size.
Here I have set the audio data after its fetched to the audio element, but this is not necessary. I just added it to play the audio file.
(You will have to wait till the file has loaded to see result after pressing Run code snippet.)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install file-size
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page