Computing desk | ||
---|---|---|
< February 27 | << Jan | February | Mar >> | February 29 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I have an account I rarely used and missed an email. I used to be able to forward ALL incoming mail (by going under settings) in gmail, and I would like to turn that on again, but can't find it under the new look. Can anyone tell me where it is (exactly)/how to get to that window again? Thanks. -- 80.99.254.208 ( talk) 11:06, 28 February 2012 (UTC)
I've been playing with a resource hacker (A program that has the ability to change bitmaps on a executable file, it is what the exe displays, for example calc.exe displays a calculator). It seems the program needs different versions of the same icon..
256 colors | 256x256px | 48x48px | 32x32px | 16x16px |
32 colors | 256x256px | 48x48px | 32x32px | 16x16px |
16 colors | 256x256px | 48x48px | 32x32px | 16x16px |
(Ok there isn't really a 16 colors bitmap with 256x256 resolution, it's ridiculous, it's an example) Is there anyway automated way of getting all those versions of a bitmap? It seems that it will take a really long time to do it manually. Thanks! -- 190.60.93.218 ( talk) 12:52, 28 February 2012 (UTC)
I need an 8 foot by 4 foot sheet of semi transparent material that allows most/all IR light to pass though. I intend to use this sheet(maybe glued to a sheet of acrylic) as a projector screen. This screen needs to let IR pass though and it needs to show the projected image from the opposite side. Anyone know where i could get a sheet or a lining or paint that will allow me to build this screen? 98.238.132.145 ( talk) 19:24, 28 February 2012 (UTC)
I have a table (table1) full of latitude and longitude coordinates stored as doubles.
I have another table (table2) (a very large one) full of places in countries (e.g. cities) that also have latitude and longitude coordinates, along with a country code.
What's an efficient SQL query that allows me to take the lat/lon coordinates in table1, run them through table2 to find the nearest coordinates, and then grab the country code from table2?
It does not have to be precise. Speed matters more than accuracy here; table2 has several million entries in it, and table1 is pretty large as well, and I'd like this to finish in my lifetime... -- Mr.98 ( talk) 21:54, 28 February 2012 (UTC)
DIST = R * acos[sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2)*cos(long1-long2)]
DIST = sqrt[(lat1-lat2)²+(long1-long2)²]
DIST² = (lat1-lat2)²+(long1-long2)²
DIST = |lat1-lat2| + |long1-long2|
DIST² = (lat1-lat2)²+( cos(lat1) * (long1-long2) )²
min
value of either of the two expressions above (squared or absolute values), but I have my doubts about the power of the
query optimizer. (My understanding of min here is incorrect; see below.) Might it possibly be smart enough to recognize that these expressions are minimized when the two lats and the two lngs are close together, and thus use table 2's indexes? (Anybody here know?) If not, then I see three ways to force index use, which I will follow up with shortly. --
ToE 23:51, 29 February 2012 (UTC)delta_lat
and delta_lng
so that (lat1 - delta_lat, lng1 - delta_lng)
and (lat1 + delta_lat, lng1 + delta_lng)
represent
catty-corners of the square centered on (lat1,lng1)
with size size
. Note that applying cos(lat1) here would be quite cheap, as it need only be computed once per row of table 1. Now query the database to determine the count
of rows from table 2 which fall in that box, that is, where:lat1 - delta_lat < lat2 < lat1 + delta_lat lng1 - delta_lng < lng2 < lng1 + delta_lng
size
. If, on the other hand, the count
is quite large, then halve size
and repeat. Keep doubling or halving size
until you have determined a value of size
whose box contains no rows from table 2, yet the box with sides twice as large contains some (possibly lots) of rows from table 2. Then half-split until you have a size
whose box contains only one or just a few rows from from table 2. These rows will be amongst the closest to (lat1,lng1)
. Note that this is using the taxicab metric. If you are concerned about the Euclidean metric, then you will now have to compute actual distances, and if the closest row in your box is outside of the circle inscribed in the box, you will have to check for new points in a slightly larger box, to ensure that there are not any closer ones than those "sneaking in the corners" of your box.size
, your box might go from containing no rows of table 2 to lots and lots of such rows. I don't think that this would cause too much of a performance hit, because since you are querying for a count
, all the work should be in the index, and no retrievals from the table itself should be required. (What sayeth a Database Guru?) You only actually retrieve a row once you've determined a box size
with only one or just a few rows. --
ToE 01:05, 1 March 2012 (UTC)min(abs(col_1 - constant_value))
, will the query optimizer use col_1's index? If so, then you can directly query for a closest point. (My understanding of min here is incorrect; see below.) If not, they you will need to play with boxes again, but the queries will be more efficient. This is pretty much what a spatially enabled database extension will do automatically for you. --
ToE 01:29, 1 March 2012 (UTC)In the discussion above I assumed that
select col_1, min(expression) from table_1;
would return the value of col_1
from a row for which expression
is minimized, but this does not appear to be the case. As an
aggregate function, it appears that any other columns selected along with a min
must be used in a group by
. If you want a single query that identifies the closest point (not simply tells you how far away it is), you would presumable need an inner join on that minimum distance value, which is even more to optimize. So it appears to me that unless you use a spatially enabled database (and do they even offer a "closest to" function?), you will want to do something along the lines of the multiple queries described in method 2. The proper spatial index of method 3 could still be used to speed things up if method 2 is not fast enough. --
ToE 14:05, 1 March 2012 (UTC)
Computing desk | ||
---|---|---|
< February 27 | << Jan | February | Mar >> | February 29 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I have an account I rarely used and missed an email. I used to be able to forward ALL incoming mail (by going under settings) in gmail, and I would like to turn that on again, but can't find it under the new look. Can anyone tell me where it is (exactly)/how to get to that window again? Thanks. -- 80.99.254.208 ( talk) 11:06, 28 February 2012 (UTC)
I've been playing with a resource hacker (A program that has the ability to change bitmaps on a executable file, it is what the exe displays, for example calc.exe displays a calculator). It seems the program needs different versions of the same icon..
256 colors | 256x256px | 48x48px | 32x32px | 16x16px |
32 colors | 256x256px | 48x48px | 32x32px | 16x16px |
16 colors | 256x256px | 48x48px | 32x32px | 16x16px |
(Ok there isn't really a 16 colors bitmap with 256x256 resolution, it's ridiculous, it's an example) Is there anyway automated way of getting all those versions of a bitmap? It seems that it will take a really long time to do it manually. Thanks! -- 190.60.93.218 ( talk) 12:52, 28 February 2012 (UTC)
I need an 8 foot by 4 foot sheet of semi transparent material that allows most/all IR light to pass though. I intend to use this sheet(maybe glued to a sheet of acrylic) as a projector screen. This screen needs to let IR pass though and it needs to show the projected image from the opposite side. Anyone know where i could get a sheet or a lining or paint that will allow me to build this screen? 98.238.132.145 ( talk) 19:24, 28 February 2012 (UTC)
I have a table (table1) full of latitude and longitude coordinates stored as doubles.
I have another table (table2) (a very large one) full of places in countries (e.g. cities) that also have latitude and longitude coordinates, along with a country code.
What's an efficient SQL query that allows me to take the lat/lon coordinates in table1, run them through table2 to find the nearest coordinates, and then grab the country code from table2?
It does not have to be precise. Speed matters more than accuracy here; table2 has several million entries in it, and table1 is pretty large as well, and I'd like this to finish in my lifetime... -- Mr.98 ( talk) 21:54, 28 February 2012 (UTC)
DIST = R * acos[sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2)*cos(long1-long2)]
DIST = sqrt[(lat1-lat2)²+(long1-long2)²]
DIST² = (lat1-lat2)²+(long1-long2)²
DIST = |lat1-lat2| + |long1-long2|
DIST² = (lat1-lat2)²+( cos(lat1) * (long1-long2) )²
min
value of either of the two expressions above (squared or absolute values), but I have my doubts about the power of the
query optimizer. (My understanding of min here is incorrect; see below.) Might it possibly be smart enough to recognize that these expressions are minimized when the two lats and the two lngs are close together, and thus use table 2's indexes? (Anybody here know?) If not, then I see three ways to force index use, which I will follow up with shortly. --
ToE 23:51, 29 February 2012 (UTC)delta_lat
and delta_lng
so that (lat1 - delta_lat, lng1 - delta_lng)
and (lat1 + delta_lat, lng1 + delta_lng)
represent
catty-corners of the square centered on (lat1,lng1)
with size size
. Note that applying cos(lat1) here would be quite cheap, as it need only be computed once per row of table 1. Now query the database to determine the count
of rows from table 2 which fall in that box, that is, where:lat1 - delta_lat < lat2 < lat1 + delta_lat lng1 - delta_lng < lng2 < lng1 + delta_lng
size
. If, on the other hand, the count
is quite large, then halve size
and repeat. Keep doubling or halving size
until you have determined a value of size
whose box contains no rows from table 2, yet the box with sides twice as large contains some (possibly lots) of rows from table 2. Then half-split until you have a size
whose box contains only one or just a few rows from from table 2. These rows will be amongst the closest to (lat1,lng1)
. Note that this is using the taxicab metric. If you are concerned about the Euclidean metric, then you will now have to compute actual distances, and if the closest row in your box is outside of the circle inscribed in the box, you will have to check for new points in a slightly larger box, to ensure that there are not any closer ones than those "sneaking in the corners" of your box.size
, your box might go from containing no rows of table 2 to lots and lots of such rows. I don't think that this would cause too much of a performance hit, because since you are querying for a count
, all the work should be in the index, and no retrievals from the table itself should be required. (What sayeth a Database Guru?) You only actually retrieve a row once you've determined a box size
with only one or just a few rows. --
ToE 01:05, 1 March 2012 (UTC)min(abs(col_1 - constant_value))
, will the query optimizer use col_1's index? If so, then you can directly query for a closest point. (My understanding of min here is incorrect; see below.) If not, they you will need to play with boxes again, but the queries will be more efficient. This is pretty much what a spatially enabled database extension will do automatically for you. --
ToE 01:29, 1 March 2012 (UTC)In the discussion above I assumed that
select col_1, min(expression) from table_1;
would return the value of col_1
from a row for which expression
is minimized, but this does not appear to be the case. As an
aggregate function, it appears that any other columns selected along with a min
must be used in a group by
. If you want a single query that identifies the closest point (not simply tells you how far away it is), you would presumable need an inner join on that minimum distance value, which is even more to optimize. So it appears to me that unless you use a spatially enabled database (and do they even offer a "closest to" function?), you will want to do something along the lines of the multiple queries described in method 2. The proper spatial index of method 3 could still be used to speed things up if method 2 is not fast enough. --
ToE 14:05, 1 March 2012 (UTC)