Php uses the longitude and latitude of two locations to determine the distance
/**
* Calculate the distance between two known longitude and latitude, in meters.
* @ Param lng1, lng2 longitude
* @ Param lat1, lat2 latitude
* @ Return float distance, in meters
* @ Author yalong sun
**/
Function getdistance ($ lng1, $ lat1, $ lng2, $ lat2 ){
// Convert the angle to the Fox
$ RadLat1 = deg 2rad ($ lat1); // The deg 2rad () function convert
IOS searches for nearby locations (similar to Weibo moments) and ios moments
Everything is pale ~
In some cases, we need to obtain the user's surrounding location for the user to select. For example, when sending a circle of friends, you can select a location. This function is used.
Based on the above situation (in fact, to imitate), we have a simple demo.
#-1 Description
The AMAP Development Kit is used, and the positioning and searching mod
Reading image resources from different locations (drawable, asset, SDCard) in Android
Method 1:
You have saved the image to the drawable directory and obtained the Drawable or Bitmap by using the image id. This method is most commonly used. (If you only know the image name, you can also obtain the image id through the image name)
(1) Obtain Drawable by image id
Drawable drawable = getResource (). getDrawable (R. drawable. xxx );
(2) Obtain Bitmap by i
Adjust textField (multiple) locations based on the keyboard so that it will not be blocked by the keyboard, textfield Blocking
When a textField is displayed on the interface, make sure that the textField is not blocked by the keyboard. The general practice is to listen to UIKeyboardWillShowNotification and UIKeyboardWillHideNotification, obtain the keyboard information through notification. userInfo in the notification selector method, and then adju
Postgresql fatal error: Reserved connection locations are reserved for Super Users who execute non-replication requests, and postgresql Super Users
Recently, database monitoring of the monitoring system is always delayed. An error is reported when you view the log:
10:20:19, 534 ERROR Traceback (most recent call last): File "oracle_mon.py", line 306, in
Check that the number of active connections used by the database is about 90, and the default max
Nowadays, many blogger prefer to embed a small Google map in their blog to mark their location. Such a simple function can increase the color of your blog and attract more visitors. By studying the previous chapter, I believe that readers can make Google maps by themselves. This chapter will not describe this too much, but will introduce how to locate a visitor on a map and record the visitor's regional source.Understand Microsoft's IP address locating Interface
I. This section describes how to
PHP substr_replace replaces the character between the specified two locations with the * code. For more information, see.
The code is as follows:
$ Username = "zongzi ";
Echo substr_replace ($ username, '**', '1', '2 ');
Definition and usage
The substr_replace () function replaces one part of the string with another.Syntax
substr_replace(string,replacement,start,length)
Parameters
Description
String
Required. Specifies the st
Title DescriptionDescriptionGiven the string A and string B, to ensure that B is a substring of a, please output B in a where the first occurrence.Enter a descriptionInput DescriptionOnly one row contains two strings A and bOutput descriptionOutput DescriptionOne-line integer onlySample inputSample InputABCD BCSample outputSample Output2Data range and TipsData Size HintThe length of the string does not exceed 100Pascal user note: Two strings may contain multiple spacesDetailed KMP explanation,
HTML> Head> title>Click event Exampletitle> not one outside of one can - Head>no, not inside . - Body> three outside the room can not - inputtype= "button"value= "Change Color"onclick= "Tell ()" /> No, four is not allowed inside . - DivID= "Change">1233Div> Five outside the room can not - styletype= "Text/css">Div{width:100px;Height:100px;Background-color:Red; } style> not six outside . - Body> Both ins
IE, Safari, Opera, and chrome all provide screenleft and screentop properties that indicate the position of the window relative to the left and top of the screen, respectively. Firefox, Safari, and Chrome provide the same window information in ScreenX and ScreenY. Opera supports ScreenX and ScreenY properties, but with Screenleft and screentop properties do not correspond, so do not use in opera ScreenX and ScreenY. Use the following code to get the window position across browsers:1 var le
How the following code exchanges the location of the #a and #bEntire DOM ExchangeDOCTYPE HTML>HTML>Head>Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />title>Untitled Documenttitle>Head>styletype= "Text/css">b{Display:Block;}#a{background:Red;width:100px;Height:35px;margin:10px;}#b{background:#666;width:100px;Height:35px;margin:10px;}style>Body>DivID= "A" class= "a">b>11b>Div>DivID= "B" class= "C ae">em>22em>Div>Divstyle= "background: #963; width:100px; height:100px;"ID= "Odi
The position of the target number in the increment array, if the target number is not in the array, return the position where it should be.Ideas: Binary lookup, comparison with neighboring numbers, attention to boundaries1 classSolution {2 Public:3 intSearchinsert (vectorint> Nums,inttarget) {4 intstart=0, End=nums.size ()-1;5 intflag=0;6 while(startend) {7flag= (start+end)/2;8 if(Nums[flag]==target)returnFlag;9 Else if(nums[flag]target) {Ten
PHP substr_replace replaces the character between the specified two locations with the * code. For more information, see.
The code is as follows:
$ Username = "zongzi ";Echo substr_replace ($ username, '**', '1', '2 ');
Definition and usage
The substr_replace () function replaces one part of the string with another.Syntax
substr_replace(string,replacement,start,length)
Parameters
Description
String
Required. Specifies the str
PHP queries nearby locations based on a given latitude and longitude point
The implementation principle first calculates the four points of the rectangle around the point, and then uses the longitude and latitude to directly match the records in the database.
// Obtain the surrounding coordinates
Public function returnSquarePoint ($ lng, $ lat, $ distance = 0.5 ){
$ EarthRadius = 6378138;
$ Dlng = 2 * asin (sin ($ dis
This article mainly introduces how to obtain IP addresses and share geographic locations in PHP. in this article, the general interface of SINA is used for geographic location, if you need a script, you can refer to it and find that the script has not been written.
The classic logic is used to obtain IP addresses, and the common interface of SINA is used for geographic location.
For details about the usage method, see the source code:
The code is as
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.