229
questions
1
vote
3
answers
153
views
atexit(3) in Perl: `END {}` or `$SIG{__DIE__}`?
I'm wondering: When you detect you need to clean up at the end of the program (excluding "end of block"), you want to "queue an exit handler" that does the cleanup at some later ...
0
votes
1
answer
356
views
How set dd(dump and die) in yii2 framework?
I want use DD (dump and die) like Laravel framework
How use it in yii2 framework?
2
votes
2
answers
68
views
PHP $_SESSION- comparison between scripts
There is a PHP script on the server which runs about 20 - 30 seconds depending on the size of the file it's working on.
To stop the running instance when a new one ist started I change a session ...
0
votes
1
answer
120
views
die() or exit() without destructors?
I would like to stop my php code when a condition is not valid.
Example:
if (strlen($string) < 6){
echo "minimum 6"
}
if (strlen($string) > 32){
echo "maximum 32&...
1
vote
1
answer
118
views
NetLogo hatch and die
I want to make turtles move around and look for a partner (a turtle that is not already partnered that is on the same patch) , and when they found one I want them to hatch a certain number of turtles ...
0
votes
0
answers
24
views
why the die() don't catch the fatal error? [duplicate]
here is my code
(the database don't need password, but i intentionally added it to create the error)
<?php
$connection = mysqli_connect("localhost", "root", "null", &...
5
votes
1
answer
663
views
die() is not stopping code from executing
the problem is in the following:
echo 'Hello...';
die('I died...');
echo 'HAHAHA!!!';
on the web browser it is executing the echo after the die().
on the CLI stops on the die() and does not shows ...
0
votes
3
answers
99
views
breaks while loop when all die rolls the same number
using System;
using System.Collections.Generic;
namespace AnyDice
{
class Program
{
static void Main(string[] args)
{
int diceSides;
int rollDie;
...
0
votes
1
answer
46
views
Strange PHP DIE() behaviour
I have a database class, which uses a db->query() and $db->close method
The query class supports prepared statements, with ? parameters compared against an array ($data) of values.
The table has ...
2
votes
0
answers
174
views
When does php prepare to send headers?
I wish to review and change headers before they are sent & also be able to stop any content from being send if headers are not to my liking or other conditions are not met.
When I set a function ...
0
votes
2
answers
529
views
Dice combinations to a total
Trying to find a nice algorithm for working out d4 dice combinations for a total. For example 3 dice with four sides, all the combinations to make 4 would give: 004 013 112 022
I will be using c# but ...
3
votes
2
answers
171
views
where is perl eval "...propagated" documented
In the following code, eval checks whether an expression is valid.
It captures an exception, and my code prints out the exception, without the code dying at that point. So far, so good.
But when a die;...
0
votes
0
answers
29
views
PHP - logic - if else / or die?
A simple question, I have this following code:
if ($this->someSecurityCheck()) {
// do stuff
} else {
// show alert message
redirect(‘index');
}
and for better legibility (the code is ...
3
votes
1
answer
635
views
How can I write a SIG{__DIE__} handler that does not trigger in eval blocks?
According to the perldoc -f die, which documents $SIG{__DIE__}
Although this feature was to be run only right before your program was to exit, this is not currently so: the $SIG{__DIE__} hook is ...
6
votes
1
answer
222
views
How do you catch a buggy sig die handler if the mechanism to debug code that everyone uses overrides it?
Let's say you use a cpan (or otherwise external) module, like our fictional one here Stupid::CPAN::Module::OfSatan
package Stupid::CPAN::Module::OfSatan {
BEGIN { $SIG{__DIE__} = sub { print STDERR &...
0
votes
1
answer
239
views
Finding mean and variance in R
Is what I did correct in making a code for this problem?
My goal is to find the mean and variance of the total score of the team when for any pair of gamers who throw the same number, the team scores ...
0
votes
2
answers
3k
views
PHP: Execution of code after "die" function in PHP/Laravel
I'm new to PHP and I want to start my laravel project that I copied from another source. I get a 500 error. If I try to debug the index.php in public folder I get an odd behaviour that die function ...
2
votes
2
answers
191
views
CORE::GLOBAL::die redefinition inside BEGIN
I have the following code
print "Starting..\n";
eval { die "Before die sub redefinition\n" };
#die "Before die sub redefinition\n";
BEGIN {
print "inside Begin ...
8
votes
1
answer
198
views
Perl die() call mysteriously not dying
I was able to get to this short code after doing some serious debugging at work with a very obscure bug in the project. A die call that was not dying.
The issue happens only when calling script.pl. If ...
0
votes
3
answers
296
views
Calculating the random sum and its probabilities for 1-6 dice
My error message is
File "/Users/CoconutTime/Downloads/sista_bomben.py", line 60, in probability_sums2
percentage_2 = (count[j] / freq)*100
IndexError: list index out of range
and I don't really ...
1
vote
2
answers
121
views
Calculating the different outcomes for 2 to 6 different dices
updated code
I know my programming is garbage but I'm very new to this. Sorry if it's an eyesore to look at.
I have to calculate the relative frequency for the sums of 2 dice up to 6 dices. So far I ...
0
votes
1
answer
161
views
Include new page.php and die the rest of content
Is there any way to include a new page by GET function and die the rest content of the present page.
This is what I tried
if($_GET['send'] == '1') echo include("info.php");
{die('info');}
This ...
2
votes
1
answer
172
views
Mojo $c->reply->exception vs die?
They seem to do the same thing.
$c->reply->exception('foo');
return;
vs
die "foo\n";
Should I chose one over the other?
1
vote
2
answers
179
views
Django server dies when try to connect /admin page
I'm trying to implement Restful API server using Django.
I added admin urls like followings, but whenever I connect to admin page, Django server silently dies with return code 245.
The last console ...
9
votes
2
answers
225
views
What's the raku analog of perl 5's carp?
By default, Raku's "die" reports the line number where the "die" is located, what if you'd like the line number of the calling context, ala "carp" with perl 5?
0
votes
1
answer
50
views
Change die to not stop code from executing
In the code below, the code would stop from executing further when Kiyoh would not be reachable. This is not good for production. So I was wondering what the best way would be to replace the die ...
3
votes
2
answers
230
views
Perl: `die` did not work upon opening a nonexistent gz file using gzip
The following script creates a gziped file named "input.gz". Then the script attempts to open "input.gz" using gzip -dc. Intuitively, die should be triggered if a wrong input file name is provided. ...
5
votes
2
answers
592
views
What is the easiest way to test error handling when writing to a file in Perl?
I have a bog standard Perl file writing code with (hopefully) adequate error handling, of the type:
open(my $fh, ">", "$filename") or die "Could not open file $filname for writing: $!\n";
# Some ...
0
votes
0
answers
57
views
PHP die() all files within a directory [duplicate]
So I am in the process of making an admin panel for a client and I have setup a PHP class which is called Login::isAdminLoggedIn. So the way that I have to use this at the moment is by going through ...
3
votes
5
answers
165
views
the condition in my while loop doesn't seem right?
trying to write a program that casts a die 3 times and once you get 3 6s in a row it prints out how many tries it took. having a problem at the end of the code, the diff between || and &&, ...
4
votes
2
answers
1k
views
How can I exit php upon error with a custom html message
I am wondering what is the best way I can exit a php script (if I encounter an error) where I also include all my html code too. Currenty my script is:
<?php
// Some other code here
// ...
0
votes
1
answer
682
views
How to let only a certain percentage of turtles die every 10 ticks?
After trying all somewhat applicable solutions here to no avail, I still would like to see if someone can help me with this.
I have a type of turtle (sexworkers) divided along a boolean variable [...
0
votes
0
answers
52
views
PHP - Should I add the die() function at the end of every php script? [duplicate]
I'm very new to PHP, from what I've read the die() function pretty much just exits the current script.
So my question is, is it necessary to include it at the end of every script? or is it needed ...
-1
votes
1
answer
12
views
How to Never Have Linewraps no Matter What in a Div with a Fixed Width and Overflow Set to Auto
I give up. Okay? I give up. I don't want to parade around with showing off code. I have spent three and a half months searching and experimenting CSS codes across the Internet. The only place left to ...
0
votes
1
answer
74
views
How to ask turtles which represent x% of Stock die?
I am new to Netlogo my cas is as follows :
I have 100 turtles , turtles have two variables height and width, from height I can calculate the stock. I know how to make asking x% of the turtles to die ...
0
votes
1
answer
402
views
PHP, Wordpress die(); problems
Having an odd problem.
I have a plugin that I'm using that is a login register page that uses die();
when it runs normally it just kills the page after login and redirects showing the user is now ...
1
vote
1
answer
1k
views
Is it good practice to die or exit in long scripts (PHP)
I've looked at different answers and except for this one that talks about die while testing and generating errors, I want to know if die() has a negative impact on my code when it is useless to ...
1
vote
2
answers
827
views
PHP die suddenly stops to show string
I am a noob with php. I have been using for more than 1 year a script in php to comunicate with an arduino.
Arduino sends data to my php script and it answers with text that arduino can read to know ...
0
votes
0
answers
532
views
PHP exit (or die) doesn't work properly
I'm trying to stop a php script using exit (or die). The problem is that after executing exit the page keeps loading and loading (and never finish) instead of stopping the script with the error ...
0
votes
1
answer
300
views
Java:Counting the times each number is rolled on a die
public class Die {
public static void main(String[] args) {
Random r = new Random();
int dieOne=0, dieTwo=0, dieThree=0, dieFour=0, dieFive=0, dieSix=0;
Scanner input = new ...
0
votes
0
answers
393
views
PHP - Using "or die()" in __construct()?
I am learning OOP and PHP.
I am trying to create a class for file uploads (from here on "File"). When I create an instance of File, I want to call a function that usually succeeds, but sometimes ...
1
vote
1
answer
2k
views
Laravel application show blank page without error and log
I updated the project but it turn out showing blank page for all frontend route, I roll back the changes but seems no luck.
The backend works:
http://unionmaterials.com.hk/admin
The frontend, ...
2
votes
1
answer
360
views
Overriding croak cluck confess carp from carp module in Perl
I know how to override in built functions in perl and I have overridden die warn say and since print and printf can't be overridden I have tied it to a handle for my logging framework.
Example of ...
3
votes
2
answers
8k
views
Exit Codes when using die in Perl
I have overridden die in perl for my logging framework, so that it can log messages and print it on console.
Overridden code for die:
BEGIN{ *CORE::GLOBAL::die = sub {
my ($package, $...
1
vote
1
answer
459
views
Database connection and die issue
if(DB::connection()->getDatabaseName()){
$data = User::get(['id','first_name','last_name']);
return View::make('index')->with('data',$data);
}
else{
$request->...
-2
votes
1
answer
51
views
Is it possible in PHP to exit an included file through something like die()? [closed]
My main PHP file includes several PHP files. At the beginning of one of them I'm testing a variable. If it passes the test then I want the whole script to run, otherwise I want to exit. Is it possible ...
0
votes
0
answers
36
views
PHP - Is danger to use mysqli connect without die() when connect error? [duplicate]
Is danger to use mysqli connect without die() when connect error and if so why?
3
votes
2
answers
546
views
How can a Perl subroutine report the line that called it?
I am writing a Perl pipeline, a script that calls various other programs and manages passing data from one to the other. The script (call it pipeline.pl) and the various sub-scripts it manages all ...
1
vote
2
answers
181
views
Die if Data Not Exisits in php mysql table [duplicate]
I'm getting an error message when the data is not available in data base table. I would like to stop the qry search without getting an error when the data is not available.
It works good if the data ...
1
vote
4
answers
628
views
Specific dice to reroll in C
I am working on a game of Yahtzee and one part of the game is the user can choose which dice out of 5 they wish to re-roll. I don't really know how to approach this besides writing a ton of if if-else ...