- 1
During handling of the above exception, another exception occurred
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
During handling of the above exception, another exception occurred
А бывает "Исключение возникло при обработке исключения, которое возникло при попытке обработать исключение"?
+3
case 'sav8':
if (isset($user) & $user['balls'] < $color[cena2])
{
echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FFA500' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFA500' WHERE `id` = '$user[id]'");
echo 'Сохранено!<br/>'; } break;
case 'sav9':
if (isset($user) & $user['balls'] < $color[cena2])
{
echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#8B008B' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#8B008B' WHERE `id` = '$user[id]'");
echo 'Сохранено!<br/>'; } break;
case 'sav10':
if (isset($user) & $user['balls'] < $color[cena2])
{
echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#000000' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#000000' WHERE `id` = '$user[id]'");
echo 'Сохранено!<br/>'; } break;
case 'sav11':
if (isset($user) & $user['balls'] < $color[cena2])
{
echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#696969' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#696969' WHERE `id` = '$user[id]'");
echo 'Сохранено!<br/>'; } break;
case 'sav12':
if (isset($user) & $user['balls'] < $color[cena2])
{
echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
}else{
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
mysql_query("UPDATE `user` SET `ncolor`='#FFFFFF' WHERE `id` = '$user[id]'");
mysql_query("UPDATE `user` SET `ncolor2`='#FFFFFF' WHERE `id` = '$user[id]'");
echo 'Сохранено!<br/>'; } break;
Код смены цвета ника для одной популярной CMS доставшийся в "наследство" от клиента. Кто и под чем писал - без понятия.
0
public function onAnswerPoll()
{
$data = request()->all();
ValidatePollForm::run($data);
try {
$options = Option::find($data['option_ids']);
$log = Crypt::decrypt($data['log']);
$log['options'] = array_merge(
array_get($log, 'options', []),
$options->lists('id')
);
$log['comments'] = array_get($log, 'comments', []) + array_get($data, 'comments', []);
$this->log = Crypt::encrypt($log);
$this->option = $options->first();
$this->poll = $this->loadPoll();
$this->locations = Location::get();
$this->step = ++$data['step'];
if ($this->option->is_last) {
Log::store($this->poll, $log);
Option::whereIn('id', $log['options'])->get()->each(function ($item) {
$item->increment('votes');
$item->logs()->create();
});
}
} catch (Exception $e) {
trace_log($e);
return response()
->json('Something was wrong.', 500);
}
}
/**
* onLoadDepartments
*/
public function onLoadDepartments()
{
$data = request()->all();
$validator = Validator::make($data, [
'location' => 'required|exists:kitsoft_polls_locations,slug',
'answer_id' => 'required|exists:kitsoft_polls_answers,id'
]);
if ($validator->fails()) {
throw new ValidationException($validator);
}
try {
$this->departments = Department::make()
->whereHas('locations', function ($query) use ($data) {
return $query->where('slug', $data['location']);
})
->whereHas('answers', function ($query) use ($data) {
return $query->where('id', $data['answer_id']);
})
->get();
} catch (Exception $e) {
trace_log($e);
return response()
->json('Something was wrong.', 500);
}
}
Из слитых сорцов «Дія.City».
+2
RUN apt install -y apache2
RUN apt install -y php
RUN apt install -y php-mysql
RUN apt install -y libapache2-mod-php
RUN apt install -y curl
RUN apt install -y php-mbstring
RUN apt install -y php-mysql
RUN apt install -y php7.4-sqlite3
RUN apt install -y php-gd
RUN apt install -y php-intl
RUN apt install -y php-xml
RUN apt install -y php-curl
#RUN apt install -y php7.0-ffmpeg
RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.4/apache2/php.ini
RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.4/cli/php.ini
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
RUN echo "IncludeOptional /var/www/*.conf" >> /etc/apache2/apache2.conf
#RUN sed -i "s/<\/VirtualHost>/Проверка\n<\/VirtualHost>" /etc/apache2/apache2.conf
RUN sed -i "s/<\/VirtualHost>/\n\t<Directory \/var\/www\/html>\n\t<\/Directory>\n<\/VirtualHost>/g" /etc/apache2/sites-available/000-default.conf
RUN sed -i "s/<\/Directory>/\tOptions Indexes FollowSymLinks MultiViews\n\t<\/Directory>/g" /etc/apache2/sites-available/000-default.conf
RUN sed -i "s/<\/Directory>/\tAllowOverride All\n\t<\/Directory>/g" /etc/apache2/sites-available/000-default.conf
RUN sed -i "s/<\/Directory>/\tOrder allow,deny\n\t<\/Directory>/g" /etc/apache2/sites-available/000-default.conf
RUN sed -i "s/<\/Directory>/\tAllow from all\n\t<\/Directory>/g" /etc/apache2/sites-available/000-default.conf
RUN sed -i "s/<\/Directory>/\tRequire all granted\n\t<\/Directory>/g" /etc/apache2/sites-available/000-default.conf
RUN mv /etc/apache2/sites-enabled/000-default.conf /tmp
RUN cd /etc/apache2/sites-enabled/; ln -s ../sites-available/000-default.conf 000-default.conf
RUN a2enmod php7.4
RUN a2enmod rewrite
#RUM apt install -y certbot
#RUN a2enmod python-certbot-apache
#RUN a2enmod ssl
EXPOSE 80
EXPOSE 22
# <Directory /var/www/html>
# Options Indexes FollowSymLinks MultiViews
# AllowOverride All
# Order allow,deny
# Allow from all
# Require all granted
# </Directory>
RUN wget -O /var/www/html/index.phar https://github.com/mpak2/mpak.su/raw/master/phar/index.phar
RUN wget -O /var/www/html/.htaccess https://github.com/mpak2/mpak.su/raw/master/.htaccess
RUN wget -O /var/www/html/.htdb https://github.com/mpak2/mpak.su/raw/master/.htdb
RUN chown www-data /var/www/html/.htdb
RUN chown www-data /var/www/html
RUN mkdir /var/www/html/include
RUN mkdir /var/www/html/include/images
RUN chmod 0777 /var/www/html/include/images
RUN rm /var/www/html/index.html
https://github.com/mpak2/mpak.su/blob/654b7daf0b7d4f3c83385c0ca35fcab6a1ec45f7/phar/docker/www/Dockerfile
+1
alex@ASD-PC:~/TypeScriptCompiler/3rdParty/llvm-wasm/debug/bin$ node mlir-translate.js --help
OVERVIEW: MLIR Translation Testing Tool
USAGE: mlir-translate.js [options] <input file>
OPTIONS:
Color Options:
--color - Use colors in output (default=autodetect)
General options:
--dot-cfg-mssa=<file name for generated dot file> - file name for generated dot file
--mlir-disable-threading - Disabling multi-threading within MLIR
--mlir-elide-elementsattrs-if-larger=<uint> - Elide ElementsAttrs with "..." that have more elements than the given upper limit
--mlir-pretty-debuginfo - Print pretty debug info in MLIR output
--mlir-print-debuginfo - Print debug info in MLIR output
--mlir-print-elementsattrs-with-hex-if-larger=<long> - Print DenseElementsAttrs with a hex string that have more elements than the given upper limit (use -1 to disable)
--mlir-print-op-on-diagnostic - When a diagnostic is emitted on an operation, also print the operation as an attached note
--mlir-print-stacktrace-on-diagnostic - When a diagnostic is emitted, also print the stack trace as an attached note
-o=<filename> - Output filename
--split-input-file - Split the input file into pieces and process each chunk independently
Translation to perform
--deserialize-spirv - deserialize-spirv
--import-llvm - import-llvm
--mlir-to-llvmir - mlir-to-llvmir
--serialize-spirv - serialize-spirv
--test-spirv-roundtrip - test-spirv-roundtrip
--test-spirv-roundtrip-debug - test-spirv-roundtrip-debug
--verify-diagnostics - Check that emitted diagnostics match expected-* lines on the corresponding line
Generic Options:
--help - Display available options (--help-hidden for more)
--help-list - Display list of available options (--help-list-hidden for more)
--version - Display the version of this program
program exited (with status: 0), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)
alex@ASD-PC:~/TypeScriptCompiler/3rdParty/llvm-wasm/debug/bin$
сказ о том как я LLVM на WASM компилял :)
0
private static final Map<Integer, FieldInfo> HEAD_FIELDS = new ImmutableMap.Builder<Integer, FieldInfo>()
.put(5, new FieldInfo("DOC.CODEOKATO", FieldInfoType.STRING))
// .put(7, new FieldInfo("DOC.NAMECMO", FieldInfoType.STRING))
.put(8, new FieldInfo("DOC.CODECMO", FieldInfoType.STRING))
// .put(9, new FieldInfo("DOC.NAMEMEDORG", FieldInfoType.STRING))
.put(10, new FieldInfo("DOC.CODEMO", FieldInfoType.STRING))
.put(14, new FieldInfo("DOC.INFINSPERSON_BIRTHDAY", FieldInfoType.DATE))
.put(12, new FieldInfo("DOC.INFINSPERSON_NUMHEALINS", FieldInfoType.STRING))
.put(15, new FieldInfo("DOC.INFINSPERSON_GENDER", FieldInfoType.STRING))
.put(16, new FieldInfo("DOC.INFINSPERSON_DATESTRMED", FieldInfoType.DATE))
.put(17, new FieldInfo("DOC.INFINSPERSON_DATEFINMED", FieldInfoType.DATE))
.put(13, new FieldInfo("DOC.INFINSPERSON_NMEDICCARD", FieldInfoType.STRING))
.put(18, new FieldInfo("DOC.INFINSPERSON_CODEMKB", FieldInfoType.STRING))
.put(23 - 1, new FieldInfo("DOC.INFINSPERSON_SEVCOVID19", FieldInfoType.STRING))
.put(24 - 1, new FieldInfo("DOC.INFINSPERSON_SEVCOVID191", FieldInfoType.STRING))
.put(25 - 1, new FieldInfo("DOC.INFINSPERSON_SEVCOVID192", FieldInfoType.STRING))
.build();
Коллега изменил мой код, пока я болел.
+2
// https://github.com/seanbaxter/circle/blob/master/examples/README.md#tldr
// ...
// Circle's primary syntactic element is the @meta keyword, which runs the prefixed statement
// during source translation (or during template instantiation in dependent contexts).
// https://github.com/seanbaxter/circle/blob/master/examples/README.md#same-language-reflection
// duff1.cxx
void duff_copy1(char* dest, const char* source, size_t count) {
const char* end = source + count;
while(size_t count = end - source) {
switch(count % 8) {
case 0: *dest++ = *source++; // Fall-through to case 7
case 7: *dest++ = *source++; // Fall-through to case 6...
case 6: *dest++ = *source++;
case 5: *dest++ = *source++;
case 4: *dest++ = *source++;
case 3: *dest++ = *source++;
case 2: *dest++ = *source++;
case 1: *dest++ = *source++;
break;
}
}
}
// Reproduced above is a simplified version of Duff's device, an infamous memcpy function designed
// to reduce the amount of branching in the operation. (The loop is optimally interleaved with the switch,
// but I'm trying to illustrate some other points and don't want to add to the confusion.) Once we enter the
// switch, perform an assignment and unconditionally progress to the next case statement. This algorithm
// cries out for automation. The case statements have indices that run from 8 down to 1, modulo 8. Can we give it the Circle treatment?
// duff2.cxx
void duff_copy2(char* dest, const char* source, size_t count) {
const char* end = source + count;
while(size_t count = end - source) {
switch(count % 8) {
@meta for(int i = 8; i > 0; --i)
case i % 8: *dest++ = *source++;
break;
}
}
Но гомоиконности таким подкостыливанием вы естественно не добавите!
+1
if constexpr (BusMode::BLOCKING == mode) {
derived()->send_block(arr, num);
} else if (BusMode::IT == mode){
derived()->send_it(arr, num);
} else if (BusMode::DMA == mode){
derived()->send_dma(arr, num);
}
https://habr.com/ru/post/556144/
> Отладочный вывод на микроконтроллерах: как Concepts и Ranges отправили мой printf на покой
Стреляем себе в ногу при помощи if constexpr.
+1
%% Generates a Normal-distributed random variable using Box-Muller method
%% from: https://github.com/basho/basho_stats/blob/develop/src/basho_stats_rv.erl
-spec rnd_normal(integer(), integer()) -> non_neg_integer().
rnd_normal(Mean, Sigma) ->
Rv1 = random:uniform(),
Rv2 = random:uniform(),
Rho = math:sqrt(-2 * math:log(1-Rv2)),
abs(trunc(Rho * math:cos(2 * math:pi() * Rv1) * Sigma + Mean)).
Это норма.
0
#include <iostream>
#include <vector>
template <typename T>
struct Vec {
T x, y;
Vec& operator /=(const T& d) {
x /= d;
y /= d;
return *this;
}
};
Найдите баг в коде.
Посмотрел этот видос: https://www.youtube.com/watch?v=4M1MlW0sP0Q