Questions tagged [peek]

Refers to a non-destructive operation performed on sequential, collection-like data structures that have the notion of "top element" or "next element", such as stacks, queues and streams. The `peek` operation returns the value of the "top" (or "next") element without "consuming" that element, i.e. without removing that element from the data structure.

163 questions
3
votes
1 answer

react-native ViewPagerAndroid peek property

How to properly use the "peekEnabled" property on ViewPagerAndroid ? {this.props.children} I want something like this
Tiziano Munegato
  • 869
  • 1
  • 7
  • 21
3
votes
1 answer

3D Touch Peek - Background Blur Color

When 3D Touch Peek is invoked, the background blur that happens, I notice it varies. For example, it's a LIGHT blur in iMessage, but DARK blur in FaceTime App. (Although below image might not be the best example to show the contrast, you can…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
3
votes
3 answers

How can I peek at the next character in a file in Python 3?

Suppose I'm building a parser, and I want to lookahead in the stream. In Python 2, I could write: def peek(): next = inputfile.read(1) inputfile.seek(-1,1) return next however, in Python 3, relative seeks were disabled.
John Doucette
  • 4,370
  • 5
  • 37
  • 61
3
votes
5 answers

Return value of ifstream.peek() when it reaches the end of the file

I was looking at this article on Cplusplus.com, http://www.cplusplus.com/reference/iostream/istream/peek/ I'm still not sure what peek() returns if it reaches the end of the file. In my code, a part of the program is supposed to run as long as this…
superlazyname
  • 265
  • 3
  • 7
  • 17
3
votes
1 answer

I pressed one cell in UITableViewl using 3D touch, then it prompted wrong cell view

In my test demo, I put a UITableView into UIViewController in storyboard. When I test demo on my iPhone, I pressed one cell in tableView, I got this error in picture wrong cell view In func previewingContext(previewingContext:…
JerryShi
  • 33
  • 4
3
votes
1 answer

Am I obliged to call EndPeek after using BeginPeek?

I have a Windows service that processes a private, local message queue (MSMQ). When it starts, it registers an event handler for PeekCompleted on the queue, and it then calls the asynchronous BeginPeek() to wait for a message to arrive. protected…
pleinolijf
  • 891
  • 12
  • 29
3
votes
1 answer

clang and libc++ istream::peek() does not set eof flag

I'm using Mac OSX 10.8.1 (Mountain Lion) with: Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) - latest available. Clang with libc++ std::istream::peek() seems to work incorrectly regarding eof detection. Problem does not…
gringo001
  • 31
  • 3
3
votes
2 answers

Removing Message from Queue only if user does some operation

We are having MVC application which reads data from MSMQ. We are trying to find out a way to read message from queue and remove it from queue only if user has done a successful operation on the queue. The message should remain in the queue until…
Balaji
  • 2,109
  • 5
  • 27
  • 34
2
votes
4 answers

Getting number of bytes available to read in a socket

Here's my scenario. I have a TCP client that is talking to the server. Both the server and the client are running on local machine (Windows). The dialog goes something like: Client sends data to the server (Request) Client does shutdown for send on…
Kiran M N
  • 424
  • 1
  • 6
  • 15
2
votes
6 answers

peek at input buffer, and flush extra characters in C

If I want to receive a one character input in C, how would I check to see if extra characters were sent, and if so, how would I clear that? Is there a function which acts like getc(stdin), but which doesn't prompt the user to enter a character, so I…
Carson Myers
  • 37,678
  • 39
  • 126
  • 176
2
votes
1 answer

How to peek into a TcpStream and block until enough bytes are available?

I would like to classify incoming tcp streams by their first n bytes and then pass to different handlers according to the classification. I do not want to consume any of the bytes in the stream, otherwise I will be passing invalid streams to the…
talz
  • 1,004
  • 9
  • 22
2
votes
0 answers

how do I determine whether a variable is stored as numeric or string in perl?

In the code below, we see that Dumper can tell whether a string variable (a variable for which the ref value is an empty string) is currently stored as numeric or as string. Is there any way, simpler than by using Dumper, to answer this question…
Jacob Wegelin
  • 1,304
  • 11
  • 16
2
votes
1 answer

iOS Storyboard Peak a stackview leaves whitespace on actionsheet present

In iOS11 on iPhone X, I'm having problems removing space on a peek. The space is between the top and the stackview. The white gap is the root view on the view controller. The constraints are set to safe area. The whitespace at the top only becomes…
Ostrich-39
  • 25
  • 1
  • 4
2
votes
0 answers

Error peek() returns \xff

I have some specific text formatting requirements for an assignment, so I am using peek() to try and see the next character and decide what to do, but sometimes my peek() returns \xff. What could this mean? It even stays at that point too. After…
L.Martin
  • 21
  • 4
2
votes
2 answers

Ifstream infinite loop (it never seems to find the marker to stop reading)

A rather quick question... I can't figure out why this loop never ends... #include #include using namespace std; int main() { //[city1][city2][distance] ifstream sourcefile; int data[50][50]; …
superlazyname
  • 265
  • 3
  • 7
  • 17