For instance, a computation involving commands to read and write from the prompt:
First we describe the "commands" of our computation as a Functor data type
{-# LANGUAGE DeriveFunctor #-}
data TeletypeF next
= PrintLine String next
| ReadLine (String -> next)
derivin...
Using the apt package manager
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
# the node & npm versions in apt are outdated. This is how you can update them:
sudo npm install -g npm
sudo npm install -g n
sudo n stabl...
jQuery offers a variety of methods that can be used for DOM manipulation.
The first is the .empty() method.
Imagine the following markup:
<div id="content">
<div>Some text</div>
</div>
By calling $('#content').empty();, the inner div would be removed. This...
Model creation
Model classes must extend Illuminate\Database\Eloquent\Model. The default location for models is the /app directory.
A model class can be easily generated by the Artisan command:
php artisan make:model [ModelName]
This will create a new PHP file in app/ by default, which is name...
Avoid destructive operations on quoted objects. Quoted objects are literal objects. They are possibly embedded in the code in some way. How this works and the effects of modifications are unspecified in the Common Lisp standard, but it can have unwanted consequences like modifying shared data, tryin...
git difftool -t meld --dir-diff
will show the working directory changes. Alternatively,
git difftool -t meld --dir-diff [COMMIT_A] [COMMIT_B]
will show the differences between 2 specific commits.
Standard installation
All Node.js binaries, installers, and source files can be downloaded here.
You can download just the node.exe runtime or use the Windows installer (.msi), which will also install npm, the recommended package manager for Node.js, and configure paths.
Installation by package m...
There are a variety of undocumented methods on UIColorwhich expose alternate colors or functionality. These can be found in the UIColor private header file. I will document the use of two private methods, styleString() and _systemDestructiveTintColor().
styleString
Since iOS 2.0 there is a priva...
Assembly language is a human readable form of machine language or machine code which is the actual sequence of bits and bytes on which the processor logic operates. It is generally easier for humans to read and program in mnemonics than binary, octal or hex, so humans typically write code in assemb...
Selenium Grid Node configuration resides on the Node itself and holds the information about network configuration and Node capabilities. The configuration can be applied in various ways:
Default Configuration
JSON Configuration
Command line Configuration
JSON Configuration
The node configur...
A few modules in the standard library have been renamed:
Old nameNew name_winregwinregConfigParserconfigparsercopy_regcopyregQueuequeueSocketServersocketserver_markupbasemarkupbasereprreprlibtest.test_supporttest.supportTkintertkintertkFileDialogtkinter.filedialogurllib / urllib2urllib, urllib.pars...
In general, most of the objects you would interact with as a user would tend to be a vector; e.g numeric vector, logical vector. These objects can only take in a single type of variable (a numeric vector can only have numbers inside it).
A list would be able to store any type variable in it, making...
Every package requires a setup.py file which describes the package.
Consider the following directory structure for a simple package:
+-- package_name
| |
| +-- __init__.py
|
+-- setup.py
The __init__.py contains only the line def foo(): return 100.
The following setup.py...
To find every vector of the form (x, y) where x is drawn from vector X and y from Y, we use expand.grid:
X = c(1, 1, 2)
Y = c(4, 5)
expand.grid(X, Y)
# Var1 Var2
# 1 1 4
# 2 1 4
# 3 2 4
# 4 1 5
# 5 1 5
# 6 2 5
The result is a data.frame with one...
Django manger is an interface through which the django model queries the database. The objects field used in most django queries is actually the default manager created for us by django (this is only created if we don't define custom managers).
Why would we define a custom manager/queryset?
To avo...
Assuming a class
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=50)
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('view_author', args=[str(self.id)])
class Book(models.Mo...
Node Version Manager, otherwise known as nvm, is a bash script that simplifies the management of multiple Node.js versions.
To install nvm, use the provided install script:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
For windows there is a nvm-windows p...