问题列表 - 第4805页

数据库视图会影响查询性能吗?

数据库视图只是简化数据访问的一种方法,还是在访问视图时提供了性能优势,而不是仅运行视图所基于的查询?我怀疑视图在功能上等同于将存储的视图查询添加到视图数据上的每个查询,这是正确的还是还有其他细节和/或优化发生?

database performance views

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

Spring和Hibernate的Java截屏视频

我是一个对学习OOP和Java感兴趣的SQL人员,但我阅读或遇到的大多数书都没有触及数据库.

是否有任何可以直接教我Spring Framework和Hibernate框架而不深入Java的截屏视频?

java

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

如何在返回null时检索HttpContext属性?

我在一个单独的线程上做一些异步工作:

ThreadPool.QueueUserWorkItem()
Run Code Online (Sandbox Code Playgroud)

在这个单独的线程中,我需要调用HttpContext.Current以便我可以访问:

HttpContext.Current.Cache  
HttpContext.Current.Server  
HttpContext.Current.Request  
Run Code Online (Sandbox Code Playgroud)

但是,HttpContext.Current当我创建这个单独的线程时,它为null.

如何创建新线程以使其HttpContext.Current不为空?或者是否有另一种方法可以访问Cache,Server和Request对象?

asp.net httpcontext

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

打开包含Excel中特殊字符的.csv文件

我有一个系统导出.csv文件,一些行包含特殊的框字符,使得数据如下所示:

Please specify the primary type of opportunity which you’re proposing:
?? Please specify what type of sport:
?? What is this person’s vocation?
??? How long have they been in the industry?
Run Code Online (Sandbox Code Playgroud)

但是,当我在Excel中打开文件时,Excel会对框中的字符进行扭曲,使其最终看起来像这样:

Please specify the primary type of opportunity which you’re proposing:    
└─ Please specify what type of sport:   
└─ What is this person’s vocation?    
└── How long have they been in the industry?  
Run Code Online (Sandbox Code Playgroud)

该文件以纯文本形式保存到用户的硬盘中,我可以在文本编辑器中打开它并查看字符,所以我知道当Excel读入数据时会发生这种情况.

有什么想法吗?我怎么能阻止这个?

excel text

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

开源java XSLT 2.0实现?

我目前正在研究使用XSLT 2.0,但我找不到任何开源java实现(Saxon-B似乎符合要求,但不支持架构).

我错过了什么吗?

java xml xslt open-source xslt-2.0

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

如何获取方法的Method对象?

我正在尝试按以下方式扩展Method类:

irb(main):008:0> class A
irb(main):009:1> def a
irb(main):010:2> puts "blah"
irb(main):011:2> end
irb(main):012:1> end
=> nil
irb(main):013:0> class Method
irb(main):014:1> def aa
irb(main):015:2> p "hi"
irb(main):016:2> end
irb(main):017:1> end
=> nil
irb(main):018:0> f = A.new
=> #<A:0x54ed4>
irb(main):019:0> A.a
NoMethodError: undefined method `a' for A:Class
    from (irb):19
    from :0
irb(main):020:0> f.a
blah
=> nil
irb(main):027:0> f.a.aa
blah
NoMethodError: undefined method `aa' for nil:NilClass
    from (irb):27
    from :0
Run Code Online (Sandbox Code Playgroud)

正如所料,当我f.a.aa,.aa正在执行的返回值f.a.如何获得对表示的Method对象的访问权限f.a

ruby

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

从C访问网络数据包中未对齐数据的安全有效方法

我正在用ARM9处理器编写C for Linux程序.该程序用于访问网络数据包,其中包括一系列标记数据,如:

<fieldID><length><data><fieldID><length><data> ...
Run Code Online (Sandbox Code Playgroud)

fieldID和length字段都是uint16_t.数据可以是1个或更多字节(如果使用全长,则最多64k,但事实并非如此).

只要<data>有一个偶数个字节,我就没有看到问题.但是,如果我有一个1或3或5字节的<data>部分,那么下一个16位fieldID最终不会出现在16位边界上,我预计会出现对齐问题.已经有一段时间了,因为我从头开始做了这样的事情,所以我对细节不太了解.任何反馈欢迎.谢谢.

c networking memory-alignment

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

如何将基于www的URL动态重定向到同一个VirtualHost中具有多个域的非www URL

我有一个看起来像这样的VirtualHost:

<VirtualHost *:80>

  ServerName  domain1.com
  ServerAlias www.domain1.com domain2.com www.domain2.com

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

当有人访问www.domain1.com/test时,应将其重定向到:

domain1.com/test
Run Code Online (Sandbox Code Playgroud)

当有人访问www.domain2.com/test时,应将其重定向到:

domain2.com/test
Run Code Online (Sandbox Code Playgroud)

我目前的RewriteRules缺乏.

编辑:这是我到目前为止所得到的:

# Rewrite www to non-www
RewriteEngine on
RewriteCond %{HTTP_HOST} www\.%{HTTP_HOST}$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301]
Run Code Online (Sandbox Code Playgroud)

显然,这会产生无限重定向循环.

apache mod-rewrite url-rewriting

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

在多个文件中查找/替换的最佳方法是什么?

最好的方法是什么?我不是命令行战士,但我认为有可能使用grep和cat.

我只想替换文件夹和子文件夹中出现的字符串.最好的方法是什么?如果重要的话,我正在运行ubuntu.

-d

shell replace find

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

javascript,css,z-index,div stacking

我想创建一种只对页面内的单个DIV起作用的光/厚盒子.当我开火时,第一个div(phantom_back)按照我想要的方式行动,但是第二个,phantom_top在phantom_back之后设置自己,无论它的z-index和定位如何.

我究竟做错了什么?

这是我到目前为止:

<html>
<head>
    <script type="text/javascript">
    <!--//
        function phantom_back(image)
        {
            document.getElementById('phantom_back').style.zIndex = 100;
            document.getElementById('phantom_back').style.height = '100%';
            document.getElementById('phantom_back').style.width = '100%';
            phantom_top();
        }

        function phantom_top(image)
        {
            document.getElementById('phantom_top').style.zIndex = 102;
            document.getElementById('phantom_top').style.height = 600;
            document.getElementById('phantom_top').style.width = 600;
            document.getElementById('phantom_top').style.top = 0;
            document.getElementById('phantom_top').style.left = 0;
        }
    //-->
    </script>
</head>
<body>
    <a href="#" onclick="phantom_back()">Change</a>

    <div style="height: 700px; width: 700px; border: 2px black solid; margin:0 auto; background-color: red;" id="overlord">
        <div style="height: 10px; width: 10px; position: relative; z-index: -1; background-color: #000000; filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.5;" id="phantom_back"></div> …
Run Code Online (Sandbox Code Playgroud)

html javascript css z-index

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