问题列表 - 第40031页

找到第三点

我有2分P1P2.我需要找到P3,以便

  • 所有要点都在同一条线上;
  • P3应在距离dP2(远离P1)

我开始一个复杂的系统显然很难解决...
替代文字

PS.

矢量答案很酷,但我使用C#而不知道如何在那里添加矢量.

math drawing

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

错误丢失; 在jquery中通过jquery发送序列化的xml之前的语句

我在var data =<?php echo serialize($msg);?>;下面的代码中得到此错误.控制台还会引发未定义错误的数据.我在数据周围加上引号,然后出现这个错误,但第一个错误仍然存​​在.

EDITED

//Raw xml
    $result = curl_exec($ch);
    curl_close($ch);
    $xml = simplexml_load_string($result);
     return $xml;
    } 
?>    
   <head>
   <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">
   </script>
   </head>
   <body>
   <script type="text/javascript"> <?php $msg = searchResults('windows');?>;
   var data ="<?php echo serialize($msg);?>";
   </script>
   <script type="text/javascript">
     $(document).ready(function() 
    {
       $.ajax({
       url: "script.php",
       type: "POST",
       data: data,
       success: function(){
       alert("success");
       }
      });
      return false;
     });
    </script>
    </body>
    </html>
Run Code Online (Sandbox Code Playgroud)

我试图看到但无法找出任何问题

这是script.php

<?php
var_dump($_POST);
?>
Run Code Online (Sandbox Code Playgroud)

这是来自twitter的xml

var data =O:16:"SimpleXMLElement":5:{s:2:"id";s:43:"tag:search.twitter.com,2005:search/#DIYSe_D";s:4:"link";a:4:{i:0;O:16:"SimpleXMLElement":1:{s:11:"@attributes";a:3:{s:4:"type";s:9:"text/html";s:4:"href";s:45:"http://search.twitter.com/search?q=%23DIYSe_D";s:3:"rel";s:9:"alternate";}}i:1;O:16:"SimpleXMLElement":1:{s:11:"@attributes";a:3:{s:4:"type";s:20:"application/atom+xml";s:4:"href";s:58:"http://search.twitter.com/search.atom?q=%23DIYSe_D&rpp=100";s:3:"rel";s:4:"self";}}i:2;O:16:"SimpleXMLElement":1:{s:11:"@attributes";a:3:{s:4:"type";s:37:"application/opensearchdescription+xml";s:4:"href";s:40:"http://search.twitter.com/opensearch.xml";s:3:"rel";s:6:"search";}}i:3;O:16:"SimpleXMLElement":1:{s:11:"@attributes";a:3:{s:4:"type";s:20:"application/atom+xml";s:4:"href";s:84:"http://search.twitter.com/search.atom?q=%23DIYSe_D&rpp=100&since_id=7856019371724800";s:3:"rel";s:7:"refresh";}}}s:5:"title";s:25:"#DIYSe_D - Twitter Search";s:7:"updated";s:20:"2010-11-24T21:53:28Z";s:5:"entry";a:3:{i:0;O:16:"SimpleXMLElement":7:{s:2:"id";s:44:"tag:search.twitter.com,2005:7552404006371328";s:9:"published";s:20:"2010-11-24T21:53:28Z";s:4:"link";a:2:{i:0;O:16:"SimpleXMLElement":1:{s:11:"@attributes";a:3:{s:4:"type";s:9:"text/html";s:4:"href";s:50:"http://twitter.com/_smir/statuses/7552404006371328";s:3:"rel";s:9:"alternate";}}i:1;O:16:"SimpleXMLElement":1:{s:11:"@attributes";a:3:{s:4:"type";s:9:"image/png";s:4:"href";s:67:"http://s.twimg.com/a/1289849896/images/default_profile_5_normal.png";s:3:"rel";s:5:"image";}}}s:5:"title";s:59:"#DIYse_D DELIVERAB: twitter messages 2_inc 1, 19th …
Run Code Online (Sandbox Code Playgroud)

php xml jquery json

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

Java try/catch性能,是否建议将try子句中的内容保持在最低限度?

考虑到你有这样的代码:

doSomething() // this method may throw a checked a exception
//do some assignements calculations
doAnotherThing() //this method may also throw the same type of checked exception
//more calls to methods and calculations, all throwing the same kind of exceptions.
Run Code Online (Sandbox Code Playgroud)

现在我知道,实际上在构造异常时会出现性能损失,特别是展开堆栈.我还阅读了几篇文章,指出在输入try/catch块时会有轻微的性能损失,但这些文章似乎都没有结论.

我的问题是,是否建议将try catch中的行保持最小?,即只在try子句中包含可以实际抛出正在捕获的异常的行.try子句中的代码运行速度较慢或导致性能下降吗?

但考虑到这一点,更重要的是最佳实践/更易读的解决方案:

try {
    doSomething() // this method may throw a checked a exception
//do some assignements calculations
doAnotherThing() //this method may also throw the same type of checked exception
//more calls to methods and calculations, all throwing …
Run Code Online (Sandbox Code Playgroud)

java performance readability try-catch

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

在ActiveRecord(Rails)中有什么类似create_view的东西吗?

我需要在我的数据库中创建一个视图.我知道我可以使用ActiveRecord使用create_table方法创建表.我想知道是否有类似create_table的东西,但是会创建一个视图.

ruby-on-rails

7
推荐指数
3
解决办法
3687
查看次数

如何在SQL Server中选择前100个字符?

我想将列截断为最多100个字符.你如何在SQL Server中这样做?

sql sql-server

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

在同一位置重新加载页面

嗨,我想知道是否有一种简单的方法可以在重新加载时将页面滚动到其先前的位置.例如,我的页面中间有一个公告牌.公告是分页的,用户可以单击下一步以查看下一批公告.页面重新加载时的问题是跳转到页面顶部的正常行为.当您使用F5重新加载页面时,页面重新加载到相同位置的一个很好的示例.

我知道很难做到这一点.

分页链接就是这样的

 index.php?page_num=2&page_scroll=200;
Run Code Online (Sandbox Code Playgroud)

当页面加载运行一个脚本,该脚本从URL中拉出页面滚动并设置

document.body.ScrollTop==200px.
Run Code Online (Sandbox Code Playgroud)

当然可以访问最后一页的dom并在重定向之前获取它的位置.当你点击F5时,浏览器如何做到这一点?

javascript php dom

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

重构一个类

我有两个几乎相同的类,实际上每个成员函数都是相同的,每个成员都是相同的,每个成员函数都完全相同.这些类之间的唯一区别是我可以定义其类型变量的方式:

AllocFactorScientific<102,-2> scientific;
AllocFactorLinear<1.2> linear;  
Run Code Online (Sandbox Code Playgroud)

这是他们的标题:

template<double&& Factor>
struct AllocFactorLinear;

template<short Mantissa, short Exponent, short Base = 10>
struct AllocFactorScientific
Run Code Online (Sandbox Code Playgroud)

我的问题是如何从那些允许我只有一组函数而不是两组相同函数的类中重构那些函数.

c++ refactoring c++11

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

c ++ std :: vector performance [需要参考]

我正在编写一些数据结构的并行实现.我想知道是否有人知道纯指针和std :: vector之间的性能差异.如果您知道有关它的可靠文档,请写下URL /书名/等等.任何提示都是受欢迎的!

c++ stl vector

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

背景图像可以比div本身大吗?

我有一个100%宽度的页脚div.它的高度约为50px,具体取决于其内容.

是否有可能为#footer提供一个溢出这个div的背景图像?

图像大约是800x600px,我希望它位于页脚的左下角.它应该有点像我的网站的背景图像,但我已经在我的身体上设置了背景图像.我需要另一个位于我网站左下角的图像,#footer div对此非常适合.

#footer {
    clear: both;
    width: 100%;
    margin: 0;
    padding: 30px 0 0;
    background:#eee url(images/bodybgbottomleft.png) no-repeat left bottom fixed;
}
Run Code Online (Sandbox Code Playgroud)

图像设置为页脚,但不会溢出div.是否有可能实现这一目标?

overflow:visible 不做这个工作!

css background image

72
推荐指数
6
解决办法
10万
查看次数

使用py2exe创建exe后,raw_input导致EOFError

从脚本创建exe后py2exe raw_input()导致EOFError.

我怎么能避免这个?

 File "test.py", line 143, in main
    raw_input("\nPress ENTER to continue ")
EOFError: EOF when reading a line
Run Code Online (Sandbox Code Playgroud)

python py2exe eoferror

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