小编MrG*_*MrG的帖子

2列div布局:右列有固定宽度,左侧流体

我的要求很简单:2列,右列有固定大小.不幸的是,我无法在stackoverflow和Google上找到有效的解决方案.如果我在自己的上下文中实现,那么每个解决方案都会失败 目前的解决方案是:

div.container {
    position: fixed;
    float: left;
    top: 100px;
    width: 100%;
    clear: both;
}

#content {
    margin-right: 265px;
}

#right {
    float: right;
    width: 225px;
    margin-left: -225px;
}

#right, #content {
    height: 1%; /* fixed for IE, although doesn't seem to work */
    padding: 20px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
    <div id="content">
        fooburg content
    </div>
    <div id="right">
        test right
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我用上面的代码得到以下内容:

|----------------------- -------|
| fooburg content  |            |
|-------------------------------|
|                  | test right | 
|----------------------- -------|
Run Code Online (Sandbox Code Playgroud)

请指教.非常感谢!

html css

155
推荐指数
5
解决办法
19万
查看次数

将焦点设置为动态加载的DIV中的字段

将焦点设置为动态加载的DIV中的特定字段的正确方法是什么?

$("#display").load("?control=msgs"); // loads the HTML into the DIV
$('#display').fadeIn("fast"); // display it
$("tex#header").focus();          // ?? neither that
$("input#header").focus();        // ?? nor that
$('#display', '#header').focus()  // ?? nor that
$("#header").focus();             // ?? nor that works
Run Code Online (Sandbox Code Playgroud)

将以下HTML提取到displayDIV中:

<div id="display">
<form id="newHeaderForm" class="dataform" action="/" method="post">
    <input id="to" type="hidden" value="22" name="to"/>
    <dl>
        <dt>Header</dt>
        <dd>
            <input id="header" class="large" type="text" name="header" value="" maxlength="128"/>
        </dd>
 </form>
 </div>
Run Code Online (Sandbox Code Playgroud)

非常感谢!

html jquery focus setfocus

41
推荐指数
3
解决办法
17万
查看次数

.htaccess for cakephp

我正在尝试使用CakePHP应用程序.为此,我设置了一个全新的Debian安装,更新了配置并将所有内容放在/ var/www中,其中包含以下内容:

app
cake
.htaccess
index.php
vendors
Run Code Online (Sandbox Code Playgroud)

.htaccess文件包含以下内容:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    /webroot/ [L]
    RewriteRule    (.*) /webroot/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

如果我访问我的虚拟主机(http:// myhost /),我会看到正确的页面.但即使加载的JavaScript src="/js/validate.js"失败(它位于其中/var/www/app/webroot/js/validate.js):

[Wed Aug 26 15:45:12 2009] [error] [client 10.7.10.52] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Aug 26 15:45:12 2009] [debug] core.c(3063): [client 10.7.10.52] r->uri = /webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/js/prototype.js
[Wed Aug …
Run Code Online (Sandbox Code Playgroud)

php .htaccess cakephp apache2

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

C# - 使用DataTable填充组合框

我习惯使用Java,那里有大量的例子.由于各种原因,我不得不切换到C#并尝试在SharpDevelop中执行以下操作:

// Form has a menu containing a combobox added via SharpDevelop's GUI

// --- Variables
languages = new string[2];
languages[0] = "English";
languages[1] = "German";
DataSet myDataSet = new DataSet();

// --- Preparation
DataTable lTable = new DataTable("Lang");
DataColumn lName = new DataColumn("Language", typeof(string));
lTable.Columns.Add( lName );
for( int i=0; i<languages.Length; i++ ) {
    DataRow lLang = lTable.NewRow();
    lLang["Language"] = languages[i];
    lTable.Rows.Add(lLang);
}
myDataSet.Tables.Add(lTable);

// --- Handling the combobox
mnuActionLanguage.ComboBox.DataSource = myDataSet.Tables["Lang"].DefaultView;
mnuActionLanguage.ComboBox.DisplayMember = "Language";
Run Code Online (Sandbox Code Playgroud)

人们会假设在下拉列表中看到一些值,但它是空的.请告诉我我做错了什么;(

编辑:mnuActionLanguage.ComboBox.DataBind()是我也在网上找到的,但它在我的情况下不起作用.

mnuActionLanguage.ComboBox.BindingContext …
Run Code Online (Sandbox Code Playgroud)

.net c# datatable combobox sharpdevelop

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

Javascript:设置标签文本

我正在尝试为具有以下格式的多个字段的表单实现泛型函数.

<label id="LblTextCount"></label>
<textarea name="text" onKeyPress="checkLength(this, 512, LblTextCount)">
</textarea>
Run Code Online (Sandbox Code Playgroud)

以下JavaScript:

function checkLength(object, maxlength, label) {
    charsleft = (maxlength - object.value.length);

    // never allow to exceed the specified limit
    if( charsleft < 0 ) {
        object.value = object.value.substring(0, maxlength-1);
    }

    // I'm trying to set the value of charsleft into the label
label.innerText = charsleft;
    document.getElementById('LblTextCount').InnerHTML = charsleft;
}
Run Code Online (Sandbox Code Playgroud)

第一部分工作正常,但我无法将charsleft值设置到标签中.我究竟做错了什么?请注意,我正在寻找一种动态方法,而不是将标签名称硬编码到JS函数中.JQuery也会很好:)


解决方案 - 感谢所有人!

HTML

<label id="LblTextCount"></label>
<textarea name="text">
</textarea>
Run Code Online (Sandbox Code Playgroud)

JS

$(document).ready(function() {
    $('textarea[name=text]').keypress(function(e) {
        checkLength($(this),512,$('#LblTextCount'));
    }).focus(function() { …
Run Code Online (Sandbox Code Playgroud)

javascript

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

jQuery:根据名称和值选择复选框

我有以下HTML:

<form id="test">
  <input type="radio" value="A" name="C1"/>
  <a href="javascript:selectCheckbox('C1', 'A');"> OPTION-A </a>

  <input type="radio" value="B" name="C1"/>
  <a href="javascript:selectCheckbox('C1', 'B');"> OPTION-B </a>

 <input type="radio" value="C" name="C1"/>
  <a href="javascript:selectCheckbox('C1', 'C');"> OPTION-C </a>

  // several other: C2, C3, ..
</form>
Run Code Online (Sandbox Code Playgroud)

我正在尝试实施selectCheckbox( chkbox, value),它应该:

  1. 搜索所有收音机name = chkbox并设置attr('checked') = false
  2. 搜索有name = chkbox AND val() = value和设置的无线电attr('checked') = true

我无法弄清楚,正确的选择器是什么,我尝试了以下没有任何运气:

var name = "#" + chkbox + " :checked";
$(name).each(..  // doesn't work

$('#'+chkbox).each( .. // if …
Run Code Online (Sandbox Code Playgroud)

jquery

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

Java SSO:针对Active Directory的Kerberos身份验证

我仍在尝试为SSO(在*nix上运行)找到基于Java的解决方案,我可以在JBoss上使用它来针对Active Directory /域控制器进行授权.我最初尝试通过NTLM执行此操作,但放弃了因为它在Windows Server> = 2008上不受支持.

因此,我正在尝试使用Kerberos实现此功能,但似乎无法找到正确/可行的解决方案.请指出正确的方向,说明如何设置这样的配置,如何验证Active Directory和/或域控制器,以便:

  1. 找出该帐户是否有效
  2. 获取用户的组列表

任何帮助表示赞赏!


UPDATE

我正在使用jcifs-ext-0.9.4和jcifs-krb5-1.3.12开发解决方案.我按如下所述设置了web.xml:

<web-app>
  <!-- servlet / servlet-mapping / welcome-file-list skipped -->

 <filter>
 <filter-name>auth</filter-name>
 <filter-class>jcifs.http.AuthenticationFilter</filter-class>

 <init-param>
 <param-name>java.security.auth.login.config</param-name>
 <param-value>/WEB-INF/login.conf</param-value>
 </init-param>

 <init-param>
 <param-name>jcifs.spnego.servicePrincipal</param-name>
 <param-value>HTTP/testconn@mydomain.com</param-value>
 </init-param>

 <init-param>
 <param-name>jcifs.spnego.servicePassword</param-name>
 <param-value>supersecret</param-value>
 </init-param>

 <init-param>
 <param-name>sun.security.krb5.debug</param-name>
 <param-value>true</param-value>
 </init-param>

 <init-param>
 <param-name>java.security.krb5.realm</param-name>
 <param-value>mydomain.com</param-value>
 </init-param>

 <init-param>
 <param-name>java.security.krb5.kdc</param-name>
 <param-value>testdom01.mydomain.com </param-value>
 </init-param>

 <init-param>
 <param-name>jcifs.smb.client.domain</param-name>
 <param-value>TESTDOMAIN</param-value>
 </init-param>

 <init-param>
 <param-name>jcifs.http.enableNegotiate</param-name>
 <param-value>true</param-value>
 </init-param>

 <init-param>
 <param-name>jcifs.http.basicRealm</param-name>
 <param-value>mydomain.com</param-value>
 </init-param>

 <init-param>
 <param-name>jcifs.http.domainController</param-name>
 <param-value>testdom01.mydomain.com</param-value>
 </init-param>

 </filter>
 <filter-mapping>
 <filter-name>auth</filter-name>
 <url-pattern>/*</url-pattern>
 </filter-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)

如果尝试访问应用程序,这会导致以下堆栈跟踪:

2010-07-22 15:53:10,588 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/google].[default]] Servlet.service() for servlet …
Run Code Online (Sandbox Code Playgroud)

java authentication kerberos active-directory single-sign-on

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

Apache ServiceMix的入门指南

从Apache ServiceMix开始的权威指南是什么?网站上的指南和指南太简单了,无法开始.

java documentation apache-servicemix

11
推荐指数
2
解决办法
6017
查看次数

确保按顺序采用Java同步锁?

我们有两个线程通过synchronized方法访问一个列表.我们可以吗

a)依靠运行时间来确保每个人都可以根据他们尝试的顺序或方式接收方法

b)VM是否遵循任何其他规则

c)是否有更好的方法来序列化请求?

java multithreading synchronization

11
推荐指数
2
解决办法
9275
查看次数

Java嵌套列表到数组转换

将数据从嵌套列表转换为对象数组(可以用作JTable的数据)的最有效方法是什么?

List<List> table = new ArrayList<List>();

for (DATAROW rowData : entries) {
    List<String> row = new ArrayList<String>();

    for (String col : rowData.getDataColumn())
        row.add(col);

    table.add(row);
}

// I'm doing the conversion manually now, but
// I hope that there are better ways to achieve the same
Object[][] finalData = new String[table.size()][max];
for (int i = 0; i < table.size(); i++) {
    List<String> row = table.get(i);

    for (int j = 0; j < row.size(); j++)
        finalData[i][j] = row.get(j);
}
Run Code Online (Sandbox Code Playgroud)

非常感谢!

java arrays list jtable

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