Matplotlib plot zooming with scroll wheel

This should work. It re-centers the graph on the location of the pointer when you scroll. import matplotlib.pyplot as plt def zoom_factory(ax,base_scale = 2.): def zoom_fun(event): # get the current x and y limits cur_xlim = ax.get_xlim() cur_ylim = ax.get_ylim() cur_xrange = (cur_xlim[1] – cur_xlim[0])*.5 cur_yrange = (cur_ylim[1] – cur_ylim[0])*.5 xdata = event.xdata # get … Read more

Blackberry – fields layout animation

This effect may be easily achived with custom layout: class AnimatedManager extends Manager { int ANIMATION_NONE = 0; int ANIMATION_CROSS_FLY = 1; boolean mAnimationStart = false; Bitmap mBmpBNormal = Bitmap.getBitmapResource(“blue_normal.png”); Bitmap mBmpBFocused = Bitmap.getBitmapResource(“blue_focused.png”); Bitmap mBmpRNormal = Bitmap.getBitmapResource(“red_normal.png”); Bitmap mBmpRFocused = Bitmap.getBitmapResource(“red_focused.png”); Bitmap mBmpYNormal = Bitmap.getBitmapResource(“yellow_normal.png”); Bitmap mBmpYFocused = Bitmap.getBitmapResource(“yellow_focused.png”); Bitmap mBmpGNormal = Bitmap.getBitmapResource(“green_normal.png”); Bitmap … Read more

How to do page navigation for many, many pages? Logarithmic page navigation

Here’s my solution – use “Logarithmic Page Navigation”: This can be achieved by having page numbers distributed logarithmically, according to distance from either the endpoints or the current page. Here’s an example of what I mean: 1 2 3 4 5 6 . 10 . 20 . 30 . 40 . 50 .. 100 .. … Read more

Blackberry – Loading/Wait screen with animation

Fermin, Anthony +1. Thanks to all, you gave me the part of answer. My final solution: 1.Create or generate (free Ajax loading gif generator) animation and add it to project. 2.Create ResponseCallback interface (see Coderholic – Blackberry WebBitmapField) to receive thread execution result: public interface ResponseCallback { public void callback(String data); } 3.Create a class … Read more

How do you add UI inside cells in a google spreadsheet using app script?

The apps UI only works for panels. The best you can do is to draw a button yourself and put that into your spreadsheet. Than you can add a macro to it. Go into “Insert > Drawing…”, Draw a button and add it to the spreadsheet. Than click it and click “assign Macro…”, then insert … Read more

Good text foreground color for a given background color

For maximum legibility, you want maximum brightness contrast without getting into hues which don’t work together. The most consistent way to do this is to stick with black or white for the text color. You might be able to come up with more aesthetically pleasing schemes, but none of them will be more legible. To … Read more