小编Nam*_*mbi的帖子

Bootstrap Carousel图像未正确对齐

请看下面的图片,我们正在使用bootstrap carousel来旋转图像.但是,当窗口宽度较大时,图像不能正确对齐边框.

但是无论窗口的宽度如何,bootstrap提供的轮播示例总能正常工作.遵循代码.

有人可以解释为什么旋转木马表现不同?这与图像大小或某些引导配置有关吗?

<section id="carousel">
<div class="hero-unit span6 columns">
    <h2>Welcome to TACT !</h2>
    <div id="myCarousel" class="carousel  slide" >
      <!-- Carousel items -->
      <div class="carousel-inner">
        <div class="item  active" >
            <img alt=""  src="/eboxapps/img/3pp-1.png">
            <div class="carousel-caption">
                <h4>1. Need a 3rd party jar?</h4>
            </div>
        </div>
        <div class="item">
            <img alt=""  src="/eboxapps/img/3pp-2.png">
            <div class="carousel-caption">
                <h4>2. Create Request</h4>
            </div>
        </div>
        <div class="item">
            <img alt=""  src="/eboxapps/img/3pp-3.png">
            <div class="carousel-caption">
                <h4>3. What happens?</h4>
            </div>
        </div>
        <div class="item">
            <img alt=""  src="/eboxapps/img/3pp-4.png">
            <div class="carousel-caption">
                <h4>4. Status is Emailed</h4>
            </div>
        </div>
      </div> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery carousel twitter-bootstrap

89
推荐指数
6
解决办法
15万
查看次数

如何将值参数传递给Bootstrap中的modal.show()函数

我有一个页面显示当地咖啡馆的列表.当用户点击某个咖啡馆时,会显示一个模式对话框,该对话框已经预先填写了"咖啡馆名称".该页面包含许多咖啡馆名称,表单应包含他点击的"咖啡馆名称".

以下是使用链接按钮生成为文本的咖啡馆名称列表

         <table class="table table-condensed  table-striped">
      <tbody>   
        <tr>
          <td>B&Js
          </td>
          <td>10690 N De Anza Blvd </td>
          <td>
              <a class="btn btn-primary" data-toggle="modal" onClick="$('#createFormId').modal('show')" >Announce</a>
          </td>
        </tr>

        <tr>
          <td>CoHo Cafe
          </td>
          <td>459 Lagunita Dr </td>
          <td>
              <a class="btn btn-primary" data-toggle="modal" onClick="$('#createFormId').modal('show')" >Announce</a>
          </td>
        </tr>


        <tr>
          <td>Hot Spot Espresso and Cafe
          </td>
          <td>1631 N Capitol Ave </td>
          <td>
              <a class="btn btn-primary" data-toggle="modal" onClick="$('#createFormId').modal('show')" >Announce</a>
          </td>
        </tr>

      </tbody>
    </table>
Run Code Online (Sandbox Code Playgroud)

这是模态形式

<div class="modal hide fade" id="createFormId"">
<div class="modal-header">
    <a href="#" class="close" data-dismiss="modal">&times;</a>
    <h3>Create Announcement</h3>
</div> …
Run Code Online (Sandbox Code Playgroud)

jquery modal-dialog twitter-bootstrap jquery-events

27
推荐指数
2
解决办法
17万
查看次数

JGit:签出一个远程分支

我正在使用JGit来检查远程跟踪分支.

Git binrepository = cloneCmd.call()

CheckoutCommand checkoutCmd = binrepository.checkout();
checkoutCmd.setName( "origin/" + branchName);
checkoutCmd.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK );
checkoutCmd.setStartPoint( "origin/" + branchName );

Ref ref = checkoutCmd.call();
Run Code Online (Sandbox Code Playgroud)

文件已签出,但HEAD未指向分支.以下是git status输出,

$ git status
# Not currently on any branch.
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)

可以在git命令行中轻松执行相同的操作,它可以正常工作,

git checkout -t origin/mybranch
Run Code Online (Sandbox Code Playgroud)

怎么做这个JGit?

git jgit

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

Git子模块跟踪远程分支

我正在尝试使用git子模块将10多个存储库聚合到一个结构中以便于开发.

它应该克隆模块并签出分支.而是以分离头模式检出模块.

git clone git@github.com:org/global-repository.git
git submodule update —init
cd config-framework
git status

$git status
#HEAD detached at b932ab5
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)

gitmodules文件似乎没问题

$cat .gitmodules 
[submodule "config-framework"]
        path = config-framework
        url = git@github.com:org/config-framework.git
        branch = MY_BRANCH
Run Code Online (Sandbox Code Playgroud)

我们希望默认情况下检出MY_BRANCH分支,而不是分离头.我们如何实现这一目标?

git git-remote git-submodules git-branch

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

将变量传递到骨干模板时,如何在模板中引用它?

模板看起来像这样.

<div>
    <H5>Status for your request</H5>
    <table>
    <tbody>
    <tr>
        <th>RequestId</th>
        <th><%=id%></th>
    </tr>
    <tr>
        <th>Email</th>
        <th><%=emailId%></th>
    </tr>       
    <tr>
        <th>Status</th>
        <th><%=status%></th>
    </tr>       
     </tbody>
     </table>
</div>
Run Code Online (Sandbox Code Playgroud)

这是呈现页面的View Javascript.

window.StatusView = Backbone.View.extend({

initialize:function () {
    console.log('Initializing Status View');
    this.template = _.template(tpl.get('status'));
},

render:function (eventName) {

    $(this.el).html(this.template());
    return this;
},

events: { "click button#status-form-submit" : "getStatus" },

getStatus:function(){

    var requestId = $('input[name=requestId]').val();
    requestId= $.trim( requestId );

    var request  = requests.get( requestId );

    var statusTemplate = _.template(tpl.get('status-display'));
    var statusHtml = statusTemplate( request );
    $('#results-span').html( statusHtml ); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery templates backbone.js underscore.js

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

Spring JavaMailSenderImpl不支持SSL

简单的Java Mail客户端可以正常运行在SSL上运行的电子邮件服务器.但是从Spring JavaMailSenderImpl类使用时,同一服务器无法正常工作.thunderbird也可以正常使用邮件服务器.但是,春天有问题.

这是原始的Java代码,工作正常.

    final String username = "id@server.com";
    final String password = "password";

    Properties props = new Properties();
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.smtps.ssl.checkserveridentity", "true");
    props.put("mail.smtps.ssl.trust", "*");
    props.put("mail.smtp.host", "server.com");
    props.put("mail.smtp.port", "587");

    Session session = Session.getInstance(props,
      new javax.mail.Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(username, password);
        }
      });

    try {

        Message message = new MimeMessage(session);

        message.setFrom(new InternetAddress("id@server.com"));

        message.setRecipients(  Message.RecipientType.TO, 
                                InternetAddress.parse("id@gmail.com"));

        message.setSubject("Testing Subject");
        message.setText("Dear Mail Crawler, \n\n No spam to my email, please!");

        Transport.send(message);

        System.out.println("Done");

    } catch (MessagingException e) {
        throw …
Run Code Online (Sandbox Code Playgroud)

ssl spring jakarta-mail

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

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

从 ipaddress 获取地理代码的 Java 库

我的应用程序知道用户的 IP 地址。我们需要识别用户所在的城市、州、国家以及用户的经纬度。

有没有可以做到这一点的java库?

如果没有,用于将 IP 地址转换为地理位置的算法或数据源是什么?

java geocoding

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

如何在git中找到commitId的分支?

让我说我有一个提交ID"0678dd19c498ede50e7714505eb5af3a5​​494beef"我试过"git log"命令打印,

$git log --full-history   1c57338cd62ee1a83df57d2c37ce1f3fa17bee17
commit 1c57338cd62ee1a83df57d2c37ce1f3fa17bee17
Author: blah@blah.com
Date:   Thu Feb 3 15:39:33 2011 -0800

Updated ejo syntax

commit 8fb7a6b3e44a020e4e495fd1c9a9976c8675c339
Author: blah@blah.com
Date:   Thu Feb 3 14:49:19 2011 -0800

Added a sample controller

commit 628788eb81c365a88ab435ffa62978077065f72c
Author: blah@blah.com
Date:   Wed Feb 2 11:33:41 2011 -0800

Test checkin
Run Code Online (Sandbox Code Playgroud)

反正是否打印了进行此提交的分支?

git

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

Chrome邮件传递错误:尝试使用已断开连接的端口对象

我的chrome扩展使用长寿命的"Port"对象在"内容脚本"和"弹出"页面之间传递消息."弹出窗口"能够向"内容脚本"事件监听器发送消息.但是,"内容脚本"中的"端口"对象无法向"弹出"页面发送消息.

var port = chrome.extension.connect({"name":"swap"});

// listener for incoming connections
chrome.extension.onConnect.addListener(function( incomingPort ){

    // listener on incoming messages
    incomingPort.onMessage.addListener(function( msg ){

        if( msg.command === 'get_scripts' ){
            //do work

        }

        var scrs = { 'scripts' : 'name' };
        var result = port.postMessage( scrs );

    });
});
Run Code Online (Sandbox Code Playgroud)

执行'port.postMessage(Object obj)'时,插件会抛出以下错误,

Error in event handler for 'undefined': Attempting to use a disconnected port object   Error: Attempting to use a disconnected port object
at PortImpl.postMessage (miscellaneous_bindings:54:5)
at chrome-extension://loiamkgdhfjdlkcpehnebipeinpcicfj/swap.js:27:31
at [object Object].dispatch (event_bindings:203:41)
at Object.<anonymous> (miscellaneous_bindings:250:22) …
Run Code Online (Sandbox Code Playgroud)

google-chrome google-chrome-extension

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

从Java生成的Sha256哈希与OpenSSL和Sha256Sum实用程序不同。为什么?

这是一个Java代码,可为Java中的字符串生成sha256哈希。

public static void main(){

    String data = "hello world";

    // Generate the Sha256 hash using Apache Common Codec library
    String hash = DigestUtils.sha256Hex( data);

    System.out.println("Apache : Sha256hash: "+ hash);

    // Generate Sha 256 hash by using guava library
    final String hashed = Hashing.sha256()
            .hashString(data, StandardCharsets.UTF_8)
            .toString();


    System.out.println("Guava  : Sha256hash: "+ hashed);
}
Run Code Online (Sandbox Code Playgroud)

当我运行程序时,我得到以下值。两个哈希完全相同。

Apache : Sha256hash: b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
Guava  : Sha256hash: b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
Run Code Online (Sandbox Code Playgroud)

现在,我从命令行为字符串“ hello world”生成了Sha256哈希。

命令行util sha2

echo "hello world" | sha2 -256
SHA-256 ((null)) = a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447
Run Code Online (Sandbox Code Playgroud)

OpenSSL实用程序

echo 'hello …
Run Code Online (Sandbox Code Playgroud)

java apache openssl sha256 guava

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

如何将回调附加到Bootstrap Typeahead插件

使用自定义引导程序插件进行预先输入功能 https://gist.github.com/1891669

如何附加'select'事件的回调?以下代码不起作用.

var selectedFn = $('.typeahead dropdown-menu').on('select', function( ev ){
    console.log(ev);
});
Run Code Online (Sandbox Code Playgroud)

谁能解释一下这是如何工作的?

jquery-ui jquery-plugins jquery-selectors typeahead twitter-bootstrap

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