问题列表 - 第46752页

C#远程应用程序执行

我正在尝试创建某种远程应用程序执行程序.情况是我在远程PC上有一个我需要执行的脚本.理想情况下,我可以告诉这个远程PC执行这个脚本,就好像我在本地.

如果可能的话,它可以执行而无需登录到PC(例如发送登录详细信息等).我打算使用.net c#.

c#

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

mod_proxy_ajp错误:将html呈现为text/plain,提示用户"另存为..."

我们有一个奇怪的,间歇性的错误,发生在mod_proxy_ajp,即使用apache作为tomcat服务器的前端.

错误

  • 用户点击链接浏览器会提示用户"另存为...."(例如在Firefox中"你选择了顶级开放的thread.jsp,这是一个应用程序/八位字节流"...... firefox应该对这个文件做什么)
  • 用户说"嗯?" 并按"取消"
  • 用户再次点击同一链接
  • 浏览器正确显示页面

此错误间歇性地发生,但遗憾的是很少在我们的测试服务器上并且经常在生产中.

在firefox的LiveHttpHeaders中,我在上面的用例中看到以下内容:

  • 首页下载(即点击链接)是"text/plain"
  • 第二次下载是"text/html"

我认为问题可能源于ProxyPassReverse(即混淆了是否使用http或ajp),但所有这些proxypassreverse设置都导致了同样的错误:

另外,我检查了apache错误日志(设置为debug),看不到警告或错误......

**但它适用于mod_proxy_http ??**

似乎切换到mod_proxy_http'解决了这个问题.有限的测试,我无法在测试环境中重现问题.

因为这个问题是间歇性的,所以我不能100%确定mod_proxy_http"解决"了这个问题

环境

  • Apache 2.2 Windows
  • Jboss 4.2.2后端(tomcat 6)

另一个数据点

无论好坏,tomcat中的servlet过滤器会在将html发送到apache之前对其进行gzip压缩.(这意味着额外的工作,因为apache必须在执行ProxyPassReverse的"查找和替换"之前解压缩).我不知道"gzip"是否会混乱.

问题

  • 有人见过这个吗?
  • 什么工具有助于分析原因?

谢谢

附录1:这是LiveHttpHeaders输出

浏览器错误地将html视为"text/plain"

http://forums.customer.com/pe/action/forums/displaythread?rootPostID=10842016&channelID=1&portalPageId=1002

GET http://forums.customer.com/pe/action/forums/displaythread?rootPostID=10842016&channelID=1&portalPageId=1002 HTTP/1.1
Host: forums.customer.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Proxy-Connection: keep-alive
Cookie: __utma=156962862.829309431.1260304144.1297956514.1297958674.234; __utmz=156962862.1296760237.232.50.utmcsr=forumstest.customer.com|utmccn=(referral)|utmcmd=referral|utmcct=/pe/action/forums/displaythread; s_vi=[CS]v1|258F5B88051D3FC3-40000105C056085F[CE]; inqVital=xd|0^sesMgr|{"sID":4,"lsts":1292598007}^incMgr|{"id":"755563420055418864","group":"CHAT","ltt":1292598006741,"sid":"755563549194447187","igds":"1290627502757","exempt":false}^inq|{"customerID":"755562378269271622"}^saleMgr|{"state":"UNSOLD","qDat":{},"sDat":{}}; inqState=sLnd|1^Lnd|{"c":4,"flt":1274728016,"lldt":17869990,"pgs":{"201198":{"c":1,"flt":1274728016,"lldt":0},"0":{"c":3,"flt":1274845009,"lldt":17752997}},"pq":["0","0","0","201198"],"fsld":1274728016697}; …
Run Code Online (Sandbox Code Playgroud)

apache tomcat mod-proxy ajp

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

Rails太多查询?

只是做一些Rails并注意到当使用@products.each do它在单个页面上显示30个产品时,好像在后台有很多查询,请参阅下面的我的控制台输出.这是对的,还是我读错了?

Category Load (0.1ms)  SELECT "categories".* FROM "categories" WHERE ("categories"."name" = 'bras') LIMIT 1
  Product Load (28.0ms)  SELECT "products".* FROM "products" WHERE ("products".category_id = 48)
  Brand Load (0.2ms)  SELECT "brands".* FROM "brands" WHERE ("brands"."id" = 408) LIMIT 1
  Category Load (0.1ms)  SELECT "categories".* FROM "categories" WHERE ("categories"."id" = 48) LIMIT 1
  Merchant Load (0.1ms)  SELECT "merchants".* FROM "merchants" WHERE ("merchants"."id" = 2) LIMIT 1
Rendered products/_product.html.erb (16.9ms)
  CACHE (0.0ms)  SELECT "brands".* FROM "brands" WHERE ("brands"."id" = 408) …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails-3

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

Scheme中的递归函数是否总是尾调用优化?

我已经阅读了一些关于Scheme中尾调优化的内容.但我不确定我是否理解尾调用的概念.如果我有这样的代码:

(define (fac n)
  (if (= n 0)
      1
      (* n (fac (- n 1)))))
Run Code Online (Sandbox Code Playgroud)

这可以优化,以便它不会占用堆栈内存吗?或者尾部调用优化只能应用于这样的函数:

(define (factorial n)
    (let fact ([i n] [acc 1])
      (if (zero? i)
          acc
          (fact (- i 1) (* acc i)))))
Run Code Online (Sandbox Code Playgroud)

scheme tail-call-optimization

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

如何获得我的Android应用程序的可怕WRITE_SECURE_SETTINGS权限?

我需要能够打开和关闭GPS接收器,并且需要WRITE_SECURE_SETTINGS才能访问安全设置.我已经搜索了很多,我看到的每个答案都说,系统/固件之外的任何应用程序都无法获得该认可.

然而,这完全是不真实的.市场上有几个应用程序正是我正在尝试的(关于GPS),但还有更多具有WRITE_SECURE_SETTINGS权限的应用程序.例如:

扩展控件

SwitchPro

配置流程

那么,怎么做呢?

permissions gps android

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

以编程方式更改spring security logout-success-url

我需要根据用户的角色将用户重定向到2个不同的注销URL.我该怎么做呢?

我正在使用spring security 2.0,我的xml看起来像这样:

    <s:http access-denied-page="/" >
        <s:intercept-url pattern="/pages/SplashPage.jsf" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
        <s:intercept-url pattern="/pages/Home.jsf" access="ROLE_USER,ROLE_MERCHANT"/>

        <s:anonymous/>
        <s:form-login
            login-page="/"
            login-processing-url="/j_spring_security_check"
            default-target-url="/pages/Home.jsf"
            authentication-failure-url="/" always-use-default-target='false' />
        <s:logout invalidate-session="true" logout-url="/pages/logout.jsf" logout-success-url="/" />
        <s:concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="false"/>
    </s:http>
Run Code Online (Sandbox Code Playgroud)

spring-security

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

从图形调整图像大小?

我试图在从屏幕上复制它后调整图像大小,并且无法弄清楚如何做到这一点.我一直在阅读的教程建议使用Graphics.DrawImage来调整图像大小,但是当我运行此代码时,它不会调整大小.

Bitmap b = new Bitmap(control.Width, control.Height);
Graphics g = Graphics.FromImage(b);
g.CopyFromScreen(control.Parent.RectangleToScreen(control.Bounds).X, control.Parent.RectangleToScreen(control.Bounds).Y, 0, 0, new Size(control.Bounds.Width, control.Bounds.Height), CopyPixelOperation.SourceCopy);

g.DrawImage(b, 0,0,newWidth, newHeight);
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激,谢谢!

c# graphics

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

从SQL服务器转换一个小int

我正在使用linq to sql来填充对象列表.我感兴趣的其中一个字段存储为tinyint.我应该如何在对象定义中声明此属性类型?作为短片?字节?Int16的?

谢谢.

c# linq asp.net linq-to-sql

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

悬停另一个时将类添加到div(Javascript)

我对Javascriptan有一个有限的理解我正在尝试将一个类添加到div当我悬停另一个div现在我可以添加一个类到同一个div但我希望能够添加让我们说类蓝色到div当我悬停#second和#third时首先调用.

当前代码:

    
    $(document).ready(function() {     
    $("#second, #third").hover(function(){     
    $(this).addClass("hover");    
    $(this).removeClass("hoverable");      
    },     
    function(){    
    $(this).removeClass("hover");     
        $(this).addClass("hoverable");     
    }  
    );     
    });        

我的实时网站可以在www.designinterieurm2.com/dev上看到

html javascript css jquery

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

模拟使用findAll,生成MissingMethodException的grails方法

def retrieveEatenFood(String token, String addedDate) {     

    def consumer = Consumer.findByMobileToken(token)
    if(consumer != null) {  

        def efList = []

        def list = consumer.findAll("from EatenFood as ef where date(ef.dateAdded) =  date(:da)",[da:sdf_long.parse(addedDate)])
        list.each{
            def eatenList = [:]
            eatenList.put("foodType",it.food.name)
            eatenList.put("sequenceNumber",it.sequenceNumber)
            eatenList.put("eatenDate", it.eatenDate)
            eatenList.put("DateAdded",it.dateAdded)
            efList.add(eatenList);
        }

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

试图模拟上面的方法,但findAll继续生成异常.

这个问题有效!现在我需要为它编写测试,并且我一直得到这个例外.任何人都可以帮助我!

groovy.lang.MissingMethodException: No signature of method: carrotdev.Consumer.findAll() is applicable for argument types: (java.lang.String, java.util.LinkedHashMap) values: [from EatenFood as ef where date(ef.dateAdded) =  date(:da), [da:Sun Feb 13 01:51:47 AST 2011]]
Possible solutions: findAll(groovy.lang.Closure), find(groovy.lang.Closure)
    at …
Run Code Online (Sandbox Code Playgroud)

grails junit unit-testing grails-orm

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