## Reduce ATM to the language of TM encodings concatenated by a string where the TM accepts both the string and its reverse

Prove that the language \$LM ={langle M,xranglemid M text{ accepts }xtext{ and rev}(x) }\$, where \$mathrm{rev}(x)\$ is the reverse of the string \$x\$, is undecidable with a reduction from \$A_{mathrm{TM}}\$. Note that the empty string belongs to \$LM\$.

All topic

## How can I reduce the size of the psd but also altering the size of the psb inside?

I’ve got some mockups of laptops to display my work. All of them are large files but I wanted to use it in thumbnails. The problems it’s when I change the psb to my work and then make the psd file into the size of the thumbnail the work is completely distorted. I know there will be some distortion but I have a feeling it would look better if the psb was the same size as the placeholder on the original psd.

All topic

## Why Naive Bayes can reduce number of parameters?

I read from a book that the naive Bayes classifier makes a conditional independence assumption that reduces the number of parameters from $$O(2^d)$$ to $$O(d)$$.

But I am super confused about this concept. Why making a conditional independence can reduce the needed number of parameters in estimating the posterior probability?

Can anyone give me an example?
Thanks!

All topic

## Would crushing an NPC’s body parts, as part of torture, reduce its hit points?

One argument was made that a crushed testicle doesn’t affect the NPC’s hit points because it wouldn’t compromise its ability to fight or flee. Another argument was made that damage is damage; it’s bludgeoning damage– the testicle was crushed underfoot– and the NPC should lose hit points, probably 1d4 as an “improvised weapon” attack.

The NPC was able to escape but took attack damage while fleeing, so the torture damage could tip the balance of whether it lived or died.

All topic

## Would crushing an NPC’s testicle, as part of torture, reduce its hit points?

One argument was made that a crushed testicle doesn’t affect the NPC’s hit points because it wouldn’t compromise its ability to fight or flee. Another argument was made that damage is damage; it’s bludgeoning damage– the testicle was crushed underfoot– and the NPC should lose hit points, probably 1d4 as an “improvised weapon” attack.

The NPC was able to escape but took attack damage while fleeing, so the torture damage could tip the balance of whether it lived or died.

All topic

## Do multiple Obvious Techniques reduce the AP of a spell multiple times?

In Barbarians of Lemuria, the Arcane Power [AP] cost of a spell can be reduced by adding requirements, such as a special item, line of sight, or obvious technique. On page 49 we have:

Obvious Technique: The caster must gesture, chant, dance or make strange sounds during the brief casting process.

Since there is an “or” in there, a spell could have an obvious technique of a gesture without a “magic word”, or a magic word with no gesture.

If the spell has a gesture and a magic word, are those two obvious techniques, or two parts of the same? If they are two obvious techniques, are you allowed two of the same requirement type to reduce spell AP?

By way of example:

Methyn Sarr knows that Krongar is in the palace, and will certainly want revenge on her. In the grand hall there is a huge chandelier secured by rope tied off to the wall. She will trick Krongar into stopping under the chandelier and use a spell she devised to untie the rope. This is ruled as more complicated than a cantrip, so is a spell of the first magnitude. When casting the spell, Methyn points her ring and index finger at the rope and says “Shazam!”

Does the spell cost Methyn 4 AP for obvious technique, or 3 for two obvious techniques (the hand gesture and the magic word)?

All topic

## How to reduce image size and resize image together for my coding ? [PHP]

How to reduce image size and resize image together for my coding ? [PHP]

When i use my code for only reduce image size, it’s work good.

Code for only reduce image size.

``````

``````

But when i want to reduce image size and resize image together like this code. It’s not reduce image size and not resize image too , how can i do for reduce image size and resize image together on my code ?

…………………………………………………………………………………………………………………………………………………………………

``````

\$height) {
\$r = (\$w / \$width);
\$newwidth = \$w;
\$newheight = ceil(\$height * \$r);
}

if (\$width < \$height) {
\$r = (\$h / \$height);
\$newheight = \$h;
\$newwidth = ceil(\$width * \$r);
}

if (\$width == \$height) {
\$newheight = \$h;
\$newwidth = \$w;
}

\$src = imagecreatefromjpeg(\$file);
\$tgt = imagecreatetruecolor(\$newwidth, \$newheight);
imagecopyresampled(\$tgt, \$src, 0, 0, 0, 0, \$newwidth, \$newheight, \$width, \$height);

return \$tgt;
}

\$new_image_name_rand_num = RAND(0,100);
\$new_image_name_rand_text = substr(str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ23456789'),0,7);

\$image_name_new = \$pet_ref_id."-".\$new_image_name_rand_num."-".\$new_image_name_rand_text;
\$temp = explode(".", \$_FILES['pet_image']['name']);
\$newfilename = \$image_name_new. '.' . end(\$temp);

{
\$compress_images = compressImage(\$source_image, \$image_destination);
}
}
?>

``````

All topic

## How to limit the impact of and reduce the risk of SQL injection for existing website?

Our website is 100% API based (with an SPA client). Recently, a hacker managed to get our admin’s password (hashed with SHA-256) through SQL injection (and cracking pwd) like this:

``````https://example.com/api/products?userId=3645&type=sqlinject here
``````

It is just an example, but it is deadly to us. Fortunately, it was a nice hacker and he just emailed us about the hack. Lucky for a website under constants attacks throughout it’s 5 years of existence.

Yes we DO know that we need to check user input everywhere and do properly format/escape/prepared statement before sending data to MySQL. We know, and we are fixing it. But we do not have enough developers/testers to make it 100% safe.

Now assuming we have 0.1% chance of being SQL injected somehow. How do we make it harder for hacker to find it and limit the damage as possible?

What we do so far as quick fixes/additional measurements:

1. At the output “gate” shared by all APIs, we no longer send the raw PDOException and message like before. But we still have to tell the client that exception occurred:

``````{type: exception, code: err643, message: 'contact support for err643'}
``````

I am aware that if hacker see exception, he will keep trying…

2. The user PHP uses to connect to MySQL can only CRUD to tables. Is that safe enough?

3. Rename all tables (we use open source so hacker can guess the tables name).

What else should we do?

Update : since there are many comments, I would like to give some side
info

1. First of all, this is LEGACY app, developed by some student-like folks, not enterprise grade. The dev team is nowhere to be found, now
only 1-2 hybrid dev-test guy handling hundreds of Data Access class.
2. The password is hash with SHA-256, yes it sucks. And we are changing it to recommended php way.
3. SQL injection is 17 years old. Why is it still around?
4. Are prepared statements 100% safe against SQL injection?

All topic

## Reduce size of bullet character in lists

Example for a list using `mdwlist`:

``````begin{itemize*}
item First
item Second
end{itemize*}
``````

The bullet symbol for the first level can be redefined with:

``````renewcommand{labelitemi}{\$bullet\$}
``````

It apparently uses a math environments symbol by default.
I would like to reduce the size of it, but font size modifiers like `tiny` seem to be invalid.

All topic

## How to reduce layers/sublayers/paths into one layer?

I had a single top-level layer called EAR. There were two vector paths which made it up.

Somehow, illustrator has transformed it from a normal, single top-level layer into a three-level layer structure. With two EAR layers, and then the paths separated into two layers on the third.

I have tried everything. I cannot drag the graphics onto the top-level. I cannot merge the layers. I cannot make the paths into a layer. Release to layers does nothing. It just duplicates another EAR layer. I can’t move any components of the layer anywhere, or do anything that would make sense.

I want the artwork how it originally was, in one single layer. I want to merge the paths, and get rid of the container layer holding the EAR layer.

I also would like to know how to configure Illustrator so that it never does this again, this automatic creation of hierarchies.

All topic