半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-11-17 05:22:04

如果您使用的是 Ubuntu 11.04+ 并且无法轻松访问主题编辑器,请使用:

如何在统一中更改工具提示背景颜色

If you are using Ubuntu 11.04+ and cant easily access the theme editor, Use this:

how-to-change-tooltip-background-color-in-unity

在 Eclipse 中设置窗口背景 JavaDoc

半城柳色半声笛 2024-11-17 03:09:52

您需要将代码放入方法中——在实现中不能让它“松散”。

You need to put your code inside a method -- you can't have it "loose" in the implementation.

预计“”在声明列表的末尾

半城柳色半声笛 2024-11-17 02:05:21

它清楚地表明:它需要一个数组,而你传递的是其他东西。

如果您检查了 $result 的类型,您会发现它不是一个数组,而是一个资源。

It clearly says: it expects an array and you pass something else.

If you had checked the type of $result you would have seen that it is not an array, intead a resource.

PHP:警告:sort() 期望参数 1 为数组,给定资源

半城柳色半声笛 2024-11-16 23:22:52

您需要将该列添加到 band 中的 SortedColumns 集合中:

    private void SwitchGroupByFor(string key) //key stands for the ultragridcolumn key
    {
        var band = grid.DisplayLayout.Bands[0];
        var sortedColumns = band.SortedColumns;

        sortedColumns.Add(key, false, true); //last flag indicates is a group by column
    }

hth

You need to add the column to the SortedColumns collection in the band:

    private void SwitchGroupByFor(string key) //key stands for the ultragridcolumn key
    {
        var band = grid.DisplayLayout.Bands[0];
        var sortedColumns = band.SortedColumns;

        sortedColumns.Add(key, false, true); //last flag indicates is a group by column
    }

hth

如何才能“分组依据”?在 ultrawinggrid 柱上?

半城柳色半声笛 2024-11-16 23:15:48

如果您使用的是 Linux,请尝试在 strace 内运行服务器。这会将大量有用的数据写入日志文件。

strace -f -o strace.out ./server

然后查看日志文件的末尾。也许程序做了什么以及何时崩溃是显而易见的,也许不是。在后一种情况下:在此处发布最后几行。

If you are on Linux, try to run the server inside strace. This will write lots of useful data to a log file.

strace -f -o strace.out ./server

Then have a look at the end of the log file. Maybe it's obvious what the program did and when it crashed, maybe not. In the latter case: Post the last lines here.

send() 使我的程序崩溃

半城柳色半声笛 2024-11-16 19:51:09

如果您的 catch 语句需要访问 using 语句中声明的变量,那么 inside 是您唯一的选择。

如果您的 catch 语句需要在释放之前使用 using 中引用的对象,那么 inside 是您唯一的选择。

如果您的 catch 语句执行持续时间未知的操作(例如向用户显示消息),并且您希望在此之前处理掉您的资源,那么外部是您的最佳选择。

每当我遇到与此类似的场景时,try-catch 块通常位于调用堆栈中与 using 不同的方法中。像这样知道如何处理其中发生的异常的方法并不典型。

所以我的一般建议是在外面——远远的外面。

private void saveButton_Click(object sender, EventArgs args)
{
    try
    {
        SaveFile(myFile); // The using statement will appear somewhere in here.
    }
    catch (IOException ex)
    {
        MessageBox.Show(ex.Message);
    }
}

If your catch statement needs to access the variable declared in a using statement, then inside is your only option.

If your catch statement needs the object referenced in the using before it is disposed, then inside is your only option.

If your catch statement takes an action of unknown duration, like displaying a message to the user, and you would like to dispose of your resources before that happens, then outside is your best option.

Whenever I have a scenerio similar to this, the try-catch block is usually in a different method further up the call stack from the using. It is not typical for a method to know how to handle exceptions that occur within it like this.

So my general recomendation is outside—way outside.

private void saveButton_Click(object sender, EventArgs args)
{
    try
    {
        SaveFile(myFile); // The using statement will appear somewhere in here.
    }
    catch (IOException ex)
    {
        MessageBox.Show(ex.Message);
    }
}

我应该把 try/catch 和“using”放在哪里?陈述?

半城柳色半声笛 2024-11-16 17:09:49

我能想到的唯一问题是:没有“next_request_url”或没有“some_other_function”。在这两种情况下,“call_next_ajax()”都不会执行。

The only problem I can think of is: there is no 'next_request_url' or there is no 'some_other_function'. In both cases 'call_next_ajax()' will not execute.

在 Prototype 中嵌套 Ajax 调用

半城柳色半声笛 2024-11-16 14:45:16

有一个 cancel() 方法。您的代码必须注意这一点。如果它在异常后继续运行,则您的代码似乎忽略了不应该的异常。

There is a cancel() method. Your code would have to pay attention to that. If it keeps running after an exception, it would appear that you code is ignoring an exception that it shouldn't be.

如何取消SwingWorker的执行?

半城柳色半声笛 2024-11-16 13:50:43

阅读手册

该函数可能返回布尔值
FALSE,但也可能返回
非布尔值,其计算结果为
FALSE,例如 0 或“”。请阅读
有关布尔值的部分了解更多信息
信息。 使用 === 运算符
测试这个的返回值
功能。

read manual:

This function may return Boolean
FALSE, but may also return a
non-Boolean value which evaluates to
FALSE, such as 0 or "". Please read
the section on Booleans for more
information. Use the === operator for
testing the return value of this
function.

如果 http:// 在字符串中则保留它,否则如果不添加它

半城柳色半声笛 2024-11-16 12:15:07

根据我的经验:

实体框架:

  • 逻辑保留在应用程序中
  • 更容易与源代码控制集成(根据我的经验)
  • 如果需要,还可以使用存储过程(我在全文搜索例程中使用它)
  • 与数据库无关 ->好吧,我之前没有真正尝试过更改数据库,但它应该可以保护您免受底层持久性存储的影响。
  • 个人偏好:获取对象/模型数组而不是庞大的数据表更加漂亮和方便..更不用说那我
    需要知道列的顺序等等......

数据库 SP

  • 您不必学习任何新东西 - 有些任务对于存储过程来说是微不足道的,但在使用 EF 时可能会非常令人烦恼地晦涩难懂。好吧,这取决于你追赶的速度。
  • 易于使用,更精细的控制 - 到目前为止,我不知道如何创建一个在实体的 linq 中使用 WITH 和 OVER() 的查询。

就我个人而言,我也会使用 EF,因为我已经上面提到的(加上我现在想不起来的其他一些)。此外,如果我无法使用 linq 查询执行或无法快速执行某些操作,我将仅创建一个存储过程或仅执行一条 SQL 语句(是的,您可以使用上下文执行 SQL)。

Based on my experience:

Entity Framework:

  • Logic stays in the application
  • Easier to integrate with source control (in my experience)
  • Can also use stored procedures if needed (I used it in a full text search routine)
  • Database agnostic -> well, I haven't really tried changing db's before, but its supposed to shield you from the underlying persistence store
  • Personal Preference: its so much prettier and convenient to get an array of objects/models instead of a bulky datable.. not to mention that I
    need to know the order of the columns and such..

Database SPs

  • You don't have to learn anything new - There are certain tasks that are trivial from a storedproc but can be so annoyingly obscure when using EF. Well, it depends on how quick you catch up.
  • Easy to use, more granular control - up til now, I don't know how to create a query that uses WITH and OVER() in linq to entities..

Personally, I'd go with EF too for the reasons I've mentioned above (plus a few others I cant think of right now). Besides, if there's something I can't do or cant do fast with a linq query, I'll just create a stored proc or just execute an SQL statement (yes you can execute SQL using the context).

Entity SQL 还是 StoredProcedure,该用什么?

半城柳色半声笛 2024-11-16 10:17:47
jQuery(function($, undefined) {

  function Something(i, domElement) { 
    // ... 
  }

  Something.prototype.doSomething = ...

  var something = new Something(10, $("#foo")[0]);
  something.doSomething();

});

是的,它可以改进。你的例子是一个开始。我建议您还添加一些 OOP。

jQuery(function($, undefined) {

  function Something(i, domElement) { 
    // ... 
  }

  Something.prototype.doSomething = ...

  var something = new Something(10, $("#foo")[0]);
  something.doSomething();

});

Yes it can be improved. Your example is a start. I recommend you also add a bit of OOP into the mix.

这是什么 Javascript/jQuery 模式来封闭和隐藏所有内容,但仍然可以更改页面?

半城柳色半声笛 2024-11-16 07:02:16

这应该可以做到。谷歌搜索结构中字段的确切含义,但从这段代码来看它应该是不言自明的。

#import <sys/sysctl.h>
#import <mach/host_info.h>
#import <mach/mach_host.h>
#import <mach/task_info.h>
#import <mach/task.h>
int mib[6]; 
mib[0] = CTL_HW;
mib[1] = HW_PAGESIZE;

int pagesize;
size_t length;
length = sizeof (pagesize);
if (sysctl (mib, 2, &pagesize, &length, NULL, 0) < 0)
{
    fprintf (stderr, "getting page size");
}

mach_msg_type_number_t count = HOST_VM_INFO_COUNT;

vm_statistics_data_t vmstat;
if (host_statistics (mach_host_self (), HOST_VM_INFO, (host_info_t) &vmstat, &count) != KERN_SUCCESS)
{
    fprintf (stderr, "Failed to get VM statistics.");
}

double total = vmstat.wire_count + vmstat.active_count + vmstat.inactive_count + vmstat.free_count;
double wired = vmstat.wire_count / total;
double active = vmstat.active_count / total;
double inactive = vmstat.inactive_count / total;
double free = vmstat.free_count / total;

task_basic_info_64_data_t info;
unsigned size = sizeof (info);
task_info (mach_task_self (), TASK_BASIC_INFO_64, (task_info_t) &info, &size);

double unit = 1024 * 1024;
memLabel.text = [NSString stringWithFormat: @"% 3.1f MB\n% 3.1f MB\n% 3.1f MB", vmstat.free_count * pagesize / unit, (vmstat.free_count + vmstat.inactive_count) * pagesize / unit, info.resident_size / unit];

This should do it. Google around for the exact meaning of the fields in the structures, but it should be pretty self-explanatory working from this code.

#import <sys/sysctl.h>
#import <mach/host_info.h>
#import <mach/mach_host.h>
#import <mach/task_info.h>
#import <mach/task.h>
int mib[6]; 
mib[0] = CTL_HW;
mib[1] = HW_PAGESIZE;

int pagesize;
size_t length;
length = sizeof (pagesize);
if (sysctl (mib, 2, &pagesize, &length, NULL, 0) < 0)
{
    fprintf (stderr, "getting page size");
}

mach_msg_type_number_t count = HOST_VM_INFO_COUNT;

vm_statistics_data_t vmstat;
if (host_statistics (mach_host_self (), HOST_VM_INFO, (host_info_t) &vmstat, &count) != KERN_SUCCESS)
{
    fprintf (stderr, "Failed to get VM statistics.");
}

double total = vmstat.wire_count + vmstat.active_count + vmstat.inactive_count + vmstat.free_count;
double wired = vmstat.wire_count / total;
double active = vmstat.active_count / total;
double inactive = vmstat.inactive_count / total;
double free = vmstat.free_count / total;

task_basic_info_64_data_t info;
unsigned size = sizeof (info);
task_info (mach_task_self (), TASK_BASIC_INFO_64, (task_info_t) &info, &size);

double unit = 1024 * 1024;
memLabel.text = [NSString stringWithFormat: @"% 3.1f MB\n% 3.1f MB\n% 3.1f MB", vmstat.free_count * pagesize / unit, (vmstat.free_count + vmstat.inactive_count) * pagesize / unit, info.resident_size / unit];

如何像活动监视器一样以编程方式检查 Mac 上的可用系统内存?

半城柳色半声笛 2024-11-15 18:42:16

我推荐 Chris Richardson 的POJOs in Action。它已经有几年历史了,但仍然可以满足您的需求。

I'd recommend POJOs in Action, by Chris Richardson. It's a few years old but it still covers what you need.

我可以开始掌握并完全掌握 Java 的 Spring 2.5 的教程Hibernate(带有其他一些框架)

半城柳色半声笛 2024-11-15 05:21:56

您可以使用prototype将新函数分配给Element原型。

Element.prototype.testFunction=function(str){alert(str)};

这将为所有 HTML 元素提供函数“testFunction”。

您可以通过这种方式扩展任何基本对象,即数组、字符串等。

这将在没有任何插件的情况下工作 - 尽管我不认为它在 IE 中工作。我相信 MooTools 和 jQquery 等库会使用 DOM 元素创建自己的继承,以确保跨浏览器兼容性,尽管不要引用我的观点。

You can use prototype to assign a new function to the Element prototype.

Element.prototype.testFunction=function(str){alert(str)};

This would provide the function 'testFunction' to all HTML elements.

You can extend any base Object this way, i.e. Array, String etc.

This will work without any plugin at all - although that said I don't think it will work in IE. I believe libraries such as MooTools and jQquery create their own inheritance with DOM elements to ensure cross-browser compatibility, although don't quote me on that.

类似 jQuery 的自定义函数

半城柳色半声笛 2024-11-15 02:31:25

FormatFloat('0.00',qrysth.Fields[i].AsFloat) 将给出“12.00”。

为了能够得到“12.000000000000000”,您应该自己进行舍入,因为不会损失精度。

FormatFloat('0.00',qrysth.Fields[i].AsFloat) will give '12.00'.

To be able to get '12.000000000000000' you should do the rounding yourself, as there's no loss of precision.

AsFloat 转换为字符串

更多

推荐作者

寻梦旅人

文章 0 评论 0

冰美式不加糖

文章 0 评论 0

m0_51416705

文章 0 评论 0

123456wqwqwq

文章 0 评论 0

qq_R47skh

文章 0 评论 0

hs1283

文章 0 评论 0

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