小编byt*_*e77的帖子

空javascript事件的最佳实践(例如onclick ="javascript:;")

如果你想要一个事件或一个空的javascript调用的链接,有几种方法,我可以想到:

<a href="#">Method 1</a>                    <- Ugh... changes URL in browser
<a href="javascript:;">Method 1</a>         <- My currently preferred method
<a href="javascript:void(0);">Method 1</a>  <- Another approach?
Run Code Online (Sandbox Code Playgroud)

在跨浏览器兼容性和简洁性方面,最好的方法是什么?

html javascript

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

从Laravel输出原始HTML

我有一个form包含textarea在表中存储用户输入的.

目前,当我在我的视图中提取此数据时,{{ $data->textarea }}它输出<strong>&lt;strong&gt;.我想要使​​用或构建一个非常基本的WYSIWYG编辑器,但如果我不能输出原始HTML,我认为它不会起作用.

我需要在视图或控制器中定义某种属性吗?


Meta:创建像Stack Exchange或Reddit这样的系统更明智**this is bold text**吗?

html php mysql laravel

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

正确重命名 C# WinForms 中的表单

我目前正在使用C# WinForms开发一个项目,我想知道如何在Form不破坏应用程序的情况下正确重命名。我需要将 Form8 更改为 Form9,并且假设您需要在表单的属性窗口中重命名设计(名称),但是为了正确重命名,我还需要采取其他步骤吗?

c# forms windows winforms

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

继承另一个类的类是否继承了继承类/接口的类?

我有两节课:

public class Question : IDisposable, IEquatable<Question>
{
}

public class SessionQuestion : Question, IDisposable, IEquatable<SessionQuestion>
{
}
Run Code Online (Sandbox Code Playgroud)

作为Question继承IDisposableIEquatable,是否也SessionQuestion隐式继承了这些接口?

c# inheritance

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

将std :: wstring拆分为std :: vector

此问题显示如何使用单个字符分隔符将a拆分string为a .vector

问题:将std :: string拆分为向量的正确方法

然而,应用这种技术wstring并不像我想象的那么容易.因此,这绝对不是重复!

wstringstream stringStream(str);
istream_iterator<wstring> begin(stringStream);
istream_iterator<wstring> end;
List = vector<wstring>(begin, end);
copy(List.begin(), List.end(), ostream_iterator<wstring>(cout, ";"));
Run Code Online (Sandbox Code Playgroud)

第二行无法使用VS2015进行编译.并使用istream_iterator<wstring, wchar_t>导致编译错误iterator.h.

我怎样才能分割std::wstringstd::vector由分离";"

c++ string vector wstring

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

ImageList:32位图像质量下降

我使用ImageListTreeViewListView.我首先将图像质量设置为32位,然后添加半透明图像.质量看起来不错,但在编写,编译和执行应用程序几分钟后,质量看起来很糟糕.

看截图: 在此输入图像描述

使用过的属性

ColorDepth: Depth32Bit
ImageSize: 16; 16
TransparentColor: Transparent
Run Code Online (Sandbox Code Playgroud)

像素背后有黑色像素,半透明但不完全透明.

重新添加所有图像会恢复原始质量,但几分钟后,它就会显示在屏幕截图的右侧.

c# graphics imagelist winforms

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

*无法识别的字段:数据库您的意思是?: - metrics - server - logging - DROPWIZARD

在我的应用程序配置文件(server.yml)中添加数据库详细信息后,我无法启动我的dropwizard应用程序.

server.yml(app配置文件)

server:
  applicationConnectors:
  - type: http 
    port: 8080
  adminConnectors:
  - type: http
    port: 9001

database:
  # the name of your JDBC driver
  driverClass: org.postgresql.Driver

  # the username
  user: dbuser

  # the password
  password: pw123

  # the JDBC URL
  url: jdbc:postgresql://localhost/database

  # any properties specific to your JDBC driver:
  properties:
    charSet: UTF-8

  # the maximum amount of time to wait on an empty pool before throwing an exception
  maxWaitForConnection: 1s

  # the SQL query to run when validating a connection's …
Run Code Online (Sandbox Code Playgroud)

postgresql yaml jdbc dropwizard

6
推荐指数
2
解决办法
5814
查看次数

即使其中一个查询失败,pdo也会在多个查询中返回true

这里的深层问题是知道PDO何时返回true和false.

文档说如果失败成功为假则为true.那么MySQL的成功和失败是什么?

这是我当前的问题:我在一个PDO执行中将所有查询一起发送,即使foreign_id不应该为NULL,它也会返回true:

SET @id := NULL; SELECT id INTO @id FROM ? WHERE id = ? AND to_user = ?;
INSERT INTO hidden_notifications(table_name, foreign_id) VALUES (?, NULL);
Run Code Online (Sandbox Code Playgroud)

但如果我只发送

INSERT INTO hidden_notifications(table_name, foreign_id) VALUES (?, NULL);
Run Code Online (Sandbox Code Playgroud)

false被正确返回.

NB NULL仅用于测试目的,通常由@id替换.

我进一步尝试了解PDO的行为:

INSERT INTO hidden_notifications(table_name, foreign_id) VALUES (?, ?);
INSERT INTO hidden_notifications(table_name, foreign_id) VALUES (?, NULL);
Run Code Online (Sandbox Code Playgroud)

这里第一个插入是正确的,第二个插入没有,PDO返回true ..我开始认为只有一个查询成功时PDO返回true.

你可以向我解释一下,所以我知道如何处理我的数据库.因为我的所有计划都基于这个原则:

execute('BEGIN')
execute(myquery) // which can be many selections, insertions updates together in one string
if succed execute('COMMIT')
else execute('ROLLBACK')
Run Code Online (Sandbox Code Playgroud)

php mysql pdo

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

PowerMock不适用于JAXB Unmarshal

我正在创建一个测试用例,其中,我输入xml并解组它以进行处理.我正在尝试使用PowerMock而且我一直在努力

javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.xxxxxxx.org/xxxxx/xx/xx", local:"Element"). Expected elements are <{}NotifRQ>,<{http://www.xxxxxxx.org/xxxxx/xx/xx}NotifRS>,etc
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:659)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:255)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:250)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:117)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1060)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:495)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:477)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:147)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:220)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:192)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:136)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:141)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:150)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:168)
    -------sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:613)
    at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:66)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:310)
    at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
    at …
Run Code Online (Sandbox Code Playgroud)

java xml jaxb junit4 powermock

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

如何使我的 Horizo​​ntalBarChart 可滚动?

目前正在尝试使用 MPAndroidChart 实现 Horizo​​ntalBarChart。但是,条形太多,无法全部显示在屏幕上。Horizo​​ntalBarChart 只有在我放大时才会滚动,但永远不会超过屏幕上已有的内容。不确定这是否是 XML 问题(我在相对布局中有 Horizo​​ntalBarChart,尝试过 ScrollView 但没有工作)或者是否已经有像 chart.enableScroll() 这样的实现(我已经尝试过,但它不起作用)。

android android-studio mpandroidchart

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