问题列表 - 第22106页

PHP解析文件路径的目录和子目录以及仅jpg图像类型的名称

我希望修改这个PHP代码,在具有未知数量的子目录的单个已知目录上执行递归"搜索和显示图像".

这是我扫描单个目录并将文件回显到html的代码:

<?php 
    foreach(glob('./img/*.jpg') as $filename)
    {
        echo '<img src="'.$filename.'"><br>';
    }
?>
Run Code Online (Sandbox Code Playgroud)

假定基本目录$base_dir="./img/";包含具有未知数量的子目录和它们自己的子目录的层,这些子目录都仅包括.jpg文件类型.

基本上需要构建子目录的所有路径的数组.

php directory recursion parsing loops

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

Google Web Toolkit 2的隐藏功能

我很想知道Google Web Toolkit 2(GWT)的模糊隐藏功能是什么.如果您知道任何技巧/特征 - 在Javadocs中不常见,没有记录或隐藏,那么它们是什么以及为什么它们有用?

我个人最喜欢的是StyleSheetLoader,它隐藏在与GWT捆绑在一起的ShowCase应用程序中.我使用它来" 动态"交换样式表以提供Web应用程序主题功能.

功能摘要:

gwt web-applications

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

混淆在'if'语句中使用逗号

我在C++中有这段代码:

ihi = y[0]>y[1] ? (inhi=1,0) : (inhi=0,1);
Run Code Online (Sandbox Code Playgroud)

但它在C#中看起来如何呢?

c# c++ if-statement

13
推荐指数
2
解决办法
1347
查看次数

在Repeater内部的Linkbutton用于分页ASP.Net

我正在做一个带有搜索的网页,它会从MSSQL中获取大量信息.我所做的是一个存储过程,只返回要在网站上看到的页面.

现在我正在进行分页,因为我需要显示类似于谷歌的东西.如果您在第1页,他们会显示前10页,如果您在第19页,则显示自第9页到第28页.

我认为显示页码的最佳选择是在转发器中使用链接按钮.我现在遇到的问题是我不知道在回发时获取页码的最佳方法.

做一个快速示例我将一个ArrayList分配给repeater.datasource:

  <asp:Repeater ID="Repeater2" runat="server">
    <ItemTemplate>
            <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument="<%# Container.DataItem %>"><%# Container.DataItem %></asp:LinkButton>
    </ItemTemplate>
  </asp:Repeater>
  <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="4654">Test #1</asp:LinkButton>
Run Code Online (Sandbox Code Playgroud)

在我的Default.aspx.cs文件中,我有下一个代码

    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack)
        {
            string x = LinkButton2.CommandArgument;
            //string y = LinkButton1.CommandArgument;
//I know this line will not work since the Linkbutton1 is inside the Repeater.
            }
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能使它有效?

有没有人有这个分页更好的解决方案?

谢谢

杰瑞

c# asp.net paging repeater linkbutton

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

用法问题:Spring AOP与AspectJ编织

我正在使用Spring AOP分析遗留应用程序,我希望得到一些关于我需要做出的决定的数据点.

这就是我到目前为止所做的:我使用Spring AOP创建了代码和配置,这将帮助我分析Spring容器管理的bean.

在分析dao层时,我发现遗留应用程序使用c3p0框架 - 特别是ComboPooledDataSource类.由于这个类是最后一个类,因此我无法再使用Spring AOP - 因为cglib无法为最终类创建代理!

面对这个障碍,我打算使用方面编译时编织技术.我想知道这是正确的决定还是有其他方法可以使用Spring AOP本身来解决这个问题.请告诉我.

配置信息:

<bean id="sample_dao" class="com.foo.SampleDaoImpl">
  <property name="dataSource" ref="sample_data_source"/>
  ..
  <property name="sampleProperty" ref="sample_bean"/>
</bean>

   <bean id="sample_data_source" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" depends-on="some_sample">
  <property name="driverClass" value="${driverClassName}"/>
  <property name="jdbcUrl" value="${url}"/>
  <property name="user" value="${username}"/>
  <property name="password" value="${password}"/>
  <property name="initialPoolSize" value="1"/>
  <property name="maxPoolSize" value="4"/>
  <property name="acquireIncrement" value="1"/>
  <property name="preferredTestQuery" value="select 1 from sample_table"/>
  <property name="idleConnectionTestPeriod" value="30"/>
  <property name="testConnectionOnCheckin" value="true"/>
  <property name="acquireRetryAttempts" value="3"/>
  <property name="connectionCustomizerClassName" value="com.foo.SampleConnectionCustomizer"/>
Run Code Online (Sandbox Code Playgroud)

aop spring aspectj

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

如何从NSMutableArray中获取String值

码:

[self.menuList addObject:[NSDictionary dictionaryWithObjectsAndKeys:
                                       NSLocalizedString(@"PropertySubtype2fTitle", @""), 
                                       kTitleKey,
                                       publishNoOfRoomsViewController, 
                                       kViewControllerKey, nil]];
Run Code Online (Sandbox Code Playgroud)

menuList是一个NSMutableArray.

我想稍后在代码中读取PropertySubtype2fTitle本地化字符串,如:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

string iphone nsmutablearray didselectrowatindexpath

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

如何在ipod touch中隐藏URL栏

我需要在加载web applcation时隐藏ipod touch中的URL栏,我尝试了在线找到的所有可能的解决方案,包括在这里找到的解决方案:http: //www.iphonemicrosites.com/tutorials/how-to-hide-the-地址栏合mobilesafari /

并在CSS中设置min-height,但它仅适用于横向,在配置文件模式下,它只隐藏部分URL栏而不是整个栏.有谁有任何想法?谢谢.

下面是我的代码:

<meta name="app-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-touch-fullscreen" content="YES" />
<meta name="viewport" content="width=320;initial-scale=0.6666;;minimum-scale=0.6666; maximun-scale=1.0;"/>


<title>Test</title>
<script type="application/x-javascript">

addEventListener("load", function()
{
    setTimeout(updateLayout, 0);
}, false);

var currentWidth = 0;

function updateLayout()
{
    if (window.innerWidth != currentWidth)
    {
        currentWidth = window.innerWidth;

        var orient = currentWidth == 320 ? "profile" : "landscape";
        document.body.setAttribute("orient", orient);
        setTimeout(function()
        {
            window.scrollTo(0, 1);
        }, 100);
    }
}

setInterval(updateLayout, 100);

</script>
<link media="only screen and (max-device-width: 320px)" href="style.css" …
Run Code Online (Sandbox Code Playgroud)

iphone mobile-safari

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

在PHP/Apache/Linux上下文中,为什么chmod 777确实存在危险?

受到这个问题讨论的启发,可能是一个愚蠢的问题.

我们都被教导过,将基于Linux的Web主机上的目录或文件保留为权限级别777是一件坏事,并且根据需要设置总是很少的权限.

我现在好奇的地方正是在于剥削的危险,特别是在一个PHP/Apache的环境.

毕竟,一个PHP脚本文件可以从外部执行(即通过调用Web服务器,然后再到解释器),无论它是否被标记为"可执行",不是吗?这同样适用于通过命令行php解释器调用的文件,对吧?

那么漏洞到底在哪里777?事实是同一台机器上的其他用户可以访问世界上可写的文件吗?

php linux apache security chmod

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


有没有办法从javascript中的子函数调用父函数的Return?

我有一个非常奇怪的案例.我想要return一些数据 - 通过ajax下载的数据.到目前为止,异步和同步模式无法及时获取数据return.有可能我可以return从子函数调用父函数,还是timeOut可以解决问题?我想不出另一种方法,但必须返回数据.

javascript ajax return

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