Better HN
topnewbestaskshowjobs
Log inSign up

codesink

233 karma · joined Aug 27, 2008 (18y ago) · 64 submissions

coding for fun and profit http://codesink.org
Submissions

comment 16y ago · link · parent

true, the distance calculation must NOT be in the WHERE clause if you want to use indexes (and you want).

What I'm doing, given a max distance and a search point, is to calculate the bounding box in which I want to search in filter results with

WHERE lat BETWEEN lat_min AND lat_max AND lng BETWEEN lng_min AND lng_max

Calculating latitude min/max is trivial knowing that 1 latitude degree is 111.2KM. Longitude is a bit more convoluted because longitude degree size changes moving north/south.

$lat_min = $lat - $range_km * (1 / 111.2); $lat_max = $lat + $range_km * (1 / 111.2);

$k = $range_km/6371.04; $lng_min = $lng - rad2deg($k/cos(deg2rad($lat))); $lng_max = $lng + rad2deg($k/cos(deg2rad($lat)));

comment 16y ago · link · parent

you can embed your own C code without the hassle to handle HTTP/S (or forkbombs) using KLone web server; it can easily handle thousands of requests per second.

p.s. I'm part of the company whom made it.

comment 16y ago · link · parent

I'm pretty happy with VMware Fusion.

http://www.vmware.com/products/fusion/

34.

HackIt 0x0d: Hacker meetup in Rome, Italy (Jul 2,3,4)(it.hackmeeting.org ↗)

1 points · by codesink · 16y ago · discuss

comment 16y ago · link · parent

appsnap backend: nginx -> klone -> image matching server

comment 16y ago · link · parent

The Linux kernel exploits that by using two macros (likely() and unlikely()) that give hints to the compiler using GCC's __builtin_expect:

if(likely(condition)) dosomething();

comment 16y ago · link · parent

EDIT: "Each tile is 256 pixels square and the number of tiles across at each zoom level is given by this formula: Math.pow(2, zoom)"; ops I missed the word "across" :)

How did you come up with that number? The sum loop that follows reports 524287 tiles total.

#include <stdio.h> #include <math.h> int main(void) { int i; double tot = 0; for(i = 0; i <= 18; ++i) tot += exp2(i); printf("tot %f\n", tot); return 0; }

comment 16y ago · link · parent

You can read why that happens in the paragraph titled "Scale".

Here's an excerpt (given that Google tiles are 256x256 and at zoom 0 one tile covers the whole world):

"Intuitively its easy to see why the scale changes. Let's think about Google Maps zoom level 0. At zoom level 0 the world is fit into a 256 pixel wide image. But we know that the earth's circumference is the largest at the equator and dwindles down to zero at the poles. So as you move north or south away from the equator, the Earth has to be "stretched" to fit into the 256 wide bitmap. Thus as you move north or south the scale gets larger and larger because the same number of pixels on the screen are showing you a larger and larger percentage of the Earth's surface."

comment 16y ago · link · parent

Please note that the article is four years old and, as far as I can tell, Maps API has been launched mostly in the same period (wikipedia:Google_Maps).

I don't know how much information was available at that time but it shouldn't be much.

40.

How Google Maps splits the world in 2^20 256x256 tiles (2006)(cfis.savagexi.com ↗)

72 points · by codesink · 16y ago · 22 comments

41.

Ask HN: Learn/practise a language over Skype?

2 points · by codesink · 16y ago · discuss

comment 16y ago · link · parent

There's a free book about git available at

http://progit.org/book/

Both the basics and advanced topics are clearly discussed.

comment 16y ago · link · parent

It was pretty expensive a few days ago: $1.99 :-)

comment 16y ago · link · parent

I'm not sure the guy understood the app because you can actually install the app after taking the picture.

Of course if he didn't get it it's only my fault because the description is not clear enough (I'm not a native speaker) or the UI is not easy and intuitive as it should.

Any help would be highly appreciated!

comment 16y ago · link · parent

Two use cases where it may be useful:

1- you snap an app from your friend's iPhone screen and tap on the Install button (i.e. app sharing)

2- snap an app from your computer screen (a review site for example) then Install/Bookmark

comment 16y ago · link · parent

If that works there must be other "cool" commands the coder added after implementing this one...

comment 16y ago · link · parent

Sure, I'd be more then happy to give codes to HNs!

My email is in my profile for who's interested.

48.

Please review my iPhone app (icons recognition)(itunes.apple.com ↗)

15 points · by codesink · 16y ago · 11 comments

comment 16y ago · link · parent

Check out also the FOX board that's actually built of a core module (cpu, flash and ram) plus a daughter board that brings out all common interfaces for prototyping (ethernet, usb, rtc, gpio, etc.).

When you've finished prototyping and have your own board you can drop their daughter board and buy just the core for 69 euros.

Pretty sweet (and they are good guys also).

http://www.acmesystems.it/

50.

Patent: Compiler independent bit-field macros (freepatentsonline.com ↗)

47 points · by codesink · 16y ago · 38 comments

51.

Ask HN: Please review AppSnap - Snap the icon of an iPhone app to get it

1 points · by codesink · 16y ago · discuss

52.

Ask HN: Anybody kind enough to share scraped iTunes appids?

1 points · by codesink · 17y ago · discuss

53.

Ask HN: What happened to Bookpool.com?

4 points · by codesink · 17y ago · 2 comments

54.

Italian Government is Trying to Intercept Skype for Lawful Interception(translate.google.com ↗)

1 points · by codesink · 17y ago · discuss

comment 17y ago · link · parent

Thanks for your feedback!

I agree that the process (open app -> enter code -> send message -> paste) is a bit cumbersome but still I can't cope with the onscreen keyboard for message longer then a few chars. I still think that somebody out there feels the same pain, sale stats will tell us the truth :)

The next release will have a "persistant pairing" flag that will allow users to skip the "enter code" phase to make the process a bit faster.

Unfortunately opening the app with the message already written is not possible with the current SDK :(

56.

Ask HN: Please Review my iPhone App (Use an External Keyboard to Send SMS)

2 points · by codesink · 17y ago · 3 comments

57.

Geographic Distribution of iPhone Users(metrics.admob.com ↗)

2 points · by codesink · 17y ago · discuss

comment 17y ago · link · parent

It would be useful to know where he advertised for the job.

comment 17y ago · link · parent

The kernel code comes from xnu and freebsd, the UI stuff and the development tools comes stright from the NeXT that's about 20 years old.

Of course those are just the starting points, from that a lot has been reworked/improved and a lot has been added.

123