程序设计

专业和发烧友程序员的问答

9
添加VirtualHost失败:禁止访问错误403(XAMPP)(Windows 7)
我已经在Windows 7上运行XAMPP安装。 一旦我将VirtualHost添加到httpd-vhosts.conf中,“常规” http://localhost和新功能dropbox.local 都无法使用。 这是我添加到我的httpd-vhosts.conf: <VirtualHost *:80> ServerAdmin postmaster@dummy-host.localhost DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs" ServerName dropbox.local ServerAlias www.dropbox.local ErrorLog "logs/dropbox.local-error.log" CustomLog "logs/dropbox.local-access.log" combined </VirtualHost> 因此,我dropbox.local-error.log查询了所有信息: [Thu Feb 02 10:41:57 2012] [error] [client 127.0.0.1] client denied by server configuration: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/ 该错误似乎可以通过添加解决 <directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"> Allow from all </directory> 但是现在我得到了这个错误dropbox.local-error.log: [Thu Feb 02 10:45:56 2012] …

13
比较两个data.frame以找到data.frame 1中不存在的行data.frame 2
我有以下2个data.frames: a1 <- data.frame(a = 1:5, b=letters[1:5]) a2 <- data.frame(a = 1:3, b=letters[1:3]) 我想找到a1没有的行。 是否有针对此类操作的内置功能? (ps:我确实为此写了一个解决方案,我只是很好奇是否有人已经编写了更完善的代码) 这是我的解决方案: a1 <- data.frame(a = 1:5, b=letters[1:5]) a2 <- data.frame(a = 1:3, b=letters[1:3]) rows.in.a1.that.are.not.in.a2 <- function(a1,a2) { a1.vec <- apply(a1, 1, paste, collapse = "") a2.vec <- apply(a2, 1, paste, collapse = "") a1.without.a2.rows …
161 r  merge  compare  rows  dataframe 

4
什么是渴望加载?
什么是渴望加载?我用PHP / JS编写代码,但是更通用的答案就可以了。 我看到了很多有关Java和Ruby的问题,但是我不知道这些语言中的任何一种,而且我很难阅读代码。首先我不知道该怎么办

9
Python:json.loads返回以“ u”为前缀的项目
我将收到来自Obj-C的JSON编码字符串,并且正在解码一个伪字符串(目前),如下面的代码。我的输出结果是在每个项目前加上字符'u': [{u'i': u'imap.gmail.com', u'p': u'aaaa'}, {u'i': u'333imap.com', u'p': u'bbbb'}... JSON如何添加此Unicode字符?删除它的最佳方法是什么? mail_accounts = [] da = {} try: s = '[{"i":"imap.gmail.com","p":"aaaa"},{"i":"imap.aol.com","p":"bbbb"},{"i":"333imap.com","p":"ccccc"},{"i":"444ap.gmail.com","p":"ddddd"},{"i":"555imap.gmail.com","p":"eee"}]' jdata = json.loads(s) for d in jdata: for key, value in d.iteritems(): if key not in da: da[key] = value else: da = {} da[key] = value mail_accounts.append(da) except Exception, …
161 python  json 

11
PHP-FPM不会写入错误日志
我刚刚安装了Nginx + php-fpm服务器。一切似乎都很好,只是PHP-FPM从未向其日志写入错误。 fpm.conf [default] listen = /var/run/php-fpm/default.sock listen.allowed_clients = 127.0.0.1 listen.owner = webusr listen.group = webusr listen.mode = 0666 user = webusr group = webusr pm = dynamic pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.status_path = /php/fpm/status ping.path = /php/fpm/ping request_terminate_timeout = 30s …
161 php 

6
不支持关键字:初始化实体框架上下文的“数据源”
我正在初始化实体框架对象上下文,这给了我关键字不受支持的错误: metadata=res://*/MainDB.csdl|res://*/MainDB.ssdl|res://*/MainDB.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Workspace\vs\Leftouch\Leftouch.Web\Data\Leftouch.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;App=EntityFramework" 我直接从正在运行的web.config中获取了连接字符串,并仅修改了文件的路径(该文件是我动态设置的),并且不使用默认值,而是明确使用了该连接字符串。是什么导致此错误?

9
Android O中弃用了NotificationCompat.Builder
将项目升级到Android O之后 buildToolsVersion "26.0.1" Android Studio中的Lint显示了以下通知构建器方法的不建议使用的警告: new NotificationCompat.Builder(context) 问题是: Android开发人员更新了描述NotificationChannel的文档,以支持Android O中的通知,并向我们提供了一个代码段,但已弃用了相同的警告: Notification notification = new Notification.Builder(MainActivity.this) .setContentTitle("New Message") .setContentText("You've received new messages.") .setSmallIcon(R.drawable.ic_notify_status) .setChannelId(CHANNEL_ID) .build(); 通知概述 我的问题:还有其他用于构建通知的解决方案,并且仍然支持Android O吗? 我发现的解决方案是将通道ID作为Notification.Builder构造函数中的参数传递。但是此解决方案并非完全可重用。 new Notification.Builder(MainActivity.this, "channel_id")



6
有相对于​​根的链接吗?
有没有一种方法可以使页面上的所有链接都相对于根目录? 例如,在www.example.com/fruits/apples/apple.html我上面可以有一个链接说: <a href="fruits/index.html">Back to Fruits List</a> 该链接指向www.example.com/fruits/apples/fruits/index.html还是www.example.com/fruits/index.html?如果是第一个,有没有办法让它指向第二个呢?

7
std :: function vs template
感谢C ++ 11,我们获得了std::function函子包装器系列。不幸的是,我一直只听到关于这些新功能的坏消息。最受欢迎的是,它们运行缓慢。我测试了一下,与模板相比,它们确实很烂。 #include <iostream> #include <functional> #include <string> #include <chrono> template <typename F> float calc1(F f) { return -1.0f * f(3.3f) + 666.0f; } float calc2(std::function<float(float)> f) { return -1.0f * f(3.3f) + 666.0f; } int main() { using namespace std::chrono; const auto tp1 = system_clock::now(); for (int i …

2
CSS的后代(-1)
我正在寻找一个CSS选择器,该选择器使我可以选择列表的最后一个子元素。 <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <!-- select the pre last item dynamically no matter how long this list is --> <li>6</li> </ul> 静态方法: ul li:nth-child(5) 动态方法: ul li:last-child(-1) 哪一个当然不能验证,nth-last-child似乎也没有提供动态方式。
161 css  css-selectors 

5
手动将用户脚本添加到Google Chrome
我没有在网络上找到许多教程来手动添加,而没有“安装”用户脚本。他们所有人都告诉我要执行相同的步骤: 将目录设置为C:\ Users \ Blabla \ AppData \ Local \ Google \ Chrome \ User Data \ Default \ User Scripts 在其中放置一个.js文件,其中包含用户脚本 使用参数--enable-user-scripts启动Chrome 我这样做了-但是我的演示脚本没有做任何事情: // ==UserScript== // @name Test // @description Test // @include http://example.com/* // @version 1.0 // ==/UserScript== alert(0); 我究竟做错了什么?


6
包括另一个JSP文件
我目前正在尝试学习JSP。我的问题是,目前,我以前使用以下方式包含页面的页眉和页脚: <%@include file="includes/header.jsp" %> 和 <%@include file="includes/footer.jsp" %> 但是现在,我也将页面内容分开了。因此,如果用户单击某个页面(例如产品),则必须加载位于以下位置的JSP文件:includes/pages/products.jsp 因此,到用户的链接就像:<a href="index.jsp?p=products">Products</a>。 因此,我必须获取p值并基于它显示页面。 以下是我到目前为止所做的事情。 <% if(request.getParameter("p")!=null) { String p = request.getParameter("p"); %> <%@include file="includes/page_name.jsp" %> <% } %> 那么,如何将变量“ p”的值放在“ page_name”的位置? 或者,还有其他方法可以使用吗? 在PHP中,我们可以使用include()或include_once()。我对这个JSP有点困惑。:(
161 jsp 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.