问题列表 - 第47521页

是否有更有效的方式来获取电子邮件后缀而不是爆炸?(PHP)

当前代码我用来获取电子邮件后缀

$emailarray  = explode('@',$email_address);
$emailSuffix = $emailarray[1];
Run Code Online (Sandbox Code Playgroud)

必须有一个更有效的功能.也许用的东西substr()

php email

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

渲染部分:对象vs:本地

<%= render :partial => 'partial/path', :locals => {:xyz => 'abc'} %>
Run Code Online (Sandbox Code Playgroud)

VS

<%= render :partial => 'partial/path', :object => @some_object %>
Run Code Online (Sandbox Code Playgroud)

我认为第一个在partial中创建一个名为xyz的局部变量,第二个在partial中创建一个名为object的局部变量.那么区别是什么呢?(除了本地人允许多于变量)

ruby-on-rails

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

警告:赋值从指针生成整数而没有强制转换

当我声明一个char *固定的字符串并重用指针指向另一个字符串

/* initial declaration */
char *src = "abcdefghijklmnop";
.....

/* I get the   "warning: assignment makes integer from pointer without a cast" */
*src ="anotherstring";
Run Code Online (Sandbox Code Playgroud)

我试图重铸指针但没有成功.

c casting

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

减少Wordpress网站上的等待时间

我已经配置了一个月的wordpress主题,但知道我想提高速度.我已经阅读了关于提高速度的不同提示,这些提示有很大帮助,但似乎我的域的初始负载花费的时间最长.使用firebug工具中的"net"选项卡,它向我显示正在运行的不同进程.我已经在页眉,页脚和我主题的其他部分更改了一些静态php请求.我删除了任何插件,我没有使用; 并优化了一些图像.我通过永久删除帖子/页面修订来优化我的数据库.我删除了垃圾数据库条目.

我应该提到我确实使用了W3 Total Cache,这确实提高了网站的速度,但是一些缓存选项令人困惑,因为最近对网站的一些更改没有被提取.我的网站基于我的会员创建/更新优惠券和提供企业,因此他们必须能够看到对网站及其个人列表所做的任何更改.所以暂时我将其停用.

为什么加载第一个请求需要这么长时间(平均8秒),这是我的域名?如何增加等待时间?

这是网站:savingsulove dot com

php wordpress performance

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

System.Internal中的_HACK方法的目的是什么(x64上的.net 4.0)

在x64上的.net 4.0的mscorlib中,有一个类System.Internal包含三个带后缀的静态方法_HACK.有没有人知道这些方法的目的是什么?

这是.NET Reflector输出:

internal static class Internal
{
    // Methods
    private static void CommonlyUsedGenericInstantiations_HACK()
    {
        Array.Sort<double>(null);
        Array.Sort<int>(null);
        Array.Sort<IntPtr>(null);
        new ArraySegment<byte>(new byte[1], 0, 0);
        new Dictionary<char, object>();
        new Dictionary<Guid, byte>();
        new Dictionary<Guid, object>();
        new Dictionary<Guid, Guid>();
        new Dictionary<short, IntPtr>();
        new Dictionary<int, byte>();
        new Dictionary<int, int>();
        new Dictionary<int, object>();
        new Dictionary<IntPtr, bool>();
        new Dictionary<IntPtr, short>();
        new Dictionary<object, bool>();
        new Dictionary<object, char>();
        new Dictionary<object, Guid>();
        new Dictionary<object, int>();
        new Dictionary<object, long>();
        new Dictionary<uint, WeakReference>();
        new Dictionary<object, uint>();
        new …
Run Code Online (Sandbox Code Playgroud)

c# generics 64-bit internals .net-4.0

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

遍历一个用 C# 中的数组填充的 List

        public List<string[]> parseCSV(string path)
    {
        List<string[]> parsedData = new List<string[]>();

        try
        {
            using (StreamReader readFile = new StreamReader(path))
            {
                string line;
                string[] row;
                while ((line = readFile.ReadLine()) != null)
                {
                    row = line.Split(',');
                    parsedData.Add(row);
                }
            }
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
        }

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

我想使用此代码来解析 CSV,这将返回一个填充数组的列表。我的问题是,如果列表中的数组大小未知,我该如何遍历它们?

例如:

for (int a=0; a<=CSVList(firstindex).Length;a++)
         for (int a=0; a<=CSVList(secondindex).Length;a++)
Run Code Online (Sandbox Code Playgroud)

像这样的东西会读取 CSVList 的第一个索引,然后读取其中的第一个数组元素......我想我真的被语法困住了。

谢谢

c#

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

JAXB没有将xml的任何元素解组为JAXBElement

我有一个网络服务电话.在我的响应中,当我尝试将xml any元素放入JAXBElement时,它会抛出错误.

在模式中我有:

<xs:complexType name="InputType">
    <xs:annotation></xs:annotation>
    <xs:sequence>           
        <xs:element name="Id" type="xs:string" />
        <xs:any namespace="##any" processContents="lax" minOccurs="0" />
    </xs:sequence>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)

我正在使用的代码:

Object obj = inputType.getAny();
Object o = ((JAXBElement)obj).getValue(); 
Run Code Online (Sandbox Code Playgroud)

这行引发了错误:org.apache.xerces.dom.ElementNSImpl incompatible with javax.xml.bind.JAXBElementsoap ui中的错误.

为什么它不转换为JAXBElement?我如何使其工作?

java jaxb

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

C++ - 图像处理库还是计算机视觉库?

我对使用C++进行医学图像特征提取感兴趣(即恶性和良性结节).

什么适合我,图像处理库或计算机视觉

谢谢.

c++ image-processing computer-vision libraries

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

Jquery选择器问题

我的页面上有以下html标记,

<div id="sig_container">
    <div id="layer1" class="layer ui-draggable ui-resizable ui-resizable-autohide">
    <div id="layer2" class="layer ui-draggable ui-resizable ui-resizable-autohide">
    <div id="layer3" class="layer ui-draggable ui-resizable selected ui-resizable-autohide">
</div>
Run Code Online (Sandbox Code Playgroud)

在这个页面上,我试图选择#sig_container div,而不选择任何一个孩子.但是我遇到了一个问题.选择器要么选择所有内容,要么不选

在此先感谢丹尼尔

编辑:对不起,我应该添加我试图在容器上添加一个点击事件.所以我希望只有当我点击容器而不是孩子时才会触发事件.

html javascript jquery selector

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

如何使WPF按钮看起来像一个链接?

我想在WPF中使用像链接样式的按钮.Microsoft在其Windows对话框中执行此操作(看似不一致).

它们看起来像蓝色文字.并在鼠标光标悬停时更改颜色和下划线.

例:

Windows 7中的LinkBut​​ton

我搞定了.(感谢Christian,Anderson ImesMichaC)但是,我必须把一个TextBlock放在我的按钮内.

如何在不需要Button内的TextBlock的情况下改进我的风格?

用法XAML

<Button Style="{StaticResource HyperlinkLikeButton}">
    <TextBlock>Edit</TextBlock>
</Button>
Run Code Online (Sandbox Code Playgroud)

风格XAML

<Style x:Key="HyperlinkLikeButton" TargetType="Button">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <ContentPresenter />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" />
    <Setter Property="Cursor" Value="Hand" />
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="true">
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <ControlTemplate.Resources>
                            <Style TargetType="{x:Type TextBlock}">
                                <Setter Property="TextDecorations" Value="Underline" />
                            </Style>
                        </ControlTemplate.Resources>
                        <ContentPresenter />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Trigger>
    </Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)

windows wpf xaml styles wpf-controls

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