灯角

文章 0 评论 0 浏览 23

灯角 2024-12-24 20:21:21

您可以执行此操作来刷新 updatepanel,而无需按钮:

<script type="text/javascript">

    function refreshPanel() {
        __doPostBack('<%= updatePanel.UniqueID %>', '');
    }

</script>
<label>Search:</label>
<asp:TextBox runat="server" ID="search"  
                ClientIDMode="Static" OnKeyUp="refreshPanel();" />
<asp:UpdatePanel runat="server" ID="updatePanel">

您只需为 updatepanel 提供一个 ID(此处为 updatePanel),然后

在按键时或在您准备好时执行该代码。

You can do this to refresh your updatepanel without the button:

<script type="text/javascript">

    function refreshPanel() {
        __doPostBack('<%= updatePanel.UniqueID %>', '');
    }

</script>
<label>Search:</label>
<asp:TextBox runat="server" ID="search"  
                ClientIDMode="Static" OnKeyUp="refreshPanel();" />
<asp:UpdatePanel runat="server" ID="updatePanel">

You just need to give your updatepanel an ID (updatePanel here)

Execute that code on a keyup or whenever you are ready for it.

如何通过TextBox控件触发UpdatePanel?

灯角 2024-12-24 16:57:48

好吧,错误的根本原因是 PlotLegends 包,这是一个可怕的、有缺陷的包。删除它,Show 可以正确组合它们:

plota = Plot[{-2 x, -2 Sqrt[x], -2 x^(3/5)}, {x, 0, 1}]
plotb = ParametricPlot[{2.4056 (u - Sin[u]), 2.4056 (Cos[u] - 1)}, {u,
    0, 1.40138}]
Show[plota, plotb]

在此处输入图像描述

您可以看到 Simon 的解决方案 此处获取在不使用标签的情况下标记不同曲线的想法PlotLegends。 James 的这个答案也说明了为什么 PlotLegends 具有它所拥有的声誉...


您仍然可以使用 PlotLegends 包来挽救一些东西。下面是一个使用 ShowLegends 的示例,您可以根据自己的喜好进行修改

colors = {Red, Green, Blue, Pink};
legends = {-2 x, -2 Sqrt[x], -2 x^(3/5), "Problem 3"};

plota = Plot[{-2 x, -2 Sqrt[x], -2 x^(3/5)}, {x, 0, 1}, 
   PlotStyle -> colors[[1 ;; 3]]];
plotb = ParametricPlot[{2.4056 (u - Sin[u]), 2.4056 (Cos[u] - 1)}, {u,
     0, 1.40138}, PlotStyle -> colors[[4]]];
ShowLegend[
 Show[plota, 
  plotb], {Table[{Graphics[{colors[[i]], Thick, 
      Line[{{0, 0}, {1, 0}}]}], legends[[i]]}, {i, 4}], 
  LegendPosition -> {0.4, -0.15}, LegendSpacing -> 0, 
  LegendShadow -> None, LegendSize -> 0.6}]

在此处输入图像描述

Well, the root cause of the error is the PlotLegends package, which is a terrible, buggy package. Removing that, Show combines them correctly:

plota = Plot[{-2 x, -2 Sqrt[x], -2 x^(3/5)}, {x, 0, 1}]
plotb = ParametricPlot[{2.4056 (u - Sin[u]), 2.4056 (Cos[u] - 1)}, {u,
    0, 1.40138}]
Show[plota, plotb]

enter image description here

You can see Simon's solution here for ideas to label your different curves without using PlotLegends. This answer by James also demonstrates why PlotLegends has the reputation it has...


You can still salvage something with the PlotLegends package. Here's an example using ShowLegends that you can modify to your tastes

colors = {Red, Green, Blue, Pink};
legends = {-2 x, -2 Sqrt[x], -2 x^(3/5), "Problem 3"};

plota = Plot[{-2 x, -2 Sqrt[x], -2 x^(3/5)}, {x, 0, 1}, 
   PlotStyle -> colors[[1 ;; 3]]];
plotb = ParametricPlot[{2.4056 (u - Sin[u]), 2.4056 (Cos[u] - 1)}, {u,
     0, 1.40138}, PlotStyle -> colors[[4]]];
ShowLegend[
 Show[plota, 
  plotb], {Table[{Graphics[{colors[[i]], Thick, 
      Line[{{0, 0}, {1, 0}}]}], legends[[i]]}, {i, 4}], 
  LegendPosition -> {0.4, -0.15}, LegendSpacing -> 0, 
  LegendShadow -> None, LegendSize -> 0.6}]

enter image description here

在 Mathematica 中组合图未给出预期结果

灯角 2024-12-24 01:53:16

除了 Basile Starynkevitch 和 Bram 的回答之外,

在 Objective C 中,代码行之间的区别是,

NSString *red = [[NSString alloc]initWithFormat:@"%@"];

**上面的代码表示您拥有红色对象,因此您有责任释放它。

NSString *blue = [NSString stringWithFormat:@"%@"];

**您不拥有它,程序深处的其他人将拥有它,并且您不必释放它。

我建议您阅读 Apple 的文档以获取更多信息,这太棒了!专门学习《Objective C编程指南》

祝你好运!

PS : iOS 5 有新功能,内存管理由 iOS 本身完成,现在开发人员可以更有创意,而不是做引用计数的三年级数学:)

In addition to Basile Starynkevitch and Bram's answer,

In objective C the difference between your code line is,

NSString *red = [[NSString alloc]initWithFormat:@"%@"];

**Above code says you own red object so it's your responsibility to release it.

NSString *blue = [NSString stringWithFormat:@"%@"];

**You don't own it someone else in your program deep down inside will own this and you don't have to release this.

I would suggest for more information reading Apple's documentation is GREAT! specially Learning, "Objective C programming guide"

Good luck!

PS : iOS 5 has new feature, memory management is done by iOS itself, Now developer can be more creative instead doing 3 grade mathematics of reference counting :)

对象和指针的区别

灯角 2024-12-24 00:12:39

只需将该属性设置为'\0'(这是默认值)即可不屏蔽字符。

来源: http://msdn.microsoft.com /en-us/library/system.windows.forms.textbox.passwordchar.aspx

注意:请注意“\0”与“0”不同。第一个是空字符,白色“0”是将显示为 0 的字符。

Just set the property to '\0' (which is the default value) to not mask characters.

Source: http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.passwordchar.aspx

Note: notice that '\0' is different from '0'. The first one is the null character, white '0' is the character that will be displayed as 0.

如何取消屏蔽密码文本框并将其屏蔽回密码?

灯角 2024-12-23 23:39:41

您发布的组件列表不包括“完整”的 VS UI。 Visual Studio 被组织为 shell 加插件。在本例中,它正在安装 shell 和一个插件(Team Explorer)。

您最终得到的结果无法创建应用程序,也无法执行除充当 TFS 的 GUI 客户端之外的任何操作。它不会自动赋予人们进行构建的能力 - 这是通过您在 TFS 中分配给他们的权限赋予他们的。如果没有人有能力创建构建定义或运行构建定义,那么就不会有构建。

您也可以根本不安装构建服务。

The list of components you posted does not include a "full" VS UI. Visual Studio is organized as a shell plus plugins. In this case, it's installing the shell, and one plug-in (Team Explorer).

What you wind up with has no ability to create applications, or do anything other than act as a GUI client to TFS. It does not automatically give people the ability to do builds - that is given to them by the permissions you assign them in TFS. If nobody has the ability to create build definitions, or to run build definitions, then there will be no builds.

You can also simply not install the build service at all.

有没有办法只安装 tfs 命令行?

灯角 2024-12-23 22:16:28

Phusion 人员在博客中讨论了 的可能性将资产渲染为字符串

MyApp::Application.assets.find_asset('main.css').body

您也可以在测试中使用它。该解决方案并不理想,并且/因为 Capybara 不再参与,但它有助于在我的特定情况下验证 CSS。欢迎更好的方法!

The Phusion guys blogged about a possibility to render an asset to a string:

MyApp::Application.assets.find_asset('main.css').body

You can also use this in tests. The solution is not ideal and/since Capybara isn't involved anymore, but it helps in my specific case to validate CSS. Better approaches are welcome!

使用 Capybara 测试资产管道

灯角 2024-12-23 19:49:31

你的输出怎么奇怪?我的意思是,有很多表格 \t 和空格,但是您能解释一下什么不适合您的需要吗?

也许您可以先使用 .strip() 行:这将删除空格。

How is your output strange? I mean, there's lots of tabulations \t and white spaces, but could you explain what does not suit your need?

Maybe you could .strip() lines first: this will remove blank spaces.

如何用换行符和冒号解析一行?

灯角 2024-12-23 02:52:55

您不能使用 CSS :before:after 伪元素插入 HTML 元素。要添加 HTML 元素,您需要使用 JavaScript。

You can't use the CSS :before and :after pseudo-elements to insert HTML elements. To add HTML elements you need to use JavaScript.

带有元素的 CSS Content 属性

灯角 2024-12-22 20:40:20

我认为这会让你最接近你想要实现的目标。

http://jsfiddle.net/fXTbf/

您不希望鼠标悬停时出现淡入淡出效果已经显示的元素。接下来,您可以绑定到圆圈类,而不是单个位置类。

$('.circle').bind('mouseover', 
    function () { 
        //if element is already active don't fade it in
        if ($(this).hasClass('active')) { return; }

        //remove active class from old and add to new
        $('.active').removeClass('active');
        $(this).addClass('active');     

        //fade out text, change it, and then fade in new value  
        $('.description span').fadeOut('slow', function () {
            $(this).html($('.active').html()).fadeIn('slow');
        });

    }
);

I think this gets you the closest to what you are trying to achieve.

http://jsfiddle.net/fXTbf/

You don't want the fade effect to occur when you mouse over an already shown element. Next, you can bind to circle class as opposed to individual location classes.

$('.circle').bind('mouseover', 
    function () { 
        //if element is already active don't fade it in
        if ($(this).hasClass('active')) { return; }

        //remove active class from old and add to new
        $('.active').removeClass('active');
        $(this).addClass('active');     

        //fade out text, change it, and then fade in new value  
        $('.description span').fadeOut('slow', function () {
            $(this).html($('.active').html()).fadeIn('slow');
        });

    }
);

使用 jQuery 淡入?

灯角 2024-12-22 19:20:13

我认为对于这项任务,使用公钥应该更舒适、更安全。这真的很简单,并且有很多教程

请记住不要在密码中输入任何内容,否则就像必须输入密码一样。

I think that for that task it should be more comfortable and secure use public keys. It's really easy and there are lot of tutorials.

Remember not put anything in the passphrase, or it will be like have to type the password.

我可以将我的密码回显给两个命令吗?

灯角 2024-12-22 18:30:33

看来您应该尝试数据库解决方案而不是使用列表。查看 sqlite。默认情况下是Python

It's seems like you should try a database solution rather then using a list. Check out sqlite. It's in Python by default

python:算法 - 从平均值中收集项目

灯角 2024-12-22 17:27:16

我也面临同样的问题,但通过仅强制 xhr 轮询服务器端 javascript 解决了这个问题,结果成功了。

    var io = require('socket.io').listen(8000);
    io.configure(function () {
      io.set('transports', ['xhr-polling']);
    });
<..Rest code..>

I was also facing the same problem but resolved it by forcing only xhr-polling to server side javascript and that worked out.

    var io = require('socket.io').listen(8000);
    io.configure(function () {
      io.set('transports', ['xhr-polling']);
    });
<..Rest code..>

socket.io 客户端“发出”在 chrome 控制台中显示一个奇怪的错误

灯角 2024-12-22 17:08:38

使用数据视图筛选列: http://msdn.microsoft.com /en-us/library/system.data.dataview.aspx

根据输入验证和其他情况,您可以在编辑操作后更新数据源。

Filter columns with a Dataview: http://msdn.microsoft.com/en-us/library/system.data.dataview.aspx

Depending on input validation and what not, you can update the DataSource after an edit operation.

当 DatagridView 中的从属列时,如何过滤数据,因为先前选定的项目消失了

灯角 2024-12-22 15:38:50

编译器错误实际上非常简洁:

error: cannot convert 'std::pair<const std::basic_string<char>, int>' to 'int' in assignment

这正是问题所在。您要复制的 map 具有取消引用 pair 的迭代器,并且无法隐式转换 < code>pairVALUE

因此,您无法使用 copycopy_ifmap 复制到 vector;但标准库确实提供了一种可以使用的算法,创造性地称为“变换”。 transformcopy 非常相似,因为它需要两个源迭代器和一个目标迭代器。不同之处在于 transform 还采用一个一元函数来执行实际的转换。使用 C++11 lambda,您可以将 map 的全部内容复制到 vector,如下所示:

transform( m.begin(), m.end(), back_inserter(v), [] (const MyMap::value_type& vt)
{
  return vt.second;
});

如果您不想复制map,但只有一些元素满足某些标准?很简单,只需使用 transform_if 即可。

你说那是什么?标准库中没有transform_if?嗯,是的,你说的确实有道理。令人沮丧的是,标准库中没有 transform_if。然而,编写一个是一项足够简单的任务。代码如下:

template<class InputIterator, class OutputIterator, class UnaryFunction, class Predicate>
OutputIterator transform_if(InputIterator first, 
                            InputIterator last, 
                            OutputIterator result, 
                            UnaryFunction f, 
                            Predicate pred)
{
    for (; first != last; ++first)
    {
        if( pred(*first) )
            *result++ = f(*first);
    }
    return result; 
}

正如您所料,使用 transform_if 就像采用 copy_if 并将其与 transform 混合在一起。下面是一些伪代码来演示:

transform_if( m.begin(), m.end(), back_inserter(v),
  [] (const MyMap::value_type& vt) // The UnaryFunction takes a pair<K,V> and returns a V
  {
    return vt.second;
  }, [] (const MyMap::value_type& vt) // The predicate returns true if this item should be copied
  {
     return 0 == (vt.second%2);
  } );

The compiler error is actually quite succinct:

error: cannot convert 'std::pair<const std::basic_string<char>, int>' to 'int' in assignment

And that's exactly what the problem is. The map you're copying from has iterators that dereference to a pair<KEY,VALUE>, and there's no way to implicitly transform a pair<KEY,VALUE> to just a VALUE.

Because of this, you can't use copy or copy_if to copy from a map to a vector; but the Standard Library does provide an algorithm you can use, creatively called transform. transform is very similar to copy in that it takes two source iterators and a destination iterator. The difference is transform also takes a unary function that does the actual transformation. Using a C++11 lambda, you can copy the entire contents of a map to a vector like this:

transform( m.begin(), m.end(), back_inserter(v), [] (const MyMap::value_type& vt)
{
  return vt.second;
});

What if you don't want to copy the entire contents of the map, but only some elements meeting certian criteria? Simple, just use transform_if.

What's that, you say? There is no transform_if in the Standard Library? Well yeah, you do have a point there. Frustratingly, there is no transform_if in the Standard Library. However writing one is a simple enough task. Here's the code:

template<class InputIterator, class OutputIterator, class UnaryFunction, class Predicate>
OutputIterator transform_if(InputIterator first, 
                            InputIterator last, 
                            OutputIterator result, 
                            UnaryFunction f, 
                            Predicate pred)
{
    for (; first != last; ++first)
    {
        if( pred(*first) )
            *result++ = f(*first);
    }
    return result; 
}

As you might expect, using transform_if is like taking copy_if and mashing it together with transform. Here's some psudo-code to demonstrate:

transform_if( m.begin(), m.end(), back_inserter(v),
  [] (const MyMap::value_type& vt) // The UnaryFunction takes a pair<K,V> and returns a V
  {
    return vt.second;
  }, [] (const MyMap::value_type& vt) // The predicate returns true if this item should be copied
  {
     return 0 == (vt.second%2);
  } );

如何将_if从地图复制到矢量?

灯角 2024-12-22 12:36:54

请注意,类型“function_t”已更改:

class A
{
public:
    void func1() { cout << "func1()\n"; }
    void func2() { cout << "func2()\n"; }
    void func3() { cout << "func3()\n"; }
    void func4() { cout << "func4()\n"; }
    typedef void (A::*function_t)();
    static const function_t function_array[2][2];
};

const A::function_t A::function_array[2][2] = { { &A::func1, &A::func2 },
                                                { &A::func3, &A::func4 }
                                              };

// Example use.
A my_a;
for (int i = 0; i < 2; i++)
{
    for (int j = 0; j < 2; j++)
    {
        std::mem_fn(A::function_array[i][j])(my_a);
    }
} 

如果数组“function_array”在类实例之间可更改,则“static const”不合适,必须在构造函数中填充它。

Note the type 'function_t' has changed:

class A
{
public:
    void func1() { cout << "func1()\n"; }
    void func2() { cout << "func2()\n"; }
    void func3() { cout << "func3()\n"; }
    void func4() { cout << "func4()\n"; }
    typedef void (A::*function_t)();
    static const function_t function_array[2][2];
};

const A::function_t A::function_array[2][2] = { { &A::func1, &A::func2 },
                                                { &A::func3, &A::func4 }
                                              };

// Example use.
A my_a;
for (int i = 0; i < 2; i++)
{
    for (int j = 0; j < 2; j++)
    {
        std::mem_fn(A::function_array[i][j])(my_a);
    }
} 

If the array 'function_array' is changeable between class instances then a 'static const' is not appropriate and it must be populated in the constructor.

初始化函数指针数组

更多

推荐作者

亚希

文章 0 评论 0

cyp

文章 0 评论 0

北漠

文章 0 评论 0

11223456

文章 0 评论 0

坠似风落

文章 0 评论 0

游魂

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文