小编Nen*_*lep的帖子

在输入新段落时阻止复制属性?

在CKEditor中创建新段落时,前一段的属性(样式,类)将被复制到新段落中.有办法防止这种情况吗?

例如,如果我在一个居中的段落中写入并按Enter键来创建一个新段落,我的用户希望新段落变得简单

默认情况下没有"继承"以前的任何内容.


编辑

我设法得到它(危险地未经测试)使用Reinmar的提示.这就是我最后的结果; 我希望这有助于其他人.如果你们在这里看到一个明显的错误,请告诉我

CKEDITOR.on('instanceCreated', function(e) {
    e.editor.on('key', function(evt) {
        if (evt.data.keyCode === 13) {
            // if we call getStartElement too soon, we get the wrong element
            setTimeout(function () {
                var se = e.editor.getSelection().getStartElement();
                if(se.getName() == "span") {
                    var text = se.getText(); // Store text, we are about to nuke the spans
                    while (se.getName() == "span") { // possible infinite loop danger
                        se = se.getParent();
                    }
                    if (text.length == 0)
                        se.setHtml(" "); // It's important that this is not …
Run Code Online (Sandbox Code Playgroud)

javascript ckeditor

10
推荐指数
2
解决办法
1448
查看次数

Bit Arrays Java的高效串联

我目前正在编写一段代码,我已经确定我的两位数组的串联是瓶颈,并就如何提高它的效率进行辩论.

我的Bit数组建模如下

public BitArray(int size) { 
    int sizeBytes = size / 8 ;
    if (size % 8 !=0) sizeBytes++;
    this.array = new byte[sizeBytes];
    this.size = size ; 
}
Run Code Online (Sandbox Code Playgroud)

其中size是以位为单位的大小.

当有效地连接两个位阵列时的挑战是当将大小为7的位阵列与大小为6的位阵列连接时需要发生的跨越.因此,不可能简单地做两个阵列副本.

我正在调查的解决方案,除了我目前已经实现的以下内容:计算"跨区域"(例如,5位阵列的最后3位).使用systemBit函数从system.array.copy手动设置第二个数组中的3个"跨越位"复制第一个数组.将第二个数组向左移动3做一个System.arraycopy()

目前,我手动设置第二个数组的每个位,如下所示.

问题是,对于位移,操作实际上非常昂贵,因为必须对每个字节进行操作,然后跨越必须再次发生.

关于如何改进上述技术的想法?

这是当前代码表现不佳:

public static BitArray concatenate(BitArray x1_, BitArray x2_) {
    if (x1_ == null) {
        System.out.println("x1 is null");
        int b = x2_.getArray().length;
        byte[] array = new byte[b];
        System.arraycopy(x2_.getArray(), 0, array, 0, b);
        BitArray res = new BitArray(array);
        res.setSize(x2_.getSize());
        return res;
    } else if (x2_ == null) …
Run Code Online (Sandbox Code Playgroud)

java arrays bitmap bit

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

wkhtmltopdf输出流和下载 - diaglog

是否有可能从任何html文件中获取由wkhtmltopdf创建的pdf流,并在IE/Firefox/Chrome等中弹出下载对话框?

目前我通过此代码获取我的输出流:

public class Printer
{
    public static MemoryStream GeneratePdf(StreamReader Html, MemoryStream pdf, Size pageSize)
    {
        Process p;
        StreamWriter stdin;
        ProcessStartInfo psi = new ProcessStartInfo();

        psi.FileName =  @"C:\PROGRA~1\WKHTML~1\wkhtmltopdf.exe";

        // run the conversion utility 
        psi.UseShellExecute = false;
        psi.CreateNoWindow = true;
        psi.RedirectStandardInput = true;
        psi.RedirectStandardOutput = true;
        psi.RedirectStandardError = true;

        // note that we tell wkhtmltopdf to be quiet and not run scripts 
        psi.Arguments = "-q -n --disable-smart-shrinking " + (pageSize.IsEmpty ? "" : "--page-width " + pageSize.Width + "mm --page-height " …
Run Code Online (Sandbox Code Playgroud)

c# memorystream wkhtmltopdf

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

如何在CKEditor中为段落添加CSS类和ID?

如何在CKEditor中向文本段落添加自定义类或ID?我想从DB加载可能的类,并将它们写入到加载CKE时它们将在哪个列表中.ID将简单地在现场组成.类和ID将用于标记一段文本作为脚注或标题.


为了清楚起见,我不想使用下拉框更改文本的可见样式,我想添加可用于样式元素的CSS类保存后 - 取决于它的使用位置.

ckeditor

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

以编程方式控制保存按钮启用/禁用状态

如何使用外部JS启用/禁用CKEditor的保存按钮?我不想完全删除它,只需更改灰色和彩色图标之间的外观,以便更加用户友好.

我的保存按钮生成如下:

CKEDITOR.plugins.registered['save'] =
{
    init : function( editor )
    {
        var command = editor.addCommand( 'save', {
            modes : { wysiwyg:1, source:1 },
            exec : function( editor ) {
                if(My.Own.CheckDirty())
                    My.Own.Save();
                else
                    alert("No changes.");
            }
        });
        editor.ui.addButton( 'Save',{label : '',command : 'save'});
    }
}
Run Code Online (Sandbox Code Playgroud)

ckeditor

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

JQuery UI 1.10.2 - 如何在对话框中看到调整大小句柄?

调整大小句柄不显示在对话框或任何我尝试在对话框内重新声明的内容中.我知道这是设计它们在主题中被禁用,但我如何让它们可见?我需要在对话框内容中看到它们,对话框的内容也不会受到影响.

<p><a href="#dialog">Dialog</a>
<div id="dialog" style="display:none;">
  <p>foobar</p>
    <div style="width:100px; height:100px; border:1px solid;" id="bar">BAR</div>
</div>
<script>
    $(function(){
      $('a[href=#dialog]').click( function(e) {   
        e.preventDefault(); 
          $('#dialog').dialog({
              open: function() {
                   $('#bar').resizable({handles:'sw,se,e'});   
              }
          });
      });
    });
</script>
Run Code Online (Sandbox Code Playgroud)

也在JSFiddle中:http://jsfiddle.net/s22nx/

jquery-ui jquery-ui-resizable

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

为什么Mule流程默认 - 异常策略没有效果?

我正在使用Mule独立3.1.0,我有一个默认异常策略的流程.我的fooImpl班级故意抛出一个异常,它的堆栈跟踪被呕吐到mule stdout上 - ExceptionTransformer没有触发,我没有收到任何电子邮件.如果我删除default-exception-strategy完全没有任何改变.

我希望它发送电子邮件并打印例外ExceptionTransformer.我究竟做错了什么?

<flow name="fooService">
    <inbound-endpoint address="http://localhost:63082/foo" exchange-pattern="request-response" />
    <cxf:jaxws-service serviceClass="com.example.mule.foo.fooImpl" />
    <component class="com.example.mule.foo.fooImpl" />
    <all>
        <file:outbound-endpoint path="/home/hodor/mule-standalone-3.1.0/old/" outputPattern="foo_#[function:datestamp].xml" />
        <stdio:outbound-endpoint system="OUT" exchange-pattern="one-way" connector-ref="stdioConnector" transformer-refs="objectToInputStream"/>
    </all>
    <default-exception-strategy>
        <vm:outbound-endpoint path="generalErrorHandler" exchange-pattern="one-way" />
    </default-exception-strategy>
</flow>

<flow name="generalErrorHandler">
    <vm:inbound-endpoint path="generalErrorHandler" exchange-pattern="one-way" />
    <custom-transformer class="com.example.mule.foo.ExceptionTransformer" />
    <all>
        <smtp:outbound-endpoint host="${error.smtp.host}" port="${error.smtp.port}" subject="${error.smtp.subject}" to="${error.smtp.to}" cc="${error.smtp.cc}" bcc="${error.smtp.bcc}" from="${error.smtp.sender}" />
    </all>
</flow>
Run Code Online (Sandbox Code Playgroud)

此外,我试图用<custom-exception-strategy class="com.arcusys.nkeservice.mule.dynasty.ExceptionTest">而不是default-exception-strategy.然后ExceptionTest在服务启动期间实例化,但@override handleException永远不会被调用.

我得到stdout的强制例外是这样的:

WARN  2015-02-23 10:59:17,159 [[foo].connector.http.0.receiver.2] org.apache.cxf.phase.PhaseInterceptorChain: …
Run Code Online (Sandbox Code Playgroud)

java web-services cxf jax-ws mule

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

为什么我的文件结果文件名已损坏IE9?

我正在尝试为我的用户生成并返回文件.某些文件名包含unicode字符:aäa.pdf.当尝试在IE 9中下载它们时,文件名被破坏,下载如下所示:

         Ie9文件名问题

在Chrome中,它按预期工作.这是return语句:

return File(fileStream: stream, 
            contentType: System.Net.Mime.MediaTypeNames.Application.Octet, 
            fileDownloadName: myModel.Name + "." + pub.OutputFileType);
Run Code Online (Sandbox Code Playgroud)

我该如何解决IE 9的问题?

.net utf-8 filestreamresult internet-explorer-9 asp.net-mvc-3

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

如何从 ActiveMqMessage 获取消息文本

我是 Apache ActiveMQ 的新手。从 Producer 我发送以下内容:

{"senderPhNumber":"9986085716","sendingTime":"2015-07-20T22:11:24","spCode":"000001","customerName":"Vinod"}
Run Code Online (Sandbox Code Playgroud)

来自生产者的代码

String text = messageStr;
TextMessage message = session.createTextMessage(text);

// Tell the producer to send the message
System.out.println("Sent message: " + text );
producer.send(message);
Run Code Online (Sandbox Code Playgroud)

来自 Consumer 的消息类型为ActiveMqMessage。消费者实现MessageListener和内部onMessage()我有以下代码:

public void onMessage(Message msg) {
    if (msg instanceof ActiveMQMessage){
        System.out.println("Inside If");
        try {
            ActiveMQMessage aMsg =  (ActiveMQMessage)msg;

            System.out.println( " Inside Listener ..." + aMsg);

            ProducerInfo prod = (ProducerInfo) aMsg.getDataStructure();
            consumer.close();
            session.close();
            connection.close();
        } catch (JMSException e) {
            e.printStackTrace();
        }
    } …
Run Code Online (Sandbox Code Playgroud)

java activemq-classic

5
推荐指数
2
解决办法
7351
查看次数

在Tomcat上部署:解析方法时遇到约束违规"org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;"

我正在Tomcat 8.0.22上部署Shibboleth IdP 3.1.1,但是我收到此错误:

SEVERE [http-nio-8080-exec-13] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
 org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.shibboleth.ext.spring.context.DeferPlaceholderFileSystemXmlWebApplicationContext]: Constructor threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of java/net/URLClassLoader) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type LoggerFactory; used in the signature
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:360)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
    at …
Run Code Online (Sandbox Code Playgroud)

spring tomcat shibboleth slf4j

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