text:
Q: Can we easily find all the commands, tokens, whatevers defined by a package? This is the reverse question of How to find out where a macro is defined? (and Where do I find out how a command/environment is defined? and How to find a package name by a command name?) and is inspired by the fact that the resolution of Error with cleveref + enumerate + tikz-qtree turned out to be a name clash between two packages.
I can see the use of a script that would take a package (for some variant of TeX) and produce a list of all the stuff it defines, with the idea that comparing two of these would help in the hunt for namespace collisions.
First Question: Does such a script exist?
If the answer to that is "No", then it shouldn't be too hard to write such a script; the key is to figure out where things are defined.
Second Question: What are the main ways in which assignments are made?
(Note that this could easily be specific to flavour of TeX used.)  The word "main" is there because the purpose of such a script is not to be a necessary and sufficient test but a quick test to eliminate obvious possibilities.  In particular, a package author who does something like \let\mydef\def \mydef\something{else} is probably knowledgeable enough that they are aware of the potential for namespace collisions and know how to avoid them.  But \expandafter\def\csname s()mewe1rd c()mm@nd\endcsname should probably be allowed for.

A: I don't think such a script exists.
The closest thing I know of is (la)texdef which got recently published by me. It shows you the definition of (a) macro/s on the command line. The package(s) and class can be provided as option. If you suspect one macro name to be used by two packages it allows you to check if it is getting defined by both.
I'm planning to add some option to detect the source file of the definition using my package filehook as demonstrated by Leo Liu in his answer to How to find out where a macro is defined?.
It could also be extended or forked to produce the output you want. I wouldn't go down the route of parsing TeX code, but instead creating a TeX file by the script (as (la)texdef does) and redefine \def and friends to print the macro name. Something like:
\let\origdef\def
\origdef\def#1{%
  \message{DEF: #1^^J}%
  \origdef#1%
}
% Same for \edef, \gdef, \xdef and \let
\documentclass{$CLASS}
\usepackage{$PACKAGE}
\begin{document}
\end{document}

The output can be then formatted by the script, sorted and presented to the user. Adding an option which automatically compares the macros defined by two packages would also not be to complicated.

Another idea would be to use \tracingassigns and parse the output. It might be simpler and more precise.

Update 2011/04/03
I modified now the mentioned latexdef script to include options for listing the command sequences (macros) of the given packages. The (shortened) definition can be displayed alongside:
  --list, -l           : List user level command sequences of the given packages.
  --list-defs, -L      : List user level command sequences and their shorten definitions of the given packages.
  --list-all, -ll      : List all command sequences of the given packages.
  --list-defs-all, -LL : List all command sequences and their shorten definitions of the given packages.

So latexdef -p <package> -l will list all user level macros (which do not include @ or a space). I uploaded this as v1.3 to CTAN where it should be available shortly.

A: First question : I think No
Second Question : You give some examples but some macros can be defined by a package like xkeyval and the macro \define@cmdkey. There are other packages that work the same way as xkeyval. The method used is \csname ...\endcsnamebut the names of the macros are built with sometimes prefix and suffix; this is not easy to trace


text:
Q: Pillow won't open an image in the same directory. "FileNotFoundError: [Errno 2] No such file or directory:" The pillow library won't open an image in the same directory as the script anymore, while it used to. I haven't changed anything to do with how the file is loaded. I of course have the jpg in the folder with the script while I'm testing it.
I've tried the import to all three of these since I've read that works:
from PIL import Image

import PIL.Image

import PIL

None of these have worked and the output is
FileNotFoundError: [Errno 2] No such file or directory: 'pic.jpg'

The code loading the image is:
def main(new_width=300):

    try:
        image = PIL.Image.open("pic.jpg")
    except:
        print("Please rename the file to 'pic.jpg' and restart the script")
        quit()

A: Try using the absolute path to the image
from PIL import Image

try:
    image = Image.open("/path/to/pic.jpg")
except:
    print("Please rename the file to 'pic.jpg' and restart the script")
    quit()

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to see matched files in the pattern matching option of a Jest execution? When I execute tests with Jest, you have these options:

If I'm in a React app created with create-react-app, I run the test, I use the p options, and I digit the pattern, the list of matched files is shown:

Instead, when I run Jest in a custom app I created (adding Jest manually), the matched files are not shown:

How can I see the matched files in Jest like create-react-app does?
This is my current package.json's Jest section:
"jest": {
    "moduleDirectories": [
        "node_modules",
        "."
    ]
}

A: Add the jest-watch-typeahead package to the project, and then add this part to the package.json's Jest section:
"jest": {
    "watchPlugins": [
        "jest-watch-typeahead/filename",
        "jest-watch-typeahead/testname"
    ]
}

(This is exactly what create-react-app is doing, and you can see this by ejecting the project with yarn eject).
If you're using a jest.config.js file, the package.json configuration will be ignored. Forget the package.json and add this property to the main exported object of the jest.config.js file:
watchPlugins: [
    "jest-watch-typeahead/filename",
    "jest-watch-typeahead/testname"
]


text:
Q: mail.MailSpooler SpoolLockTimeoutException
An exception occurred when setting up mail server parameters. This
  exception was caused by:
  coldfusion.mail.MailSpooler$SpoolLockTimeoutException: A timeout
  occurred while waiting for the lock on the mail spool directory..

Recently i started to get this nasty exception in my mail.log file. Once this exception shows up, every mail that is sent from that coldfusion instance throws the same exception.
The only thing that seems to work is to restart the coldfusion server. After (usually) a day or two the same exception pops up again and we're back in the same situation.
I am aware of the hotfix to control the mailspool timeout but all it does is increase the timeout from 30 to 60 seconds. Since the mails are sent successfully until i get the exception, i don't think this is my solution.
Also i read the thread in the adobe forum where people have installed the hotfix, but still get the error.
I also tried a script to restart only the mailservice when this exception showed up, but this didn't work for me, as it didn't for others with this problem. This would also not be a concrete solution.

*

*The mails that i send arre simple html mails.

*The number of mails sent spreaded over a day is not more then 30.

*I've sent mails from
the exact same coldfusion server many times before, but with
<cfmail>. This is the first time i'm sending them in cfscript. I
don't know if this has anything to do with it, but it's only since
i'm using the cfscript equivalent of <cfmail> that i started to get
this exception.

All related blog posts that i could find are all unanswered but also pretty old. I thought that someone might have a solution by now.
Thanks.
(using coldfusion 9.0.1 server on windows 2008 server)

A: We were also experiencing this mail spool lock issue. After the issue occurred a fourth time in 2 months, we started reviewing these forums and found no solution.
This made me think that perhaps the solution and problem are not really CF at all, so I went into the server's virus protection and excluded the CF mail spool directory so that the virus protection does not touch the spool directory at all. So far, we have not had the problem again.
So I am not sure that this is the permanent fix, but it has worked so far for us. No outside entities create emails within our systems, so the directory should be relatively safe but not having email-outs work is not an option.

A: this chain from talkingtree might give some light:
http://www.talkingtree.com/blog/index.cfm?mode=entry&entry=67FD4A34-50DA-0559-A042BCA588B4C15B
what they are saying is that it could be an issue with disk activity taking to long. you can increase the mail spool timeout with the jvm argument: -Dcoldfusion.spooltimeout=120
oh.... one more thing. if you're using cfmail to email dumps when an error occurrs, make sure to add 'format="text"' to the cfdump tags. some of the emails can get pretty big and might be causing the error.


text:
Q: What is the difference between Event grid trigger and http trigger? I am having difficulty in understanding the difference in both triggers
What is the difference between EventGridTrigger and HTTP trigger?
I just saw there is an option to filter events in  EventGridTrigger
https://learn.microsoft.com/en-us/azure/event-grid/event-filtering
How we can filter events in the EventGridTrigger? Where should we add those filter options?

A: Event grid trigger is event-driven, it will be triggered when something you set happens. But Http trigger will be triggered when you send a request to hit it's endpoint.
For the filter of event grid trigger, you can go to this place:

(Click all service on Azure portal, click Event Grid Subscription, then find the Event Grid that you created, click in, you will find the Filters tab.)


text:
Q: select crazy when setData in Zend Form I have a problem with zend-form or Doctrine ORM, im not sure about it, the problem is i use zend-form and is ok but when i need to update has a problem, when i get old values end put in setData the select is crazy an set many option to selected. i will put a part of code make it and on picture for show the problem.
<?php

namespace Admin\Entity;

use Doctrine\ORM\Mapping as ORM;
use Zend\Hydrator;

/**
 * Categoria
 *
 * @ORM\Table(name="categoria", uniqueConstraints={@ORM\UniqueConstraint(name="id_UNIQUE", columns={"id"})}, indexes={@ORM\Index(name="fk_categoria_categoria1_idx", columns={"categoria_id"})})
 * @ORM\Entity
 * @ORM\Entity(repositoryClass="Admin\Repository\CategoriaRepository")
 */
class Categoria
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;
/**
 * @var string
 *
 * @ORM\Column(name="nome", type="string", length=60, nullable=false)
 */
private $nome;

/**
 * @var string
 *
 * @ORM\Column(name="slug", type="string", length=60, nullable=false)
 */
private $slug;

/**
 * @var Categoria|null
 *
 * @ORM\ManyToOne(targetEntity="Categoria", inversedBy="children")
 * @ORM\JoinColumns({
 *     @ORM\JoinColumn(name="categoria_id", referencedColumnName="id")
 *     })
 */
private $categoria;

/**
 * @var \Doctrine\Common\Collections\Collection
 *
 * @ORM\OneToMany(targetEntity="Categoria", mappedBy="categoria")
 */
private  $children;

/**
 * @var bool
 *
 * @ORM\Column(name="status", type="boolean", nullable=false)
 */
private $status;

/**
 * Categoria constructor.
 * @param array $options
 */
public function __construct(array  $options = [])
{
    (new Hydrator\ClassMethods())->hydrate($options,$this);
    $this->children = new \Doctrine\Common\Collections\ArrayCollection();
}

public function __toString(): string
{
    // TODO: Implement __toString() method.
    return $this->nome;
}

/**
 * @param array $cond
 * @param int $type
 * @return array
 */
public function toArray(array $cond = [], $type = 1)
{
    $arr = (new Hydrator\ClassMethods())->extract($this);

    if (sizeof($cond) > 0)
        if ($type == 1) {
            foreach ($arr as $k => $v) {
                if (!in_array($k, $cond))
                    unset($arr[$k]);
            }
        } else {
            foreach ($cond as $ust) {
                unset($arr[$ust]);
            }
        }

    return $arr;
}

/**
 * @return int
 */
public function getId(): int
{
    return $this->id;
}

/**
 * @param int $id
 * @return Categoria
 */
public function setId(int $id): Categoria
{
    $this->id = $id;
    return $this;
}

/**
 * @return string
 */
public function getNome(): string
{
    return $this->nome;
}

/**
 * @param string $nome
 * @return Categoria
 */
public function setNome(string $nome): Categoria
{
    $this->nome = $nome;
    return $this;
}

/**
 * @return string
 */
public function getSlug(): string
{
    return $this->slug;
}

/**
 * @param string $slug
 * @return Categoria
 */
public function setSlug(string $slug): Categoria
{
    $this->slug = $slug;
    return $this;
}

/**
 * @return Categoria
 */
public function getCategoria()
{
    return $this->categoria;
}

/**
 * @param Categoria $categoria
 * @return Categoria
 */
public function setCategoria($categoria)
{
    $this->categoria = $categoria;
    return $this;
}

/**
 * @return \Doctrine\Common\Collections\Collection
 */
public function getChildren():\Doctrine\Common\Collections\Collection
{
    return $this->children;
}

/**
 * @param Categoria $children
 * @return Categoria
 */
public function setChildren($children)
{
    $this->children = $children;
    return $this;
}

/**
 * @return bool
 */
public function isStatus(): bool
{
    return $this->status;
}

/**
 * @return bool
 */
public function getStatus(): bool
{
    return $this->status;
}

/**
 * @param bool $status
 * @return Categoria
 */
public function setStatus(bool $status): Categoria
{
    $this->status = $status;
    return $this;
}
}

an other part is
/**
 * @param array $option
 * @return \Zend\Http\Response|ViewModel
 */
public function updateAction(array $option = [], array $forceString = [])
{
    if(is_string($this->form))
        $form = new $this->form($this->em,null, $option);
    else
        $form = $this->form;

    $page = $this->params()->fromRoute('page');
    //$form = new $this->form(null, $option);
    $request = $this->getRequest();
    $repository =  $this->em->getRepository($this->entity);
    $id = (int)$this->params()->fromRoute('id', 0);

    if ($id) {
        try {
            $entity = $repository->find($id);
        } catch (\Exception $e) {
            return $this->redirect()->toRoute(
                $this->route, ['controller' => $this->controller]
            );
        }
        //$form->bind($entity);

        $form->setData($entity->toArray());
        $form->get('submit')->setValue('Editar');
    }
    if ($request->isPost()) {
       // AbstractValidator::setDefaultTranslator($this->sm->get('MvcTranslator'));
        $form->setData($request->getPost());

        if ($form->isValid()) {
            $res = $request->getPost()->toArray();
            if ($this->service->update($res, $id))
                $this->flashmessenger()->addSuccessMessage('Dados atualizados com sucesso!');
            else
                $this->flashmessenger()->addErrorMessage('Houve um erro ao tentar atualizar o seu registro!');

            if (!empty($this->module) && $this->module)
                return $this->redirect()->toRoute(
                    $this->route, ['controller' => $this->controller,'page'=>$page]
                );
            else
                return $this->redirect()->toRoute(
                    $this->route, ['controller' => $this->controller]
                );
        }
    }

    $view = new  ViewModel([
        'form' => $form,
        'id' => $id,
        'controller' => $this->controller,
        'action' => 'update',
    ]);

    $view->setTemplate($this->template);
    return $view;
}

This Image show the problem
frontend

  Categoria (<?= ($action == "insert" ? "Novo" : "Editar") ?>)

    <?php
    if ($id) {
        $acaoRedir = ['action' => $action, 'controller' => $controller, 'id' => $id];
    } else {
        $acaoRedir = ['action' => $action, 'controller' => $controller];
    }

    $form->setAttribute('action', $this->url('admin/default', $acaoRedir));
    $form->prepare();
    ?>
    <?= $this->form()->openTag($form); ?>

            <?php $nome = $form->get('nome'); ?>
            <?= $this->formLabel($nome); ?>
            <?= $this->formElement($nome); ?>
            <?= $this->formElementErrors($nome); ?>

        <?php $categoria = $form->get('categoria'); ?>
        <?= $this->formLabel($categoria); ?>

            <?= $this->formElement($categoria); ?>
            <?= $this->formElementErrors($categoria); ?>

            <?php $status = $form->get('status'); ?>
            <?= $this->formLabel($status); ?>

                <?= $this->formElement($status); ?>
                <?= $this->formElementErrors($status); ?>

        <?php $security = $form->get('security'); ?>
        <?php $submit = $form->get('submit'); ?>
        <?php $voltar = $form->get('voltar'); ?>
        <?= $this->formElement($security); ?>

        <?= $this->formHidden($form->get('id')); ?>
        <?= $this->formSubmit($submit); ?>
        <?= $this->formButton($voltar); ?>

    <?= $this->form()->closeTag($form); ?>

zedform
 <?php
/**
 * Created by PhpStorm.
 * User: WebMaster
 * Date: 13/08/2017
 * Time: 15:00
 */

namespace Admin\Form;

use Admin\Entity\Categoria;
use AppBase\Form\Form;
use Doctrine\ORM\EntityManager;
use Zend\Form\Element\Button;
use Zend\Form\Element\Select;
use Zend\Form\Element\Text;
use Zend\Form\Element\Hidden;
use Zend\Form\Element\Csrf;
use \Admin\Filter\CategoriaFilter;

class CategoriaForm extends Form
{
    public function __construct(EntityManager $em, $name = 'form-categoria', array $options = [])
    {
        parent::__construct($em, $name, $options);
        $this->setInputFilter(new CategoriaFilter());
        $this->setAttribute('method', 'post');

        $entityCategoria = $this->em->getRepository(Categoria::class);

        $arrCategorias = [
           0 => 'Categoria Principal'
        ];
        $arrCategorias+=$entityCategoria->findPairs();
        $parent = new Select('categoria');
        $parent->setLabel('Categoria parentesco');
        $parent->setAttributes([
            'id' => 'categoria',
            'class' => 'form-control js-select u-select--v3-select u-sibling w-100'
        ]);
        $parent->setAttribute('multiple', false);
        $parent->setValueOptions($arrCategorias);
        $this->add($parent);

        $id = new Hidden('id');
        $this->add($id);

        $nome = new Text('nome');
        $nome->setLabel('Nome');
        $nome->setAttributes([
            'id' => 'nome',
            'class' => 'form-control form-control-md g-brd-gray-light-v7 g-brd-gray-light-v3--focus g-rounded-4 g-px-14 g-py-10'
        ]);
        $this->add($nome);

        $status = new Select('status');
        $status->setLabel('Status');
        $status->setAttributes([
            'id' => 'status',
            'class' => 'form-control js-select u-select--v3-select u-sibling w-100',
            'options' => [
                '' => 'Selecione',
                1 => 'Ativo',
                0 => 'Inativo',
            ],
        ]);
        $this->add($status);

        $csrf = new  Csrf("security");
        $this->add($csrf);

        $this->add([
            'name' => 'submit',
            'type' => \Zend\Form\Element\Submit::class,
            'attributes' => [
                'value' => 'Salvar',
                'class' => 'btn btn-md u-btn-3d u-btn-primary g-mr-10 g-mb-15'
            ]
        ]);
        $voltar = new Button('voltar');
        $voltar->setLabel('voltar');
        $voltar->setAttributes([
            'value' => 'voltar',
            'class' => 'btn btn-danger btn-md u-btn-3d g-mr-10 g-mb-15',
            'onClick'=>'document.location.href=\'/admin/categoria\'',
        ]);
        $this->add($voltar);

    }
}


text:
Q: The exact value of an infinite sum $e^{-n^2}$ Good morning! I'm having trouble with this problem...
how can we find the exact value of
$$\sum_{n=0}^\infty e^{-n^2}.$$
Thank you in advance to anyone who can help.

A: Hint: This may helping you and assured that no closed form exist only it is a special case for $\theta$ and $\psi$ functions
The sum :$\displaystyle\sum_{n=0}^\infty e^{-n^2}$  is a particular case of  $\psi$ function at $\displaystyle x=\frac 1 \pi$ which is defined as :$\displaystyle\psi(x)=\sum_{n=0}^\infty e^{-n^2\pi x}.$ , For more information try to check  (Edwards 2001, p. 15)and satisfies  the functional equation :$\displaystyle\frac{1+2\psi(x)}{1+2\psi(x^{-1})}=\frac {1}{\sqrt{x}}$ , In your case you have :$\displaystyle \frac{1+2\psi(\pi)}{1+2\psi({\pi}^{-1})}=\sqrt{\pi}$ , and for more information about this you can see :(Jacobi 1828; Riemann 1859; Edwards 2001, p. 15)
.


text:
Q: Deploying VS2010 ASP.Net website on IIS 7.5 I know there are related posts here on this forum and another resources but I got stuck with this and couldn't proceed. Problem is I've done a website with VS2010 when I publish it to a FTP server and navigate to the url address I got an error.
Here are the things that I've done:

*

*I've enabled IIS services and static content

*I've revert to parent the staticFile under handler mappings

*I've registered the asp.net again in command prompt(the regiis.exe thing)

*In IIS manager i've added my website adress under sites, stopped default web site and started mine.

*I've added my site to classic.NET AppPool(integrated,and v4.0)

*I've enabled the default browsing..

*I've done all the advices that generally covered..

Here is my web.config:
<configuration>
    <system.webServer>
        <directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension" />
        <defaultDocument>
             <files>
                 <add value="AnaSayfa.aspx" />
             </files>
        </defaultDocument>
    </system.webServer>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
</configuration>

Where am I making a mistake?

A: The following post has some answers to this same question.
How do I fix 404.17 error on Win Server 2k8 and IIS7
Hope that helps.
EDIT: I see you've tried most of these...Sorry.


text:
Q: How can I change text color and font of the text produced by my Javascript?
This is code for a spinning wheel. When a person clicks the spinning wheel, it rotates and gives a result after a few seconds (depending on the script's time settings). How can an edit the color of the below text? So, when the wheel stops, the result text font color must be red on black background. Which part of the code has the reference to this?

(function($) {
  var venues = [{
    "name": "1900 Mexican Grill",
    "type": "Mexican"
  }, {
    "name": "300 East",
    "type": "American/Upscale"
  }, {
    "name": "Angry Ale's",
    "type": "American/Pub "
  }, {
    "name": "Azteca",
    "type": "Mexican"
  }, {
    "name": "Bedder Bedder and Moore",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Boading",
    "type": "Chinese"
  }, {
    "name": "Brazwell's Premium Pub",
    "type": "American/Pub "
  }, {
    "name": "Brio Tuscan Grille",
    "type": "Italian"
  }, {
    "name": "Brixx",
    "type": "Pizza/Salads"
  }, {
    "name": "Café at 6100",
    "type": "Home Cooking"
  }, {
    "name": "California Pizza Kitchen",
    "type": "Pizza/Salads"
  }, {
    "name": "Chick-Fil-A",
    "type": "Fast Food"
  }, {
    "name": "City Tavern",
    "type": "American/Upscale"
  }, {
    "name": "Copper",
    "type": "Indian"
  }, {
    "name": "Cowfish",
    "type": "Sushi"
  }, {
    "name": "Duckworth's",
    "type": "American/Pub "
  }, {
    "name": "Eddie's Place",
    "type": "American/Pub "
  }, {
    "name": "El Camino",
    "type": "Mexican"
  }, {
    "name": "Fairview Plaza Restaurant",
    "type": "Home Cooking"
  }, {
    "name": "Firebird's Wood Fired Grill",
    "type": "American/Upscale"
  }, {
    "name": "Firehouse Subs",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Flying Biscuit",
    "type": "American/Fast"
  }, {
    "name": "Fuel",
    "type": "Pizza"
  }, {
    "name": "Good Food on Montford",
    "type": "American/Upscale"
  }, {
    "name": "Harper's Restaurant",
    "type": "American/Upscale"
  }, {
    "name": "Hawthorne's Pizza",
    "type": "Pizza/Italian"
  }, {
    "name": "Luisa's Brick Oven Pizza",
    "type": "Pizza/Italian"
  }, {
    "name": "Maverick Rock Taco",
    "type": "Mexican"
  }, {
    "name": "McAllister's",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Mellow Mushroom",
    "type": "Pizza/Salads"
  }, {
    "name": "Moe's",
    "type": "Mexican"
  }, {
    "name": "Moosehead Grill",
    "type": "American/Pub "
  }, {
    "name": "Paco's Tacos and Tequila",
    "type": "Mexican"
  }, {
    "name": "Panera ",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "PF Chang's",
    "type": "Chinese"
  }, {
    "name": "Portofinos",
    "type": "Pizza/Italian"
  }, {
    "name": "Qdoba",
    "type": "Mexican"
  }, {
    "name": "Rooster's Wood Fire Kitchen",
    "type": "American/Upscale"
  }, {
    "name": "Rusty's Deli",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Taco Bell",
    "type": "Fast Food"
  }, {
    "name": "Taco Mac",
    "type": "American/Pub "
  }, {
    "name": "Terrace Café",
    "type": "American/Upscale"
  }, {
    "name": "The Roasting Company",
    "type": "American/Fast"
  }, {
    "name": "Village Tavern",
    "type": "American/Upscale"
  }, {
    "name": "Which Witch?",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Zack's Hamburgers",
    "type": "American/Fast"
  }];

  // Helpers
  var blackHex = '#333',
    whiteHex = '#fff',
    shuffle = function(o) {
      for (var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x)
      ;
      return o;
    },
    halfPI = Math.PI / 2,
    doublePI = Math.PI * 2;

  String.prototype.hashCode = function() {
    // See http://www.cse.yorku.ca/~oz/hash.html
    var hash = 5381,
      i;
    for (i = 0; i < this.length; i++) {
      char = this.charCodeAt(i);
      hash = ((hash << 5) + hash) + char;
      hash = hash & hash; // Convert to 32bit integer
    }
    return hash;
  };

  Number.prototype.mod = function(n) {
    return ((this % n) + n) % n;
  };

  // WHEEL!
  var wheel = {
    timerHandle: 0,
    timerDelay: 33,

    angleCurrent: 0,
    angleDelta: 0,

    size: 290,

    canvasContext: null,

    colors: ['#003366', '#FF6600', '#CCCC00', '#006600', '#3333CC', '#CC0066', '#FF3300', '#009900', '#6600CC', '#33CC33', '#0066CC', '#FF0066', '#3300FF', '#00CC00', '#FFCC00'],

    segments: [],

    seg_colors: [], // Cache of segments to colors

    maxSpeed: Math.PI / 16,

    upTime: 1000, // How long to spin up for (in ms)
    downTime: 5000, // How long to slow down for (in ms)

    spinStart: 0,

    frames: 0,

    centerX: 300,
    centerY: 300,

    spin: function() {
      // Start the wheel only if it's not already spinning
      if (wheel.timerHandle == 0) {
        wheel.spinStart = new Date().getTime();
        wheel.maxSpeed = Math.PI / (16 + Math.random()); // Randomly vary how hard the spin is
        wheel.frames = 0;
        wheel.sound.play();

        wheel.timerHandle = setInterval(wheel.onTimerTick, wheel.timerDelay);
      }
    },

    onTimerTick: function() {
      var duration = (new Date().getTime() - wheel.spinStart),
        progress = 0,
        finished = false;

      wheel.frames++;
      wheel.draw();

      if (duration < wheel.upTime) {
        progress = duration / wheel.upTime;
        wheel.angleDelta = wheel.maxSpeed *
          Math.sin(progress * halfPI);
      } else {
        progress = duration / wheel.downTime;
        wheel.angleDelta = wheel.maxSpeed *
          Math.sin(progress * halfPI + halfPI);
        if (progress >= 1) {
          finished = true;
        }
      }

      wheel.angleCurrent += wheel.angleDelta;
      while (wheel.angleCurrent >= doublePI) {
        // Keep the angle in a reasonable range
        wheel.angleCurrent -= doublePI;
      }
      if (finished) {
        clearInterval(wheel.timerHandle);
        wheel.timerHandle = 0;
        wheel.angleDelta = 0;

        if (console) {
          console.log((wheel.frames / duration * 1000) + " FPS");
        }
      }

      /*
      // Display RPM
      var rpm = (wheel.angleDelta * (1000 / wheel.timerDelay) * 60) / (Math.PI * 2);
      $("#counter").html( Math.round(rpm) + " RPM" );
       */
    },

    init: function(optionList) {
      try {
        wheel.initWheel();
        wheel.initAudio();
        wheel.initCanvas();
        wheel.draw();

        $.extend(wheel, optionList);

      } catch (exceptionData) {
        alert('Wheel is not loaded ' + exceptionData);
      }

    },

    initAudio: function() {
      var sound = document.createElement('audio');
      sound.setAttribute('src', 'wheel.mp3');
      wheel.sound = sound;
    },

    initCanvas: function() {
      var canvas = $('#canvas')[0];
      canvas.addEventListener("click", wheel.spin, false);
      wheel.canvasContext = canvas.getContext("2d");
    },

    initWheel: function() {
      shuffle(wheel.colors);
    },

    // Called when segments have changed
    update: function() {
      // Ensure we start mid way on a item
      //var r = Math.floor(Math.random() * wheel.segments.length);
      var r = 0,
        segments = wheel.segments,
        len = segments.length,
        colors = wheel.colors,
        colorLen = colors.length,
        seg_color = [], // Generate a color cache (so we have consistant coloring)
        i
      wheel.angleCurrent = ((r + 0.5) / wheel.segments.length) * doublePI;

      for (i = 0; i < len; i++) {
        seg_color.push(colors[segments[i].hashCode().mod(colorLen)]);
      }
      wheel.seg_color = seg_color;

      wheel.draw();
    },

    draw: function() {
      wheel.clear();
      wheel.drawWheel();
      wheel.drawNeedle();
    },

    clear: function() {
      wheel.canvasContext.clearRect(0, 0, 1000, 800);
    },

    drawNeedle: function() {
      var ctx = wheel.canvasContext,
        centerX = wheel.centerX,
        centerY = wheel.centerY,
        size = wheel.size,
        i,
        centerSize = centerX + size,
        len = wheel.segments.length,
        winner;

      ctx.lineWidth = 2;
      ctx.strokeStyle = blackHex;
      ctx.fillStyle = whiteHex;

      ctx.beginPath();

      ctx.moveTo(centerSize - 10, centerY);
      ctx.lineTo(centerSize + 10, centerY - 10);
      ctx.lineTo(centerSize + 10, centerY + 10);
      ctx.closePath();

      ctx.stroke();
      ctx.fill();

      // Which segment is being pointed to?
      i = len - Math.floor((wheel.angleCurrent / doublePI) * len) - 1;

      // Now draw the winning name
      ctx.textAlign = "left";
      ctx.textBaseline = "middle";
      ctx.fillStyle = blackHex;
      ctx.font = "2em Arial";
      winner = wheel.segments[i] || 'Choose at least 1 Venue';
      ctx.fillText(winner, centerSize + 20, centerY);
    },

    drawSegment: function(key, lastAngle, angle) {
      var ctx = wheel.canvasContext,
        centerX = wheel.centerX,
        centerY = wheel.centerY,
        size = wheel.size,
        colors = wheel.seg_color,
        value = wheel.segments[key];

      //ctx.save();
      ctx.beginPath();

      // Start in the centre
      ctx.moveTo(centerX, centerY);
      ctx.arc(centerX, centerY, size, lastAngle, angle, false); // Draw an arc around the edge
      ctx.lineTo(centerX, centerY); // Now draw a line back to the center

      // Clip anything that follows to this area
      //ctx.clip(); // It would be best to clip, but we can double performance without it
      ctx.closePath();

      ctx.fillStyle = colors[key];
      ctx.fill();
      ctx.stroke();

      // Now draw the text
      ctx.save(); // The save ensures this works on Android devices
      ctx.translate(centerX, centerY);
      ctx.rotate((lastAngle + angle) / 2);

      ctx.fillStyle = whiteHex;
      ctx.fillText(value.substr(0, 20), size - 15, 0);
      ctx.restore();
    },

    drawWheel: function() {
      var ctx = wheel.canvasContext,
        angleCurrent = wheel.angleCurrent,
        lastAngle = angleCurrent,
        len = wheel.segments.length,
        centerX = wheel.centerX,
        centerY = wheel.centerY,
        size = wheel.size,
        angle,
        i;

      ctx.lineWidth = 1;
      ctx.strokeStyle = blackHex;
      ctx.textBaseline = "middle";
      ctx.textAlign = "right";
      ctx.font = "1em Arial";

      for (i = 1; i <= len; i++) {
        angle = doublePI * (i / len) + angleCurrent;
        wheel.drawSegment(i - 1, lastAngle, angle);
        lastAngle = angle;
      }

      // Draw a center circle
      ctx.beginPath();
      ctx.arc(centerX, centerY, 20, 0, doublePI, false);
      ctx.closePath();

      ctx.fillStyle = whiteHex;
      //ctx.strokeStyle = blackHex;
      ctx.fill();
      ctx.stroke();

      // Draw outer circle
      ctx.beginPath();
      ctx.arc(centerX, centerY, size, 0, doublePI, false);
      ctx.closePath();

      ctx.lineWidth = 10;
      //ctx.strokeStyle = blackHex;
      ctx.stroke();
    }
  };
  $(function() {
    var $venues = $('#venues'),
      $venueName = $('#name'),
      $venueType = $('#types'),
      venueTypes = [],
      $list = $('
'),
      $types = $('
'),
      $filterToggler = $('#filterToggle'),
      arrayUnique = function(a) {
        return a.reduce(function(p, c) {
          if (p.indexOf(c) < 0) {
            p.push(c);
          }
          return p;
        }, []);
      };

    $.each(venues, function(index, venue) {
      $list.append(
        $("
")
        .append(
          $("<input />").attr({
            id: 'venue-' + index,
            name: venue.name,
            value: venue.name,
            type: 'checkbox',
            checked: true
          })
          .change(function() {
            var cbox = this,
              segments = wheel.segments,
              i = segments.indexOf(cbox.value);

            if (cbox.checked && i === -1) {
              segments.push(cbox.value);
            } else if (!cbox.checked && i !== -1) {
              segments.splice(i, 1);
            }

            segments.sort();
            wheel.update();
          })

        ).append(
          $('').attr({
            'for': 'venue-' + index
          })
          .text(venue.name)
        )
      );
      venueTypes.push(venue.type);
    });
    $.each(arrayUnique(venueTypes), function(index, venue) {
      $types.append(
        $("
")
        .append(
          $("<input />").attr({
            id: 'venue-type-' + index,
            name: venue,
            value: venue,
            type: 'checkbox',
            checked: true
          })
          .change(function() {
            var $this = $(this),
              i;
            for (i = 0; i < venues.length; i++) {
              if (venues[i].type === $this.val()) {
                $('[name="' + venues[i].name + '"]').prop("checked", $this.prop('checked')).trigger('change');
              }
            }
          })

        ).append(
          $('').attr({
            'for': 'venue-' + index
          })
          .text(venue)
        )
      )
    });

    $venueName.append($list);
    $venueType.append($types);
    // Uses the tinysort plugin, but our array is sorted for now.
    //$list.find('>li').tsort("input", {attr: "value"});

    wheel.init();

    $.each($venueName.find('ul input:checked'), function(key, cbox) {
      wheel.segments.push(cbox.value);
    });

    wheel.update();
    $venues.slideUp().data("open", false);
    $filterToggler.on("click", function() {
      if ($venues.data("open")) {
        $venues.slideUp().data("open", false);
      } else {
        $venues.slideDown().data("open", true);
      }
    });

    $('.checkAll').on("click", function() {
      $(this).parent().next('div').find('input').prop('checked', $(this).prop('checked')).trigger("change");
    });
  });
}(jQuery));
body {
  background: #fff;
  font-family: sans-serif;
  color: #666;
}

h1,
h2 {
  font-weight: 700;
  line-height: 2;
}

input[type='checkbox']+label {
  padding-left: .5em;
}

label,
#filterToggle {
  display: inline-block;
}

#venues,
#filterToggle {
  background: #fefefe;
  box-shadow: 0 1px 2px #efefef;
}

#venues {
  padding: .5em;
  overflow: hidden;
}

#venues ul,
#venues h2 {
  clear: both;
}

#venues li {
  float: left;
  width: 25%;
  line-height: 1.5;
  vertical-align: middle;
}

#filterToggle {
  border-radius: 0 0 3px 3px;
  cursor: pointer;
  margin-left: .5em;
  margin-top: -1px;
  padding: .5em;
}

Venues <input type="checkbox" class="checkAll" checked />

Types <input type="checkbox" class="checkAll" checked />

. . .

  <canvas id="canvas" width="1000" height="600"></canvas>

How can I change text color and font of the text?

A: I can help you with the font size and the color:
          // Now draw the winning name
          ctx.textAlign = "left";
          ctx.textBaseline = "middle";
          ctx.fillStyle = '#fff000'; // text color
          ctx.font = "5em Arial"; // font size and family

You have to edit this part.

(function($) {
  var venues = [{
    "name": "1900 Mexican Grill",
    "type": "Mexican"
  }, {
    "name": "300 East",
    "type": "American/Upscale"
  }, {
    "name": "Angry Ale's",
    "type": "American/Pub "
  }, {
    "name": "Azteca",
    "type": "Mexican"
  }, {
    "name": "Bedder Bedder and Moore",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Boading",
    "type": "Chinese"
  }, {
    "name": "Brazwell's Premium Pub",
    "type": "American/Pub "
  }, {
    "name": "Brio Tuscan Grille",
    "type": "Italian"
  }, {
    "name": "Brixx",
    "type": "Pizza/Salads"
  }, {
    "name": "Café at 6100",
    "type": "Home Cooking"
  }, {
    "name": "California Pizza Kitchen",
    "type": "Pizza/Salads"
  }, {
    "name": "Chick-Fil-A",
    "type": "Fast Food"
  }, {
    "name": "City Tavern",
    "type": "American/Upscale"
  }, {
    "name": "Copper",
    "type": "Indian"
  }, {
    "name": "Cowfish",
    "type": "Sushi"
  }, {
    "name": "Duckworth's",
    "type": "American/Pub "
  }, {
    "name": "Eddie's Place",
    "type": "American/Pub "
  }, {
    "name": "El Camino",
    "type": "Mexican"
  }, {
    "name": "Fairview Plaza Restaurant",
    "type": "Home Cooking"
  }, {
    "name": "Firebird's Wood Fired Grill",
    "type": "American/Upscale"
  }, {
    "name": "Firehouse Subs",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Flying Biscuit",
    "type": "American/Fast"
  }, {
    "name": "Fuel",
    "type": "Pizza"
  }, {
    "name": "Good Food on Montford",
    "type": "American/Upscale"
  }, {
    "name": "Harper's Restaurant",
    "type": "American/Upscale"
  }, {
    "name": "Hawthorne's Pizza",
    "type": "Pizza/Italian"
  }, {
    "name": "Luisa's Brick Oven Pizza",
    "type": "Pizza/Italian"
  }, {
    "name": "Maverick Rock Taco",
    "type": "Mexican"
  }, {
    "name": "McAllister's",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Mellow Mushroom",
    "type": "Pizza/Salads"
  }, {
    "name": "Moe's",
    "type": "Mexican"
  }, {
    "name": "Moosehead Grill",
    "type": "American/Pub "
  }, {
    "name": "Paco's Tacos and Tequila",
    "type": "Mexican"
  }, {
    "name": "Panera ",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "PF Chang's",
    "type": "Chinese"
  }, {
    "name": "Portofinos",
    "type": "Pizza/Italian"
  }, {
    "name": "Qdoba",
    "type": "Mexican"
  }, {
    "name": "Rooster's Wood Fire Kitchen",
    "type": "American/Upscale"
  }, {
    "name": "Rusty's Deli",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Taco Bell",
    "type": "Fast Food"
  }, {
    "name": "Taco Mac",
    "type": "American/Pub "
  }, {
    "name": "Terrace Café",
    "type": "American/Upscale"
  }, {
    "name": "The Roasting Company",
    "type": "American/Fast"
  }, {
    "name": "Village Tavern",
    "type": "American/Upscale"
  }, {
    "name": "Which Witch?",
    "type": "Sandwiches, Salads, Soups"
  }, {
    "name": "Zack's Hamburgers",
    "type": "American/Fast"
  }];

  // Helpers
  var blackHex = '#333',
    whiteHex = '#fff',
    shuffle = function(o) {
      for (var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x)
      ;
      return o;
    },
    halfPI = Math.PI / 2,
    doublePI = Math.PI * 2;

  String.prototype.hashCode = function() {
    // See http://www.cse.yorku.ca/~oz/hash.html
    var hash = 5381,
      i;
    for (i = 0; i < this.length; i++) {
      char = this.charCodeAt(i);
      hash = ((hash << 5) + hash) + char;
      hash = hash & hash; // Convert to 32bit integer
    }
    return hash;
  };

  Number.prototype.mod = function(n) {
    return ((this % n) + n) % n;
  };

  // WHEEL!
  var wheel = {
    timerHandle: 0,
    timerDelay: 33,

    angleCurrent: 0,
    angleDelta: 0,

    size: 290,

    canvasContext: null,

    colors: ['#003366', '#FF6600', '#CCCC00', '#006600', '#3333CC', '#CC0066', '#FF3300', '#009900', '#6600CC', '#33CC33', '#0066CC', '#FF0066', '#3300FF', '#00CC00', '#FFCC00'],

    segments: [],

    seg_colors: [], // Cache of segments to colors

    maxSpeed: Math.PI / 16,

    upTime: 1000, // How long to spin up for (in ms)
    downTime: 5000, // How long to slow down for (in ms)

    spinStart: 0,

    frames: 0,

    centerX: 300,
    centerY: 300,

    spin: function() {
      // Start the wheel only if it's not already spinning
      if (wheel.timerHandle == 0) {
        wheel.spinStart = new Date().getTime();
        wheel.maxSpeed = Math.PI / (16 + Math.random()); // Randomly vary how hard the spin is
        wheel.frames = 0;
        wheel.sound.play();

        wheel.timerHandle = setInterval(wheel.onTimerTick, wheel.timerDelay);
      }
    },

    onTimerTick: function() {
      var duration = (new Date().getTime() - wheel.spinStart),
        progress = 0,
        finished = false;

      wheel.frames++;
      wheel.draw();

      if (duration < wheel.upTime) {
        progress = duration / wheel.upTime;
        wheel.angleDelta = wheel.maxSpeed *
          Math.sin(progress * halfPI);
      } else {
        progress = duration / wheel.downTime;
        wheel.angleDelta = wheel.maxSpeed *
          Math.sin(progress * halfPI + halfPI);
        if (progress >= 1) {
          finished = true;
        }
      }

      wheel.angleCurrent += wheel.angleDelta;
      while (wheel.angleCurrent >= doublePI) {
        // Keep the angle in a reasonable range
        wheel.angleCurrent -= doublePI;
      }
      if (finished) {
        clearInterval(wheel.timerHandle);
        wheel.timerHandle = 0;
        wheel.angleDelta = 0;

        if (console) {
          console.log((wheel.frames / duration * 1000) + " FPS");
        }
      }

      /*
      // Display RPM
      var rpm = (wheel.angleDelta * (1000 / wheel.timerDelay) * 60) / (Math.PI * 2);
      $("#counter").html( Math.round(rpm) + " RPM" );
       */
    },

    init: function(optionList) {
      try {
        wheel.initWheel();
        wheel.initAudio();
        wheel.initCanvas();
        wheel.draw();

        $.extend(wheel, optionList);

      } catch (exceptionData) {
        alert('Wheel is not loaded ' + exceptionData);
      }

    },

    initAudio: function() {
      var sound = document.createElement('audio');
      sound.setAttribute('src', 'wheel.mp3');
      wheel.sound = sound;
    },

    initCanvas: function() {
      var canvas = $('#canvas')[0];
      canvas.addEventListener("click", wheel.spin, false);
      wheel.canvasContext = canvas.getContext("2d");
    },

    initWheel: function() {
      shuffle(wheel.colors);
    },

    // Called when segments have changed
    update: function() {
      // Ensure we start mid way on a item
      //var r = Math.floor(Math.random() * wheel.segments.length);
      var r = 0,
        segments = wheel.segments,
        len = segments.length,
        colors = wheel.colors,
        colorLen = colors.length,
        seg_color = [], // Generate a color cache (so we have consistant coloring)
        i
      wheel.angleCurrent = ((r + 0.5) / wheel.segments.length) * doublePI;

      for (i = 0; i < len; i++) {
        seg_color.push(colors[segments[i].hashCode().mod(colorLen)]);
      }
      wheel.seg_color = seg_color;

      wheel.draw();
    },

    draw: function() {
      wheel.clear();
      wheel.drawWheel();
      wheel.drawNeedle();
    },

    clear: function() {
      wheel.canvasContext.clearRect(0, 0, 1000, 800);
    },

    drawNeedle: function() {
      var ctx = wheel.canvasContext,
        centerX = wheel.centerX,
        centerY = wheel.centerY,
        size = wheel.size,
        i,
        centerSize = centerX + size,
        len = wheel.segments.length,
        winner;

      ctx.lineWidth = 2;
      ctx.strokeStyle = blackHex;
      ctx.fillStyle = whiteHex;

      ctx.beginPath();

      ctx.moveTo(centerSize - 10, centerY);
      ctx.lineTo(centerSize + 10, centerY - 10);
      ctx.lineTo(centerSize + 10, centerY + 10);
      ctx.closePath();

      ctx.stroke();
      ctx.fill();

      // Which segment is being pointed to?
      i = len - Math.floor((wheel.angleCurrent / doublePI) * len) - 1;

      // Now draw the winning name
      ctx.textAlign = "left";
      ctx.textBaseline = "middle";
      ctx.fillStyle = '#fff000'
      ctx.font = "5em Arial";
      winner = wheel.segments[i] || 'Choose at least 1 Venue';
      ctx.fillText(winner, centerSize + 20, centerY);
    },

    drawSegment: function(key, lastAngle, angle) {
      var ctx = wheel.canvasContext,
        centerX = wheel.centerX,
        centerY = wheel.centerY,
        size = wheel.size,
        colors = wheel.seg_color,
        value = wheel.segments[key];

      //ctx.save();
      ctx.beginPath();

      // Start in the centre
      ctx.moveTo(centerX, centerY);
      ctx.arc(centerX, centerY, size, lastAngle, angle, false); // Draw an arc around the edge
      ctx.lineTo(centerX, centerY); // Now draw a line back to the center

      // Clip anything that follows to this area
      //ctx.clip(); // It would be best to clip, but we can double performance without it
      ctx.closePath();

      ctx.fillStyle = colors[key];
      ctx.fill();
      ctx.stroke();

      // Now draw the text
      ctx.save(); // The save ensures this works on Android devices
      ctx.translate(centerX, centerY);
      ctx.rotate((lastAngle + angle) / 2);

      ctx.fillStyle = whiteHex;
      ctx.fillText(value.substr(0, 20), size - 15, 0);
      ctx.restore();
    },

    drawWheel: function() {
      var ctx = wheel.canvasContext,
        angleCurrent = wheel.angleCurrent,
        lastAngle = angleCurrent,
        len = wheel.segments.length,
        centerX = wheel.centerX,
        centerY = wheel.centerY,
        size = wheel.size,
        angle,
        i;

      ctx.lineWidth = 1;
      ctx.strokeStyle = blackHex;
      ctx.textBaseline = "middle";
      ctx.textAlign = "right";
      ctx.font = "1em Arial";

      for (i = 1; i <= len; i++) {
        angle = doublePI * (i / len) + angleCurrent;
        wheel.drawSegment(i - 1, lastAngle, angle);
        lastAngle = angle;
      }

      // Draw a center circle
      ctx.beginPath();
      ctx.arc(centerX, centerY, 20, 0, doublePI, false);
      ctx.closePath();

      ctx.fillStyle = whiteHex;
      //ctx.strokeStyle = blackHex;
      ctx.fill();
      ctx.stroke();

      // Draw outer circle
      ctx.beginPath();
      ctx.arc(centerX, centerY, size, 0, doublePI, false);
      ctx.closePath();

      ctx.lineWidth = 10;
      //ctx.strokeStyle = blackHex;
      ctx.stroke();
    }
  };
  $(function() {
    var $venues = $('#venues'),
      $venueName = $('#name'),
      $venueType = $('#types'),
      venueTypes = [],
      $list = $('
'),
      $types = $('
'),
      $filterToggler = $('#filterToggle'),
      arrayUnique = function(a) {
        return a.reduce(function(p, c) {
          if (p.indexOf(c) < 0) {
            p.push(c);
          }
          return p;
        }, []);
      };

    $.each(venues, function(index, venue) {
      $list.append(
        $("
")
        .append(
          $("<input />").attr({
            id: 'venue-' + index,
            name: venue.name,
            value: venue.name,
            type: 'checkbox',
            checked: true
          })
          .change(function() {
            var cbox = this,
              segments = wheel.segments,
              i = segments.indexOf(cbox.value);

            if (cbox.checked && i === -1) {
              segments.push(cbox.value);
            } else if (!cbox.checked && i !== -1) {
              segments.splice(i, 1);
            }

            segments.sort();
            wheel.update();
          })

        ).append(
          $('').attr({
            'for': 'venue-' + index
          })
          .text(venue.name)
        )
      );
      venueTypes.push(venue.type);
    });
    $.each(arrayUnique(venueTypes), function(index, venue) {
      $types.append(
        $("
")
        .append(
          $("<input />").attr({
            id: 'venue-type-' + index,
            name: venue,
            value: venue,
            type: 'checkbox',
            checked: true
          })
          .change(function() {
            var $this = $(this),
              i;
            for (i = 0; i < venues.length; i++) {
              if (venues[i].type === $this.val()) {
                $('[name="' + venues[i].name + '"]').prop("checked", $this.prop('checked')).trigger('change');
              }
            }
          })

        ).append(
          $('').attr({
            'for': 'venue-' + index
          })
          .text(venue)
        )
      )
    });

    $venueName.append($list);
    $venueType.append($types);
    // Uses the tinysort plugin, but our array is sorted for now.
    //$list.find('>li').tsort("input", {attr: "value"});

    wheel.init();

    $.each($venueName.find('ul input:checked'), function(key, cbox) {
      wheel.segments.push(cbox.value);
    });

    wheel.update();
    $venues.slideUp().data("open", false);
    $filterToggler.on("click", function() {
      if ($venues.data("open")) {
        $venues.slideUp().data("open", false);
      } else {
        $venues.slideDown().data("open", true);
      }
    });

    $('.checkAll').on("click", function() {
      $(this).parent().next('div').find('input').prop('checked', $(this).prop('checked')).trigger("change");
    });
  });
}(jQuery));
body {
  background: #fff;
  font-family: sans-serif;
  color: #666;
}

h1,
h2 {
  font-weight: 700;
  line-height: 2;
}

input[type='checkbox']+label {
  padding-left: .5em;
}

label,
#filterToggle {
  display: inline-block;
}

#venues,
#filterToggle {
  background: #fefefe;
  box-shadow: 0 1px 2px #efefef;
}

#venues {
  padding: .5em;
  overflow: hidden;
}

#venues ul,
#venues h2 {
  clear: both;
}

#venues li {
  float: left;
  width: 25%;
  line-height: 1.5;
  vertical-align: middle;
}

#filterToggle {
  border-radius: 0 0 3px 3px;
  cursor: pointer;
  margin-left: .5em;
  margin-top: -1px;
  padding: .5em;
}

Venues <input type="checkbox" class="checkAll" checked />

Types <input type="checkbox" class="checkAll" checked />

. . .

  <canvas id="canvas" width="1000" height="600"></canvas>


text:
Q: On the 'wrong proof' of the chain rule I am looking through an old analysis course that I had and I was pondering a bit about the proof of chain rule (especially the notorious wrong proof that you can give). I'd be happy if someone was willing to verify my reasoning below. I end with an actual question.
Let's start with the following nice result.

Let $f\colon \mathbb{R}\to \mathbb{R}$ be a continuous function which is differentiable on $\mathbb{R}_0$. Assume that $\lim_{x\to 0}f'(x)=L\in \mathbb{R}$. Then $f$ is differentiable in $0$.

Proof: For each $h\neq 0$, the mean value theorem yields a $c_h\in \mathbb{R}$ strictly between $h$ and $0$ such that $f'(c_h)=\frac{f(h)-f(0)}{h}$. Letting $h\to 0$, is it is obvious that $c_h\to 0$ as each $|c_h|<|h|$. Hence $$\lim_{h\to 0}\frac{f(h)-f(0)}{h}=\lim_{h\to 0}f'(c_h)=L.$$ $\square$
Great, let's apply this to the following function: $$\phi\colon \mathbb{R}\to \mathbb{R}:x\mapsto \begin{cases}x^3\sin(\frac{1}{x}) & \mbox{ if }x\neq 0,\\0 & \mbox{ if } x=0.\end{cases}$$
Clearly $\phi$ is differentiable on $\mathbb{R}_0$ and $$\phi'(x)=3x^2\sin(\frac{1}{x})-x^3\cos(\frac{1}{x})\frac{1}{x^2}=3x^2\sin(\frac{1}{x})-x\cos(\frac{1}{x})$$ for all $x\neq 0$.
It is straightforward to see that $\lim_{x\to 0}\phi'(x)=0$ and thus the above result yields that $\phi'(0)=0$ (in particular $\phi$ is differentiable on the whole of $\mathbb{R}$).
Now at this point, recall the chain rule.

Let $f,g\colon \mathbb{R}\to \mathbb{R}$ be functions. If $a\in\mathbb{R}$ such that $f'(a)$ and $g'(f(a))$ both exist, then $(g\circ f)'(a)=g'(f(a))f'(a)$.

The obvious argument to try is the following 'wrong proof':
\begin{eqnarray}
\lim_{x\to a}\frac{g\circ f(x)-g\circ f(a)}{x-a} &=& \lim_{x\to a}\frac{g\circ f(x)-g\circ f(a)}{f(x)-f(a)}\cdot \frac{f(x)-f(a)}{x-a}\\
&=& \lim_{x\to a}\frac{g\circ f(x)-g\circ f(a)}{f(x)-f(a)}\cdot \lim_{x\to a}\frac{f(x)-f(a)}{x-a}\\
&=& g'(f(a))f'(a).
\end{eqnarray}
Here we used that $f$ is continuous in $a$ to see that $f(x)\to f(a)$ as $x\to a$. $\triangle$
However, there is an obvious error in the above reasoning. If for example $f$ is a constant function $f(x)=f(a)$ for all $x\in \mathbb{R}$, then $\lim_{x\to a}\frac{g\circ f(x)-g\circ f(a)}{f(x)-f(a)}=\lim_{x\to a}\frac{g\circ f(x)-g\circ f(a)}{0}$ is nonsensical!
Having said that, it is also clear that the above proof does work for functions such that $\exists \delta>0:\forall x\in (a-\delta,a+\delta)\setminus \{a\}:f(x)\neq f(a)$. In that case, $f(x)$ does not equal $f(a)$ for $x$ near $a$ (and $x\neq a$). So the above proof only fails for a particular type of function, the easiest of which are constant functions. However, for a constant function $f$, one can calculate $(g\circ f')(a)$ directly and show that it's $0$.
A natural question at this point is to wonder whether there exists a nonconstant function $f$ such that $f$ is differentiable in $a$ and $f(x)=f(a)$ infinitely often for $x$ near $a$. The answer is yes and the function $\phi$ given in the example above (with $a=0$) satisfies these properties. (Also, the wikipedia page of the chain rule gives the function $f(x)=x^2\sin(\frac{1}{x})$ for $x\neq 0$ and $f(0)=0$ as an example, but this function is not differentiable in $0$. As far as I can tell, this is a worse example than just a constant function to pinpoint the failure of the 'wrong proof'. Perhaps this should be changed?)
In general let $f$ be such a function (thus $\forall \delta>0:\exists x\neq a: |x-a|<\delta$ and $f(x)=f(a)$). If $\lim_{x\to a}\frac{g\circ f(x)-g\circ f(a)}{x-a}$ exists, then we can compute this limit by choosing an appropriate sequence $x_n\to a$. For each $n\geq 1$, there exists an $x_n\neq a$ such that $|x_n-a|<\frac{1}{n}$ and $f(x_n)=f(a)$. It follows that
\begin{eqnarray}
\lim_{x\to a}\frac{g\circ f(x)-g\circ f(a)}{x-a}&=&\lim_{n\to \infty}\frac{g\circ f(x_n)-g\circ f(a)}{x_n-a}\\
&=& \lim_{n\to \infty}\frac{g\circ f(a)-g\circ f(a)}{x-a}\\
&=& 0.
\end{eqnarray}
This shows that if $f$ is a function for which the 'wrong proof' of the chain rule fails, then $(g\circ f)'(a)=0$. Off course, I was only able to show this under the assumption that $(g\circ f)'(a)$ actually exists (which off course is true as one can actually prove the chain rule). Nonetheless, this begs the question whether there is a more direct way of showing that $(g\circ f)'(a)$ actually exists (and equals zero) if $f$ is a function for which the 'wrong proof' fails. If so, one can actually fix this 'wrong proof' by considering two cases.

A: Actually, the "wrong proof" is not so bad, as the problem can only happen when $f'(a)=0$ . To fix the problem, it suffices to handle two cases: the case $f'(a)\neq 0$ (for which the "wrong proof" goes through) and the exceptional case $f'(a)=0.$ For completeness, one states the Chain Rule again.
Proposition. Let $f,g:{\mathbb R}\rightarrow {\mathbb R}$ be functions. If $a\in {\mathbb R}$ such that $f'(a)$ and $g'(f(a))$ both exist, then $$(g\circ f)'(a)=g'(f(a))f'(a).$$
Case 1. $f'(a)\neq 0.$
In this case, there exists $\delta>0$ such that $$f(x)-f(a)\neq 0$$ if $0<|x-a|<\delta.$ To see this, let $0<\epsilon<\frac{|f'(a)|}2$ be given. Then there exists $\delta>0$ such that $$0<|x-a|<\delta\Rightarrow \left|\frac{f(x)-f(a)}{x-a}-f'(a)\right|<\epsilon$$ $$\Rightarrow \left|\frac{f(x)-f(a)}{x-a}\right|>|f'(a)|-\epsilon>\frac{|f'(a)|}2>0$$ $$\Rightarrow |f(x)-f(a)|\neq 0,$$ as required. This means that as $x\rightarrow a$, the "wrong proof" works.
Case 2. $f'(a)=0.$
In this case, one needs to prove that $(g\circ f)'(a)=0.$ One considers two possibilities:
$$\frac{(g\circ f)(x)-(g\circ f)(a)}{x-a}=\left\{\begin{array}{cc}0&{\rm if~}f(x)=f(a)\\
\frac{g(f(x))-g(f(a))}{f(x)-f(a)}\cdot \frac{f(x)-f(a)}{x-a}&{\rm if~}f(x)\neq f(a).\end{array}  \right.$$ It suffices to show that for every $\epsilon>0$, there exists $\delta>0$ such that $$0<|x-a|<\delta\Rightarrow  \left|\frac{(g\circ f)(x)-(g\circ f(a)}{x-a}\right|<\epsilon.\qquad (1)$$ It is clear that when $x\rightarrow a$ and $x\neq a$, if $f(x)=f(a)$, the right hand side of (1) gives $0<\epsilon$, which trivially holds. So for the given $\epsilon>0$, one just needs to find $\delta>0$ to address the second possibility: $f(x)\neq f(a)$. Namely, one needs to show in this case that $$\left|\frac{(g\circ f)(x)-(g\circ f)(a)}{x-a}\right|=\left|\frac{g(f(x))-g(f(a))}{f(x)-f(a)}\right|\cdot \left|\frac{f(x)-f(a)}{x-a}\right|<\epsilon.\qquad (2)$$ This is more or less straightforward, but one spells out the details below.
Since $g'(f(a))$ exists (hence bounded), there exists $\epsilon_1>0$ and $M>0$ such that $$0<|f(x)-f(a)|<\epsilon_1\Rightarrow \left|\frac{g(f(x))-g(f(a))}{f(x)-f(a)}\right|\leq M.$$
Since $f'(a)=0,$ there exists $\delta_1>0$ such that $$0<|x-a|<\delta_1\Rightarrow \left|\frac{f(x)-f(a)}{x-a}\right|<\frac{\epsilon}M.$$
Since $f$ is continuous at $a,$ there exists $\delta_2$ such that $$|x-a|<\delta_2\Rightarrow |f(x)-f(a)|<\epsilon_1.$$
Now let $\delta:=\min(\delta_1,\delta_2).$ Then one sees that $$0<|x-a|<\delta\Rightarrow \left|\frac{g(f(x))-g(f(a))}{f(x)-f(a)}\right|\cdot \left|\frac{f(x)-f(a)}{x-a}\right|<M\cdot \frac{\epsilon}M=\epsilon,$$ provided that  $f(x)-f(a)\neq 0,$ as required by (2). QED


text:
Q: How to convert the number of month in the name abbreviation in Jasper Report? I have a XY Line Chart in JasperReports and I´m using a range in my Chart for display the Months, currently i´m using this configuration and show the values from 1 to 12 in X Line:
Image of currently chart
<?xml version="1.0" encoding="UTF-8"?>
<property name="net.sf.jasperreports.customizer.class.1" value="net.sf.jasperreports.customizers.axis.DomainAxisCustomizer"/>
                    <property name="net.sf.jasperreports.customizer.1.tickUnit" value="1.0"/>
                    <propertyExpression name="net.sf.jasperreports.customizer.1.minValue"><![CDATA["1"]]></propertyExpression>
                    <propertyExpression name="net.sf.jasperreports.customizer.1.maxValue"><![CDATA["12"]]></propertyExpression>

but I need show the abbreviation of the months, like this:
1 - JAN,
2 - FEB,
3 - MAR,
...
Is there a better way to do this?

A: You can implement your own domain axis customizer like this:
public class DomainAxisWithMonthsCustomizer extends JRAbstractChartCustomizer {
    @Override
    public void customize(JFreeChart chart, JRChart jasperChart) {
        XYPlot plot = chart.getXYPlot();
        String[] shortMonths = new DateFormatSymbols().getShortMonths();
        SymbolAxis domainAxis = new SymbolAxis("Month",
                IntStream.rangeClosed(1, 12)
                        .mapToObj(m -> m + " - " + shortMonths[m - 1].toUpperCase())
                        .toArray(String[]::new));
        plot.setDomainAxis(domainAxis);
    }
}

And use it in your report template:
<chart customizerClass="my.project.report.DomainAxisWithMonthsCustomizer">
...
</chart>


text:
Q: Windows 10 on MacbookPro2,2 drivers missing I have installed 64-bit windows 10 on to a Macbook Pro 2,2 However there is now no sound.
I am slightly lost as there graphics card is showing as the Microsoft Basic one.
How can I install the drivers needed to make windows work with the Mac Hardware?
I am not using bootcamp. I wiped the OSX partition and installed Windows 10

A: You will get all your Windows drivers at boot camp site from Apple here: https://www.apple.com/support/bootcamp/downloads/
It's quite a big package for every model.
Note that not all Apple device support Win10.
In case of my MBA it was 2011 or 2012+


text:
Q: Why does LD keep outputting "no version information available" On every loading of a lib, I get the error:

no version information available

This lib has been compiled on another PC (ubuntu 10.04) than the one running it (mandriva 2010.2).
$ ldd /usr/local/gnu-eabi-4.5.2/i686-pc-linux-gnu/arm-eabi/lib/libbfd-2.21.so
/usr/local/gnu-eabi-4.5.2/i686-pc-linux-gnu/arm-eabi/lib/libbfd-2.21.so: /lib/libz.so.1: no version information available (required by /usr/local/gnu-eabi-4.5.2/i686-pc-linux-gnu/arm-eabi/lib/libbfd-2.21.so)
 linux-gate.so.1 =>  (0xffffe000)
 libz.so.1 => /lib/libz.so.1 (0xb77a7000)
 libc.so.6 => /lib/i686/libc.so.6 (0xb7655000)
 /lib/ld-linux.so.2 (0xb787a000)

Edit: the workaround didn't work.

A: That error, "no version information available", means that the version of libz that you linked against when you compiled the library is newer than the version on the mandrivia system you're using.

A: No, it doesn't.  It appears to mean that the version of libz you linked against when you compiled your program was built with different tools than the version on the madriva system you're using.  The mandriva copy is missing symbol version info which was present in the copy of the libz library your program originally linked against.  This has to do with differences int he respective build environments, not with versions of the libz library itself.
I suspect you'll continue to get the message until you supply a copy of libz that was built with the same toolset as your binary, i.e., a toolset that inserts symbol versions into the library.  Or build your binary with tools similar to those used when libz was compiled on your mandriva system, so no symbol version references are present in the binary.
See:
http://harmful.cat-v.org/software/dynamic-linking/versioned-symbols
http://www.linux-kongress.org/1997/youngdale.html
http://www.usenix.org/publications/library/proceedings/als00/2000papers/papers/full_papers/browndavid/browndavid_html/
I don't know of any tool that would let you modify the binary compiled on the other system to delete the symbol version references you don't want, and leave all others, if any.


text:
Q: Is it possible to separate nested populate calls in different methods? Suppose I have the following schemas:
const QuestionSchema = new mongoose.Schema({
    number: String,
    question: { type: String, required: true },
    submitter: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
});

const QuizSchema = new mongoose.Schema({
    name: { type: String, required: true },
    questions: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Question' }]
});

For a particular quiz, I know that if I want to populate the questions, including their submitters, I would do this:
quiz.populate({
    path: 'questions',
    model: mongoose.model('Question'),
    options: {
        sort: { number: 1 }
    },
    populate: {
        path: 'questions.submitter',
        model: mongoose.model('User')
    }
}).exec(cb)

Now is it possible to separate the populate calls within different methods?
For example, I want to do something like
QuizSchema.methods.withQuestions = function () {
    return this.populate({
        path: 'questions',
        model: this.model('Question'),
        options: {
            sort: { number: 1 }
        }
    });
};

QuizSchema.methods.withSubmitter = function () {
    return this.populate({
        path: 'questions.submitter',
        model: this.model('User')
    });
};

in order to do
quiz.withQuestions().withSubmitter().execPopulate().then(cb)

Unfortunately, when I try doing it this way, submitter does not get populated.


text:
Q: Show that limit of integrals is zero Let $\mu$ be a Borel probability measure on $(0,+\infty)$ and $\alpha > 1$. Is it true that
$$
   \lim\limits_{y \to +0}  y^{\alpha-1} \int\limits_0^\infty x^2 e^{-y^{\alpha} x} \, d\mu(x) = 0\ ?
$$
If measure $\mu$ is concentrated in finite number of points or have a compact support it is true. But is it possible to say that it is true in general or there is a counterexample?

A: If you choose $c>1$ and set
$$
d\mu(x) = \begin{cases}
\frac{c-1}{x^c}\,dx, &\text{if } x>1, \\\
0, &\text{if } x\le1,
\end{cases}
$$
then I believe the limit equals $+\infty$ for all $a>1$ and $c>1$.

A: This is not always true: if $\mathrm d\mu(x)=x^{-2}\mathbf 1_{x\geqslant1}\mathrm dx$, the LHS is $y^{-1}\mathrm e^{-y^\alpha}\to+\infty$ when $y\to0^+$.
To get a positive result, note that $y^{\alpha-1}x^{1-1/\alpha}\mathrm e^{-y^\alpha x}\leqslant c_\alpha$ uniformly on every nonnegative $x$ and $y$, for some finite $c_\alpha$. Hence the LHS is at most $c_\alpha\mathbb E(X^{1+1/\alpha})$, where the distribution of $X$ is $\mu$. Thus, if $\mathbb E(X^{1+1/\alpha})$ is finite, the limit of the LHS when $y\to0^+$ is zero. In fact, studying the case of the measures $\mathrm d\mu(x)=\beta x^{-\beta-1}\mathbf 1_{x\geqslant1}\mathrm dx$ with $\beta$ positive, one can guess that, if $\mathbb E(X^{\beta})$ is infinite for some $\beta\lt1+1/\alpha$, the limit of the LHS when $y\to0^+$ is not zero (our first counterexample being the case $\beta=1$).


text:
Q: Older versions of Xcode Command Line Tools on macOS Catalina I have a project that requires the Command Line Tools from macOS
High Sierra. The specific installer I'm running is Command Line Tools (macOS High Sierra version 10.13).pkg.
When I run it, I get:

"This package is incompatible with this version of macOS. The package is trying to install content to the system volume. Contact the software manufacturer for assistance."

I haven't contacted Apple about this yet. My queries are:

*

*Should I just install this on a different drive?

*Is there a way to get this to install to my main internal SSD?

*Once installed, what's the easiest way to switch between the old Command Line Tools and new Command Line Tools when I need to?

A: The command-line tool installer installs lots of stuff (libraries, frameworks, etc.) in multiple OS system directories.  So you probably need to find or create a volume (external drive or partition) with OS X High Sierra on it for the install to complete.
I usually partition my SSDs so that I can keep multiple bootable macOS versions on it for running such older tooling and apps.

A: I can answer the first and third part.

*

*Yes!

From man installer:

A device parameter for the target is any one of the following:
 1) Any of the values returned by -dominfo
 2) The device node entry.  Any entry of the form of /dev/disk*.  ex:
 /dev/disk2
 3) The disk identifier.  Any entry of the form of disk*.  ex: disk1s9
 4) The volume mount point.  Any entry of the form of /Volumes/Mountpoint.
 ex: /Volumes/Untitled
 5) The volume UUID.  ex: 376C4046-083E-334F-AF08-62FAFBC4E352

installer -verbose -pkg "Command Line Tools ().mkpg" -target <target>

https://apple.stackexchange.com/a/107314/313842

*

*
what's the easiest way to switch

xcode-select switch path/to/commandLineTools


text:
Q: What is a reified column and how to get all value from it? There are some objects (like FieldDefinition or AppTabMember) that when you want to uses SOSL SELECT all data from them, it fails with "a filter on a reified column is required". I have a lot of questions about these objects, especially:

*

*Is there a way to extract all the values from these kind of objects?

*Can a custom object be created with reified columns? (Are those columns declared as external reference IDs or something else?)


text:
Q: Keyboard shortcut keys with no scancode? I have a Microsoft Wireless Keyboard 2000, model #1477, running on Ubuntu 16.04 32-bit with a strange issue. It has a row of shortcut keys along the top (one of the reasons I chose it), but only half of them work.
I thought the nonfunctional keys weren't assigned and just needed to be mapped, but going through the keys using showkey --scancodes doesn't provide any response. Does this mean the keys aren't sending any signal at all to the system? That seems extremely weird to me. There is a driver for the keyboard, but I wanted to find out if there was a native way to get these keys working before I started trying to wrestle a Microsoft driver into cooperating.
Here are the keys by label and the scancodes for those that give them:
(home icon): 0xe0 0x32, 0xe0 0xb2
(envelope): 0xe0 0x6c, 0xe0 0x6c 0xe0 0xec
(1):
(2):
(3):
(4):
(5):
(star): 0xe0 0x66, 0xe0 0x66 0xe0 0xe6
(- magnifying glass):
(+ magnifying glass):
(play/pause): 0xe0 0x22, 0xe0 0xa2
(«): 0xe0 0x10, 0xe0 0x90
(»): 0xe0 0x19, 0xe0 0x99
(speaker down): 0xe0 0x2e, 0xe0 0xae
(speaker up): 0xe0 0x30, 0xe0 0xb0


text:
Q: Exclude file locally I'd like to change the files locally, but still have the ability to keep those updates in case others on my team make important changes. However, I would like to be able to choose that all changes can be committed and not exclude the extra files every time. Is there a possibility?
With .gitignore and with exclude, the file would unfortunately not get any updates.
Before that I worked with SVN and there was a section with ignore-on-commit. Is there something like that with Git?

A: You are looking for git update-index --assume-unchanged:

When the "assume unchanged" bit is on, the user ... allows Git to assume that the working tree file matches what is recorded in the index.


text:
Q: Specs for all android phones Is there a central place where I can find the specs for the majority of the Android phones available on the market? I want to create avds for each of them.

A: Android SDK v6 tools brings sdk addons to the emulator via avd manager instead of the old way..expected release with android Os 2.2  sdk sometime within the next 4 to 6 weeks..
Suppose to simplify the way to integrate those emulator addons with items like google  maps etc..
That is why is some OEMS have been waiting instead of issuing emulator addons..


text:
Q: Git: Merge a branch but without some of the files I only need modified locally? I have this particular scenario, which is simple really, but I don't see (so far) a similar question here.
I'm working in my own branch copied from a remote repo, And I have added my own tasks to a Capistrano Capfile. These tasks will only help Me deploy the app to my own private server, Therefore when it's time to Merge my branch with origin master, I don't want the changes in the Capfile to be pushed to the remote master repo, because, obviously, this file should remain intact over there without my personal alterations.
What's the best practice to deal with this situation?
Thanks in advance!
PS. I guess that what I'm looking for, is a way to 'Git Ignore' files exclusively for a branch. To over simplify things.

A: I would suggest to branch a now branch (lets name it Local) off from your current branch (lets name it Original).
In Original, you revert the changes you made to the capfile. In Local, you continue working on your data as usual. Before it comes to remerge into the remote, you merge Local to Original and just push Original. If you do not change the local Capfile further, it should be fine, otherwise you have to (again) revert those changes (although that should result in a merge conflict anyways, so you can handle it in the merge directly).

A: See the bottom of the following page: https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_merge_strategies.
It describes how you can set different merge strategies with git attributes. In this case you always want the master version of your capistrano file to be in charge, not the one on your branch, e.g.
capistrano.file merge=ours

Ours refer to "our version of the file" relative to the branch you are on when doing the merge.


text:
Q: replace s01e01 in filename I have a list of movies that when the link has focus sends the link text to an input field that I use for a search function.
I would like to do the same for TV shows.
My files are currently formatted as
Showname s01e01

The text I need to send to the input field is

Showname&Season=01&Episode=01

Is this possible without changing the link text that is displayed on the screen?
This is the script that I use to send the text to the input field.
$(function () {
    $('#rightbox a').on('focus', function () {
        var text = $('#moviename');
        text.val($(this).text());
var fileName =$(this).text();
        fileName = fileName.replace(/\.[^/.]+$/, "");
        text.val(fileName);
        $Form.click();
    });
});

I'm guessing I need some regex in here, but I'm not good enough at regex yet.

A: If your string is as simple as:  'Showname s01e01' then you could use a simple capture of:
/^(.+?) s(\d+)e(\d+)$/
That is:
  (.+?)  - Match and capture one or more characters up to a space before
  s      - an s
  (\d+)  - capture the next one or more digits
  e      - followed by e
  (\d+)  - capture the next one or more digits

And from those captures you can construct your new string for the input box.
$(function () {
    $('#rightbox a').on('focus', function () {
        var filename = $(this).text(); // like "Lost s01e02" ??
        var myRegexp = /^(.+?) s(\d+)e(\d+)$/;
        var match = myRegexp.exec(filename); // array of matched bits
        var qryStr = match[1] + '&Season=" + match[2] + "&Episode=" + match[3];
        $("#moviename").val(qryStr); // <- text box??
        $Form.click();
    });
});

input 'moviename' would then contain the string:
Lost&Season=01&Episode=02
fiddle: https://jsfiddle.net/m7qxsf6m/4/

A: Alternatively, you can do it like this to capture both movies and shows titles:
[updated]
jsFiddle Demo

$("#containera a").click(function() {
  var title = $(this).text(),
    // we check if the title has case insensitive s01e01 pattern
    // if yes it's a show, otherwise it's a movie
    isShow = (/s(\d+)e(\d+)/i).test(title),
    rgx, rplcment;

  // the regex and the replacement both depend on if it's a show or a movie
  // we control it using the conditional (ternary) Operator
  rgx = (isShow) ? / s(\d+)e(\d+).*/i : /(\w+(\.\w+)*)\.\w+/;
  rplcmnt = (isShow) ? '&Season=$1&Episode=$2' : '$1';

  title = title.replace(rgx, rplcmnt);
  $('#moviename').val(title);
});

<input id='moviename' size=50>

  rocky.mp4

  rambo.avi

  some #movie [title] & with (dots), w3.2.5.avi

  lost s01e01.mp4

  simpsons s01e02.mkv

  big bang theory S02E05 [lorem ipsum] by ABC123.mp4

  some $other show title 3.5 S11E15.mkv


text:
Q: How does delete (10k+) work? I was browsing the questions with the most deleted votes in the 10k tools and I still can't seem to understand how delete votes work.
This question had 2 votes already, and I agreed so voted to delete, and it was deleted immediately.
but this question already has 5 delete votes and hasn't been deleted. (As it happens I think this question actually has good content and should not be deleted)

*

*What is the number of votes required to delete?

*Is there anyway to disagree with delete votes other than commenting?

(Perhaps there should be an official FAQ page on this if there isn't one already that I can't find)

A:
popular questions require more deletion votes to be deleted, at a ratio of 20:1 - a question's popularity is defined by the sum of its score plus all its answers' scores.

See this link for an explanation for determining how many delete votes are left to go.
Full Deletion Rules Here


text:
Q: How to display description of input value while calling a function in asp.net? I want to add description of parameters/value we input in function in asp.net.
So that when we call the function it will display description of value which is going to enter.
Code:
public static void DoingSplit(string name, int id)
{
  // some code
}

protected void Page_Load(object sender, EventArgs e)
{
  // some code
  DoingSplit(name,id);
}

I want to do when someone calling the function
DoingSplit(

When he press ( key intellisense display description that which type of value you have to pass.
Normally it will show only string s in my case.
I want to add more descriptions in this. like : enter string with no spaces.
Can any one help me regarding this.

A: You can do this by typing /// in the row above your method. This will automatically generate XML documentation for you to fill in: a description of the method, a description of each variable you use, and (if anything is returned) what the method returns.
example:
/// <summary>
/// checks if the given number is prime
/// </summary>
/// <param name="number">the number to be checked</param>
/// <returns>boolean that is true if the number given is prime</returns>
private bool CheckIsPrime(int number)
{
    //code
}


text:
Q: EF persists columns I don't want it to, how to avoid this behaviour? From the code sample of this question, I added a string property to my wrapper, and then I only want it for GUI and tests purposes, I don't want this string property to be persisted into the database. The wrapper looks the same as sampled in the linked question with this add-on:
public string StringValue {
    get {
        return stringValues[Value];
    }
    set {
        if (stringValues.Contains(value))
            t = (StreetType)stringValues.Single(s => s == value).IndexOf(value);
    }
}

public static implicit operator string(StreetTypeWrapper w) {
    return w == null ? stringValues[0] : w.StringValue;
}

public static implicit operator StreetTypeWrapper(string s) {
    return new StreetTypeWrapper() { StringValue = s };
}

Not to mention that I never changed the StreetTypeMapping complex type mapping class to include this new property, I don't want it in the database, but EF keeps persisting it anyway, though I only mapped the Value property of this complex type.
Is there something I do wrong for this to happen?
How can I avoid this annoying behaviour?
(EF decides for me what to map though I specified what to map)

A: you can add the [NotMapped] attribute to the property
[NotMapped]
public string StringValue { .... }

if there is some way to make the property read-only, then EF will ignnore it also.


text:
Q: Including javascript function, does not work on android i'm trying to solve a strange problem. I have realized a personnalized project for 2 weeks ago creating personnalized widget and event on them and as a result i want to deploy it on my android device.
For example, this link : http://jsfiddle.net/fc8hL/ show you a checkBox example :
--> first div is a container which can include many checkboxes
--> second div is a checkbox container
--> three img in the previous div are differents images which appear according to mouse/touch event on the checkbox.
--> the js function "check(e)" allows me to treat these 3 images and the event.
THIS FUNCTION WORKS PERFECTLY on both my local computer and my android device! i have realized some others functions in order to put in the HTML buttons, radio and comboBox.
Some events are attributed to this widgets.
Problem is : the final html file is huge : indeed, there is one function per img and i would like to optimize it creating javascript file. That is easy, i just put
<script "checkBox.js"> ***My existing function that works !***
</script>
And when i open my html file... surprise ! that works on my local computer, but not on my android device... Are you seeing an issue for this problem ?

A: Ok guys,
i have debugged my program thanks to epascarello link, and i found my problem.
On my remote computer, an error is showing :
"Failed to load resource: the server responded with a status of 403 (Forbidden)"
All my files are on a server and i didn't change reading options on them, that's why i couldn't access to all javascripts functions included in these files. Bad mistake...
Thanks a lot for your help :)


text:
Q: Error when trying to run django application Trying to install 'Django-inventory' from https://github.com/rosarior/django-inventory
After resolving dependency errors im getting this:
    (inventory)root@ip-172-31-47-17:/home/admin# django-inventory.py runserver
Traceback (most recent call last):
  File "/home/admin/inventory/bin/django-inventory.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    commands = get_commands()
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 107, in get_commands
    apps = settings.INSTALLED_APPS
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
    self._setup(name)
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django/conf/__init__.py", line 49, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django/conf/__init__.py", line 128, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/home/admin/inventory/local/lib/python2.7/site-packages/django_inventory/settings/local.py", line 4
    SECRET_KEY = '@PK$vmu_W@=^hYy\<hwYKDX.)eX5-MAlsYJ?Y-v5EbRC7KZ)5CSg:bS2^?RJi/S@$j%L9Tc9^2j&&$<o)xpr.v?uiwvsT%d9sq;\'
                                                                                ^
SyntaxError: EOL while scanning string literal
(inventory)root@ip-172-31-47-17:/home/admin#

Appreciate any pointers to resolving this.

A: The final backslash in your SECRET_KEY is escaping the close single quote. Remove it.