reverse

Media element Rewind

匆匆过客 提交于 2019-11-29 17:07:40
In my application, I play a video file using the MediaElement control, and I need to have fast forward and rewind options. For fast forward, I increased the SpeedRatio , but how can I implement fast rewind? I want to play the video in reverse (in appropriate speed ratio). You could set the MediaElement.ScrubbingEnabled property to true, and pause the MediaElement, and then periodically change its MediaElement.Position property backwards to mimic the rewinding behaviour. 来源: https://stackoverflow.com/questions/10880331/media-element-rewind

How to reverse lines of a text file?

旧街凉风 提交于 2019-11-29 16:09:28
问题 I'm writing a small shell script that needs to reverse the lines of a text file. Is there a standard filter command to do this sort of thing? My specific application is that I'm getting a list of Git commit identifiers, and I want to process them in reverse order: git log --pretty=oneline work...master | grep -v DEBUG: | cut -d' ' -f1 | reverse The best I've come up with is to implement reverse like this: ... | cat -b | sort -rn | cut -f2- This uses cat to number every line, then sort to sort

A ref or out argument must be an assignable variable

喜你入骨 提交于 2019-11-29 15:10:55
I'm coding an application which can make a reverse proxy connection but I have a problem! The error is here: new Form1.ProxyConfig() When I try to run it I get an error: " A ref or out argument must be an assignable variable " private void startToolStripMenuItem_Click(object sender, EventArgs e) { if (this.startToolStripMenuItem.Text == "Start") { var form2 = new Form2(); if (form2.ShowDialog() != DialogResult.OK) return; int num1 = Form1.ProxyListenerStart(ref new Form1.ProxyConfig() { pclient_port = form2.ClientPort, pp_start = form2.LocalStartPort, pp_end = form2.LocalEndPort }, ref this.

Python reverse() for palindromes

五迷三道 提交于 2019-11-29 13:56:52
I'm just getting started in python, and I'm trying to test a user-entered string as a palindrome. My code is: x=input('Please insert a word') y=reversed(x) if x==y: print('Is a palindrome') else: print('Is not a palindrome') This always returns false because y becomes something like <reversed object at 0x00E16EF0> instead of the reversed string. What am I being ignorant about? How would you go about coding this problem? Try y = x[::-1] . This uses splicing to get the reverse of the string. reversed(x) returns an iterator for looping over the characters in the string in reverse order, not a

ggplot2: Reversing secondary continuous x axis

淺唱寂寞╮ 提交于 2019-11-29 12:28:37
I am trying to reverse the secondary X axis on top of my ggplot. ggplot( data=MasterTable, aes(x=Concentration, y=Signal, color=factor(Assay))) + scale_x_continuous("Chemical 1", sec.axis = sec_axis(~ . *1, name = "Chemical 2"), scale_x_reverse(limits=c(400,0))) If you remove the last section of the code ( scale_x_reverse ...) it makes a plot with a secondary that is identical to the bottom X axis. I have managed to reverse the bottom axis but this also reverses the top axis. I am looking to only reverse the top axis. Any help on this would be really appreciated. Thanks! Here is a possibile

Value of the last element of a list

一个人想着一个人 提交于 2019-11-29 09:13:05
how to get the value of the last element of a List? I've noted that List.hd (or .Head) return an item, while List.tl (or .Tail) returns a List. Is rev the List and get the hd the only way around? Thanks. Try this function. It uses recursion, though it gets optimised to iteration anyway since it's tail recursion. In any case, it is most likely quicker than reversing the entire list (using List.rev ). let rec last = function | hd :: [] -> hd | hd :: tl -> last tl | _ -> failwith "Empty list." The answer of Pavel Minaev is definitely worth taking into account, however. Nonetheless, the algorithm

Why there is two completely different version of Reverse for List and IEnumerable?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 09:04:41
For the List object, we have a method called Reverse() . It reverse the order of the list 'in place', it doesn't return anything. For the IEnumerable object, we have an extension method called Reverse() . It returns another IEnumerable. I need to iterate in reverse order throught a list, so I can't directly use the second method, because I get a List, and I don't want to reverse it, just iterate backwards. So I can either do this : for(int i = list.Count - 1; i >=0; i--) Or foreach(var item in list.AsEnumerable().Reverse()) I found it less readable than if I have an IEnumerable, just do

reverse a linked list? [duplicate]

旧城冷巷雨未停 提交于 2019-11-29 08:59:05
This question already has an answer here: Create a reverse LinkedList in C++ from a given LinkedList 9 answers Im trying to reverse the order of the following linked list, I've done so, But the reversed list does not seem to print out. Where have I gone wrong? //reverse the linked list #include <iostream> using namespace std; struct node{ int number; node *next; }; node *A; void addNode(node *&listpointer, int num){ node *temp; temp = new node; temp->number = num; temp->next = listpointer; listpointer = temp; } void reverseNode(node *&listpointer){ node *temp,*current; current = listpointer;

“target record-full” in gdb makes “n” command fail on printf with “Process record does not support instruction 0xc5 at address 0x7ffff7dee6e7”?

十年热恋 提交于 2019-11-29 08:06:20
I was tring to use "reverse-step" and "reverse-next" command inside gdb. Stack overflow tells me that I should run "target record-full" in the execution context where I wish to "rn" and "rs". But some weird error happened: 1 2 #include<stdio.h> 3 int i=0; 4 void fa() 5 { 6 ++i; 7 printf("%d\n",i); 8 ++i; 9 } 10 int main(){ 11 fa(); 12 return 0; 13 } I compile and run this program: (gdb) b 4 Breakpoint 1 at 0x40052a: file test02.c, line 4. (gdb) r Starting program: /home/Troskyvs/a.out Breakpoint 1, fa () at test02.c:6 6 ++i; (gdb) target record-full (gdb) n 7 printf("%d\n",i); (gdb) n # Error

C - reverse a number

瘦欲@ 提交于 2019-11-29 07:35:58
I am coding in C on linux, and I need to reverse a number. (EG: 12345 would turn into 54321), I was going to just convert it into a string using itoa and then reverse that, as it's probably a lot easier with string manipulation, however it turns out itoa is non standard and isn't included in gcc. Is there a way of doing a binary rotation style thing on decimal numbers and if not what approach should I take? int n; scanf("%d",&n); int rev=0,rem; while(n>0) { rem=n%10; //take out the remainder .. so it becomes 5 for 12345 rev=rev*10+rem; //multiply the current number by 10 and add this remainder