Different ways of adding to a dictionary in C#

The performance is almost a 100% identical. You can check this out by opening the class in Reflector.net This is the This indexer: public TValue this[TKey key] { get { int index = this.FindEntry(key); if (index >= 0) { return this.entries[index].value; } ThrowHelper.ThrowKeyNotFoundException(); return default(TValue); } set { this.Insert(key, value, false); } } And this … Read more

linux tee is not responding

From man python: -u Force stdin, stdout and stderr to be totally unbuffered. On systems where it matters, also put stdin, stdout and stderr in binary mode. Note that there is internal buffering in xreadlines(), readlines() and file- object iterators (“for line in sys.stdin”) which is not influenced by this option. To work around this, … Read more

How to create a self-signed certificate for a domain name for development

Using PowerShell From Windows 8.1 and Windows Server 2012 R2 (Windows PowerShell 4.0) and upwards, you can create a self-signed certificate using the new New-SelfSignedCertificate cmdlet: Examples: New-SelfSignedCertificate -DnsName www.mydomain.example -CertStoreLocation cert:\LocalMachine\My New-SelfSignedCertificate -DnsName subdomain.mydomain.example -CertStoreLocation cert:\LocalMachine\My New-SelfSignedCertificate -DnsName *.mydomain.example -CertStoreLocation cert:\LocalMachine\My Using the IIS Manager Note that IIS certificates use SHA-1 hashing, which isn’t … Read more

How to fix Django warning “(models.W042) Auto-created primary key used when not defining a primary key type”?

Your models do not have primary keys. But they are being created automatically by django. You need to choose the type of auto-created primary keys: https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys (new in Django 3.2) Either add this to settings.py: DEFAULT_AUTO_FIELD=’django.db.models.AutoField’ or class Topic(models.Model): id = models.AutoField(primary_key=True) …

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)