小编Acc*_*t م的帖子

获取操作系统信息

我最近开始想知道像http://thismachine.info/这样获取用户操作系统信息的网站.我无法通过PHP找到如何做到这一点,并想尝试解决它.

我注意到他们列出了user-agent,它提供了很多关于浏览器的信息.他们是从那里获得操作系统信息还是从其他地方获取信息?是否有可用于获取用户操作系统的API?

我看到他们如何获得浏览器和IP,但无法弄清楚操作系统部分!

php user-agent operating-system

96
推荐指数
5
解决办法
15万
查看次数

How to reliably reproduce curl_multi timeout while testing public proxies

Relevant information: issue 3602 on GitHub

I'm working on a project that gathers and tests public/free proxies, and noticed that when I use the curl_multi interface for testing these proxies, sometimes I get many 28(timeout) errors. This never happens if I test every proxy alone.

The problem is that this issue is unreliably reproducible, and it does not always show up , it could be something in curl or something else.

Unfortunately, I'm not such a deep networks debugger …

php c bug-tracking curl curl-multi

10
推荐指数
1
解决办法
663
查看次数

PayPal NVP API错误:抱歉,我们目前无法完成您的购买

我正在使用PayPal NVP API.
当我使用沙箱帐户和沙箱API_ENDPOINT时,它运行良好.
当我使用生产帐户和生产API_ENDPOINT时,它成功重定向到PayPal,但在用户输入paypal用户名和密码并提交后,它显示:"抱歉,我们目前无法完成您的购买.请返回商家的网站并选择另一种付款方式."
我在developer.paypal.com上创建了一个应用程序,但仍然出现此错误.
任何人都可以帮忙吗?

在此输入图像描述

paypal

8
推荐指数
1
解决办法
3767
查看次数

如何选择直到总和达到某个值

有这张桌子

#table stock
+-------+----------+
|  id   |   stock  |
+-------+----------+
|   1   |    20    |
+-------+----------+
|   2   |    25    |
+-------+----------+
|   3   |    10    |
+-------+----------+
|   4   |    20    |
+-------+----------+
#note: this is an arbitrary random data
Run Code Online (Sandbox Code Playgroud)

我怎样才能继续从表中选择行,直到sum()股票列的值达到某个值或更高一点,并且表是ORDER BY id ASC.

例如,我想从表中选择行,直到我有股票'50' 的总和,所以结果将是

#result 3 rows
+-------+----------+
|  id   |   stock  |
+-------+----------+
|   1   |    20    |
+-------+----------+
|   2   |    25    |
+-------+----------+
|   3   | …
Run Code Online (Sandbox Code Playgroud)

mysql sql

5
推荐指数
1
解决办法
1107
查看次数

Firefox is not complying with RFC6265 regarding processing the path attribute of cookies

I was writing a PHP class for dealing with/parsing the Cookie and Set-Cookie HTTP headers to use it in my custom user-agents (crawlers, scrapers, bots, ..etc), and while testing it I found that it behaves different than Firefox in the way they process the Path attribute in the Set-Cookie header. I returned back to RFC 6265 and I was right

How to reproduce?

In any PHP file set this line and request it

<?php
header("set-cookie: foo=1; path=/bar/", true);
exit;
Run Code Online (Sandbox Code Playgroud)

Now …

php cookies firefox google-chrome rfc6265

5
推荐指数
1
解决办法
141
查看次数

如何警告ajax的返回数据.

伙计们,我有一个带有ajax的jquery页面,并在一个没有UI的单独的php文件中提交.所以我想要的是,如果说例如我的php文件中的插入查询将失败,我的php中的回声(你的插入失败)将在我的jquery页面中被警告.怎么做?

像这个警报(数据);

php jquery

4
推荐指数
2
解决办法
7万
查看次数

无法迭代 HttpHeaders Map

我的 IDE 说

错误:只能迭代数组或 java.lang.Iterable 的实例

headers.map()这段代码中

import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;

public static String dumpRequest(HttpRequest request)
{
    HttpHeaders headers = request.headers();
    for (Map.Entry<String, List<String>> header : headers.map()) {

    }
}
Run Code Online (Sandbox Code Playgroud)

然而,我的 IDE 中的文档map()说它返回 a Map<String, List<String>>,我缺少什么?请考虑我对 JAVA 很陌生

我正在使用 JAVA 14

这是我正在使用的HttpHeaders的文档

java loops

3
推荐指数
1
解决办法
6087
查看次数

是否可以在数据库用户表中保存用户70权限?

我目前正在开发我的第一个认真的 Web应用程序(它是一个ERP系统).我现在正在管理系统中的权限功能,我正计划将权限与用户表中的用户数据一起保存.但我拥有超过70个可以授予用户的权限.在我的短暂体验之前,我从未遇到过这么大的桌子,我不知道后来当我将系统投入生产时可能会产生什么后果,我也知道如果我做错了我将很难在以后编辑应用程序,所以我认为这将是好的如果我在开始这样做之前问过这里.

可以像这样更换表格

CREATE TABLE `user` (
  `id` int(6) unsigned NOT NULL,
  `name` varchar(70) NOT NULL,
  `type` ENUM('admin','user'),
  PRIMARY KEY (`id`)
)
Run Code Online (Sandbox Code Playgroud)

并添加这样的约70列

`p_insertSales` TINYINT(1) NOT NULL,
`p_insertPurchases` TINYINT(1) NOT NULL,
`p_insertCollections` TINYINT(1) NOT NULL,
`p_deleteSales` TINYINT(1) NOT NULL,
`p_deletePurchases` TINYINT(1) NOT NULL,
`p_manageInventory` TINYINT(1) NOT NULL,
`p_insertEntries` TINYINT(1) NOT NULL,
`p_manageAccountingSystem` TINYINT(1) NOT NULL,
`p_deleteEntries` TINYINT(1) NOT NULL,
`p_approveEntries` TINYINT(1) NOT NULL,
`p_seeFinancialReports` TINYINT(1) NOT NULL,
`p_seeLedger` TINYINT(1) NOT NULL,
`p_manageCashAccounts` TINYINT(1) …
Run Code Online (Sandbox Code Playgroud)

php mysql sql

2
推荐指数
1
解决办法
90
查看次数

Apache HttpClient 未显示响应的 Content-Length 和 Content-Encoding 标头

我安装了Apache httpcomponents-client-5.0.x,在查看 http 响应的标头时,我很惊讶它没有显示Content-LengthContent-Encoding标头,这是我用于测试的代码

import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import com.sun.net.httpserver.Headers;

CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet request = new HttpGet(new URI("https://www.example.com"));
CloseableHttpResponse response = httpclient.execute(request);
Header[] responseHeaders = response.getHeaders();
for(Header header: responseHeaders) {               
    System.out.println(header.getName());
}
// this prints all the headers except 
// status code header
// Content-Length
// Content-Encoding
Run Code Online (Sandbox Code Playgroud)

无论我尝试什么,我都会得到相同的结果,就像这样

Iterator<Header> headersItr = response.headerIterator();
while(headersItr.hasNext()) {
    Header header = headersItr.next();
    System.out.println(header.getName());
}
Run Code Online (Sandbox Code Playgroud)

或这个

HttpEntity entity = response.getEntity();
System.out.println(entity.getContentEncoding()); // NULL
System.out.println(entity.getContentLength());   // …
Run Code Online (Sandbox Code Playgroud)

java debugging apache-httpcomponents apache-httpclient-4.x apache-httpclient-5.x

2
推荐指数
1
解决办法
4895
查看次数

如何知道WM_PAINT是否必须擦除背景?Windows API

我正在尝试记录绘画消息以解决问题,并且我需要一种方法来了解WM_PAINT消息是否必须擦除背景,因此我在WM_PAINT处理中进行了此操作:

hdc = BeginPaint(hwnd,&ps);
//code to output the Invalid RECT is ommited.....
if(ps.fErase){
    //output true
}else{
    //output false
};
Run Code Online (Sandbox Code Playgroud)

ps.rcPaint有正确的价值观,但ps.fErase始终是“假的”,甚至当我打电话InvalidateRect(hwnd,0,true);哪里hwnd是我记录在这里WM_PAINT消息的窗口是一些输出图像

我想知道无效的绘画请求是否包括像我上次一样所做的擦除背景InvalidateRect(hwnd,0,1);错误吗?

c windows winapi

1
推荐指数
1
解决办法
642
查看次数

如何知道我的程序在运行时实际使用哪个共享库?

如何找出我的程序在运行时使用的共享库的路径?

我将 glibc 2.12 作为在我的 CentOS 6.10 系统上运行的主要glibc ,并且还在/opt/glibc-2.14.

当我检查我的可执行文件时

$ objdump -p ./myProgram
Run Code Online (Sandbox Code Playgroud)

它提供了这个信息

Dynamic Section:
NEEDED               libpthread.so.0
NEEDED               libcurl.so.4
NEEDED               libc.so.6
Run Code Online (Sandbox Code Playgroud)

我的LD_LIBRARY_PATH有这个值/opt/glibc-2.14/lib

是否可以查看我的程序在运行时libc.so.6实际使用的库(可能是库文件的路径)?

c linux shared-libraries dynamic-linking ld

1
推荐指数
1
解决办法
778
查看次数