程序设计

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

6
未声明HTML文档的字符编码
当我单击表单的提交按钮时,出现以下错误消息: “未声明HTML文档的字符编码。如果文档包含US-ASCII范围以外的字符,则在某些浏览器配置中,文档将呈现乱码。必须在文档中声明页面的字符编码,否则,在传输协议中。” insert.html: <!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>insert page</title></head> <body> <h1> Insert Page </h1> <form action="insert.php" method="post" enctype="application/x-www-form-urlencoded" > <p>Title:<input type="text" name="title" size="40"/></p> <p>Price:<input type= "text" name="price" size="40" /></p> <p><input type="submit" value="Insert" /> <input type="reset" value="Reset" /></p> </form> </body> …
163 php  html 



11
将data.frame列转换为向量?
我有一个数据框,例如: a1 = c(1, 2, 3, 4, 5) a2 = c(6, 7, 8, 9, 10) a3 = c(11, 12, 13, 14, 15) aframe = data.frame(a1, a2, a3) 我尝试了以下将列之一转换为向量的方法,但是它不起作用: avector <- as.vector(aframe['a2']) class(avector) [1] "data.frame" 这是我唯一能想到的解决方案,但我假设必须有一种更好的方法来做到这一点: class(aframe['a2']) [1] "data.frame" avector = c() for(atmp in aframe['a2']) { avector <- atmp } class(avector) …

15
选择表中的最后一行
我想检索插入到表中的最后一个文件。我知道该方法first()存在,并为您提供表中的第一个文件,但我不知道如何获取最后一个插入。
163 laravel  eloquent 

6
如何使用SELECT * INTO tempTable from CTE Query创建临时表
我有一个要从中创建临时表的MS SQL CTE查询。我不确定该怎么办,因为它会导致Invalid Object name错误。 下面是整个查询供参考 SELECT * INTO TEMPBLOCKEDDATES FROM ;with Calendar as ( select EventID, EventTitle, EventStartDate, EventEndDate, EventEnumDays,EventStartTime,EventEndTime, EventRecurring, EventStartDate as PlannedDate ,EventType from EventCalender where EventActive = 1 AND LanguageID =1 AND EventBlockDate = 1 union all select EventID, EventTitle, EventStartDate, EventEndDate, EventEnumDays,EventStartTime,EventEndTime, EventRecurring, dateadd(dd, 1, …

5
如何使用jQuery获得href值?
我正在尝试使用jQuery获取href值: <html> <head> <title>Jquery Test</title> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function() { $("a").click(function(event) { alert("As you can see, the link no longer took you to jquery.com"); var href = $('a').attr('href'); alert(href); event.preventDefault(); }); }); </script> </head> <body> <a href="http://jquery.com/">jQuery</a> </body> </html> 但这是行不通的。为什么?
163 javascript  jquery 

19
无法删除具有相关子映像的Docker映像
我在尝试 docker rmi c565603bc87f 错误: 守护程序的错误响应:冲突:无法删除c565603bc87f(无法强制执行)-图像具有相关的子图像 因此,即使使用-f标志,我也无法删除图像。然后如何删除图像及其所有子级? Linux和docker版本: uname -a Linux goracio-pc 4.4.0-24-generic#43-Ubuntu SMP Wed Jun 8 19:27:37 UTC 2016 x86_64 x86_64 x86_64 GNU / Linux docker版本客户端:版本:1.11.2 API版本:1.23 Go版本:go1.5.4 Git提交:b9f10c9内置:Wed Jun 1 22:00:43 2016 OS / Arch:linux / amd64 服务器:版本:1.11.2 API版本:1.23 Go版本:go1.5.4 Git提交:b9f10c9内置:Wed Jun 1 22:00:43 2016 OS / Arch:linux …

4
Gradle替代MVN安装
我在mvn上有2个不同的项目。我正在尝试替换为Gradle。 项目1是SDK,项目2使用sdk(示例) 在进行Maven时,它使用mvn install创建了工件,该工件将整个项目添加到本地存储库中。 我喜欢像这样工作。我喜欢项目1 build.gradle需要将其发布为gradle本地存储库,然后示例项目需要使用它。 在maven中,我们执行mvn install,它将项目工件添加到.m2文件夹中,但是如何在gradle中执行操作,以便我可以将项目工件添加到本地存储库中。 我有办法吗?
163 maven-2  gradle 

12
如何在网站上使用Google的Roboto字体?
我想在我的网站上使用Google的Roboto字体,并且正在关注此教程: http://www.maketecheasier.com/use-google-roboto-font-everywhere/2012/03/15 我已经下载了具有如下文件夹结构的文件: 现在我有三个问题: 我的media/css/main.css网址中包含CSS 。所以我需要把文件夹放在哪里? 我是否需要从所有子文件夹中提取所有eot,svg等文件并放入fonts文件夹中? 我是否需要创建CSS文件fonts.css并将其包含在基本模板文件中? 他使用的例子 @font-face { font-family: 'Roboto'; src: url('Roboto-ThinItalic-webfont.eot'); src: url('Roboto-ThinItalic-webfont.eot?#iefix') format('embedded-opentype'), url('Roboto-ThinItalic-webfont.woff') format('woff'), url('Roboto-ThinItalic-webfont.ttf') format('truetype'), url('Roboto-ThinItalic-webfont.svg#RobotoThinItalic') format('svg'); (under the Apache Software License). font-weight: 200; font-style: italic; } 如果我想使用类似dir的结构,我的网址应该是什么样的: /media/fonts/roboto
163 html  css  fonts 


8
python生成器“发送”功能的目的?
谁能给我一个为什么与Python生成器函数关联的“发送”函数存在的示例?我完全了解yield函数。但是,发送功能使我感到困惑。有关此方法的文档非常复杂: generator.send(value) 恢复执行并将值“发送”到生成器函数。value参数成为当前yield表达式的结果。send()方法返回生成器产生的下一个值,如果生成器退出而不产生另一个值,则返回StopIteration。 那是什么意思?我以为价值是功能的输入?短语“ send()方法返回生成器产生的下一个值”似乎也是yield函数的确切目的;yield返回生成器产生的下一个值... 有人可以给我一个使用send的生成器的示例,该生成完成了某些无法完成的工作吗?
163 python 

10
在Spring Boot中从命令行设置活动配置文件和配置位置
我有一个Spring Boot应用程序。 我的应用程序中有三个配置文件-> 开发,暂存和生产。所以我有3个档案 应用程序开发 application-staging.yml application-production.yml 我的application.yml驻留在内部src/main/resources。我在application.yml中将活动配置文件设置为: spring: profiles.active: development 其他3个配置文件特定的配置文件位于C:\config文件夹中。 我正在使用gradle插件进行蚀。当我尝试执行“ bootRun ”时,我在eclipse中的gradle配置中将命令行参数设置为 -Dspring.profiles.active=staging -Dspring.config.location=C:\Config 但是,命令行属性没有得到反映,并且我的活动配置文件始终被设置为development(这是我在applications.yml文件中提到的内容)。此外,不会在C:\ Config文件夹中搜索特定于配置文件的配置文件。 我想我在这里错过了一些东西。在过去的两天里,我一直在努力解决问题。但是没有运气。我真的很感谢您的帮助。

5
检查TypeScript的枚举中是否存在值
我收到一个数字type = 3,必须检查此枚举中是否存在该数字: export const MESSAGE_TYPE = { INFO: 1, SUCCESS: 2, WARNING: 3, ERROR: 4, }; 我发现的最好方法是将所有Enum值作为一个数组并在其上使用indexOf。但是生成的代码不是很清晰: if( -1 < _.values( MESSAGE_TYPE ).indexOf( _.toInteger( type ) ) ) { // do stuff ... } 有没有更简单的方法可以做到这一点?

4
useState设置方法不能立即反映更改
我正在尝试学习钩子,该useState方法使我感到困惑。我正在将初始值分配给数组形式的状态。useState即使使用spread(...)或,in中的set方法对我也不起作用without spread operator。我已经在另一台PC上创建了一个API,我正在调用该API并提取要设置为状态的数据。 这是我的代码: import React, { useState, useEffect } from "react"; import ReactDOM from "react-dom"; const StateSelector = () => { const initialValue = [ { category: "", photo: "", description: "", id: 0, name: "", rating: 0 } ]; const [movies, setMovies] = useState(initialValue); useEffect(() => { (async …

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.