Best practices for circular shift (rotate) operations in C++

See also an earlier version of this answer on another rotate question with some more details about what asm gcc/clang produce for x86. The most compiler-friendly way to express a rotate in C and C++ that avoids any Undefined Behaviour seems to be John Regehr’s implementation. I’ve adapted it to rotate by the width of … Read more

Android: Bitmaps loaded from gallery are rotated in ImageView

So, as an example… First you need to create an ExifInterface: ExifInterface exif = new ExifInterface(filename); You can then grab the orientation of the image: orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1); Here’s what the orientation values mean: http://sylvana.net/jpegcrop/exif_orientation.html So, the most important values are 3, 6 and 8. If the orientation is ExifInterface.ORIENTATION_ROTATE_90 (which is 6), for … Read more

JS Client-Side Exif Orientation: Rotate and Mirror JPEG Images

The github project JavaScript-Load-Image provides a complete solution to the EXIF orientation problem, correctly rotating/mirroring images for all 8 exif orientations. See the online demo of javascript exif orientation The image is drawn onto an HTML5 canvas. Its correct rendering is implemented in js/load-image-orientation.js through canvas operations. Hope this saves somebody else some time, and … Read more

Evenly space multiple views within a container view

LOOK, NO SPACERS! Based on suggestions in the comments section of my original answer, especially @Rivera’s helpful suggestions, I’ve simplified my original answer. I’m using gifs to illustrate just how simple this is. I hope you find the gifs helpful. Just in case you have a problem with gifs, I’ve included the old answer below … Read more

CSS3 Rotate Animation

Here is a demo. The correct animation CSS: .image { position: absolute; top: 50%; left: 50%; width: 120px; height: 120px; margin:-60px 0 0 -60px; -webkit-animation:spin 4s linear infinite; -moz-animation:spin 4s linear infinite; animation:spin 4s linear infinite; } @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } … Read more

Why does an image captured using camera intent gets rotated on some devices on Android?

Most phone cameras are landscape, meaning if you take the photo in portrait, the resulting photos will be rotated 90 degrees. In this case, the camera software should populate the Exif data with the orientation that the photo should be viewed in. Note that the below solution depends on the camera software/device manufacturer populating the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)