scaling

Scale image keeping its aspect ratio in background drawable

杀马特。学长 韩版系。学妹 提交于 2019-11-27 00:40:22
问题 How do I make a background image fit the view but keep its aspect ratio when using <bitmap /> as a background drawable XML? None of <bitmap> 's android:gravity values gives the desired effect. 回答1: It is impossible to achieve manipulating background attribute within xml-files only. There are two options: You cut/scale the bitmap programmatically with Bitmap.createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter) and set it as some View 's background. You use ImageView

How does noSQL perform horizontal scaling and how it is more efficient than RDBMS scaling

非 Y 不嫁゛ 提交于 2019-11-26 23:41:22
问题 I was reading about noSQL and relational DBMSs. After going through many posts, I am not able to find out exactly how noSQL systems perform horizontal scaling and how it is more efficient than RDBMS scaling. After all, RDBMSs also do replication and sharding. How this is fast in case of NoSql? 回答1: First of all, there is no technology or product called "NoSQL." NoSQL is a broad category describing dozens of different technologies, which each work differently. Please don't use the term "NoSQL"

Chrome, Safari ignoring max-width in table

佐手、 提交于 2019-11-26 22:16:30
问题 I've got HTML code like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> <title></title> </head> <body> <table style="width:100%;"> <tr> <td> <table style="width:100%; max-width:1000px; background:#000099;"> <tr> <td> 001 </td> </tr> </table> </td> </tr> </table> </body> </html> The

Emulating palette based graphics in WebGL v.s. Canvas 2D

爱⌒轻易说出口 提交于 2019-11-26 20:31:52
Currently, I'm using 2D canvas context to draw an image generated (from pixel to pixel, but refreshed as a whole buffer in once after a generated frame) from JavaScript at about a 25fps rate. The generated image is always one byte (integer / typed array) per pixel and a fixed palette is used to generate RGB final result. Scaling is also needed to adopt to the size of the canvas (ie: going to fullscreen) and/or at user request (zoom in/out buttons). The 2D context of canvas is OK for this purpose, however I'm curious if WebGL can provide better result and/or better performance. Please note: I

How to scale SVG image to fill browser window?

六眼飞鱼酱① 提交于 2019-11-26 19:35:25
This seems like it ought to be easy, but I'm just not getting something. I want to make an HTML page containing a single SVG image that automatically scales to fit the browser window, without any scrolling and while preserving its aspect ratio. For example, at the moment I have a 1024x768 SVG image; if the browser viewport is 1980x1000 then I want the image to display at 1333x1000 (fill vertically, centred horizontally). If the browser was 800x1000 then I want it to display at 800x600 (fill horizontally, centred vertically). Currently I have it defined like so: <body style="height: 100%"> <div

How do I scale one rectangle to the maximum size possible within another rectangle?

可紊 提交于 2019-11-26 18:59:03
问题 I have a source rectangle and a destination rectangle. I need to find the maximum scale to which the source can be scaled while fitting within the destination rectangle and maintaining its original aspect ratio . Google found one way to do it but I'm not sure if it works in all cases. Here is my home-brewed solution: Calculate Height/Width for each rectangle. This gives the slopes of the diagonals msrc and mdest . If msrc < mdst , scale source width to fit the destination width (and scale

Image scaling causes poor quality in firefox/internet explorer but not chrome

馋奶兔 提交于 2019-11-26 18:44:23
See http://jsfiddle.net/aJ333/1/ in Chrome and then in either Firefox or Internet Explorer. The image is originally 120px, and I'm scaling down to 28px, but it looks bad pretty much no matter what you scale it down to. The image is a PNG and it has an alpha channel (transparency). Here's the relevant code: HTML: <a href="http://tinypic.com?ref=2z5jbtg" target="_blank"> <img src="http://i44.tinypic.com/2z5jbtg.png" border="0" alt="Image and video hosting by TinyPic"> </a>​ CSS: a { width: 28px; height: 28px; display: block; } img { max-width: 100%; max-height: 100%; image-rendering: -moz-crisp

Service Oriented Architecture - AMQP or HTTP

半世苍凉 提交于 2019-11-26 17:56:41
问题 A little background. Very big monolithic Django application. All components use the same database. We need to separate services so we can independently upgrade some parts of the system without affecting the rest. We use RabbitMQ as a broker to Celery. Right now we have two options: HTTP Services using a REST interface. JSONRPC over AMQP to a event loop service My team is leaning towards HTTP because that's what they are familiar with but I think the advantages of using RPC over AMQP far

Scaling solutions for MySQL (Replication, Clustering)

余生颓废 提交于 2019-11-26 16:52:19
At the startup I'm working at we are now considering scaling solutions for our database. Things get somewhat confusing (for me at least) with MySQL, which has the MySQL cluster , replication and MySQL cluster replication (from ver. 5.1.6), which is an asynchronous version of the MySQL cluster. The MySQL manual explains some of the differences in its cluster FAQ , but it is hard to ascertain from it when to use one or the other. I would appreciate any advice from people who are familiar with the differences between those solutions and what are the pros and cons, and when do you recommend to use

Android and setting width and height programmatically in dp units

荒凉一梦 提交于 2019-11-26 16:51:20
I'm doing: button.setLayoutParams(new GridView.LayoutParams(65, 65)); According to the docs the units for the width and height (both 65 in the above) are "pixels". How do you force this to be device independent pixels, or "dp"? You'll have to convert it from dps to pixels using the display scale factor. final float scale = getContext().getResources().getDisplayMetrics().density; int pixels = (int) (dps * scale + 0.5f); I know this is an old question however I've found a much neater way of doing this conversion. TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 65, getResources()