Usage of the backtick character (`) in JavaScript

This is a feature called template literals. They were called “template strings” in prior editions of the ECMAScript 2015 specification. Template literals are supported by Firefox 34, Chrome 41, and Edge 12 and above, but not by Internet Explorer. Examples: http://tc39wiki.calculist.org/es6/template-strings/ Official specification: ECMAScript 2015 Language Specification, 12.2.9 Template Literal Lexical Components (a bit dry) Template … Read more

Python setup.py develop vs install

python setup.py install is used to install (typically third party) packages that you’re not going to develop/modify/debug yourself. For your own stuff, you want to first install your package and then be able to frequently edit the code without having to re-install the package every time — and that is exactly what python setup.py develop … Read more

How can I get the latest JRE / JDK as a zip file rather than EXE or MSI installer? [closed]

JDK is not available as a portable ZIP file, unfortunately. However, you can follow these steps: Create working JDK directory (C:\JDK in this case) Download latest version of JDK from Oracle (for example jdk-7u7-windows-x64.exe) Download and install 7-Zip (or download 7-Zip portable version if you are not administrator) With 7-Zip extract all the files from … Read more

Sample random rows in dataframe

First make some data: > df = data.frame(matrix(rnorm(20), nrow=10)) > df X1 X2 1 0.7091409 -1.4061361 2 -1.1334614 -0.1973846 3 2.3343391 -0.4385071 4 -0.9040278 -0.6593677 5 0.4180331 -1.2592415 6 0.7572246 -0.5463655 7 -0.8996483 0.4231117 8 -1.0356774 -0.1640883 9 -0.3983045 0.7157506 10 -0.9060305 2.3234110 Then select some rows at random: > df[sample(nrow(df), 3), ] X1 X2 … Read more

Run PostgreSQL queries from the command line

psql -U username -d mydatabase -c ‘SELECT * FROM mytable’ If you’re new to postgresql and unfamiliar with using the command line tool psql then there is some confusing behaviour you should be aware of when you’ve entered an interactive session. For example, initiate an interactive session: psql -U username mydatabase mydatabase=# At this point … Read more

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