erase

Clearing the terminal screen?

拥有回忆 提交于 2019-12-20 10:32:41
问题 I'm reading data from 9 different sensors for my robot and I need to display them all steadily, in the same window so I can compare the values and see if any of the readings is off. The problem I'm having with both Serial.print and lcd.print is that the values are constantly moving and I can't really have a good look at them while moving the robot. I was thinking to call something like Serial.clear() before displaying anything else and that would just keep things steady and in one place,

c++11: erase using a const_iterator

核能气质少年 提交于 2019-12-19 16:47:11
问题 I believe that since C++11, the erase function of most containers (e.g. std::vector ) accepts a const_iterator as parameter: iterator erase (const_iterator position); Still my compilers (GCC 4.8 and Clang 3.2, both using GCC libstdc++) won't allow me to use such function, even when compiling with --std=c++11 . Is it a compiler/libstdc++ bug, or did I do something bad? This is a sample code: #include <vector> int main( ) { std::vector<int> v; v.push_back( 1 ); v.push_back( 2 ); v.push_back( 3

Javascript erase image with cursor

送分小仙女□ 提交于 2019-12-19 04:07:17
问题 Is it possible with javascript? I'm trying to implement a scratchcard type thing, and I was wondering if the user could 'scratch it' with his cursor and then javascript would remove/erase the image to show the text below. But i've not been able to find anything (javascript wise) which can erase abit (cursor location) of an image. Does anyone have any suggestions/ideas? Thanks. 回答1: Use html5 canvas element. Checkout this fiddle for an example: http://jsfiddle.net/ArtBIT/WUXDb/1/ 回答2: jQuery

How does a 7- or 35-pass erase work? Why would one use these methods?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 11:37:18
问题 How and why do 7- and 35-pass erases work? Shouldn't a simple rewrite with all zeroes be enough? 回答1: I'd never heard of the 35-part erase: http://en.wikipedia.org/wiki/Gutmann_method The Gutmann method is an algorithm for securely erasing the contents of computer hard drives, such as files. Devised by Peter Gutmann and Colin Plumb, it does so by writing a series of 35 patterns over the region to be erased. The selection of patterns assumes that the user doesn't know the encoding mechanism

How to delete “px” from 245px

一世执手 提交于 2019-12-18 10:13:15
问题 Whats a simple way to delete the last two characters of a string? 回答1: To convert 245px in 245 just run: parseInt('245px', 10); It retains only leading numbers and discards all the rest. 回答2: use var size = parseInt('245px', 10); where 10 is the radix defining parseInt is parsing to a decimal value use parseInt but don't use parseInt without a radix The parseInt() function parses a string and returns an integer. The signature is parseInt(string, radix) The second argument forces parseInt to

How do I erase printed characters in a console application(Linux)?

别等时光非礼了梦想. 提交于 2019-12-17 23:18:05
问题 I am creating a small console app that needs a progress bar. Something like... Conversion: 175/348 Seconds |========== | 50% My question is, how do you erase characters already printed to the console? When I reach the 51st percentage, I have to erase this line from the console and insert a new line. In my current solution, this is what happens... Conversion: 175/348 Seconds |========== | 50% Conversion: 179/348 Seconds |========== | 52% Conversion: 183/348 Seconds |========== | 54% Conversion

Vector.erase(Iterator) causes bad memory access

心不动则不痛 提交于 2019-12-17 13:46:04
问题 I am trying to do a Z-Index reordering of videoObjects stored in a vector . The plan is to identify the videoObject which is going to be put on the first position of the vector , erase it and then insert it at the first position. Unfortunately the erase() function always causes bad memory access. Here is my code: testApp.h: vector<videoObject> videoObjects; vector<videoObject>::iterator itVid; testApp.cpp: // Get the videoObject which relates to the user event for(itVid = videoObjects.begin()

Vector.erase(Iterator) causes bad memory access

六眼飞鱼酱① 提交于 2019-12-17 13:45:08
问题 I am trying to do a Z-Index reordering of videoObjects stored in a vector . The plan is to identify the videoObject which is going to be put on the first position of the vector , erase it and then insert it at the first position. Unfortunately the erase() function always causes bad memory access. Here is my code: testApp.h: vector<videoObject> videoObjects; vector<videoObject>::iterator itVid; testApp.cpp: // Get the videoObject which relates to the user event for(itVid = videoObjects.begin()

Erase the current printed console line

吃可爱长大的小学妹 提交于 2019-12-17 02:33:39
问题 How can I erase the current printed console line in C? I am working on a Linux system. For example - printf("hello"); printf("bye"); I want to print bye on the same line in place of hello. 回答1: You can use VT100 escape codes. Most terminals, including xterm, are VT100 aware. For erasing a line, this is ^[[2K . In C this gives: printf("%c[2K", 27); 回答2: You can use a \r (carriage return) to return the cursor to the beginning of the line: printf("hello"); printf("\rbye"); This will print bye on

Trying to delete comments from code inputed by user C++

不想你离开。 提交于 2019-12-14 03:59:03
问题 string code; cout << "Enter code\n"; getline(cin, code, '~'); size_t comment = code.find('/*'); size_t second = code.find('*/', comment); size_t first = code.rfind('/*', comment); code.erase(first, second - first); cout << code << '\n'; INPUT /*comment comment*/ okay~ OUTPUT // okay ============= the program deletes everything between /* */ , but won't delete the / /. Am I missing something? 回答1: Yes, you're missing two backslashes, Actually, you should use code.erase(first-1, second - first