Questions tagged [shift]

Questions related to the usage of the right and/or left shift key on the keyboard. For questions regarding bitwise shift operations use [bit-shift]

Questions related to the usage of the right and/or left Shift key on the keyboard. For questions regarding bitwise shift operations use

1054 questions
10
votes
1 answer

Detect CTRL and SHIFT key without keydown event?

I've been wondering if I can detect CTRL and SHIFT key being pressed WITHOUT using keydown event. The reason is that I am creating some sort of Grid Viewer in JavaScript, and I implemented selecting different items by holding CTRL or SHIFT key as it…
Flash
  • 466
  • 6
  • 16
9
votes
5 answers

How can I distinguish between an argument that was not passed and one that was passed with a false value?

I am trying to figure the best way to differeniate in Perl between cases where an argument has not been passed, and where an argument has been passed as 0, since they mean different things to me. (Normally I like the ambiguity, but in this case I'm…
Stephen
  • 8,508
  • 12
  • 56
  • 96
9
votes
3 answers

How to do arithmetic right shift in python for signed and unsigned values

Some languages like Java, Verilog have both bitwise logical (<<, >>) and arithmetic shift (<<<, >>>) operators. For unsigned values, logical and arithmetic shifts have identical operation. Say if 8'b11000101 is binary representation of 8-bit…
nurabha
  • 1,152
  • 3
  • 18
  • 42
9
votes
5 answers

Keyboard shift key having issues

Whenever i press the Shift key, it causes the same effect as if i pressed the Ctrl+v shortcut. It pastes the last thing i highlighted over and over. A single press usually causes around 20 or so paste functions. Does anyone know what the issue might…
Ryujin89
  • 213
  • 2
  • 6
  • 16
9
votes
0 answers

Why left shift of a negative signed value is not well-defined behavior?

This question was asked in an interview. What is the reason that left shift << of a negative value has undefined behavior, while Right shift >> of a negative signed number has implementation-defined behavior? C11 $6.5.7: Paragraph 4: The result of…
Jayesh
  • 4,755
  • 9
  • 32
  • 62
9
votes
2 answers

How can I disable text selection using shift without disabling all text selection?

So I know this sounds like a duplicate, but it isn't (or if it is, the accepted answer on all the ones I can find doesn't work the way I need it to). The issue is this: I'm writing in HTML5 using jQuery, I need to make a grid allow multi-select with…
Adam McCormick
  • 1,654
  • 18
  • 22
9
votes
2 answers

matplotlib: How to pick up shift click on figure?

I have a matplotlib and I have created a button_press_event like this: self.fig.canvas.mpl_connect('button_press_event', self.onClick) def onClick(self, event) if event.button == 1: # draw some artists on left click elif…
NotNone
  • 661
  • 1
  • 8
  • 13
8
votes
2 answers

A complex key for guavas Cache (shifting)

I have a point object: class Point { final int x,y; ... } Because these points will be used/created all over the place in my code, I want to start using guavas cache. Unfortuinally the CacheLoader only accept one parameter. Another…
Marcel Jaeschke
  • 707
  • 7
  • 24
8
votes
2 answers

Verilog Barrel Shifter

I want to create a 64-bit barrel shifter in verilog (rotate right for now). I want to know if there is a way to do it without writing a 65 part case statement? Is there a way to write some simple code such as: Y = {S[i - 1:0], S[63:i]}; I tried…
Robert Cardona
  • 1,068
  • 5
  • 18
  • 31
8
votes
2 answers

React: How to shift focus using arrow keys? (TreeView)

I am looking for solution which allow to focus elements inside treeview using arrow keys. Currently, I have treeView (ul) and treeNode (li). Each treeNode may have their own treeView and so on. Every treeNode has tabIndex="0" property to add…
Roman Mahotskyi
  • 4,576
  • 5
  • 35
  • 68
7
votes
4 answers

Google Chrome console.log out of sequence?

Can someone explain the following two outputs? Code 1: console.log(itemsAry); //loadNextItem(); function loadNextItem(){ var item = itemsAry.shift(); console.log(item); } Result: ["cat-53", "cat-57", "cat-51", "cat-10", "cat-55", "cat-56",…
Tom Auger
  • 19,421
  • 22
  • 81
  • 104
7
votes
6 answers

Arithmetic Bit Shift of Double Variable Data Type in C

I am trying to arithmetic bit shift a double data type in C. I was wondering if this is the correct way to do it: NOTE: firdelay[ ][ ] is declared in main as double firdelay[8][12] void function1(double firdelay[][12]) { int * shiftptr; …
Veridian
  • 3,531
  • 12
  • 46
  • 80
7
votes
4 answers

What is the most efficient way to push and pop a list in Python?

In Python how do I write code which shifts off the last element of a list and adds a new one to the beginning - to run as fast as possible at execution? There are good solutions involving the use of append, rotate etc but not all may translate to…
D.Jordan
  • 89
  • 1
  • 1
  • 3
7
votes
4 answers

Is a union more efficient than a shift on modern compilers?

Consider the simple code: UINT64 result; UINT32 high, low; ... result = ((UINT64)high << 32) | (UINT64)low; Do modern compilers turn that into a real barrel shift on high, or optimize it to a simple copy to the right location? If not, then using a…
Adam Davis
  • 91,931
  • 60
  • 264
  • 330
7
votes
2 answers

Subtracting datetime value from previous row in pandas dataframe

I have a dataframe with two columns: Category and Datetime I want to create a new column that shows the difference between the Datetime of the current row vs the previous row, restarting at each category. What I have: Category Datetime A …
Josephine M. Ho
  • 543
  • 1
  • 6
  • 8
1 2
3
70 71