Questions tagged [reverse]

Rearranging the order of a sequence such that the final order is a mirror image of the original.

Rearranging the order of a sequence such that the final order is a mirror image of the original.

3773 questions
106
votes
8 answers

c# Trying to reverse a list

I have the following code: public class CategoryNavItem { public int ID { get; set; } public string Name { get; set; } public string Icon { get; set; } public CategoryNavItem(int CatID, string CatName, string CatIcon) { …
Tom Gullen
  • 61,249
  • 84
  • 283
  • 456
105
votes
3 answers

Best way to create a "reversed" list in Python?

In Python, what is the best way to create a new list whose items are the same as those of some other list, but in reverse order? (I don't want to modify the existing list in place.) Here is one solution that has occurred to me: new_list =…
davidchambers
  • 23,918
  • 16
  • 76
  • 105
88
votes
4 answers

How do i pass GET parameters using django urlresolvers reverse

I am using django 1.2 and going from one view to another using the urlresolvers reverse method. url = reverse(viewOne) and I want to pass a get parameter, for example name = 'joe' so that in the viewOne if I do def viewOne(request): …
yossi
  • 12,945
  • 28
  • 84
  • 110
84
votes
2 answers

How to reverse order a vector?

Suppose I have a vector v, how do I get its reverse, i.e. last element first? The first thing that comes to me is v[length(v):1], but it returns NA when v is numeric(0), while user normally expect sorting nothing returns nothing, not sorting nothing…
Tankman六四
  • 1,638
  • 2
  • 13
  • 19
81
votes
6 answers

Including a querystring in a django.core.urlresolvers reverse() call

I'm trying to reverse a named URL and include a querystring in it. Basically, I've modified the login function, and I want to send ?next= in it. Here's what I'm doing now: reverse(name) + "?next=" + reverse(redirect) Here's what I'd like to do:…
Brian Hicks
  • 6,213
  • 8
  • 51
  • 77
80
votes
14 answers

Printing an array in C++?

Is there a way of printing arrays in C++? I'm trying to make a function that reverses a user-input array and then prints it out. I tried Googling this problem and it seemed like C++ can't print arrays. That can't be true can it?
JohnHemmars
71
votes
12 answers

Best way to loop over a python string backwards

What is the best way to loop over a python string backwards? The following seems a little awkward for all the need of -1 offset: string = "trick or treat" for i in range(len(string)-1, 0-1, -1): print string[i] The following seems more…
clwen
  • 20,004
  • 31
  • 77
  • 94
69
votes
6 answers

How to reverse String.fromCharCode?

String.fromCharCode(72) gives H. How to get number 72 from char H?
IAdapter
  • 62,595
  • 73
  • 179
  • 242
67
votes
2 answers

How to reverse an std::string?

Im trying to figure out how to reverse the string temp when I have the string read in binary numbers istream& operator >>(istream& dat1d, binary& b1) { string temp; dat1d >> temp; }
Kameron Spruill
  • 679
  • 1
  • 5
  • 3
67
votes
7 answers

Linux: Find all symlinks of a given 'original' file? (reverse 'readlink')

Consider the following command line snippet: $ cd /tmp/ $ mkdir dirA $ mkdir dirB $ echo "the contents of the 'original' file" > orig.file $ ls -la orig.file -rw-r--r-- 1 $USER $USER 36 2010-12-26 00:57 orig.file # create symlinks in dirA and dirB…
sdaau
  • 36,975
  • 46
  • 198
  • 278
63
votes
3 answers

How can I capture which direction is being panned using UIPanGestureRecognizer?

Ok so I have been looking around at just about every option under the sun for capturing multi-touch gestures, and I have finally come full circle and am back at the UIPanGestureRecognizer. The functionality I want is really quite simple. I have…
Brandon B.
  • 727
  • 2
  • 8
  • 9
63
votes
3 answers

Apache reverse proxy with basic authentication

Trying to configure my reverse proxy with basic authentication before forward the traffic to my back end server. Can any one give me a solution. Example here: User(internet) -> reverse proxy / vhosts server (need to add basic authentication here )…
Vincent P
  • 761
  • 1
  • 5
  • 6
63
votes
3 answers

How to unzip, edit and zip an android apk

I have an android apk and I deleted my source code and dont have the project again, I want to change the version code of the old apk. my question is how do I unzip and repack the apk so I can use the. am using a mac system. I saw so many things for…
user1662302
62
votes
5 answers

android - reverse the order of an array

I have an array of objects. Is it possible to make a new array that is a copy of this array, but in reverse order? I was looking for something like this. // my array ArrayList mElements = new ArrayList(); // new…
user401183
  • 2,530
  • 4
  • 27
  • 25
59
votes
11 answers

How to reverse order of keys in python dict?

This is my code : a = {0:'000000',1:'11111',3:'333333',4:'444444'} for i in a: print i it shows: 0 1 3 4 but I want it to show: 4 3 1 0 so, what can I do?
zjm1126
  • 34,604
  • 53
  • 121
  • 166