Questions tagged [invert]

0

votes
0

answer
5

Views

Creating a second inverted singly-linked list based on another list

So I need to create a function that takes a normal singly-linked list and creates another list based on it, except the first element in the new list will be the last element in the original list and so on. It doesn't sound hard at all but my function for some reason only ever returns the same numbe...
Matt17BR
1

votes
1

answer
76

Views

Inversing a twodimensional array in python

I have an array a, which is twodimensional. A contains objects which also contain objects. I want to make sure that a[1,1] becomes a[n,n], a[2,1] becomes a[n-1,n], a[2,2] becomes a[n-1][n-1] etc. I wrote the following code to do this: tempArray = copy(self.topArea) for y in range(0,len(tempArray)):...
Cheiron
1

votes
1

answer
229

Views

Invert all colors with LESS

I have a stylesheet I am happy with and I compile it using the following code. Works great. function css($inputFile, $outputFile) { $cacheFile = $inputFile.".cache"; $cache = file_exists($cacheFile) ? unserialize(file_get_contents($cacheFile)) : $inputFile; $less = new lessc; $less->setFormatter("co...
Svish
1

votes
1

answer
569

Views

Incorrect results with invert in opencv

I am using opencv library in c++ for matrix inversion. I use the function invert with DECOMP_SVD flag. For matrices which are not singular, it computes using SVD method. However it gives me an incorrect answer for singular matrices (determinant = 0) when I compare it to the output in Matlab for the...
MonsieurBeilto
1

votes
1

answer
130

Views

Algorithm for Deep Hash Invert (should be in ruby)

I have a hash H (see bottom) and need to perform a deep invert operation on it, such that a new hash H2 is returned where each key K is a value inside the original hash. The keys in H2 map to an array of arrays of all the sequences of keys that, when applied onto the original hash H would give you t...
theideasmith
4

votes
2

answer
214

Views

Invert last bit

How can I invert the last bit in an int? int a = 11; System.out.print(a + " " + Integer.toBinaryString(a)) //11 1011 int b = invertLastBit(a); System.out.print(b + " " + Integer.toBinaryString(b)); //10 1010 I wrote this: static int invertLastBit(int i) { String s = Integer.toBinaryString(i); if (s....
maks28rus
2

votes
5

answer
386

Views

Cannot create a program which will invert string

I am using Linux. I am trying to write a program in c that will print a string backward. Here is my code: #include #include #include int main (){ char string[100]; printf ("Enter string:\n"); gets (string); int length = strlen (string)-1; for (length = length; length>=0; length--){ puts (string[l...
Tom
19

votes
3

answer
3.1k

Views

Is there a conventional method for inverting NSColor values?

I'm looking for a way to invert arbitrary NSColor values at runtime, and there doesn't appear to be any built-in method to do so. I will be using a category to extend NSColor as follows: NSColor * invertedColor = [someOtherColor inverted]; Here is the category method prototype that I am using: @impl...
e.James
2

votes
3

answer
2.2k

Views

Inverting a diff or patch || CVS diff

In CVS, my working copy (WC) is on a certain branch (which we'll call "foo"). There have been other changes checked into foo by another dev. I want to do a diff between my WC and the upstream state of foo. Normally, when working in the trunk (HEAD), I just do a cvs diff, and that's fine. But for...
Pistos
5

votes
2

answer
6.8k

Views

css filter invert() not working on mozilla firefox?

I'm having an annoying issue with the css filter invert(); on Firefox 25. This is the code, inserted inside jQuery .ready() context: $('#colorcontrast').bind('click', function() { var css = 'html {'+ ' filter:invert(100%);' + ' -webkit-filter: invert(100%);' + ' -o-filter:invert...
Shad
1

votes
3

answer
4k

Views

invert specific bits using bitwise NOT

does anyone have experience to use Bitwise Not to invert specific bits for x number. I know we can do this use XOR and mask but question requires use NOT. I need to invert a group of bis starting at a given position. The variable inside the function includes original value, position wants to start...
user3552515
2

votes
2

answer
350

Views

Is it possible to invert audio using the HTML5 audio API?

I'm playing around a little with the HTML5 Audio API and wondering if it's possible to invert waveforms? That is, completely flip a waveform, in effect cancelling it out. Appreciate any insight. Greg
lionysis
2

votes
4

answer
8.4k

Views

Jython convert picture to grayscale and then negate it

Please bear with me, I've only started python a few weeks ago. I am using JES. I have made a function to convert a picture to grayscale. I created two names for each color r and r1, g and g1, b and b1. The idea behind this, was to keep the original values in memory, so the picture could be restored...
Yvette Colomb
6

votes
3

answer
2.4k

Views

Inverted glyph: bitmap > SVG via autotrace > glyph via fontforge

I am trying to create a font/glyph by: taking a bitmap image creating an SVG with autotrace (on Linux) importing the outline as a glyph with python-fontforge (glyph.importOutlines(svgfile) ) This works fine except that the resulting glyph in inverted (see images). Any idea how this can be prevented...
Hoff
3

votes
2

answer
5.6k

Views

Draw standard NSImage inverted (white instead of black)

I'm trying to draw a standard NSImage in white instead of black. The following works fine for drawing the image in black in the current NSGraphicsContext: NSImage* image = [NSImage imageNamed:NSImageNameEnterFullScreenTemplate]; [image drawInRect:r fromRect:NSZeroRect operation:NSCompositeSourceOver...
smartgo
1

votes
2

answer
154

Views

Auto Layout inverts views horizontally iOS

I haven’t been able to pinpoint the cause of an issue i’m having , regarding our company project. I have notice that in all the auto layout views in the project , the views that appear to be attached to a specific side in interface builder, are presented on the opposite side after the build. I...
Benzi Heler
2

votes
4

answer
82

Views

Inverting a two-dimensional array

I'm trying to invert and flip a two-dimensional array, but something goes wrong! Flipping works ok, but inverting is not. Can't find a mistake right here: public int[][] flipAndInvert(int[][] A) { int row = -1; int col = -1; int[][] arr = A; for (int i = 0; i < arr.length; i++) { row++; col = -1; fo...
Dmytro Z.
3

votes
3

answer
978

Views

iOS openGL image invert

I'm trying to get create an inverse of an image, as part of an app. I have implemented some image processing using openGL, following the GLImageProcessing demo from Apple. My image is loaded from a .jpg, and loaded to a texture. I can happily modify contrast and brightness. However, I am having unsa...
Deaglan O Meachair
3

votes
4

answer
12.8k

Views

How to flip an image horizontally

HiI was wondering how to flip and image horizontally, for a practce task I was given a code that reads an image, inverting it to an image indicating it's brightness from 0-5, I had to flip an image. This is my code of my reading an image and drawing it public int[][] readImage(String url) throws IO...
Judy Tran
4

votes
3

answer
23.9k

Views

Invert text-color of a specific element (using jQuery)

How do I invert the text-color of an element using jQuery? Invert me
David Knaack
3

votes
1

answer
2.1k

Views

Invert enum flags

Lets say I have the following flags: [Flags] public enum Foo { None = 0, Foo1 = 1, Foo2 = 2, Foo4 = 4, Foo8 = 8 } Now I have a variable foo: var foo = Foo.Foo1 | Foo.Foo4; What I want to get is the following the inverted flags of foo. That would mean something like this: Foo.Foo2 | Foo.Foo8 I've tri...
Florian
1

votes
2

answer
2.5k

Views

css invert filer in Chrome

I have BODY { -webkit-filter: invert(100%); -moz-filter: invert(100%); -ms-filter: invert(100%); -o-filter: invert(100%); filter: invert(100%); } and .jpg { -webkit-filter: invert(0%) !important; -moz-filter: invert(0%) !important; -ms-filter: invert(0%) !important; -o-filter: invert(0%) !important...
Ole Sørensen
4

votes
5

answer
3.2k

Views

invert white to black uiimage

I have the following UIImage: Using Objective-C, I want to be able to invert the white to black and vice versa. Any help would be appreciated.
Maystro
1

votes
3

answer
63

Views

Need to use invert grep option with -A tag

I have a list like the following: Name_JR_1 1.1.1.1 Name_SR_1 2.2.2.2 Name_NONE_1 3.3.3.3 If I want to chose all associated name with following numerical syntax I can run as follows: grep "JR" -A1 file_name and this will print what I want: Name_JR_1 1.1.1.1 I need a way to invert this however, where...
JimRomeFan
6

votes
4

answer
10.5k

Views

Invert height direction in CSS

I want to change the height growth path of Top-down to Down-top Is it possible in CSS? this is my code http://jsfiddle.net/yasharshahmiri/1pkemq1p/3/ .buttom{ margin-top:200px; margin-right:34px; width:150px; height:45px; background:black; float:right; transition-duration:2s; } .buttom:hover{ heig...
Yashar Shahmiri
3

votes
2

answer
69

Views

What would be a compact way to return 1 if a variable is 0 and to return 0 if it is 1?

How could the following be made more compact (perhaps using Booleans), given that I am supplied with an integer variable? indexTag = 0 # or 1 1 if indexTag == 0 else 0
d3pd
24

votes
8

answer
20.5k

Views

Java invert map

I need create inverse map - select unique values and for them find keys. Seems that only way is to iterate all key/value pairs, because entrySet returns set of so value not unique? Thanks.
user710818
3

votes
2

answer
4.9k

Views

Invert image faster in C#

I'm using WinForms. I have a picture-box in my form. When I open a picture in the picture-box I am able to invert the colors back and forth on a click of a button, but my code is extremely slow. How can I increase the performance. private void Button1_Click(object sender, System.EventArgs e) { Bit...
taji01
1

votes
3

answer
1k

Views

Why is nlogn so hard to invert?

Lets say I have a function that is nlogn in space requirements, I want to work out the maximum size of input for that function for a given available space. i.e. I want to find n where nlogn=c. I followed an approach to calculate n, that looks like this in R: step = function(R, z) { log(log(R)-z)}...
casbon
4

votes
3

answer
6.9k

Views

How to I invert a 2d list in python [duplicate]

This question already has an answer here: Transpose list of lists 10 answers I have a 2d list like this: 1 2 3 4 5 6 and I want to make this: 1 4 2 5 3 6 I've tried to do a for loop and switch each value but I keep getting an index out of bound error. Here's what I have: for i in resu...
R Doolabh
30

votes
1

answer
18.1k

Views

Inverting a numpy boolean array using ~

Can I use ~A to invert a numpy array of booleans, instead of the rather awkward functions np.logical_and() and np.invert()? Indeed, ~ seems to work fine, but I can't find it in any nympy reference manual, and - more alarmingly - it certainly does not work with scalars (e.g. bool(~True) returns True...
Rolf Bartstra
2

votes
2

answer
362

Views

Java invert a map

I need to invert an original map. which type is , like {1 = A, 2 = A, 3 = B....}. I want to create a new map which is String to ArrayList because if 1 = A, and 2 = A, than I want to have something like this: A = [1, 2]. So how can I do that?
Anderson
1

votes
3

answer
1.3k

Views

How do I invert key and value in RDD in Python 3 pyspark?

This works in Python 2.7, but in Python 3.5 it returns SyntaxError: invalid syntax. I'm not sure if this has to do with the fact that "tuple unpacking" was removed from Python 3, as I read on another post, or is a different issue. rddInverted = rdd.map(lambda (x,y): (y,x))
Deana H.
2

votes
1

answer
698

Views

Controlling position of the CSS mirrored text

Using code from the answer to this question I managed to mirror text but now it's out of the flow of normal text. span.flip { display: block; -moz-transform: scaleX(-1); /* Gecko */ -o-transform: scaleX(-1); /* Operah */ -webkit-transform: scaleX(-1); /* webkit */ transform: scaleX(-1); /* standard...
user1378031
7

votes
3

answer
5.1k

Views

How to invert colors of an image in pygame?

I have a pygame Surface and would like to invert the colors. Is there any way quicker & more pythonic than this? It's rather slow. I'm aware that subtracting the value from 255 isn't the only definition of an "inverted color," but it's what I want for now. I'm surprised that pygame doesn't have so...
Ain Britain
33

votes
7

answer
57.1k

Views

How do I invert a colour?

I know that this won't directly invert a colour, it will just 'oppose' it. I was wondering if anyone knew a simple way (a few lines of code) to invert a colour from any given colour? At the moment I have this (which isn't exactly the definition of an invert, because if I pass it a grey / gray colour...
ThePower
3

votes
2

answer
565

Views

Invert colours with CSS on mouse over

I have all of my categories shown in white DIVs with blue icons/text on them. I would like to invert the colors on mouse over, making the background blue and the icons/text white instead. Clouds 4 Listings I've got the background working without any issue, however I am not sure how to apply a white...
2

votes
1

answer
391

Views

How can use invert grep after pipe?

I want to list directory disk usage in a fileserver. I also want to ignore the error messages. Here is my command: du -sh * | grep -v "Permission denied" | sort -n The result still contains the permission denied lines: du: cannot access './myFile1/': Permission denied du: cannot access './myFile2/'...
user3816048
1

votes
6

answer
802

Views

C++ - inverting enum value

I have an enumeration declared like this: enum class ShootingDirection { Down, Up, Right, Left }; I've also declared a class member of that type that needs to be inverted in some method, it doesn't matter why and where. By inverted I mean Down -> Up (also vice versa) and Right -> Left (again, vice v...
Venom
3

votes
2

answer
178

Views

C++ does what it wants | Char[] cout and inverted char[]

I'm actually working on a C++ Invert String/Char[] Methods #include using namespace std; void inverse(string input) { int length = input.length(); char* output = new char[length]; for(int i = 0; i < length; i++) { output[length - (i + 1)] = input[i]; } cout in; inverse(in); } return 0; } The probl...
CooliMC

View additional questions