How do JavaScript closures work?

How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures...

What is the difference between UTF-8 and Unicode?

I have heard conflicting opinions from people - according to the Wikipedia UTF-8 page. They are the same thing, aren't they? Can someone clarify?

What is the difference between declarative and imperative paradigm in programming?

I have been searching the web looking for a definition for declarative and imperative programming that would shed some light for me. However, the language used at some of the resources that I have...

Why is {a^nb^n | n >= 0} not regular?

In a CS course I'm taking there is an example of a language that is not regular: {a^nb^n | n >= 0} I can understand that it is not regular since no Finite State Automaton/Machine can be written...

What advantages do LL parsers have over LR parsers?

What advantages do LL parsers have over LR parsers to warrant their relative popularity in today's parser generator tools? According to Wikipedia, LR parsing appears to have advantages over...

How to get plain text out of Wikipedia

I'd like to write a script that gets the Wikipedia description section only. That is, when I say /wiki bla bla bla it will go to the Wikipedia page for bla bla bla, get the following, and return...

What are the differences between PEGs and CFGs?

From this wikipedia page: The fundamental difference between context-free grammars and parsing expression grammars is that the PEG's choice operator is ordered. If the first alternative succeeds,...

How to convert a Roman numeral to integer in PHP?

Using PHP, I'd like to convert a string containing a Roman number into its integer representation. I need this because I need to make calculations on them. Wikipedia on Roman numerals It would...

What is the difference between Q-learning and SARSA?

Although I know that SARSA is on-policy while Q-learning is off-policy, when looking at their formulas it's hard (to me) to see any difference between these two algorithms. According to the book...

How to securely generate an IV for AES CBC Encryption?

I work on some crypto stuff. I use AES 256 with CBC mode I use OPENSSL I am aware of the following things (source = wikipedia): an initalization vector should be: Unique: must not be repeated...

Is there a Wikipedia API just for retrieve the content summary?

I need just to retrieve the first paragraph of a Wikipedia page. Content must be HTML formatted, ready to be displayed on my website (so no BBCode, or Wikipedia special code!)

How do I decide which way to backtrack in the Smith–Waterman algorithm?

I am trying to implement local sequence alignment in Python using the Smith–Waterman algorithm. Here's what I have so far. It gets as far as building the similarity matrix: import sys,...

Drawing sequence logos in D3

How would I go about drawing a sequence logo with D3? From Wikipedia a sequence logo is a graphical representation of the sequence conservation of nucleotides (in a strand of DNA/RNA) or amino...

iTerm2: delete line?

I'm trying to map ⌘+Delete (backspace) to delete to the beginning of the line (like it works in browsers and text editors) in iTerm2 and I'm unable to find a working escape code for it. I tried...

Custom linear congruential generator in JavaScript

I am trying to create a custom linear congruential generator (LCQ) in JavaScript (the one used in glibc). Its properties as it's stated on Wikipedia are: m=2^31 , a=1103515245 , c=12345. Now I am...

How do Markov Chains work and what is memorylessness?

How do Markov Chains work? I have read wikipedia for Markov Chain, But the thing I don't get is memorylessness. Memorylessness states that: The next state depends only on the current state and...

rotation matrix in openCV

I am creating a rotation matrix in python as follows: import numpy as np def make_rot(angle): cost = np.cos(np.deg2rad(angle)) sint = np.sin(np.deg2rad(angle)) rot = np.array([[cost,...

What sorting algorithm is this 3 liner?

Given array a=[4,6,9,3,1,5,9,1,4,2,8] [4, 6, 9, 3, 1, 5, 9, 1, 4, 2, 8] Sorting algorithm Note that in case anybody doesn't know. To swap 2 numbers 'a' and 'b' you can do a=a+b b=a-b a=a-b (can...

Does the complement have any impact on Fletcher's checksum?

The Wikipedia article for Fletcher's checksum states: These examples assume two's complement arithmetic, as Fletcher's algorithm will be incorrect on one's complement machines. This SO question...

Using IFF in Python

Is there a way to write an iff statement (i.e., if and only if) in Python? I want to use it like in for i in range(x) iff x%2==0 and x%i==0: However, there isn't any iff statement in Python....

Making text appear on hover

I was trying to make a text box appear when I hovered over something different. In my code: I want to hover over the h1 block and make the h3 block appear. h1.title { font-size: 100px; ...

Understanding `option long_options[]` when using `getopt_long`

I am trying to learn to use getopt_long. From wikipedia, I see the code #include <stdio.h> /* for printf */ #include <stdlib.h> /* for exit */ #include <getopt.h> /* for getopt_long;...

what is anisotropic scaling in computer vision?

What is anisotropic scaling? And how is it achieved w.r.t image processing and computer vision? I understand that it is some form of non-uniform scaling as Wikipedia puts it, but I still don't get...

Read first line of huge Json file with Spark using Pyspark

I'm pretty new to Spark and to teach myself I have been using small json files, which work perfectly. I'm using Pyspark with Spark 2.2.1 However I don't get how to read in a single data line...

How can I find the actual Clang version on Mac?

Note: None of the answers provided at https://stackoverflow.com/questions/33603027/get-apple-clang-version-and-corresponding-upstream-llvm-version seems to work anymore. The download page at...

"e.target" calling wrong target?

The component that I'm working on relies on <img> elements inside of <span> elements, and when the <span> detects a "click" event through JQuery, that span's ID should be logged to the console....

Elliptic curve double and add implementation in python

I am trying to implement the "double and add" algorithm to quickly multiply points on an elliptic curve in Python (3, please). Based off this previous answer (about addition and...

Fast key-value disk storage for Python

I'm wondering if there is a fast on-disk key-value storage with Python bindings which supports millions of read/write calls to separate keys. My problem involves counting word co-occurrences in a...

Getting error "CUDA backend requires cuDNN" when configuring OpenCV cmake build with cuda backend turned on

My goal: My goal is to configure a build of OpenCV 4.5.1-dev with support for cuda, tesseract and QT without any cmake error.. The problem I am having: I am getting the following error when I...

Handling dispose method when using hot restart

Is there a way to properly dispose resources when using hot restart: Hot restart loads code changes into the VM, and restarts the Flutter app, losing the app state. (⇧⌘\ in IntelliJ and...