295 questions
0
votes
1
answer
51
views
can we change the native semantics of landmark elements or any element of html5 using aria
can we change the native semantics of landmark elements or any element of html5 using aria, is it semantically correct and conforming to do so ?
Suppose I want to use the dialog element as a ...
0
votes
2
answers
585
views
How to print a list of numpy.float32 values?
I run some simulations whose result is a dict like this:
results = {
'this': 5,
'that': 6,
'those': [2.34, 5.67]
}
I save it in a human-readable format using code like this:
s = ''
for ...
0
votes
1
answer
59
views
Representation exposure on an int method
This function exposes the value of worldSize, so it is a form of representation exposure:
/**
* Returns the size of the simulation world.
* Used for documentation ONLY
* Should not have ...
0
votes
1
answer
49
views
Represent a full, but not complete, binary tree with an array structure
I have been reading about binary heaps and I was wondering if there was a similar representation that could be used to represent a non-complete binary tree, if that binary tree happened to also be ...
1
vote
1
answer
54
views
sed to find and transform binary number representation
I have a file with binary numbers that I would like to alter inline with sed -i.
The file has lines like this:
00018342 0000 dc.b 11010101b
So I would like to have it represented this ...
-1
votes
1
answer
190
views
Plot to represent coverage of a sequence
Does anyone have an idea of generating a plot that would look something like this:
Basically, I would have sequences, say T1 and T2, which need to be aligned to the "main" sequence. Also, ...
0
votes
0
answers
158
views
Swift: Trying to dismiss the presentation controller while transitioning already
I have 3 controllers like that: A -> B -> C
A: Present to B
B: Present to C
From C, I used the code below to transition to A
window.rootViewController = nil
window.rootViewController = vc
let ...
1
vote
1
answer
173
views
How can I see the contents of a NimNode?
I'm using the nim programming language and am doing some metaprogramming.
I want to write a DSL of some sorts that enables generating procs. For that I want to pass some nim-code into a macro (e.g. a ...
0
votes
1
answer
140
views
Evolutionary algorithm: permutation problem with restrictions on allowed permutations
I have a set of same-sized n(=25) matrices, m_1, m_2, ..., m_n, where each matrix falls into one of 10 classes. For each matrix, I have to find a "pair matrix" from the set so that the sum ...
1
vote
2
answers
277
views
PowerShell object representation
There are different ways to represent (display) an object in PowerShell but when it comes to complex objects it is either very verbose or quiet useless:
$Object = @{ 'a' = 1; 'b' = 2 }
Just ...
0
votes
1
answer
82
views
Meaning of string representation of binary data
Recently I faced with such string representation of binary-data: \xfa\xd4\xe4d\x00\x00\x00\x00
It is string representation of little-endian UNIX timestamp (1692718330)
I understand that, for example, \...
1
vote
2
answers
1k
views
How can I convert a bitstring to the binary form in Julia
I am using bitstring to perform an xor operation on the ith bit of a string:
string = bitstring(string ⊻ 1 <<i)
However the result will be a string, so I cannot continue with other i.
So I want ...
0
votes
1
answer
919
views
What decimal value does the 8-bit binary number 11011111 have if it is on a computer using signed-magnitude representation?
I am confused on how to present this in decimal value
Would it be just the negative value of 223 or would it be -125?
0
votes
1
answer
30
views
How do I create a representation when my constructor has added kwargs?
How do I create a representation when my constructor has added kwargs?
class Thing:
def __init__(self, a, b, **kwargs):
self.a = a
self.b = b
self.__dict__.update(kwargs)
#...
-2
votes
1
answer
46
views
Can autoencoders be used to extract useful (not truthful) representations?
I'm looking for a neural network model that can extract useful information from an image. Here "useful" is arbitrarily defined by the user based on some specific task the autoencoder needs ...
11
votes
5
answers
9k
views
What is an S-Expression
All Lisp developers seem to know what an S-Expression is. But can anybody explain this for non Lisp developers?
There is already a Wikipedia entry (https://en.wikipedia.org/wiki/S-expression). But ...
0
votes
1
answer
1k
views
Newtonian notation for derivates on latex
I am using Notion for my studies: so I have to use Latex to represent the equations or others math stuffs. I noticed that I can use the Newtonian notation on Latex with the command \dot or \ddot (...
0
votes
0
answers
115
views
Is posible represent rectangular pulse in Matlab using vector?
I have to represent this pulses in Matlab but only when i find a 0 in a vector
This is my code, i generate a vector with 10 numbers 0s and 1s but I am not able to program the representation of the ...
1
vote
1
answer
90
views
How the short type is represented by the Visual C++ compiler? [duplicate]
I know that most significant bit means the sign of a number in signed types. But I found one strange (for me) thing: if the number is negative and we use short type, this number will look like 0xffff##...
0
votes
1
answer
639
views
How to represent a floating point number in binary from 32-bit hex value in C++ without using bitset or float variable?
Given a 32-bit hex like 0x7f000002, how do I get the full value of this number printed in binary without using bitset or defining any float variables to use union?
I know that it is supposed to ...
0
votes
1
answer
877
views
Is there a way to convert a string into a float without losing accuracy?
I have float values with high precision. When I convert them to a string I lose precision.
I am storing this float value in a Json::Value object. And I need to later take the float back out of the ...
0
votes
2
answers
398
views
How looks like an Expression-Tree (when function calls are involved)
I've found many places that shows expression-trees that involve operators (+,-,*, &&, ||, etc). Here is a simple example:
But I can not find an example when functions (with zero or more ...
2
votes
0
answers
60
views
Is there a C++ library that wraps a internal type to be able to derive from that internal type?
I have this template that wrap an unsigned integer type (any) :
template<std::unsigned_integral T>
struct base_dig_t
{T m_data;};
Then I have this template to modify the behavior ...
4
votes
1
answer
808
views
Python Jupyter Notebook: Embed an interactive plot in the _repr_html_() method of a class
I am trying to embed an interactive graph in the _repr_html_() method of a class C.
What I have tried so far does not seem to be working in my Jupyter Notebook.
Plotly (python)
Here is an example plot ...
2
votes
0
answers
138
views
Why are encoded representations bad for classification?
Given a pre-trained well-performing auto-encoder. When I train a classifier on encodings (produced by the auto-encoder) the classifier does very poorly. In particular, it does much worse than training ...
0
votes
1
answer
95
views
Unambiguous hashable representation for plane defined by 3 points with integer coordinates
I need to be able to use planes as keys in a hash map. The planes are defined by three distinct points in 3d space. I have been unable to find a representation for a plane, that is the same no matter ...
1
vote
1
answer
100
views
How to convert a string representation of bytearray to a numpy array?
I have a string like this:
string = "b'\\xf4\\xf0\\xf2\\xef\\xf8\\xf2\\xee'"
So far I have come up with this:
arr = np.array([int(s_num, 16) for s_num in re.findall(r'x([a-f0-9]{2})', ...
2
votes
1
answer
743
views
How to represent two different types of data being returned by a class method in a UML diagram?
I have the following method:
def getInvoiceById(self, id):
for invoice in self.invoices:
if invoice.id == id:
return invoice
return False
inside a ...
0
votes
1
answer
92
views
Calculate the order of precision limit of floating type representation [duplicate]
Let's say that I have a Single-precision floating-point format variable in my machine and I want to assign on it the result of a given operation.
From Wikipedia:
The IEEE 754 standard specifies a ...
0
votes
0
answers
20
views
Why does R represent numerics with a "higher accuracy" than given in a text file? [duplicate]
I'm pretty sure that this has to do something with (representation of) numerical precision. But in this case, I find it especially unintuitive and I want to understand what happens and why it happens.
...
0
votes
0
answers
355
views
How add ocean waves to Leaflet?
I'm working on an ocean weather visualization tool with Leaflet and I would like to add a waves layer, like this one of windy.
I already have the data and I can adjust it to any representation. How ...
1
vote
2
answers
1k
views
Python Pint: set short representation of units as default
Pint units are represented by default with their full name:
>>> import pint
>>> ureg = pint.UnitRegistry()
>>> q = ureg.Quantity('3.456 m^2')
>>> print(q)
3.456 ...
0
votes
2
answers
468
views
How to convert an int array into a single int c
I have a integer array, int KEY[32], that stores the binary representation of a four letter quadgram, e.g.:
char quadgram[4] = {'T','I','O','N'};
Where the binary representations of the characters ...
1
vote
1
answer
903
views
Represent negative numbers in other bases
How do I represent negative numbers in non-10 bases, eg say in base 20. I know how to do this in binary using two's complement, but what would the equivalent of two's complement be in other bases?
For ...
2
votes
1
answer
335
views
Can canonical SMILES strings be constructed for arbitrary labelled graphs?
I have been reading a few papers on canonical SMILES strings recently and to me it seems like the canonization procedure most of the time relies on adding additional chemical information into the ...
0
votes
1
answer
492
views
Name of fixed-point/integer representation with alternate unit of measurement
When processing signals and sensor values in embedded C, we can usually choose between representing the values in floating-point (e.g. IEEE 754) or fixed-point, the latter often preferred when no ...
2
votes
0
answers
117
views
What's the need for different ways to represent data using the binary system? [closed]
There are many ways to represent data using binary like - unsigned, signed magnitude, 1s/2s complement, offset-M,
floating-point, ASCII, and Unicode. Why do we need so many different ways?
1
vote
2
answers
1k
views
Simple explaination of representation invariant
The representation invariant defines which values of the data attributes correspond to valid
representations of class instances. The representation invariant for IntSet is that vals contains no
...
0
votes
1
answer
280
views
Binary Representations
Why is that
>>> print(f"{-5 & 0b1111: 04b}")
1011
However,
>>> print(f"{-5 | 0b0000: 04b}")
-101
Moreover,
>>> print(f"{-5 | 0b1111: ...
0
votes
1
answer
1k
views
Representation of graphs in a hash table
I'm currently writing my master thesis about clusterings in graphs. My prof said he wants the graph to be represented as a hash table. Because it needs less space than the adjency matrix and it is ...
0
votes
0
answers
153
views
Get binary representation of ASCII symbol (C#)
Sorry for asking a question like that, but I'm really stuck.
I have this method for reading data from file:
public void ReadFromFile()
{
string fileName = @"my .txt file path";
...
50
votes
3
answers
5k
views
If the size of "long" and "int" are the same on a platform - are "long" and "int" different in any way?
If the representation of a long int and a int are the same on a platform, are they strictly the same? Do the types behave any differently on the platform in any way according to the C standard?
Eg. ...
2
votes
0
answers
266
views
__str__ of lists (or tuples) shows __repr__ of Datetime so it is unreadable
I am quite new to Python.
I am working on an application which uses lists of Datetime objects (from the datetime module).
I want to debug my app, so I print (or log) thoses lists, but it returns me ...
1
vote
0
answers
73
views
What is a mathematical (described with a function) equivalent of mirroring bits?
So imagine we have a function F(x), where x can be any 8bit number, and our functions returns mirrored number. How could this function look in decimal format or maybe do you even would think of binary ...
0
votes
1
answer
90
views
How not to print zeros at the beginning of the binary representation of a usigned short int?
I have a code like this that converts a short integer to binary, but zeros are printed at the beginning. So here's how to make sure that these zeros are not displayed, and the output starts from the ...
1
vote
1
answer
351
views
How to "filter" out a list in Python , without losing the index
We have a group of people. They are randomly assigned a number each week from 0 to 10 and if the number is greater than 9 so they become leaders .If they are more than 1 people, they all become ...
4
votes
2
answers
2k
views
Is there a way to get R print ouput as string?
Is there a simple way to get the output of print as a string variable? Something like:
output_string = print(object)
the function print() imho has a rather "intelligent" way of representing ...
4
votes
1
answer
2k
views
How to print literal representation of a string in Node.js?
In my program there is a REPL loop that occassionaly need to print to the console a string representation of the given string variable.
For example, suppose that we have have a string variable str ...
0
votes
1
answer
2k
views
Convert an integer to an alphanumeric string with as few characters as possible
I am looking for a way to reduce a decimal integer representation to a string with the fewest characters possible.
E.g. hexadecimal uses the letters A-F on top of the decimal numbers.
hex(123)
Is ...
5
votes
2
answers
155
views
Is there a name for the property of Python objects to have a console representation equivalent to their code?
This is somewhat of a broad topic, but I will try to pare it to some specific questions.
I was thinking about a certain ~meta~ property in Python where the console representation of many basic ...