GeoLite2-City.mmdb文件如何打开?如何将数据导入mysql数据库 20C



Java 通过Request请求获取IP地址对应省份、城市

旋风过山车 它本身的根据ip获取对应城市的算法是怎么 实现的?
接近 2 年之前 回复


旋风过山车 关键是就算放在mysql里,不知道该怎么去判断
接近 2 年之前 回复
Csdn user default icon

<div class="post-text" itemprop="text"> <p>In a handler of mine, I open a <code>.mmdb</code> file for doing geo lookups. In my package, I use <code>./</code> notation to reference the file since the handler and file are in the same directory. Now that I want to deploy the function using serverless, I've included the file within the <code>include</code> block in my <code>serverless.yml</code> file. Based on the package size that I'm seeing, the file is being uploaded, however I'm getting the error </p> <pre><code>open ./GeoLite2-City.mmdb: no such file or directory </code></pre> <p>when running the lambda. What is the proper way to get the location of the file from within my lambda?</p> </div>

hive udf报错SemanticException [Error 10014]

**hive的udf怎么引入依赖呢,我通过下面方式添加了第三方依赖** ``` add file /home/chenxy/hive/GeoLite2-City.mmdb; add jar /home/chenxy/jars/spark-hive_2.11-2.1.0.jar; add jar /home/chenxy/jars/geoip2-2.12.0.jar; add jar /home/chenxy/jars/IpCity.jar; create temporary function ip2poi as 'com.tianzhuo.portrait.Ip2PoiUDF'; select ip2poi(""); ``` select ip2poi("");操作后错误日志如下: ``` FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments '""': org.apache.hadoop.hive.ql.metadata.HiveException: Unable to execute method public java.lang.String com.tianzhuo.portrait.Ip2PoiUDF.evaluate(java.lang.String) on object com.tianzhuo.portrait.Ip2PoiUDF@23592946 of class com.tianzhuo.portrait.Ip2PoiUDF with arguments {} of size 1 ``` 如果evaluate函数直接返回字符串是没有问题的,加上geoip2-2.12.0.jar相关代码就会报错 求助大佬们,困扰我两天了,百度谷歌搜遍了,也没合适解决方案

Shiny GeoIP - 为多个MaxMind GeoIP数据库添加支持

<div class="post-text" itemprop="text"> <p>I have a problem. So, I have a geoip database reading api in PHP and I wanted to add the ability to fetch data from multiple geoip2 databases in this api, but due to my lack of knowledge in PHP class structures, I can't do it. Some advice to making this happen would be great. I know I can also achieve the same result by combining the databases, but I didn't figure out how to properly do this, despite MaxMind's thorough documentation of building custom databases. I would prefer to do this via the api though, as I wanted to make a fork anyways to fit my needs. I have narrowed down the importation of the databases in the code to the following line in src/Domain/LocationDomain.php:</p> <pre><code>public function __construct() { $this-&gt;pathToLocationDb = PROJECT_ROOT . 'data/GeoLite2-City.mmdb'; $this-&gt;reader = new Reader($this-&gt;pathToLocationDb); } </code></pre> <p>As you can see, the code imports only one database and I need it to import a second or potential third. I was playing around with it and I found that adding these lines within the function will make the api favor one database over the other:</p> <pre><code>$this-&gt;pathToLocationDb = PROJECT_ROOT . 'data/GeoLite2-ASN.mmdb'; $this-&gt;reader = new Reader($this-&gt;pathToLocationDb); </code></pre> <p>However, this isn't desirable due to me wanting <em>both</em> databases.</p> <p>The repository in question is here: <a href="" rel="nofollow noreferrer"></a></p> </div>


在Windows下可以获取数据,在linux开发环境下获取不到数据是为什么?代码如下: package com.ctsig.cdn.log.util; import com.fasterxml.jackson.databind.JsonNode; import com.maxmind.db.Reader; import; import; import; import; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @copyright: * @create: 2018-05-14 17:54 */ public class IP2CCUtil { private static Logger logger = LoggerFactory.getLogger(IpAddressService.class); public String getCountry(String ipAddress) { File database = new File("/home/hadoop/GeoLite2-City.mmdb"); if(isIP(ipAddress)) { try { InetAddress address = InetAddress.getByName(ipAddress); Reader reader = new Reader(database); JsonNode response = reader.get(address); JsonNode country = response.get("country"); reader.close(); return String.format("%s %s", // 国家编码 country.get("iso_code").asText(), // 国家英文名 country.get("names").get("en").asText()); }catch (UnknownHostException e1) { e1.printStackTrace(); }catch (IOException e) { logger.debug("未查到地址ip为:"+ipAddress+"的国家码和国家名等信息!", e); } } return null; } /** * 判断是否是有效的IP * * @param ip IP * @return true or false */ public static boolean isIP(String ip) { return ip.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); } public static void main(String[] args) { String result = new IP2CCUtil().getCountry("") ; if (result != null) { String code = result.split(" ")[0] ; String name = result.split(" ")[1] ; System.out.println(result); System.out.println("Country Code: "+code); System.out.println("Country Name: "+name); } } }


<div class="post-text" itemprop="text"> <p>I'm trying to get the latest GeoIP package to work with my local wampserver. I have all of the files - autoload, databases, etc. - setup, at least as far as I know. The code I am using is:</p> <pre><code>require_once 'GeoIP2/autoload.php'; use GeoIp2/Database/Reader; $reader = new Reader('GeoIP2/GeoLite2-City.mmdb'); $record = $reader-&gt;city(''); print($record-&gt;country-&gt;isoCode . " "); // 'US' </code></pre> <p>The above outputs</p> <pre><code>city(''); print($record-&gt;country-&gt;isoCode . " "); // 'US' </code></pre> <p>I'm using php 5.6. There aren't any errors or warnings displayed anywhere that I can find. Does anyone know what I am missing or how to troubleshoot this?</p> </div>

如何包装try catch或其他错误处理

<div class="post-text" itemprop="text"> <p>I'm a little new to OOP in PHP. I was putting together an ip to location code from MaxMind, and wanted to wrap some error handling around it, because if you supply it with an incorrect IP address, or the database is corrupt, it'll throw a fatal error.</p> <p>Most of my code is stock code, but I cannot get the error handling part correct.</p> <p>Here's the stock code. The idea here is to set <code>$countryCode = 'UN'</code> and <code>$countryName = 'Unknown'</code> initially, and then, if the script works, set it to <code>whatever</code> depending on the Ip address supplied.</p> <p><strong>Stock Code</strong></p> <pre><code>require_once($_SERVER['DOCUMENT_ROOT'].'\vendor\autoload.php'); use GeoIp2\Database\Reader; $countryCode = 'UN'; $countryName = 'Unknown'; $reader = new Reader($_SERVER['DOCUMENT_ROOT'].'\geoip\GeoLite2-City.mmdb'); $record = $reader-&gt;city(''); $countryCode = $record-&gt;country-&gt;isoCode . '&lt;br&gt;'; // 'US' $countryName = $record-&gt;country-&gt;name . '&lt;br&gt;'; // 'United States' echo $countryCode; echo $countryName; </code></pre> <p><strong>I tried</strong></p> <pre><code>require_once($_SERVER['DOCUMENT_ROOT'].'\vendor\autoload.php'); use GeoIp2\Database\Reader; $countryCode = 'UN'; $countryName = 'Unknown'; try{ $reader = new Reader($_SERVER['DOCUMENT_ROOT'].'\geoip\GeoLite2-City.mmdb'); } catch(Exception $e) { echo 'Message: ' .$e-&gt;getMessage(); } $record = $reader-&gt;city(''); $countryCode = $record-&gt;country-&gt;isoCode . '&lt;br&gt;'; // 'US' $countryName = $record-&gt;country-&gt;name . '&lt;br&gt;'; // 'United States' echo $countryCode; echo $countryName; </code></pre> <p><strong>However, this is what I'm trying to do:</strong></p> <pre><code>require_once($_SERVER['DOCUMENT_ROOT'].'\vendor\autoload.php'); use GeoIp2\Database\Reader; $countryCode = 'UN'; $countryName = 'Unknown'; **If (the below is successful -&gt; the db is successfully opened)** $reader = new Reader($_SERVER['DOCUMENT_ROOT'].'\geoip\GeoLite2-City.mmdb'); then (proceed with the below){ $record = $reader-&gt;city(''); $countryCode = $record-&gt;country-&gt;isoCode . '&lt;br&gt;'; // 'US' $countryName = $record-&gt;country-&gt;name . '&lt;br&gt;'; // 'United States' } else //Send an email to the admin here echo $countryCode; echo $countryName; </code></pre> <p>I cant use if() here, how is this done using try catch? In all there's no need to halt the script. Let the default values of $countryCode and $countryName remain if the i[ detect does not succeed.</p> <p><strong>The code in the MaxMind script is done this way:</strong></p> <pre><code>if (!filter_var($ipAddress, FILTER_VALIDATE_IP)) { throw new \InvalidArgumentException( "The value \"$ipAddress\" is not a valid IP address." ); } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I make repository in github. Register it in Set up in github integrations&amp;services Packagist to track changes in repo.</p> <p>In local comp I set this commands in console: Add some changes, then add and commit it. Set tag like v1.0.2 :git tag v1.0.2 and push it to github: git push origin v1.0.2</p> <p>In github I create release <a href="" rel="nofollow noreferrer"></a></p> <p>And I still see in There is no license information available for the latest version (dev-master) of this package.</p> <p><a href="" rel="nofollow noreferrer"></a></p> <p>How I can set versions instead (dev-master)?</p> </div>

PHP中的错误处理。 怎么做?

<div class="post-text" itemprop="text"> <p>I'm a beginner in PHP OOP and I'm with some doubts about the correct way of handling errors in PHP.</p> <p>Look at this function for example:</p> <pre><code>public function deleteFileFromDisk($fileNameToBeDeleted) { $handle = unlink($fileNameToBeDeleted); if (!$handle) { $result = "(this-&gt;deleteFileFromDisk) - Error, " . $fileNameToBeDeleted . " not deleted."; } else { $result = "(this-&gt;deleteFileFromDisk) - Success, " . $fileNameToBeDeleted . " deleted."; } return $result; } </code></pre> <p>Is this the correct way of doing it, or I can do better than this?</p> <p>Let me add some details of what I'm achieving...</p> <p>I'm running class methods, and I need to control errors in the process. If any call to the object throw an error I need to catch it and send an e-mail.</p> <p>Here are the object interactions:</p> <pre><code>$testar_classe = new geoIpImportCSV('geolitecity', ''); $testar_classe-&gt;downloadAndSaveFile('./', $testar_classe-&gt;obtainDownloadFileName()); $testar_classe-&gt;uncompressZipFile($testar_classe-&gt;obtainDownloadFileName(), '.'); $testar_classe-&gt;deleteLine(1, 'GeoLiteCity-Location.csv'); $testar_classe-&gt;deleteLine(1, 'GeoLiteCity-Blocks.csv'); $testar_classe-&gt;deleteDataFromTable('tabela1'); $testar_classe-&gt;deleteDataFromTable('tabela2'); $testar_classe-&gt;insertLinesToDb('GeoLiteCity-Location.csv', 'tabela1'); $testar_classe-&gt;insertLinesToDb('GeoLiteCity-Blocks.csv', 'tabela2'); $testar_classe-&gt;deleteFileFromDisk($testar_classe-&gt;obtainDownloadFileName()); $testar_classe-&gt;deleteFileFromDisk('GeoLiteCity-Blocks.csv'); $testar_classe-&gt;deleteFileFromDisk('GeoLiteCity-Location.csv'); </code></pre> <p>Which is the best way of handle this? Create a new method to take care of the exceptions? There are any examples on how to do this?</p> <p>Best Regards.</p> </div>

尝试安装maxmind geolite2数据库

<div class="post-text" itemprop="text"> <p>I'm having a bit of trouble installing this. I have a managed VPS and my support said they installed it, here is the error that is coming up when I try using the script:</p> <p>"Warning: require(/home/SITE/public_html/ failed to open stream: No such file or directory in /home/SITE/public_html/ on line 3</p> <p>Fatal error: require(): Failed opening required '/home/SITE/public_html/' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/SITE/public_html/ on line 3"</p> <p>Any help on this would be very appreciated.</p> </div>

Laravel 5.6,在哪里保留额外的类(附加功能)?

<div class="post-text" itemprop="text"> <p>I need to make request on some CRM api in my controller. For making this I have pretty big method. It's look like ugly. I know that there are some "Services" and to put additional code into Service is a good way. But I don't know what is this. Is it a custom classes into app folder? Or maybe it's Service-providers? I have read service-providers documentation and I'm not sure that service-providers is suitable for this. Here is my code:</p> <pre><code>&lt;?php namespace App\Http\Controllers; use App\User; use App\UserInfo; use Validator; use Illuminate\Http\Request; class UserController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $users = User::with('info') -&gt;paginate(20); $users-&gt;withPath(DIRECTORY_SEPARATOR . $request-&gt;path() .DIRECTORY_SEPARATOR); return response()-&gt;json($users)-&gt;setEncodingOptions(JSON_UNESCAPED_UNICODE); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $data = $request-&gt;json()-&gt;all(); $rules = [ 'name' =&gt; 'required', 'phone' =&gt; 'required|unique:users' ]; $validator = Validator::make($data, $rules); if ($validator-&gt;fails()) return response()-&gt;json(['errors'=&gt;$validator-&gt;errors()]); $user = new User(); $user-&gt;name = request('name'); $user-&gt;phone = request('phone'); $user_info_obj = $this-&gt;storeUserInfo(); if($user_info_obj === null){ return response('Impassible to define user geo data', 400); } $user-&gt;info_id = $user_info_obj-&gt;id; $user-&gt;save(); $this-&gt;makeAMOLead($user-&gt;name, $user-&gt;phone, $user_info_obj-&gt;user_agent, $user_info_obj-&gt;city, $user_info_obj-&gt;country); return response()-&gt;json(['success' =&gt; 'User created successfully']); } public function storeUserInfo() { $ip = request()-&gt;ip(); $reader = new \GeoIp2\Database\Reader('../resources/geo-lite2-city_20180807/GeoLite2-City.mmdb'); try { $record = $reader-&gt;city($ip); } catch (\Throwable $e){ // Code bellow is for testing on localhost, Because of maybe exception instead of geo obj on localhost. $info = new UserInfo(); $info-&gt;ip = ''; $info-&gt;city = 'Some city'; $info-&gt;country = 'Some country'; $info-&gt;country_code = 'Some code'; $info-&gt;continent = 'Some continent'; $info-&gt;continent_code = 'no'; $info-&gt;user_agent = 'User agent'; $info-&gt;save(); return $info; //return null; } $city = $record-&gt;city-&gt;names['ru']; $continent = $record-&gt;continent-&gt;names['ru']; $continent_code = $record-&gt;continent-&gt;code; $country = $record-&gt;country-&gt;names['ru']; $country_code = $record-&gt;country-&gt;isoCode; $user_agent = equest()-&gt;userAgent(); $info = new UserInfo(); $info-&gt;ip = $ip; $info-&gt;city = $city; $info-&gt;country = $country; $info-&gt;country_code = $country_code; $info-&gt;continent = $continent; $info-&gt;continent_code = $continent_code; $info-&gt;user_agent = $user_agent; $info-&gt;save(); return $info; } private function makeAMOLead($name, $phone, $userAgent, $city, $country) { $domain = env('AMO_DOMAIN'); $login = env('AMO_LOGIN'); $hash = env('AMO_HASH'); try { $credentials = new \ddlzz\AmoAPI\CredentialsManager($domain, $login, $hash); $settings = new \ddlzz\AmoAPI\SettingsStorage(); $settings-&gt;setCookiePath(env('AMO_COOKIE_FILE_PATH')); $request = \ddlzz\AmoAPI\ClientFactory::create($credentials, $settings); $lead = new \ddlzz\AmoAPI\Model\Amo\Lead(); $lead['name'] = $name; if(env('AMO_PIPELINE_ID', null)){ $lead['pipeline_id'] = intval(env('AMO_PIPELINE_ID')); } $lead['name'] = 'New pickup user ' . $name; $lead['custom_fields'] = [ [ 'id' =&gt; env('AMO_NAME_FIELD_ID'), 'values' =&gt; [ ['value' =&gt; $name], ] ], [ 'id' =&gt; env('AMO_USER_AGENT_FIELD_ID'), 'values' =&gt; [ ['value' =&gt; $userAgent] ] ], [ 'id' =&gt; env('AMO_CITY_FIELD_ID'), 'values' =&gt; [ ['value' =&gt; $city] ] ], [ 'id' =&gt; env('AMO_COUNTRY_FIELD_ID'), 'values' =&gt; [ ['value' =&gt; $country] ] ], ]; $lead['created_at'] = time(); $result = $request-&gt;add($lead); $pipelineId = json_decode($result)-&gt;_embedded-&gt;items{0}-&gt;id; // create contact $contact = new \ddlzz\AmoAPI\Model\Amo\Contact(); $contact['name'] = $name; $contact['created_at'] = time(); $contact['leads_id'] = "$pipelineId"; // dd($request-&gt;accountInfo(), true); // Call this, if you need to know ids of default fields (like phone, or position) $contact['custom_fields'] = [ [ 'id' =&gt; env('AMO_CONTACT_PHONE_ID'), 'values' =&gt; [ [ 'value' =&gt; $phone, 'enum' =&gt; 'MOB', ], ] ], ]; $result = $request-&gt;add($contact); } catch (Exception $e) { echo response()-&gt;json(['error' =&gt; $e-&gt;getFile() . ': ' . $e-&gt;getMessage()]); } } } </code></pre> <p>Look on the makeAMOLead. This is big method in my controller and this is not ok for controller conception.</p> </div>


<div class="post-text" itemprop="text"> <p>I'm reading the <a href="" rel="nofollow">MaxMind GeoIP Lite</a> City locations CSV file using Go:</p> <pre><code>csvFile, err := os.Open("/path/GeoLiteCity_20130702/GeoLiteCity-Location.csv") defer csvFile.Close() if err != nil { panic(err) } csvf := csv.NewReader(csvFile) csvf.Read() // skip header row for { fields, err := csvf.Read() if err == io.EOF { break } else if err != nil { panic(err) } // does nothing yet } </code></pre> <p>The error I'm getting is:</p> <blockquote> <p>panic: line 2, column 22: extra delimiter at end of line</p> <p>goroutine 1 [running]: main.main() /path/myprogram.go:239 +0x108f</p> <p>goroutine 2 [runnable]: exit status 2</p> </blockquote> <p>The file is quite long, but starts with these lines:</p> <pre><code>locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode 1,O1,,,,0.0000,0.0000,, 2,AP,,,,35.0000,105.0000,, 3,EU,,,,47.0000,8.0000,, 4,AD,,,,42.5000,1.5000,, 5,AE,,,,24.0000,54.0000,, 6,AF,,,,33.0000,65.0000,, 7,AG,,,,17.0500,-61.8000,, 8,AI,,,,18.2500,-63.1667,, 9,AL,,,,41.0000,20.0000,, </code></pre> <p>It appears to be properly formatted. Each row has 9 fields.</p> <p>Line 239 is my line invoking the panic, <code>panic(err)</code>. As you can see, it's failing on line 2 of the CSV file, which happens in the first iteration of the loop (line 1 is read before the loop, to skip the header row). Column 22 of line 2 is the second-to-last comma.</p> <p>Am I missing something here? I don't see any trailing comma... (clarification: the commas at the end of each line must be there to indicate empty field values, so they're not trailing, as in, extra.)</p> <p><strong>UPDATE:</strong> <a href="" rel="nofollow">The gophers have resolved this issue and the fix ships with Go 1.1.2</a>.</p> </div>

centos6.5 安装GeoIP PECL扩展

![图片说明]( 这是官方的回答,,不懂。。 How do I install the GeoIP Geo location PECL extension? If you’re using Ubuntu or Debian run the following command: sudo apt-get install php5-geoip php5-dev libgeoip-dev If you have to build the extension by hand, first make sure you have the following installed: PEAR/PECL (which includes the pecl executable) The GeoIP C library with development files Build tools (including GCC, make, etc.) php development files Then run the following command: sudo pecl install geoip Finally, add the following to your php.ini file: Once the PECL extension is installed, you must configure it. Add the following to your php.ini file: geoip.custom_directory=/path/to/piwik/misc Replace /path/to/piwik with the path to your Piwik installation. And finally, if you are using the GeoLite City database there is one more thing you need to do. The PECL extension won’t recognize the database if it’s named GeoLiteCity.dat so make sure it is named GeoIPCity.dat. Restart the webserver and the GeoIP extension should now be loaded and working in Piwik > Settings > Geolocation.

我使用GeoLite City数据库识别用户位置的PHP代码只是部分工作。 有人可以看看吗?

<div class="post-text" itemprop="text"> <p>I have simple php code to show ads in certain geo locations (US regions) and it works for some states but not for others. Can anyone take a look at my code &amp; spot errors?</p> <p>This code below is what I'm using to try to get US state location from visitors and show them particular ads if they are from those states. This is on an nginx server and the host already set up separate buckets for the cache so that certain US states (the ones identified below) would have different caches. I have cleared the server cache. The midwestern location works (Tennessee &amp; Kentucky) but the east coast location does not work (DC). Can anyone give any tips on my php? I would so appreciate it. The database is MaxMind GeoLite City database &amp; therefore the regions/US states data should be available.</p> <p>The Wordpress framework is <a href="" rel="nofollow noreferrer">beans</a> and uses the "beans smart action."</p> <pre><code>&lt;?php beans_add_smart_action('beans_content_prepend_markup', 'top_geo_home_ad', 5); function top_geo_home_ad() { $jg_user_location = getenv('GEOIP_REGION_NAME'); $jg_event_locations = array('Massachusetts', 'District of Columbia', 'Tennessee', 'Kentucky', 'New York', 'Maryland', 'DC', 'Delaware', 'Pennsylvania', 'Virginia'); if ($jg_user_location == 'District of Columbia' || $jg_user_location == 'New York' || $jg_user_location == 'Maryland' || $jg_user_location == 'Massachusetts' || $jg_user_location == 'Delaware' || $jg_user_location == 'Pennsylvania' || $jg_user_location == 'Virginia') { $jg_user_location = 'DC'; } elseif ($jg_user_location == 'Kentucky') { $jg_user_location = 'Tennessee'; } if(in_array( $jg_user_location, $jg_event_locations, TRUE )!==FALSE) { beans_add_smart_action( 'beans_content_prepend_markup', 'CEO_geoad_' . $jg_user_location, 6 ); } else { beans_add_smart_action( 'beans_content_prepend_markup', 'jg_normal_top_ad', 6); } } function CEO_geoad_DC() { echo '&lt;div class="ad-wrap horiz"&gt;' . do_shortcode('[aas_zone zone_id="56461"]') . '&lt;/div&gt;'; } function CEO_geoad_Tennessee() { echo '&lt;div class="ad-wrap horiz"&gt;' . do_shortcode('[aas_zone zone_id="56470"]') . '&lt;/div&gt;'; } function jg_normal_top_ad() { echo '&lt;div class="ad-wrap horiz"&gt;' . do_shortcode('[aas_zone zone_id="49497"]') . '&lt;/div&gt;'; } ?&gt; </code></pre> </div>

从PHP5调用MAXMIND geoip.dat时出现意外的字符/ T_STRING错误(Windows)[关闭]

<div class="post-text" itemprop="text"> <p>I encountered a strange error when trying to call MAXMIND's geoip.dat from their sample PHP script - <a href="" rel="nofollow"></a></p> <pre><code>*Warning*: Unexpected character in input: ' in*C:\Inetpub\wwwroot\clients\geoip\GeoIP.dat*on line*983* *Parse error*: syntax error, unexpected T_STRING in*C:\Inetpub\wwwroot\clients\geoip\GeoIP.dat*on line*983* </code></pre> <p>Geoip.dat, a binary file, must be downloaded separately from <a href="" rel="nofollow"></a>. Note that there's also a CSV version which I did not use.</p> <p>My code is almost exactly the same as the sample script, except for the paths:</p> <pre><code>&lt;?php // This code demonstrates how to lookup the country by IP Address include("GeoIP.dat"); // Uncomment if querying against GeoIP/Lite City. // include(""); $IPaddress=$_SERVER['REMOTE_ADDR']; $gi = geoip_open("C:\Inetpub\wwwroot\clients\geoip\GeoIP.dat",GEOIP_STANDARD); echo geoip_country_code_by_addr($gi, $IPaddress) . "\t" . geoip_country_name_by_addr($gi, $IPaddress) . " "; echo geoip_country_code_by_addr($gi, $IPaddress) . "\t" . geoip_country_name_by_addr($gi, $IPaddress) . " "; geoip_close($gi); ?&gt; </code></pre> <p>Here's my PHP info output:</p> <pre><code>PHP Version 5.2.6 System Windows NT 5.2 build 3790 Build Date May 2 2008 18:01:20 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" "--with-extra-includes=C:\Program Files (x86)\Microsoft SDK\Include;C:\PROGRA~2\MICROS~2\VC98\ATL\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\MFC\INCLUDE" "--with-extra-libs=C:\Program Files (x86)\Microsoft SDK\Lib;C:\PROGRA~2\MICROS~2\VC98\LIB;C:\PROGRA~2\MICROS~2\VC98\MFC\LIB" Server API ISAPI Virtual Directory Support enabled Configuration File (php.ini) Path C:\WINDOWS Loaded Configuration File C:\Parallels\Plesk\Additional\PleskPHP5\php.ini PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Debug Build no Thread Safety enabled Zend Memory Manager enabled IPv6 Support enabled Registered PHP Streams php, file, data, http, ftp, compress.zlib, https, ftps Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tls Registered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, </code></pre> </div>


今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...




文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Intellij IDEA 实用插件安利

1. 前言从2020 年 JVM 生态报告解读 可以看出Intellij IDEA 目前已经稳坐 Java IDE 头把交椅。而且统计得出付费用户已经超过了八成(国外统计)。IDEA 的...



总结了 150 余个神奇网站,你不来瞅瞅吗?



提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...






私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...


据羊城晚报报道,近日中芯国际从荷兰进口的一台大型光刻机,顺利通过深圳出口加工区场站两道闸口进入厂区,中芯国际发表公告称该光刻机并非此前盛传的EUV光刻机,主要用于企业复工复产后的生产线扩容。 我们知道EUV主要用于7nm及以下制程的芯片制造,光刻机作为集成电路制造中最关键的设备,对芯片制作工艺有着决定性的影响,被誉为“超精密制造技术皇冠上的明珠”,根据之前中芯国际的公报,目...


场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...


阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...


不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...






当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...


HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...




爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4


最近微信又搞出了一个大利器,甚至都上了热搜,当然消息最敏捷的自媒体人,纷纷都开通了自己的视频号。01 视频号是什么呢?视频号是微信体系内的短视频,它不同...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?



你好,我是Vam的金豆之路,可以叫我豆哥。2019年年度博客之星、技术领域博客专家。主要领域:前端开发。我的微信是 maomin9761,有什么疑问可以加我哦,自己创建了一个微信技术交流群,可以加我邀请你一起交流学习。最后自己也创建了一个微信公众号,里面的文章是我自己精挑细选的文章,主要介绍各种IT新技术。欢迎关注哦,微信搜索:臻美IT,等你来。 欢迎阅读本博文,本博文主要讲述【】,文字通...




已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...


前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...


在2019年的ReactiveConf 上,《Elm in Action》的作者Richard Feldman对未来5年Web开发的发展做了预测,很有意思,分享给大家。如果你有机会从头...


导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...




内容导航: 1、TIOBE排行榜 2、总榜(2020年6月份) 3、本月前三名 3.1、C 3.2、Java 3.3、Python 4、学习路线图 5、参考地址 1、TIOBE排行榜 TIOBE排行榜是根据全世界互联网上有经验的程序员、课程和第三方厂商的数量,并使用搜索引擎(如Google、Bing、Yahoo!)以及Wikipedia、Amazon、YouTube统计出排名数据。