灯角

文章 0 评论 0 浏览 23

灯角 2024-10-22 01:14:51

没有行限制,但有大小限制 在 InnoDB 数据库上:

最小表空间大小为 10MB。
最大表空间大小为 4
十亿数据库页 (64TB)。这是
也是表格的最大尺寸。

您始终可以通过将行存储在水平分区表中同一个表的多个分区位于多个文件中。

There isn't a row limit, but a size limit on an InnoDB database:

The minimum tablespace size is 10MB.
The maximum tablespace size is four
billion database pages (64TB). This is
also the maximum size for a table.

You could always horizontally partition your tables by storing rows in multiple partitions of the same table, in multiple files.

MySQL表的最大行数是多少

灯角 2024-10-21 23:48:07

好吧哈菲兹然后尝试这个代码。

FB.ui({
    method: 'stream.publish',
    message:'hello',
    attachment: {
      name: title,

      caption: "I'm running!",
      media: [{
        type: 'image',
        href: 'http://www.yoursite.com/',
        src: 'http://www.yoursite.com/images/working.jpeg'
      }]
    },
    action_links: [{
      text: 'Get your percentage',
      href: 'http://www.yoursite/'
    }],
    user_message_prompt: 'Tell your friends about Get your percentage:'
  });

ok Hafiz then try this code.

FB.ui({
    method: 'stream.publish',
    message:'hello',
    attachment: {
      name: title,

      caption: "I'm running!",
      media: [{
        type: 'image',
        href: 'http://www.yoursite.com/',
        src: 'http://www.yoursite.com/images/working.jpeg'
      }]
    },
    action_links: [{
      text: 'Get your percentage',
      href: 'http://www.yoursite/'
    }],
    user_message_prompt: 'Tell your friends about Get your percentage:'
  });

设置 Facebook 发布流 URL

灯角 2024-10-21 19:26:29

对窗体调用 Refresh 只是强制其重新绘制。没有任何理由认为它会以不同的方式重新绘制。您必须以该形式重写 OnPaint() 方法。显然,您没有使用 OnPaint 来绘制图像,而是使用 PictureBox。将该控件的 Visible 属性设置为 false 将使图像消失,无需其他帮助。

Calling Refresh on a form merely forces it to be repainted. There isn't any reason to assume that it will repaint differently. You would have to override the OnPaint() method in that form. Clearly you are not using OnPaint to draw an image, you are using a PictureBox. Setting that control's Visible property to false will make the image disappear, no additional help is needed.

显示/刷新按钮工作正常

灯角 2024-10-21 18:00:06

您必须使用 c++ CLI,否则无法调用 DllImport。
如果是这种情况,您只需引用 c# dll 即可。

在 c++ CLI 中,您可以执行以下操作:

using namespace Your::Namespace::Here;

#using <YourDll.dll>

YourManagedClass^ pInstance = gcnew YourManagedClass();

其中“YourManagedClass”在 c# 项目中定义,输出程序集为“YourDll.dll”。

** 编辑 **
添加了您的示例。

这就是您的示例在 CLI 中的样子(为了清楚起见,我假设 G
etResult 不是静态函数,否则您只需调用Calculate::GetResult(...)

private: System::Void CalculateResult(int arg1, int arg2)
{
    int rez=0;
    //Call C++ function from dll
    Calculate^ calculate= gcnew Calculate();
    rez=calculate->GetResult(arg1,arg2);   
}

You must be using c++ CLI, otherwise you could not call DllImport.
If that is the case you can just reference the c# dll.

In c++ CLI you can just do as follows:

using namespace Your::Namespace::Here;

#using <YourDll.dll>

YourManagedClass^ pInstance = gcnew YourManagedClass();

where 'YourManagedClass' is defined in the c# project with output assembly 'YourDll.dll'.

** EDIT **
Added your example.

This is how your example needs to look like in CLI (for clarity I am assuming that G
etResult is not a static function, otherwise you would just call Calculate::GetResult(...)

private: System::Void CalculateResult(int arg1, int arg2)
{
    int rez=0;
    //Call C++ function from dll
    Calculate^ calculate= gcnew Calculate();
    rez=calculate->GetResult(arg1,arg2);   
}

从 C++/CLI 调用 C# dll 函数

灯角 2024-10-21 15:35:59

您无法通过预处理器实现这一点。这是因为您可以在 VS 之外运行调试可执行文件(尝试一下,在调试模式下双击 VS 生成的 EXE)。

无论如何,有一个运行时(不是基于预处理器的)属性可能会有所帮助:

if (System.ComponentModel.LicenseManager.UsageMode ==
    System.ComponentModel.LicenseUsageMode.Designtime)

这些网页将提供帮助,并具有在运行时检查设计模式的其他方法:

http://msdn.microsoft.com/en-us/library/c58hb4bw(vs.71).aspx

http://weblogs.asp.net/fmarguerie/archive/2005/03/ 23/395658.aspx

You cannot achieve this through the preprocessor. This is because you can run a debug executable outside of VS (try it, double click on the EXE generated by VS under debug mode).

Anyway, there is a runtime (not preprocessor based) property that might help:

if (System.ComponentModel.LicenseManager.UsageMode ==
    System.ComponentModel.LicenseUsageMode.Designtime)

These web pages will help and have other methods of checking for design mode at runtime:

http://msdn.microsoft.com/en-us/library/c58hb4bw(vs.71).aspx

http://weblogs.asp.net/fmarguerie/archive/2005/03/23/395658.aspx

“设计模式”预处理器指令

灯角 2024-10-21 13:11:31

检查下面的示例是否适合您。关键是为您的小部件设置上下文菜单策略 CustomContextMenu 并连接到小部件的 customContextMenuRequested 信号:

import sys
from PyQt4 import QtGui, QtCore

class MainForm(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(MainForm, self).__init__(parent)

        # create button
        self.button = QtGui.QPushButton("test button", self)       
        self.button.resize(100, 30)

        # set button context menu policy
        self.button.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.button.customContextMenuRequested.connect(self.on_context_menu)

        # create context menu
        self.popMenu = QtGui.QMenu(self)
        self.popMenu.addAction(QtGui.QAction('test0', self))
        self.popMenu.addAction(QtGui.QAction('test1', self))
        self.popMenu.addSeparator()
        self.popMenu.addAction(QtGui.QAction('test2', self))        

    def on_context_menu(self, point):
        # show context menu
        self.popMenu.exec_(self.button.mapToGlobal(point))        

def main():
    app = QtGui.QApplication(sys.argv)
    form = MainForm()
    form.show()
    app.exec_()

if __name__ == '__main__':
    main()

Check if an example below would work for you. The key thing is to set context menu policy for your widget to CustomContextMenu and connect to the widget's customContextMenuRequested signal:

import sys
from PyQt4 import QtGui, QtCore

class MainForm(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(MainForm, self).__init__(parent)

        # create button
        self.button = QtGui.QPushButton("test button", self)       
        self.button.resize(100, 30)

        # set button context menu policy
        self.button.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.button.customContextMenuRequested.connect(self.on_context_menu)

        # create context menu
        self.popMenu = QtGui.QMenu(self)
        self.popMenu.addAction(QtGui.QAction('test0', self))
        self.popMenu.addAction(QtGui.QAction('test1', self))
        self.popMenu.addSeparator()
        self.popMenu.addAction(QtGui.QAction('test2', self))        

    def on_context_menu(self, point):
        # show context menu
        self.popMenu.exec_(self.button.mapToGlobal(point))        

def main():
    app = QtGui.QApplication(sys.argv)
    form = MainForm()
    form.show()
    app.exec_()

if __name__ == '__main__':
    main()

右键单击 QPushButton 上的 contextMenu

灯角 2024-10-21 10:46:58

国家/地区很可能是一个静态集合,因此您只需使用包含国家/地区(键国家/地区名称、值国家/地区代码)的静态 Map 创建一个应用程序范围的 bean。

然后只需将您的 绑定到需要国家/地区下拉列表的每个视图中即可。

(顺便说一句,此解决方案归功于 BalusC ;))

Countries is most likely a static collection, so you can just create an application scoped bean with a static Map that holds the countries (key country name, value country code).

Then simply bind your <f:selectItems> in every view that needs a country drop-down to that.

(credits to BalusC btw for this solution ;))

如何在 jsf 中填充页面加载的下拉列表?

灯角 2024-10-21 04:02:15

在控制器构造函数内执行重定向不是一个好习惯,因为上下文可能未初始化。标准做法是编写自定义操作属性并覆盖 OnActionExecuting 方法并在里面执行重定向。示例:

public class RedirectingActionAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        base.OnActionExecuting(filterContext);

        if (someConditionIsMet)
        {
            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new
            {
                controller = "someOther",
                action = "someAction"
            }));
        }
    }
}

然后用此属性装饰您想要重定向的控制器。要非常小心,不要用此属性装饰您要重定向到的控制器,否则您将陷入无限循环。

所以你可以:

[RedirectingAction]
public class HomeController : Controller
{
    public ActionResult Index()
    {
        // This action is never going to execute if the 
        // redirecting condition is met
        return View();
    }
}

public class SomeOtherController : Controller
{
    public ActionResult SomeAction()
    {
        return View();
    }
}

Performing redirects inside the controller constructor is not a good practice because the context might not be initialized. The standard practice is to write a custom action attribute and override the OnActionExecuting method and perform the redirect inside. Example:

public class RedirectingActionAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        base.OnActionExecuting(filterContext);

        if (someConditionIsMet)
        {
            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new
            {
                controller = "someOther",
                action = "someAction"
            }));
        }
    }
}

and then decorate the controller which you would like to redirect with this attribute. Be extremely careful not to decorate the controller you are redirecting to with this attribute or you are going to run into an endless loop.

So you could:

[RedirectingAction]
public class HomeController : Controller
{
    public ActionResult Index()
    {
        // This action is never going to execute if the 
        // redirecting condition is met
        return View();
    }
}

public class SomeOtherController : Controller
{
    public ActionResult SomeAction()
    {
        return View();
    }
}

MVC - 在构造函数内重定向

灯角 2024-10-21 03:56:04

您应该在同一个 SPROC 中将 BEGIN TRAN 和 COMMIT 配对。

如果您随后调用另一个也有事务的 SPROC,则后续的 BEGIN TRAN / COMMIT TRAN 对将分别递增和递减 @@Trancount。

事务在“最后”COMMIT TRAN 上提交(@@Trancount = 1)

,但是任何 ROLLBACK 都将始终回滚事务。

MSDN 有很好的解释。

You should pair up your BEGIN TRAN and COMMITs in the same SPROC

If you then call another SPROC which also has a transaction, subsequent BEGIN TRAN / COMMIT TRAN pairs will increment and decrement @@Trancount respectively.

The transaction is committed on the 'last' COMMIT TRAN (@@Trancount = 1)

However, any ROLLBACK will always roll back the transaction.

MSDN has a good explanation.

如何在多个存储过程上使用事务?

灯角 2024-10-20 07:35:45
int getX(){
    y++;
    return x;
}

如果您要在每个断点之后对 getX() 进行监视,调试器将调用 getX() 并且 y 将增加 1。并且您的程序将具有与运行模式不同的行为。

int getX(){
    y++;
    return x;
}

If you were to put a watch on getX() after every breakpoint the debugger will call getX() and y would increment by 1. And your programm would have a different behaviour from the run mode.

JDBC-SQLite 应用程序的调试和运行配置期间的不同结果

灯角 2024-10-20 04:58:21

如果我错了,请纠正我,但我相信前面的示例与 James Newton 的 Json.NET 库的最新版本略有不同步。

var o = JObject.Parse(stringFullOfJson);
var page = (int)o["page"];
var totalPages = (int)o["total_pages"];

Correct me if I'm mistaken, but the previous example, I believe, is just slightly out of sync with the latest version of James Newton's Json.NET library.

var o = JObject.Parse(stringFullOfJson);
var page = (int)o["page"];
var totalPages = (int)o["total_pages"];

使用 Newtonsoft 将 JSON 反序列化为 .NET 对象(或者可能使用 LINQ to JSON?)

灯角 2024-10-19 21:58:10

我已经尝试了几次谷歌搜索,以找到关于此问题的明确答案,但之前没有找到。刚才我发现一个线程实际上引用了有关该问题的微软知识库文章。文章 KB948869 描述了该问题。

知识库文章建议创建您自己的组合框并重写 ProcessDialogKey 方法。

using System.Windows.Forms;

public class MyComboBox : ComboBox
{
    protected override bool ProcessDialogKey(Keys keyData)
    {
        if (keyData == Keys.Tab)
            this.DroppedDown = false;
        return base.ProcessDialogKey(keyData);
    }
}

我已经尝试过,但不幸的是,它似乎没有任何效果。这有点奇怪。我希望知识库文章中描述的解决方法是准确的。

不过,我找到了另一种解决方法,那就是使用 DropDownClosed 事件。

private void comboBox1_DropDownClosed(object sender, EventArgs e)
{
    label1.Text = "DroDownClosed Selected index: " + comboBox1.SelectedIndex;
}

确实似乎有效,但仅在使用 DropDownStyle.DropDown 时有效。当您将 DropDownStyle 设置为 DropDownList 时,键入字符不会触发 DropDownClosed (因为在这种情况下没有实际的下拉列表)。仅当您实际打开下拉列表并选择一个值时,才会触发 DropDownClosed 事件。

因此,这两种选择都不是一个好的答案。

更新
我什至尝试覆盖 MyComboBox 中的属性 SelectedIndex,让它调用 OnSelectedIndexChanged(EventArgs.Empty)。输入一个字符并按 Alt+Down 后,setter 会被执行,但它会将值设置为 -1,这已经是了。按 T​​ab 键后,设置器不会再次执行,尽管 SelectedIndex 值确实发生了变化。看起来 ComboBox 绕过了设置,直接更改了 SelectedIndex 的支持字段。我相信类似的事情也可能发生在真正的 ComboBox 中。

I've tried several google searches in order to find a definitive answer on this but didn't find one before. Just now I found a thread that actually refers to a Microsoft knowledge base article about the problem. Article KB948869 describes the problem.

The knowledge base article suggest to create your own combobox and override the ProcessDialogKey method.

using System.Windows.Forms;

public class MyComboBox : ComboBox
{
    protected override bool ProcessDialogKey(Keys keyData)
    {
        if (keyData == Keys.Tab)
            this.DroppedDown = false;
        return base.ProcessDialogKey(keyData);
    }
}

I've tried it, but unfortunately, it doesn't seem to have any effect. Which is a bit strange. I would expect a workaround described in a knowledge base article to be accurate.

I found another workaround though, which is to use the DropDownClosed event in stead.

private void comboBox1_DropDownClosed(object sender, EventArgs e)
{
    label1.Text = "DroDownClosed Selected index: " + comboBox1.SelectedIndex;
}

This does seem to work, but only when using DropDownStyle.DropDown. When you set the DropDownStyle to DropDownList, typing a character does not fire the DropDownClosed (as there is no actual drop down in that case). Only if you actually open up the drop down list and select a value the DropDownClosed event is fired.

So, both options are not really a good answer.

Update
I've even tried overriding property SelectedIndex in MyComboBox, having it call OnSelectedIndexChanged(EventArgs.Empty). After typing a character and pressing Alt+Down, the setter is executed, but it's setting the value to -1, which it already is. After pressing Tab, the setter isn't executed again, although somehow the SelectedIndex value does change. It looks like the ComboBox is directly changing the backing field for SelectedIndex, bypassing the setting. I believe something like this probably also happens in the real ComboBox.

WinForms ComboBox SelectedIndexChanged 在输入几个字符后按 Alt+Down 时不会触发

灯角 2024-10-19 18:58:41

停止从站后,您可以在 START SLAVE 语句中指定要处理的位置。类似于:

START SLAVE UNTIL MASTER_LOG_FILE='xxxxx', MASTER_LOG_POS=yyyyyy;

此处记录

After you stop your slave, you can specify the positions you want to process up to in your START SLAVE statement. Something like:

START SLAVE UNTIL MASTER_LOG_FILE='xxxxx', MASTER_LOG_POS=yyyyyy;

Documented here.

Mysql 在日志位置停止从属

灯角 2024-10-19 14:04:09

你的意思是你想消除包装纸和黑线之间的间隙?如果是,只需将 #blackbox2 边距更改为 margin: 0 auto 15px;

you mean that you want to eliminate the gap between wrapper and the black line? If yes just change the #blackbox2 margin to margin: 0 auto 15px;

解决神奇的页脚问题

灯角 2024-10-19 13:12:43

就像您自己所说:您可能有另一个可以是 IRelated 的类。如何将此类的实例添加到 List 中?

你必须写:

List<IRelated> listofrelateditems = new List<IRelated>();

Like you yourself said: You may have another class that can be IRelated. How are you going to add an instance of such a class to a List<BaseItem>?

You will have to write:

List<IRelated> listofrelateditems = new List<IRelated>();

C# 中的接口和列表

更多

推荐作者

爱人如己

文章 0 评论 0

萧瑟寒风

文章 0 评论 0

云雾

文章 0 评论 0

倒带

文章 0 评论 0

浮世清欢

文章 0 评论 0

撩起发的微风

文章 0 评论 0

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