The ~ (tilde) can have different meanings: it can be an operator, performing a bitwise negation on a binary number - all 1 bits are set to 0 and all 0 bits are set to 1. It can also simply be the tilde character itself, as used in Windows for shortening long path names.
Questions tagged [tilde]
171 questions
2
votes
2 answers
What does "~." mean in R?
it's the first time I've used the model.matrix command on R. I'm posting the code from an example found in a book:
model.matrix(~., data)
I don't understand what ~. is.
Looking on the internet I saw that the first argument would be "an object of an…

Lisa Tassinari
- 21
- 1
2
votes
3 answers
RewriteRule for tilde
I am trying to do the following rewrite of tilde URLs:
RewriteRule ^/?~folder/(.*) http://whatever.com/$1 [R=302,L]
I want any links with whatever.com/~folder/something to become whatever.com/something.
It seems that the above rewrite rule works if…

apa456
- 21
- 1
- 3
2
votes
1 answer
when I write SELECT ~1; on Postgresql it gives me -2 as a result. What is the reason of this? And it keeps going for ~4 and -5 etc
I was looking for sql basics and I decided to write SELECT ~1; on postgresql and as a result it returned -2. When i tried this for bigger number it always returned me integer's next integer and negative (~300 and -301). I wonder what's the reason.

tahayf
- 23
- 4
2
votes
1 answer
Python os.walk() does not work with tilde ~ in path
I am trying to count files in a directory and subdirectories and it will be used for many users which I dont know before hand so I want to use "~" tilde in the path. But when I do the following python returns nothing:
import os
for root, dirs,…

KZiovas
- 3,491
- 3
- 26
- 47
2
votes
2 answers
Tilde showing in URL instead of mapping to root
We have a old .net site that runs on the 2.0 framework. In this site there are multiple calls that redirect when needed by calling response.redirect(). For some reason that I cannot figure out the ` character has stopped being mapped to the root -…

cschear
- 369
- 1
- 3
- 14
2
votes
1 answer
Managed debugging does not work anymore, due to wrong version of mscordbi.dll
I'm trying to debug a memory dump, using Visual Studio, as managed, but this fails with following error message:
Managed debugging is not available for this minidump.
A required library for managed minidump debugging,'mscordbi.dll', version…

Dominique
- 16,450
- 15
- 56
- 112
2
votes
4 answers
Where is official documentation for tilde (~) in Pandas?
I am pretty sure that ~ in Pandas is boolean not. I found a couple of StackOverflow questions / answers, but no pointer to official documentation.
Sanity Check
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
df =…

Martin Thoma
- 124,992
- 159
- 614
- 958
2
votes
3 answers
tilde operator query in C working differently
I came across this question.
What is the output of this C code?
#include
int main()
{
unsigned int a = 10;
a = ~a;
printf("%d\n", a);
}
I know what tilde operator do, now 10 can be represented as 1010…

NameSake
- 53
- 5
2
votes
3 answers
bash diff fails to found existing files when providing a path variable containing tilde (~)
I have a very surprising problem while trying to execute a diff command inside a bash script.
Here is a working code illustrating the point:
#!/bin/bash
cd
mkdir foo bar
head -c 1024 /dev/urandom >foo/qux
head -c 1024 /dev/urandom >bar/qux
# works…

Romain Vincent
- 2,875
- 2
- 22
- 29
2
votes
0 answers
tilde ~ in front of anonymous function in JavaScript
if I run the following code:
~ function() {
alert('I am new here');
}();
the page alerts: 'I am new here'.
however if I try to run:
function() {
alert('I am new here');
}();
I get syntax error.
I can't find any explanation of tilde (~) that would…

user3784950
- 65
- 10
2
votes
1 answer
Why does ~x on an int result in -(x+1)
Why does this code:
#include
int main ()
{
int x = 1;
int y = ~x;
std::cout << y;
}
Always print -(x+1)? If x = 00000001, shoudn't y = 11111110?

black-goat
- 67
- 5
2
votes
2 answers
What does ~> (tilde greater than) mean in this Swift code?
I am converting code that is not mine to swift 3.0 and there are some lines I don't understand that are being flagged by the compiler:
public func setupAppearance()
{
if let delegate = delegate
{
…

Greg Robertson
- 2,317
- 1
- 16
- 30
2
votes
3 answers
C++ code for copying FILES : : confused about relative address (tilde)
I've written a simple program to copy files.
It gets two strings :
1) is for the path of the source file.
2) is for name of a copy file.
It works correctly when I give it the absolute or relative path(without tilde sign (~)).
But when I give it a…

MahanTp
- 744
- 6
- 16
2
votes
1 answer
Tilde ~ makes trouble when using fstream on Mac
I do not exactly know whether I have an IDE/toolchain question, a Mac question or a C++ question:
I want to save a file with ofstream. That works as expected. But when I save to a filepath with a tilde like "~/Desktop/test.txt", ofstream::good()…

Michael
- 7,407
- 8
- 41
- 84
2
votes
4 answers
what does Tilde image mean in MATLAB?
I am working on a code for image processing in Matlab and the thinning won't work unless I call the function on the original image with the tilde and then save it to the same variable (found it somewhere on the internet).
I= bwmorph(~I, 'thin',…

Anna
- 21
- 1
- 1
- 2