function assignFilePreviews() {
$( 'input[data-previewable=\"true\"]' ).change(function() {
var prvCnt = $(this).attr('data-preview-container');
if(prvCnt) {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
var img = $('<img>');
img.attr('src', e.target.result);
img.error(function() {
$(prvCnt).html('');
});
$(prvCnt).html('');
img.appendTo(prvCnt);
}
reader.readAsDataURL(this.files[0]);
}
}
});
}
$(document).ready(function() {
assignFilePreviews();
});
HTML
<input type="file" data-previewable="true" data-preview-container=".prd-img-prv" />
<div class = "prd-img-prv"></div>
Это также обрабатывает случай, когда выбран файл с недопустимым типом (например, pdf)
Более подробную информацию можно найти здесь.
https://docs.datastax.com/en/developer/php-driver/1.2/api/Cassandra/Cluster/class.Builder/
Использование withConnectTimeout может помочь избежать a TimeoutException
$cluster = $this->cluster()->withConnectTimeout(60);
вы можете увеличить значение тайм-аута. Хотя вы обновляете немного больше, изменяя значения в /etc/cassandra/cassandra.yaml
, как показано ниже -
[118 ] sudo nano /etc/cassandra/cassandra.yaml (для редактирования файла cassandra.yaml)
# How long the coordinator should wait for read operations to complete
read_request_timeout_in_ms: 50000
# How long the coordinator should wait for seq or index scans to complete
range_request_timeout_in_ms: 100000
# How long the coordinator should wait for writes to complete
write_request_timeout_in_ms: 20000
# How long the coordinator should wait for counter writes to complete
counter_write_request_timeout_in_ms: 50000
# How long a coordinator should continue to retry a CAS operation
# that contends with other proposals for the same row
cas_contention_timeout_in_ms: 10000
# How long the coordinator should wait for truncates to complete
# (This can be much longer, because unless auto_snapshot is disabled
# we need to flush first so we can snapshot before removing the data.)
truncate_request_timeout_in_ms: 600000
# The default timeout for other, miscellaneous operations
request_timeout_in_ms: 100000
# How long before a node logs slow queries. Select queries that take longer than
# this timeout to execute, will generate an aggregated log message, so that slow queries
# can be identified. Set this value to zero to disable slow query logging.
slow_query_log_timeout_in_ms: 5000