Sufficient sets of colimits in small categories

Let $ C$ be a small category, and consider the class of diagrams $ G:D\to C$ , with $ D$ a small category, that have colimits in $ C$ . This is a proper class even when $ C$ is very small, e.g. whenever $ D$ has a terminal object $ t$ , any functor $ G:D\to C$ has a colimit $ G(t)$ , and there is a proper class of small categories with a terminal object.

However, those colimits feel kind of “trivial”; in some cases at least we can find a small set of diagrams that “carry all the nontrivial information” about colimit diagrams in $ C$ . For instance, if $ C$ is a poset, then it suffices to consider injective functors $ G$ (and we may as well take $ D$ to be discrete as well), and these form an essentially small set. For a non-posetal $ C$ we can’t restrict to injective functors, since coproducts are not idempotent, but maybe there is some other restriction that works. Note that by Freyd’s theorem, a non-posetal small category does have a bound on the cardinality of coproducts that it can admit; but this doesn’t quite answer the question itself, since a particular colimit can exist even if the coproducts that would be necessary to construct it from coproducts and coequalizers do not.

Here are two ways to make the question precise:

  1. Given a small category $ C$ , is there a small set $ L$ of diagrams $ G:D\to C$ with colimits such that for any diagram $ G’:D’\to C$ with a colimit, there is a $ (D,G)\in L$ and a final functor $ F:D\to D’$ such that $ G = G’ \circ F$ ?

  2. Given a small category $ C$ , is there a small set $ L$ of diagrams $ G:D\to C$ with colimits such that if a functor $ H:C\to E$ preserves colimits of all diagrams in $ L$ , then it preserves all colimits that exist in $ C$ ?

Any solution to question 1 is also a solution to question 2, but I’m not sure whether the converse holds. The mention of Freyd’s theorem above suggests that a solution might require classical logic — I would find it more surprising if such a set existed for a non-posetal small complete category, although I don’t immediately see an argument that it cannot.

One can of course also ask similar questions for enriched categories, internal categories, $ \infty$ -categories, and so on. Bonus points go to an answer that applies more generally in such contexts.

Guest Post on Small Business Trendsetters DR47 DA27 TF18 for $10

Guest Post on SMALL BUSINESS TRENDSETTERS Domain Stats: Domain Rank – 47 Domain Authority – 27 Trust Flow – 18 You will need to provide a unique guest post of min.500 words for publication. Please Note: Following niches are not accepted Get Rich Quick SchemeAdultGamblingDrugsDatingHealth Supplements

by: markhere
Created: —
Category: Guest Posts
Viewed: 156


Is this the best way to code this small calculator in Javascript using Object Oriented approach?

There is a simple form which takes two numbers num1, num2 and an operation op. After submission, a new object is created. I’m new to OOJS and any correction and improvements are appreciated.

window.onload = function() {    let form = document.forms['cal-form'];   form.addEventListener('submit', calculate);    function calculate(e) {     //prevent default form submission     e.preventDefault();     //get form values`enter code here`     let num1 = parseInt(document.getElementsByTagName('input')[0].value);     let num2 = parseInt(document.getElementsByTagName('input')[1].value);     let op = document.getElementsByTagName('select')[0].value;      //create object constructor function     function Calculate(num1, num2, op){       this.num1 = num1;       this.num2 = num2;       this.op = op;     }       Calculate.prototype.result = function() {       let res;       switch (op) {         case 'add':           res = this.num1 + this.num2;           break;         case 'sub':           res = this.num1 - this.num2;           break;         case 'mul':           res = this.num1 * this.num2;           break;         case 'div':           res = this.num1 / this.num2;           break;         default:           res= 'Error! No operation selected.';       }       return res;     };      //create an object     let cal = new Calculate(num1, num2, op);     //display result     document.getElementById('result').innerHTML = cal.result();    } }; 

A small PHP library for styling terminal output

I’ve attempted to make a small PHP library for styling terminal output using ANSI escape sequences. The repo is located here

To be honest, I am not really satisfied with the current structure of my code. It seems to be “not good”. But I don’t know any better ways to structure it.

Please feel free to make any critics! I really appreciate it.

Thank you!

Chalk.php

<?php namespace TdTrung\Chalk; use TdTrung\OSRecognizer\OSRecognizer; class Chalk {     const RESET = "3[0m";     private $  styles = [         'reset' => 0,         'bold' => 1,         'dim' => 2,         'italic' => 3,         'underscore' => 4,         'blink' => 5,         'inverse' => 7,         'strikethrough' => 9,         'black' => 30,         'red' => 31,         'green' => 32,         'yellow' => 33,         'blue' => 34,         'magenta' => 35,         'cyan' => 36,         'lightGray' => 37,         'darkGray' => 90,         'lightRed' => 91,         'lightGreen' => 92,         'lightYellow' => 93,         'lightBlue' => 94,         'lightMagenta' => 95,         'lightCyan' => 96,         'white' => 97     ];     private $  twoStageFns = ["rgb"];     private $  osRecognizer;     private $  supportLevel = 0;     private $  enableColor = true;     public function __construct()     {         $  this->initSeqBuilders();         $  this->osRecognizer = new OSRecognizer;         $  this->checkColorSupport();     }     private function initSeqBuilders()     {         foreach ($  this->styles as $  name => $  code) {             $  this->styles[$  name] = function ($  offset) use ($  code) {                 if ($  code > 0)                     $  code = $  offset + $  code;                 return "3[{$  code}m";             };         }         $  this->styles["rgb"] = function ($  r, $  g, $  b, $  offset) {             // TODO: Fallback to ANSI 256 if possible             if (!$  this->has16mSupport()) return "";             $  type = 38 + $  offset;             return "3[{$  type};2;{$  r};{$  g};{$  b}m";         };     }     private function checkColorSupport()     {         if (getenv('TERM') === 'dumb') {             return 0;         } else if (strpos($  this->osRecognizer->getPlatform(), 'win') !== false) {             // get os version and build             $  release = explode('.', $  this->osRecognizer->getRelease());             if (intval($  release[0]) >= 10 && intval($  release[1]) >= 10586) {                 $  this->supportLevel = intval($  release[2]) >= 14931 ? 3 : 2;                 return;             }             $  this->supportLevel = 1;         } else if (strpos(getenv('COLORTERM'), 'truecolor') !== false) {             $  this->supportLevel = 3;         } else if (function_exists('posix_isatty') && @!posix_isatty(STDOUT)) {             $  this->supportLevel = 1;         } else if (preg_match('/-256(color)?$  /i', getenv('TERM'))) {             $  this->supportLevel = 2;         } else if (preg_match('/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i', getenv('TERM'))) {             $  this->supportLevel = 1;         } else {             $  this->supportLevel = 0;         }     }     private function is256Color($  styleName)     {         return preg_match('/^color\d+/i', $  styleName);     }     private function isValidStyle($  styleName)     {         if (!(strpos($  styleName, 'bg') === false)) {             preg_match('/^bg(\w+)$  /', $  styleName, $  match);             $  styleName = lcfirst($  match[1]);         }         return array_key_exists($  styleName, $  this->styles) || $  this->is256Color($  styleName);     }     private function parseStyleName($  styleName)     {         $  offset = 0;         if (!(strpos($  styleName, 'bg') === false)) {             $  offset = 10;             preg_match('/^bg(\w+)$  /', $  styleName, $  match);             $  styleName = lcfirst($  match[1]);         }         return [$  offset, $  styleName];     }     private function get256Sequence($  styleName, $  offset)     {         preg_match('/^color(\d+)/i', $  styleName, $  match);         $  offset += 38;         return "3[{$  offset};5;{$  match[1]}m";     }     public function isTwoStageFns($  styleName)     {         return array_search($  styleName, $  this->twoStageFns) !== false;     }     public function disableColor()     {         $  this->enableColor = false;     }     public function hasColorSupport()     {         return $  this->supportLevel >= 1;     }     public function has256Support()     {         return $  this->supportLevel >= 2;     }     public function has16mSupport()     {         return $  this->supportLevel >= 3;     }     public function __get($  styleName)     {         if (!$  this->isValidStyle($  styleName)) {             throw new InvalidStyleException($  styleName);         }         list($  offset, $  styleName) = $  this->parseStyleName($  styleName);         if ($  this->is256Color($  styleName)) {             $  style = $  this->get256Sequence($  styleName, $  offset);         } else {             $  style = $  this->styles[$  styleName]($  offset);         }         return new StyleChain($  style, $  this);     }     public function __call($  styleName, $  arguments)     {         if (!$  this->isValidStyle($  styleName)) {             throw InvalidStyleException($  styleName);         }         list($  offset, $  styleName) = $  this->parseStyleName($  styleName);         if ($  this->isTwoStageFns($  styleName)) {             array_push($  arguments, $  offset);             return new StyleChain(                 call_user_func_array($  this->styles[$  styleName], $  arguments),                 $  this             );         } else if ($  this->is256Color($  styleName)) {             $  style = $  this->get256Sequence($  styleName, $  offset);         } else {             $  style = $  this->styles[$  styleName]($  offset);         }         array_unshift($  arguments, [$  style]);         return call_user_func_array([$  this, 'apply'], $  arguments);     }     public function apply()     {         if (func_num_args() < 2) throw new InvalidArgumentException('Insufficient arguments (at least 2 are required)');         $  styles = func_get_arg(0);         $  strings = func_get_args();         array_shift($  strings);         $  text = implode(" ", $  strings);         if (!$  this->enableColor || !$  this->hasColorSupport()) return $  text;         return array_reduce($  styles, function ($  carry, $  style) {             return "{$  style}{$  carry}" . Chalk::RESET;         }, $  text);     } } 

StyleChain.php

<?php /**  * Exception TdTrung\Chalk  *  * @package TdTrung\Chalk  * @author  Tran Dinh Trung <trandinhtrung176@gmail.com>  */ namespace TdTrung\Chalk; class StyleChain {     public $  styles = [];     private $  colorInstance;     public function __construct($  style, Chalk $  colorInstance)     {         array_push($  this->styles, $  style);         $  this->colorInstance = $  colorInstance;     }     public function __invoke()     {         $  arguments = func_get_args();         array_unshift($  arguments, $  this->styles);         return call_user_func_array(             [$  this->colorInstance, 'apply'],             $  arguments         );     }     public function __get($  prop)     {         $  other = $  this->colorInstance->{$  prop};         $  this->merge($  other);         return $  this;     }     public function __call($  method, $  arguments)     {         if ($  this->colorInstance->isTwoStageFns($  method)) {             $  result = call_user_func_array(                 [$  this->colorInstance, $  method],                 $  arguments             );             $  this->merge($  result);             return $  this;         }         $  other = $  this->colorInstance->{$  method};         $  this->merge($  other);         return call_user_func_array([$  this, '__invoke'], $  arguments);     }     private function merge(StyleChain $  other)     {         $  this->styles = array_merge($  this->styles, $  other->styles);     } } 

Postgresql using hash join with small table

I have one view (B) that returns ~20M records and a table (A) that has ~50M records. If I do A inner join B ON A.id=B.id, it performs a hash join, as expected. If I do B WHERE B.id IN ('value','value','value') it performs a nested loop with index scan on B, as expected. But if I do B WHERE B.id IN (SELECT id FROM A LIMIT 3) it performs a hash join, degrading performance terribly. Why is that? I tried disabling hash joins, but it is even worse: it uses seqscans anyway on both sides.

Closed subvariety that is unique in its small analytic neighborhood

Let $ Y$ be some smooth projective variety over $ \mathbb C$ with $ \dim Y \geq 2$ . For a closed sub-variety $ X \hookrightarrow Y$ , consider the following property:

There is some small open neighborhood $ U$ of $ X$ inside $ Y$ (in the complex topology), such that the only closed sub-variety $ Z$ of $ Y$ inside $ U$ with $ \dim Z=\dim X$ is just $ X$ itself.

When does such $ X$ exist (except trivial cases e.g $ X=Y$ )? Can we classify all such $ X$ ? For simplicity, one can assume $ X$ is a divisor and smooth.

Motivation: In Accumulation of algebraic subvarieties: Near one subvariety there are many others (?), 2, one finds an example given by $ Y=Bl_O (\mathbb P^2)$ and $ X$ being the exceptional divisor. In general, the divisors with such property seem to be quite special, and the existence depends on the intersection theory on $ Y$ .

Best Free WordPress Themes for Small Local Businesses

Hello all,

I'm just wondering if anyone out there could recommend some good free responsive WordPress themes for a small local business. Examples of such businesses could include plumbers, beauty salons, mechanics, landscapers, corner stores etc…

I just have to design a few websites for some people that fall into this category. I'm not brillant at web design so suggestions of simple themes would be very much appreciated.

Small Fix to Email Verification with Token

My website verifies the users email address but sometimes when the user clicks the verification link in the email, it just takes them to a blank page on the website. Nothing is actually verified. Looking for someone who can find why this happens and fix it. Using PHP 5.6.

Payment by Paypal once job is complete. Let me know your hourly rate so I can make a decision easily.

Existence of a left adjoint to the functor between cocomplete category and category of presheaves on small category.


Assume functor $ F:C \rightarrow D$ where $ C$ is a small category and $ D$ is cocomplete category. Now let $ S$ denote a functor given by composition $ D \xrightarrow{\text{Yoneda embedding}}D^* \xrightarrow F^{*} C^*$ ($ C^*$ is a category of presheaves from $ C$ ). Prove that $ S$ has left adjoint functor.

The problem here that I don’t know where to start. So I need a hint to begin with. Thanks!