灯角

文章 0 评论 0 浏览 23

灯角 2024-11-09 23:32:30

只有一个或多个输入文件?
我的意思是,是否有可能我们有一个文件,其worker-id之一有一个supervisor-id,其描述(该主管的名称-id)在另一个文件中?

There is Only one input file or more??
I mean, is it possible a case which we have a file that one of its worker-id have a supervisor-id which its descriptions(name of that supervisor-id) be in another file??

如何使用 Map-Reduce 进行查找(或连接)?

灯角 2024-11-09 20:09:16

每隔一段时间运行 jquery 代码,然后使用 PHP 打印进度百分比并绘制条形图。

所以它会像

<script>
function bar()
{
 var v=getProgress(...);
 setTimeout("bar()",1000);
 drawBar();
}

function drawBar(l)
{
 //set div's length to l
}
</script>

编辑2

<?php
/* get the request and calculate the job completion percentage and echo it !  */
?>

run your jquery code at an interval, and use PHP to print the progress percenage and draw the bar then.

so it will be something like

<script>
function bar()
{
 var v=getProgress(...);
 setTimeout("bar()",1000);
 drawBar();
}

function drawBar(l)
{
 //set div's length to l
}
</script>

EDIT 2

<?php
/* get the request and calculate the job completion percentage and echo it !  */
?>

php 和 javascript 使用 ajax 可以实现进度条吗

灯角 2024-11-09 20:01:06

它表示 Cat 类是 Object 类的有效替代品。因此,每当某个方法需要 Object 类型的对象时,您都可以替换 Cat 类型的对象。

What it says is that the Cat class is a valid substitute for the Object class. So that anytime some method needs an object of type Object, you can substitute an object of type Cat.

我的讲师对里氏替换原理的定义是否不正确,或者我是否误解了?

灯角 2024-11-09 19:09:29

您将需要将 UIImageView 转换为 scollView。

- (void) setupTextView
{
    textDescription.scrollEnabled = NO;
    NSString *foo = @"Hello Test";
    textDescription.text = foo;
    /*Here is something for dynamic textview*/
    CGRect frame;
    frame = textDescription.frame;
    frame.size.height = [textDescription contentSize].height;
    textDescription.frame = frame;
     /**/

    int linePosition = frame.size.height+20;
    lineImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"line.png"]];
    CGRect line2Frame = CGRectMake(-8, 600, 328, 10);
    lineImg.frame = line2Frame;

     //Add the image view as a subview to yout scrollview.
    [scrollView addSubView:lineImg];
}

You will needed to the UIImageView to the scorllView.

- (void) setupTextView
{
    textDescription.scrollEnabled = NO;
    NSString *foo = @"Hello Test";
    textDescription.text = foo;
    /*Here is something for dynamic textview*/
    CGRect frame;
    frame = textDescription.frame;
    frame.size.height = [textDescription contentSize].height;
    textDescription.frame = frame;
     /**/

    int linePosition = frame.size.height+20;
    lineImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"line.png"]];
    CGRect line2Frame = CGRectMake(-8, 600, 328, 10);
    lineImg.frame = line2Frame;

     //Add the image view as a subview to yout scrollview.
    [scrollView addSubView:lineImg];
}

无法添加UIImageView?

灯角 2024-11-09 18:29:34

从您链接到的网站: http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml< /a>

尽管 Internet Explorer 7 更正了属性名称以下划线或连字符作为前缀时的行为,但其他非字母数字字符前缀的处理方式与 IE6 中相同。

+ 字符被视为“其他非字母数字字符”,因此它将被“按照 IE6 中的方式处理”。

我猜想这是 * hack (*property: value) 的变体。

+ 更常规的用法是在选择器中: 有关详细信息,请参阅 w3c

From the site you linked to: http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml

Although Internet Explorer 7 corrected its behavior when a property name is prefixed with an underscore or a hyphen, other non-alphanumeric character prefixes are treated as they were in IE6.

The + character counts as "other non-alphanumeric character" and therefore it would be "treated as they were in IE6".

I'd guess that it's a variant of the * hack (*property: value).

The more conventional use of + is in selectors: see the w3c for details.

"+" 是什么意思? CSS 中的意思?

灯角 2024-11-09 18:01:17

Parallel 实际上并不是这里的最佳选择。 Parallel 将并行运行您的代码,但仍会为每个对 AWS 的请求使用线程池线程。使用 BeginCopyObject 方法可以更好地利用资源。这不会耗尽等待响应的线程池线程,而只会在收到响应并需要处理时才使用它。

下面是如何使用 Begin/End 方法的简化示例。这些并不是 AWS 特有的,而是在 .NET BCL 中发现的一种模式。

public static CopyFoos() 
{
    var client = new AmazonS3Client(...);
    var foos = GetFoos().ToList();
    var asyncs = new List<IAsyncResult>();
    foreach(var foo in foos)
    {
        var request = new CopyObjectRequest { ... };  

        asyncs.Add(client.BeginCopyObject(request, EndCopy, client));
    }

    foreach(IAsyncResult ar in asyncs)
    {
        if (!ar.IsCompleted)
        {
            ar.AsyncWaitHandle.WaitOne();
        }
    }
}

private static EndCopy(IAsyncRequest ar) 
{    
    ((AmazonS3Client)ar.AsyncState).EndCopyObject(ar);
}

对于生产代码,您可能希望跟踪已发送的请求数量,并且每次仅发送有限数量的请求。测试或 AWS 文档可能会告诉您最佳并发请求数。

在这种情况下,当请求完成时,我们实际上不需要执行任何操作,因此您可能会想跳过 EndCopy 调用,但这会导致资源泄漏。每当调用 BeginXxx 时,您都必须调用相应的 EndXxx 方法。

Parallel is actually not the best option here. Parallel will run your code in parallel but will still use up a thread pool thread for each request to AWS. It would be far better use of resources to use the BeginCopyObject method instead. This will not use up a thread pool thread waiting on a response but will only utilize it when the response is received and needs to be processed.

Here's a simplified example of how to use Begin/End methods. These are not specific to AWS but is a pattern found throughout the .NET BCL.

public static CopyFoos() 
{
    var client = new AmazonS3Client(...);
    var foos = GetFoos().ToList();
    var asyncs = new List<IAsyncResult>();
    foreach(var foo in foos)
    {
        var request = new CopyObjectRequest { ... };  

        asyncs.Add(client.BeginCopyObject(request, EndCopy, client));
    }

    foreach(IAsyncResult ar in asyncs)
    {
        if (!ar.IsCompleted)
        {
            ar.AsyncWaitHandle.WaitOne();
        }
    }
}

private static EndCopy(IAsyncRequest ar) 
{    
    ((AmazonS3Client)ar.AsyncState).EndCopyObject(ar);
}

For production code you may want to keep track of how many requests you've dispatched and only send out a limited number at any one time. Testing or AWS docs may tell you how many concurrent requests are optimal.

In this case we don't actually need to do anything when the requests are completed so you may be tempted to skip the EndCopy calls but that would cause a resource leak. Whenever you call BeginXxx you must call the corresponding EndXxx method.

如何重构此 ForEach(..) 代码以使用 Parallel.ForEach(..)?

灯角 2024-11-09 17:50:49

我能想到的唯一解释是,在发布消息之后和泵送消息队列之前,会重新创建框架的句柄。尝试在 OnShow 中发帖。

The only explanation for this that I can come up with is that your frame's handle is recreated after you post the message and before the message queue is pumped. Try posting in an OnShow.

为什么我的 TFrame 没有“看到”已发布的消息?

灯角 2024-11-09 17:47:11

将其包含在您的 Gemfile 中。

gem 'sqlite3-ruby', :require => 'sqlite3'

还要确保运行:

sudo apt-get install libsqlite3-dev sqlite3

Include this in your Gemfile.

gem 'sqlite3-ruby', :require => 'sqlite3'

Also make sure to run:

sudo apt-get install libsqlite3-dev sqlite3

Rails 3 上的 Rails 服务器错误,开发中的 sqlite3 无法正常工作

灯角 2024-11-09 16:48:02

调用该方法时,您应该告诉 E 和 K 的实际类型:

  new GenericClassFactory<ClassMatchable>().<TypeforE, TypeforK>newObject(...)

看来 Java 无法从参数中推断出它。

当然:

就像它不识别方法一样
泛型(如果您有类泛型)
已定义但未使用。

是完全正确的。

You should tell the actual types of E and K when calling the method:

  new GenericClassFactory<ClassMatchable>().<TypeforE, TypeforK>newObject(...)

It appears that Java can't infer it from the argument.

And, of course:

Its like it doesn't recognize method
generics if you have a Class Generic
defined but not used.

is exactly correct.

Java 类泛型和方法泛型冲突

灯角 2024-11-09 15:31:06

从 SEO 的角度来看,使用规范标签是明智的。该标签是一个新的构造,明确设计用于识别和
处理重复的内容。实现非常简单,如下所示:

<link rel="canonical" href="http://www.yoursite.org/blog" />

该标签旨在告诉 Yahoo!、Bing 和 Google 应处理有问题的页面
就像它是 URL http://www.yoursite.org/blog 的副本一样的链接和
从技术上讲,引擎应用的内容指标应该流回该 URL。
规范 URL 标签属性在很多方面与 SEO 的 301 重定向相似
看法。本质上,您是在告诉引擎多个页面应该被视为
一个(301 所做的),而不实际将访问者重定向到新的 URL(通常会保存
你的开发人员麻烦了)。

<一href="http://www.google.com/url?sa=t&source=web&cd=1&ved=0CCAQFjAA&url=http://www.amazon.com/Art-SEO-Theory-Practice /dp/0596518862& ;rct=j&q=%20art%20of%20seo&ei=3dyvTfOvF4-LswaOp8DkCw&usg=AFQ jCNG40N8ozqOzl6ThSgEQD8DZuDjopw&sig2=QTHR-Zy_qVqnYqd8t9UWbg&cad=rja" rel="nofollow">链接

From the SEO perspective, it's wise to use canonical tag. This tag was a new construct designed explicitly for purposes of identifying and
dealing with duplicate content. Implementation is very simple and looks like this:

<link rel="canonical" href="http://www.yoursite.org/blog" />

This tag is meant to tell Yahoo!, Bing, and Google that the page in question should be treated
as though it were a copy of the URL http://www.yoursite.org/blog and that all of the link and
content metrics the engines apply should technically flow back to that URL.
The canonical URL tag attribute is similar in many ways to a 301 redirect from an SEO
perspective. In essence, you’re telling the engines that multiple pages should be considered as
one (which a 301 does), without actually redirecting visitors to the new URL (often saving
your development staff trouble).

link

是否可以为同一个 WordPress 博客提供不同的链接?

灯角 2024-11-09 08:07:54

这很可能与以下事实有关:short 并不总是保证为两个字节。也许最好读取指定数量的字节,然后将其转换为所需的数据类型?这也适用于 int。顺便说一句:fread 返回读取的字节数,因此您可以检查是否实际读取了所需的字节数。

问候,佩里

This might very well have to do with the fact that a short is not always guaranteed to be two bytes. Maybe it is better to read the specified number of bytes and then convert it into the desired datatype? this also goes for int. By the way: fread returns the number of bytes read, so you are able to check if the desired number of bytes is actually read.

Regards, Perry

将二进制读取函数从 C# 转换为 C

灯角 2024-11-09 07:53:10

有办法做到这一点吗?

并不真地。

(强力解决方案是在全局变量中跟踪活动的引用。但这必须在每个 onResume() 中完成。在我看来,这很丑陋。)

这也是内存泄漏的一个原因。

就我个人而言,我会找到一种更好的方法来解决您认为通过获取“当前活动[原文如此]活动”来解决的任何问题。

Is there a way to do this?

Not really.

(A brute-force solution is to keep track of the activity's reference in a global variable. But this has to be done in each and every onResume(). It's ugly IMO.)

It's also a recipe for memory leaks.

Personally, I'd find a better way to solve whatever problem you think your are solving by getting the "currently activte [sic] activity".

如何获取当前的activte活动?

灯角 2024-11-09 03:46:49

要扩展 Khez 的评论,使用 jquery 你可以使用类似的内容:

<html>
<head>
<script type="text/javascript" src="PathToJquery"></script>
<script type="text/javascript">
$(document).ready (function ()
{
    $('#elID').click(function ()
    {
        $.get('urlToChangeDB?variable=value');
    }
}
</script>
</head>
<body>
<a href="#" id="elID">Link</a>
</body>
</html>

You will need to inlude the jquery libray

To expand on Khez's comment, using jquery you could use something like:

<html>
<head>
<script type="text/javascript" src="PathToJquery"></script>
<script type="text/javascript">
$(document).ready (function ()
{
    $('#elID').click(function ()
    {
        $.get('urlToChangeDB?variable=value');
    }
}
</script>
</head>
<body>
<a href="#" id="elID">Link</a>
</body>
</html>

You will need to inlude the jquery libray

通过 PHP 中的链接更新 MySQL 数据库

灯角 2024-11-09 02:55:05

如果您使用 JavaScript 来处理 DOM,那么是的,它是视图的一部分。但你仍然可以在服务器端使用JavaScript,在这种情况下它可能是与业务相关的代码的一部分。

If you use JavaScript to work with the DOM so yes, it is part of the View. But you can still use JavaScript on the server side, in this case it could be part of the code related to the business.

JavaScript 在 Web 应用程序的 MVC 模式中处于什么位置?

灯角 2024-11-08 17:36:39

如果您确实有这样的字符串,您唯一的希望就是手动解析它。要么使用 preg_match_all,要么我想你可以这样做:

$array = eval('return array('.$ages2.');');

但当然不建议这样做,因为它可能会在很多方面出错。

无论如何,我非常确定您可以重构此代码,或者如果您需要更多帮助,可以为我们提供更多背景信息。

Your only hope if you really have such a string is to parse it manually. Either using preg_match_all, or I suppose you could do:

$array = eval('return array('.$ages2.');');

But of course this isn't recommended since it could go wrong in many many ways.

In any case I'm pretty sure you can refactor this code or give us more context if you need more help.

php关联数组爆炸问题

更多

推荐作者

娇女薄笑

文章 0 评论 0

biaggi

文章 0 评论 0

xiaolangfanhua

文章 0 评论 0

rivulet

文章 0 评论 0

我三岁

文章 0 评论 0

薆情海

文章 0 评论 0

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