小编Han*_*Gay的帖子

IE7在Vista上检测到IE6 ...为什么?

我有两台vista商务机.我在两者上安装了IE 7.在我的第一台机器(Computer1)上,如果我去这个网站(http://www.quirksmode.org/js/detect.html),它说我在Windows上使用"Explorer 6".如果我将Computer2与Vista Business和IE7一起使用,它说我在Windows上使用"Explorer 7".这里是一个屏幕捕获.两台机器上都有相同版本的IE.有人有解决方案吗?

user-agent windows-vista internet-explorer-7 internet-explorer-6

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

如何在Web上获取文件的创建日期(使用Python)?

我有一个python应用程序,它依赖于客户从网站下载的文件.

该网站不在我的控制之下,并且没有API来检查该文件的"最新版本".

有没有一种简单的方法来访问文件(在python中)通过URL并检查它的日期(或大小),而不必每次都下载到客户端机器?

更新:感谢那些提到"最后修改"日期的人.这是要查看的正确参数.

我想我没有说好问题.我如何从python脚本执行此操作?我想申请检查文件,然后下载(如果(最后修改日期<当前文件日期)).

python http

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

对于只能出现一次的东西的规范术语?什么东西可以多次出现?

我真的很肛门我的名字,我需要一个形容词,只允许发生一次,以及允许多次发生的事情.

例子:

  • wordthatmeansitcanonlyhappenonce触发器
  • wordthatmeansitcanhappenmultipletimes触发器

terminology

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

帮助实现奇怪的Java GC行为

我有一个在Apache背后的JBoss上运行的Java Web应用程序(通过mod_jk),我看到一些非常奇怪的GC行为.我已经附上了这个问题的图表.之前有没有人见过类似的GC行为?它是Java 6,在服务器级机器上运行符合人机工程学的默认GC调优.谢谢.

注意:上图是指向全尺寸版本的链接.该图是使用GCViewer生成的.

java garbage-collection

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

使用mod_python时python日志记录模块的不同行为

我们有一个令人讨厌的问题,我们看到python日志记录模块在我们的服务器上运行mod_python时表现不同.在shell中执行相同的代码,或者使用runserver命令或使用mod_wsgi在django中执行相同的代码时,行为是正确的:

import logging
logger = logging.getLogger('site-errors')
logging.debug('logger=%s' % (logger.__dict__))
logging.debug('logger.parent=%s' % (logger.parent.__dict__))
logger.error('some message that is not logged.')
Run Code Online (Sandbox Code Playgroud)

然后我们进行以下记录:

2009-05-28 10:36:43,440,DEBUG,error_middleware.py:31,[logger = {'name':'site-errors','parent':<logging.RootLogger instance at 0x85f8aac>,'handlers': [],'level':0,'禁用':0,'manager':<logging.Manager实例位于0x85f8aec>,'propagate':1,'filters':[]}]

2009-05-28 10:36:43,440,DEBUG,error_middleware.py:32,[logger.parent = {'name':'root','parent':None,'handlers':[<logging.StreamHandler instance at at 0x8ec612c>,<logging.handlers.RotatingFileHandler实例位于0x8ec616c>],'level':10,'禁用':0,'传播':1,'过滤器':[]}]

可以看出,没有为子记录器"site-errors"设置处理程序或级别.

日志配置在settings.py中完成:

MONITOR_LOGGING_CONFIG = ROOT + 'error_monitor_logging.conf'

import logging
import logging.config

logging.config.fileConfig(MONITOR_LOGGING_CONFIG)

if CONFIG == CONFIG_DEV:
   DB_LOGLEVEL = logging.INFO
else:
   DB_LOGLEVEL = logging.WARNING
Run Code Online (Sandbox Code Playgroud)

第二个问题是我们还在__init__.py中添加了一个自定义处理程序,该处理程序将其作为error_middleware.py驻留在该文件夹中:

import logging
from django.conf import settings
from db_log_handler import DBLogHandler

handler = DBLogHandler()
handler.setLevel(settings.DB_LOGLEVEL)
logging.root.addHandler(handler)
Run Code Online (Sandbox Code Playgroud)

在日志记录中无法看到自定义处理程序!

如果有人知道问题所在,请告诉我们!不要犹豫要求提供额外的信息.这肯定有助于解决问题.

python django logging mod-python

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

与YUI的DataTable最接近的jQuery近似是什么?

我的两个最高优先级是渐进增强和内联编辑.我发现了渐进增强(DataTables)和内联编辑(jqGrid),但不是两者都有.支持jQuery UI主题会很不错,但优先级较低.

更新:这是我想象的解决方案类似的例子:

<table summary="A table full of example tabular data">
  <caption>My Table to Progressively Enhance</caption>
  <thead>
    <tr>
      <th id="colA">Column A</th>
      <th id="colB">Column B</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td headers="colA">foo</td>
      <td headers="colB">bar</td>
    </tr>
    <tr>
      <td headers="colA">argle</td>
      <td headers="colB">bargle</td>
    </tr>
  </tbody>
</table>

… insert jquery datatable stuff here …

<script type="text/javascript">
    progressivelyEnhanceMyTable();
</script>
Run Code Online (Sandbox Code Playgroud)

jquery yui html-table progressive-enhancement inline-editing

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

在Java上保存对象状态而不使用外部存储器

美好的一天.我知道为了在Java中保存对象状态,我应该使用序列化.但是在关于序列化的每一个主题中都说明我必须在某处保存我的对象(磁盘,网络).我的问题是我不允许这样做.我需要一种方法来保存和恢复对象状态,而无需将其写在"外部"内存上.也许将它保存在堆或堆栈上...请不要提供克隆它,我也不允许这样做.谢谢.

java serialization

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

匹配包含撇号的字符串的问题

我想在一些括号内匹配一个字符串.我的字符串可能有一些撇号.我使用以下模式进行匹配,但这不是拾取字符串,我不明白为什么 - 任何想法?

pattern = re.compile('<([\w\s\']+)>', re.IGNORECASE)
Run Code Online (Sandbox Code Playgroud)

例如,<Let's rock!>会屈服Let's rock!

python regex

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

java.io和socket.getInputStream()

我有这个代码:

 Socket incomingConnection = serverSocket.accept();
 String strategy = "1";
 Client client = new Client(incomingConnection, this, strategy);
Run Code Online (Sandbox Code Playgroud)

客户构造函数:

  public Client(Socket socket, ChatServer chatServer, String strategy) throws IOException{
        this.socket = socket;
        this.inputStream = socket.getInputStream();
        this.outputStream = socket.getOutputStream();

        this.chatServer = chatServer;
        this.instance1 = new Strategy1(chatServer, this);
        this.instance2 = new Strategy2(chatServer, this);
        this.strategy = (this.instance1.getName().equals(strategy1) ? this.instance1 : this.instance2);
        this.strategy.setStreams();
    }
Run Code Online (Sandbox Code Playgroud)

现在看起来像Strategy1:

public class Strategy1{
public Strategy1(ChatServer server, Client client) throws IOException{
    this.chatServer = server;
    this.client = client;
}

public void …
Run Code Online (Sandbox Code Playgroud)

java sockets java-io

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