问题列表 - 第42185页

如何修复jquery灯箱的宽度和高度?

我在我的图库上使用了jquery lighbox,但是由于图像尺寸可变,灯箱尺寸不固定因此打开图像的原始尺寸,这反过来导致biga图像走出屏幕并显示水平滚动条在浏览器中.

因此,我正在寻找将修复宽度和高度应用于灯箱的方法,以便每个图像必须在灯箱中以此尺寸显示.

请帮忙..

更新

我刚尝试解决方案Scott(http://geekswithblogs.net/wojan/archive/2009/06/17/jquerylightbox.aspx)给了我,我做了这个,

function _resize_container_image_box(intImageWidth,intImageHeight) {
// Get current width and height
//rescale if necessary
if((settings.maxWidth != null && settings.maxHeight != null) && (intImageWidth > settings.maxWidth || intImageHeight > settings.maxHeight)){
var isWider = intImageWidth > intImageHeight;//is the image wide or tall?
var scale = isWider ? settings.maxWidth/intImageWidth : settings.maxHeight/intImageHeight;
intImageWidth = intImageWidth * scale;
intImageHeight = intImageHeight * scale;
}

$('#lightbox-image').height(intImageHeight); 
$('#lightbox-image').width(intImageWidth); 
var intCurrentWidth = $('#lightbox-container-image-box').width();
var intCurrentHeight = $('#lightbox-container-image-box').height();
// Get the width and …
Run Code Online (Sandbox Code Playgroud)

javascript css jquery lightbox

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

如何删除这些''''' 在django模板中

这是我的代码homepage.html:

<script type="text/javascript">
 var jstree_jsondata={{json1}};
 alert(typeof jstree_jsondata)
</script>
Run Code Online (Sandbox Code Playgroud)

它在源代码中显示:

var jstree_jsondata=
  [
   { &quot;data&quot; : &quot;kkkqq node&quot;, 
    &quot;attr&quot; : { &quot;id&quot; : &quot;ooo&quot; ,&quot;time&quot;:&quot;pp&quot;},
    metadata:&quot;i am the one&quot;,
    children&quot; : [ 
        { 
Run Code Online (Sandbox Code Playgroud)

所以如何删除所有&quot; 使用django,

谢谢

javascript python django

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

如何将目录中的文件发送到Perl中的打印机?

好的,这就是我要做的事情:

我有一封包含一系列MIME附件的电子邮件.我有一些示例代码,可以让我创建一个包含已解码附件的目录; 我现在需要做的是将该目录的内容发送到lpr.(我没有筛选出错误的文件格式;我将它留给后台处理程序守护程序进行处理.)

printing shell perl lpr

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

Javascript inherance和super的使用:这可能吗?

if (typeof Object.create !== 'function') {
    Object.create = function (o) {
        function F() {
        }

        F.prototype = o;
        var f = new F();

        if(f.init){
            f.init();
        };

        return f;
    };
}

var inherit = function(P, C) {
    var i;
    for(i in P) {
        // if is the current parent
        if(P.hasOwnProperty(i) === false) {
            continue;
        };

        // define the uper property
        C.uper = {};

        // methods
        if(typeof P[i] === 'function') {
            // set as super
            C.uper[i] = P[i];
            // if child already …
Run Code Online (Sandbox Code Playgroud)

javascript inheritance

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

如何使用php发送电子邮件而邮件不会自动进入垃圾箱

我正在使用PHP的mail()函数发送一些电子邮件。但是我所有的邮件都会自动放入垃圾箱。有办法防止这种情况吗?如果是这样,我应该在哪里阅读以了解更多信息。

您会推荐我使用PHPmailer吗?

最好的问候,亚历山大

php email recycle-bin phpmailer

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

在使用密钥进行SSH身份验证期间,中间人攻击是安全威胁吗?

我不是网络安全方面的专家,所以原谅如果这个问题不是很聪明:).我正在使用ssh自动登录到某些机器.我目前正在避免使用主机密钥警告StrictHostKeyChecking no.
我天真地明白,有人可以冒充服务器,如果是这样的话,我可能会失去我的密码.但是,如果我只使用基于公钥/私钥的身份验证(使用PasswordAuthentication no),入侵者是否仍会造成伤害?

所以基本上,用ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no":

1)入侵者可以破译我的私钥吗?

2)是否还有其他安全威胁?

问候,

J.P

security ssh openssh man-in-the-middle ssh-keys

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

这个c函数的复杂性是什么?

以下c函数的复杂性是多少?

double foo (int n) {
    int i;
    double sum;
    if (n==0) return 1.0;
    else {
        sum = 0.0;
        for (i =0; i<n; i++)
        sum +=foo(i);
        return sum;
    }
}
Run Code Online (Sandbox Code Playgroud)

请不要只是发布复杂性,你可以帮助我理解如何去做.

编辑:这是一个在考试中提出的客观问题,提供的选项是1.O(1)2.O(n)3.O(n!)4.O(n ^ n)

c algorithm complexity-theory

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

如何简化网址

嗨:在我的网站上,我发现他们的网址非常简单:

http://example.com/questions/4486620/randomaccessfile-probelm

通常网址应该像:

http://example.com/questions?xx=4486620&title=randomaccessfile-probelm

也就是说,url中没有"&"组合的请求参数.

他们是怎么做到的?有框架吗?

更新: 我的应用程序在tomcat下运行.

url url-rewriting

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

使用distutils构建一个基于ctypes的"基础"C库

按照这个建议,我编写了一个本机C扩展库,通过ctypes优化Python模块的一部分.我之所以选择ctypes而不是编写CPython本地库,是因为它更快更容易(只有几个函数内部都有紧密的循环).

我现在遇到了障碍.如果我希望使用distutils可以轻松地安装我的工作python setup.py install,那么distutils需要能够构建我的共享库并安装它(可能是).但是,这不是一个Python扩展模块,所以据我所知,distutils不能这样做./usr/lib/myproject

我发现了一些对其他人有这个问题的引用:

我知道我可以做一些原生的东西而不是为共享库使用distutils,或者确实使用我的发行版的包装系统.我担心的是,这会限制可用性,因为不是每个人都能轻松安装它.

所以我的问题是:当前最好的分发共享库的方法是什么,这些方法将由ctypes使用,但是其他方面是OS本机而不是Python扩展模块?

如果您可以对其进行扩展并证明为什么这是最好的方法,请随意回答上面链接的其中一个黑客.如果没有更好的东西,至少所有的信息都会在一个地方.

python ctypes distutils

23
推荐指数
2
解决办法
2598
查看次数

普通类型的模式匹配

为什么我不能模式匹配Node [T]?

object Visitor {
  def inorder[T](root: Node[T]) : Unit = {
    root match {
    case End => return;
    case Node[T] => {
      if( root.left != null )
          inorder( root.left )

      println( root.toString );
      inorder( root.right );
    }
    case _ => return;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

更新:

代码是99个scala问题的逐字副本

我收到这个编译时错误:

BinaryTree.scala:25: '=>' expected but '[' found.
[error]         case Node[T] => {
[error]                  ^
[error] one error found
Run Code Online (Sandbox Code Playgroud)

25号线指向该线

case Node[T] => {
Run Code Online (Sandbox Code Playgroud)

scala

3
推荐指数
2
解决办法
5413
查看次数