How slicing in Python works

The syntax is: a[start:stop] # items start through stop-1 a[start:] # items start through the rest of the array a[:stop] # items from the beginning through stop-1 a[:] # a copy of the whole array There is also the step value, which can be used with any of the above: a[start:stop:step] # start through not … Read more

A non-nested animation sequence in jQuery?

You can make a custom .queue() to avoid the limitless nesting.. var q = $({}); function animToQueue(theQueue, selector, animationprops) { theQueue.queue(function(next) { $(selector).animate(animationprops, next); }); } // usage animToQueue(q, ‘#first’, {width: ‘+=100’}); animToQueue(q, ‘#second’, {height: ‘+=100’}); animToQueue(q, ‘#second’, {width: ‘-=50’}); animToQueue(q, ‘#first’, {height: ‘-=50’}); Demo at http://jsfiddle.net/gaby/qDbRm/2/ If, on the other hand, you want to … Read more

How to retrieve the current value of an oracle sequence without increment it?

SELECT last_number FROM all_sequences WHERE sequence_owner=”<sequence owner>” AND sequence_name=”<sequence_name>”; You can get a variety of sequence metadata from user_sequences, all_sequences and dba_sequences. These views work across sessions. EDIT: If the sequence is in your default schema then: SELECT last_number FROM user_sequences WHERE sequence_name=”<sequence_name>”; If you want all the metadata then: SELECT * FROM user_sequences WHERE … Read more

Matplotlib – sequence is off when using plt.imshow()

It seems you are using Juypter notebook. This always shows any autogenerated output (like the matplotlib figures) last in the output. You may use IPython.display.display to display the figures at the position of the output where they belong. import matplotlib.pyplot as plt import numpy as np from IPython.display import display images = [np.random.rayleigh((i+1)/8., size=(180, 200, … Read more