半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-12-21 11:22:09

我发现我的问题不是很聪明 - 我只是下载了源文件并打开了一个包含它们的新项目。一切都编译得很好。

I have found out my question wasn't very smart - I just downloaded the source files and opened a new project containing them. Everything compiled fine.

适用于 Windows 的 laspack视觉工作室?

半城柳色半声笛 2024-12-21 10:11:55

Franson 制作一整套串口工具,包括环回端口。

如果您只需要环回,可以使用免费驱动程序:http://com0com.sourceforge.net/

如果您想与实际设备连接,则需要使用 USB 转串口转换器。它们只要 2 美元左右。

Franson makes a whole set of serial port tools, including loopback ports.

If you just need a loopback, there is a free driver available: http://com0com.sourceforge.net/

If you want to interface with an actual device, you'll need to pick up a USB-to-serial converter. They're only $2 or so.

在没有串口的情况下模拟串口

半城柳色半声笛 2024-12-21 07:09:37
  1. 如果你想为 .h 文件创建标准 C 原型,请使用 mkproto.c

mkproto thisoldfile.c >这个旧文件.h

,您还可以在 C 文件定义中粘贴旧的 K&R 代码。


罗伯特的另一个答案 a> 在因“仅链接”答案而被删除之前包含以下(有用)信息:

您可以在以下位置找到 mkproto.c:

https://www.pcorner.com/list/C

那里还有很多其他实用程序。

该网站拥有两个版本的“mkproto”——1989-09-07 的 MKPROTO.ZIP 和 1992-06-27 的 MKPROTOB.ZIP。您必须在托管站点“程序员之角”注册才能下载文件。这些文件出现在可下载的长页面的大约 2/3 处。

  1. if you want to create standard C prototypes for a .h file use mkproto.c

mkproto thisoldfile.c > thisoldfile.h

You then could also paste over the old K&R code in the C file definition if desired.


Another answer by Robert contained the following (useful) information before it was deleted for being a 'link-only' answer:

You can find mkproto.c at:

https://www.pcorner.com/list/C

There are plenty of other utilities there.

The site hosts two versions of "mkproto" — MKPROTO.ZIP dated 1989-09-07 and MKPROTOB.ZIP dated 1992-06-27. You have to register with the host site, The Programmer's Corner, to download the files. The files appear about 2/3 of the way down a long page of possible downloads.

如何将 K&R 函数声明自动转换为 ANSI 函数声明?

半城柳色半声笛 2024-12-21 02:47:13

您不能在绑定中使用Source={DynamicResource Locator}。如果您使用 Source 属性,则需要使用 StaticResource

You cannot useSource={DynamicResource Locator} in your binding. If you use the Source property, you need to use a StaticResource

使用 MVVM light 在两个 WPF 应用程序之间共享视图

半城柳色半声笛 2024-12-20 17:51:20

还是不知道那是什么。
在另一台机器上打开相同的解决方案,并在 Add.aspx 上看到黄色错误
打开一个新的 aspx 并按组件复制 componenet - 它可以工作。

Still don't know what was it.
Opened the same solution on another machine and saw yellow error on the Add.aspx
opened a new aspx and copied componenet by component - and it works.

Aspx页面拒绝渲染

半城柳色半声笛 2024-12-20 17:11:33

FreeMarker 对 AWT 有着严重的依赖。它使得它无法与 Google App Engine 等工具一起使用。

我更喜欢使用 StringTemplate 来满足我所有的 Java 模板需求。它是唯一一个基于Java的模板系统,将逻辑与模板严格分离。

StringTemplate 是一个 Java 模板引擎(带有 C#、Python、
Ruby 和 Scala)用于生成源代码、网页、电子邮件或任何
其他格式的文本输出。 StringTemplate特别擅长
多目标代码生成器、多个站点皮肤,以及
国际化/本地化

其显着特点是严格执行
与其他引擎不同,模型视图分离
。严格的分离使得
网站和代码生成器更加灵活和可维护;它也
提供了针对恶意模板作者的出色防御。

由于您正在生成 XML

另一个乍一看并不明显的解决方案是使用 JAXB。我们这里有一个项目需要生成 XML,我们为输出文件定义了非常明确的 XSD 文件,构建对象并编组它们非常简单且轻松。

FreeMarker has a nasty dependency on AWT. It makes it impossible to use with things like Google App Engine.

I prefer to use StringTemplate for all my Java templating needs. It is the only Java based template system that strictly separates the logic from the template.

StringTemplate is a java template engine (with ports for C#, Python,
Ruby, and Scala) for generating source code, web pages, emails, or any
other formatted text output. StringTemplate is particularly good at
multi-targeted code generators, multiple site skins, and
internationalization/localization

Its distinguishing characteristic is that it strictly enforces
model-view separation unlike other engines
. Strict separation makes
websites and code generators more flexible and maintainable; it also
provides an excellent defense against malicious template authors.

Since you are generating XML

Another solution that isn't obvious at first sight is using JAXB. We have a project here that requires us to generate XML, we have very well defined XSD files for the output files, building the objects and marshalling them is super easy and very painless.

类似于ZPT(属性语言)的Java模板库

半城柳色半声笛 2024-12-20 15:35:24

如果使用高复制数据存储,请将传递给 --application 的值从 appname 更改为 s~appname

If using the high-replication datastore, change the value passed to --application from appname to s~appname.

GAE 数据下载显示 datastore_errors.BadRequestError

半城柳色半声笛 2024-12-20 12:19:49

使用 onTextChanged 或 TextWatcher 并不重要,要从这些方法中获取文本并识别它是被删除还是添加,您必须编写自己的逻辑代码,如下所示。

  • 从字符串 1 的 onTextChanged 方法获取文本

  • 从字符串 2 的 EditText 获取文本

  • 转换字符串转换为字符数组。

  • 循环、比较和查找缺失的字符。

我针对你的问题说了这个独特的算法,但没有被问到。

Use onTextChanged or TextWatcher that doesn't matter, to get text from these methods and recognize whether it was deleted or added, you've to write your own code of logic as follows.

  • Get text from onTextChanged method on String 1

  • Get text from EditText on String 2

  • Convert the string to array of characters.

  • Loop through,compare & find missing characters.

I said this unique Algorithm for your problem which had not been asked.

获取已删除的文本

半城柳色半声笛 2024-12-20 12:19:35

使用.GroupBy,您将获得IGrouping列表,因此选择如下所示:

IEnumerable<Reward> listConcat = list1.Concat(list2)
                                .GroupBy(x => x.User)
                                .Select(x => new Reward { User= x.Key, Money=x.Sum(y => y.Money) });

With .GroupBy, you get a list of IGrouping, so the select is like so:

IEnumerable<Reward> listConcat = list1.Concat(list2)
                                .GroupBy(x => x.User)
                                .Select(x => new Reward { User= x.Key, Money=x.Sum(y => y.Money) });

基于键 C# 合并两个列表

半城柳色半声笛 2024-12-20 09:45:06

将绘图限制在给定区域时,请尝试使用 mask 属性(DisplayObject 的每个子类都有它)。它的创建正是为了满足您的要求。

在您可以利用的最简单的IVisualElementContainer上,尝试使用

On restricting drawing to a given region, try using the mask property (every subclass of DisplayObject has it). It was created to do exactly what you're asking about.

On the simplest IVisualElementContainer you can draw on, try using a Group.

是否有一个 Flex 组件可以剪辑在其边界之外绘制的任何图形?

半城柳色半声笛 2024-12-20 08:48:33

感谢克里斯蒂安,我解决了这个问题。不过,我不确定这是最干净的解决方案。

我创建了一个名为 resetneeded 的布尔值。

在点击按钮代码中,我这样做:

btnVolgende.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
如果(需要重置){
光标 = (光标) WoordData.fetchset(kernset);
需要重置=假;
}
开始管理光标(光标);
tvFlitswoord.setText(cursor.getString(0));
光标.moveToNext();
if (cursor.isAfterLast()){
光标.moveToFirst();
}}

然后,在 onStart() 中,我将布尔值 resetneeded 设置为 true

// 编辑 - 第二个解决方案

最后,我决定使用 ArrayList 将单词传递到 TextView(并使用按钮循环浏览它)。 ArrayList 似乎更容易处理并且不那么脆弱。

代码:

    public void onStart(){
    super.onStart();    
    getPrefs();
    wordlistarray.clear();
    cursor = (Cursor) WoordData.fetchset(kernset);       
    cursor.moveToFirst();
    while(!cursor.isAfterLast()) {

        String wordtoadd = cursor.getString(0);
        wordlistarray.add(wordtoadd);
        cursor.moveToNext();
    }       

            for(int i = 0; i < wordlistarray.size();
                    i++){ Log.d("word in array", "" + wordlistarray.get(i)); }

Thanks to Christian, I solved it. I'm not sure this is the cleanest solution, though..

I created a boolean called resetneeded.

In the clickbutton code I do :

btnVolgende.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (resetneeded) {
cursor = (Cursor) WoordData.fetchset(kernset);
resetneeded = false;
}
startManagingCursor(cursor);
tvFlitswoord.setText(cursor.getString(0));
cursor.moveToNext();
if (cursor.isAfterLast()){
cursor.moveToFirst();
}}
}

And then, in the onStart(), I set the boolean resetneeded to true.

// EDIT - 2nd Solution

In the end, I decided to use an ArrayList for passing the words to the TextView (and cycling through it with the button). An ArrayList seems easier to handle and less fragile..

The code :

    public void onStart(){
    super.onStart();    
    getPrefs();
    wordlistarray.clear();
    cursor = (Cursor) WoordData.fetchset(kernset);       
    cursor.moveToFirst();
    while(!cursor.isAfterLast()) {

        String wordtoadd = cursor.getString(0);
        wordlistarray.add(wordtoadd);
        cursor.moveToNext();
    }       

            for(int i = 0; i < wordlistarray.size();
                    i++){ Log.d("word in array", "" + wordlistarray.get(i)); }

查询更改后刷新光标 - onStart()?

半城柳色半声笛 2024-12-20 08:45:34

有一种方法可以解决这个问题。两种实现都包含纯 python“WichmannHill”PRNG。
它速度较慢,但​​在 Jython 和 CPython 中给出相同的结果。

在我的代码中我替换

random.seed(1)
uuid += random.choice(hexdigits)

rand = random.WichmannHill(1)
uuid += rand.choice(hexdigits)

There is a way around this. Both implementations include the pure-python "WichmannHill" PRNG.
It's slower but it gives the same results in both Jython and CPython.

In my code I replaced

random.seed(1)
uuid += random.choice(hexdigits)

with

rand = random.WichmannHill(1)
uuid += rand.choice(hexdigits)

Jython 随机模块产生与 cpython 不同的结果

半城柳色半声笛 2024-12-20 03:17:41

只要标头注释被唯一分隔(即没有其他标头注释以 // ---------- 开头),并且替换文本是常量,以下 awk 脚本应该做你需要的事情:

BEGIN { normal = 1 }

/\/\/ ----------/ {
    if (normal) {
        normal = 0;
        print "// **********";
        print "// some replacement";
        print "// text";
        print "// that could have any";
        print "// format";
        print "// **********";
    } else {
        normal = 1;
        next;
    }
}

{
    if (normal) print;
}

这会打印它看到的所有内容,直到遇到段落分隔符。当它看到第一个段落时,它会打印出替换段落。在看到第二段分隔符之前,它不会打印任何内容。当它看到第二个段落分隔符时,它将再次开始正常打印下一行。

虽然从技术上讲您可以从命令行执行此操作,但您可能会遇到棘手的 shell 引用问题,尤其是当替换文本包含单引号时。将脚本放入文件中可能会更容易。只需将 #!/usr/bin/awk -f (或 awk 返回的任何路径 )放在顶部即可。

编辑

要在 awk 中匹配多行,您需要使用 getline。也许是这样的:

/\/\/ ----------/ {
    lines[0] = "// header";
    lines[1] = "// comment";
    lines[2] = "// to be replaced";
    lines[3] = "// ----------";

    linesRead = $0 "\n";
    for (i = 0; i < 4; i++) {
         getline line;
         linesRead = linesRead line;
         if (line != lines[i]) {
             print linesRead; # print partial matches
             next;
         }
    }

    # print the replacement paragraph here
    next;
}

As long as the header comments are delimited uniquely (i.e., no other header comment starts with // ----------), and the replacement text is constant, the following awk script should do what you need:

BEGIN { normal = 1 }

/\/\/ ----------/ {
    if (normal) {
        normal = 0;
        print "// **********";
        print "// some replacement";
        print "// text";
        print "// that could have any";
        print "// format";
        print "// **********";
    } else {
        normal = 1;
        next;
    }
}

{
    if (normal) print;
}

This prints everything it sees until it runs into the paragraph delimiter. When it sees the first one, it prints out the replacement paragraph. Until it sees the 2nd paragraph delimiter, it will print nothing. When it sees the 2nd paragraph delimiter, it will start printing lines normally again with the next line.

While you can technically do this from the command line, you may run into tricky shell quoting issues, especially if the replacement text has any single quotes. It may be easier to put the script in a file. Just put #!/usr/bin/awk -f (or whatever path which awk returns) at the top.

EDIT

To match multiple lines in awk, you'll need to use getline. Perhaps something like this:

/\/\/ ----------/ {
    lines[0] = "// header";
    lines[1] = "// comment";
    lines[2] = "// to be replaced";
    lines[3] = "// ----------";

    linesRead = $0 "\n";
    for (i = 0; i < 4; i++) {
         getline line;
         linesRead = linesRead line;
         if (line != lines[i]) {
             print linesRead; # print partial matches
             next;
         }
    }

    # print the replacement paragraph here
    next;
}

将整个段落替换为 Linux 命令行中的另一个段落

半城柳色半声笛 2024-12-20 01:08:50

正如@MilacH 指出的,实现中存在错误。如果 statusCode >返回 400 并抛出 IOException,因为拦截器未调用 errorHandler。该异常可以被忽略,然后在处理程序方法中再次捕获。

package net.sprd.fulfillment.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.nio.charset.StandardCharsets.UTF_8;

public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {

    final static Logger log = LoggerFactory.getLogger(LoggingRequestInterceptor.class);

    @SuppressWarnings("HardcodedLineSeparator")
    public static final char LINE_BREAK = '\n';

    @Override
    public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
        try {
            traceRequest(request, body);
        } catch (Exception e) {
            log.warn("Exception in LoggingRequestInterceptor while tracing request", e);
        }

        ClientHttpResponse response = execution.execute(request, body);

        try {
            traceResponse(response);
        } catch (IOException e) {
            // ignore the exception here, as it will be handled by the error handler of the restTemplate
            log.warn("Exception in LoggingRequestInterceptor", e);
        }
        return response;
    }

    private void traceRequest(HttpRequest request, byte[] body) {
        log.info("===========================request begin================================================");
        log.info("URI         : {}", request.getURI());
        log.info("Method      : {}", request.getMethod());
        log.info("Headers     : {}", request.getHeaders());
        log.info("Request body: {}", new String(body, UTF_8));
        log.info("==========================request end================================================");
    }

    private void traceResponse(ClientHttpResponse response) throws IOException {
        StringBuilder inputStringBuilder = new StringBuilder();
        try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getBody(), UTF_8))) {
            String line = bufferedReader.readLine();
            while (line != null) {
                inputStringBuilder.append(line);
                inputStringBuilder.append(LINE_BREAK);
                line = bufferedReader.readLine();
            }
        }

        log.info("============================response begin==========================================");
        log.info("Status code  : {}", response.getStatusCode());
        log.info("Status text  : {}", response.getStatusText());
        log.info("Headers      : {}", response.getHeaders());
        log.info("Response body: {}", inputStringBuilder);
        log.info("=======================response end=================================================");
    }

}

As @MilacH pointed out, there is an error in the implementation. If an statusCode > 400 is returned a IOException is thrown, as the errorHandler is not invoked, from interceptors. The exception can be ignored and is then caught again in the handler method.

package net.sprd.fulfillment.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.nio.charset.StandardCharsets.UTF_8;

public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {

    final static Logger log = LoggerFactory.getLogger(LoggingRequestInterceptor.class);

    @SuppressWarnings("HardcodedLineSeparator")
    public static final char LINE_BREAK = '\n';

    @Override
    public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
        try {
            traceRequest(request, body);
        } catch (Exception e) {
            log.warn("Exception in LoggingRequestInterceptor while tracing request", e);
        }

        ClientHttpResponse response = execution.execute(request, body);

        try {
            traceResponse(response);
        } catch (IOException e) {
            // ignore the exception here, as it will be handled by the error handler of the restTemplate
            log.warn("Exception in LoggingRequestInterceptor", e);
        }
        return response;
    }

    private void traceRequest(HttpRequest request, byte[] body) {
        log.info("===========================request begin================================================");
        log.info("URI         : {}", request.getURI());
        log.info("Method      : {}", request.getMethod());
        log.info("Headers     : {}", request.getHeaders());
        log.info("Request body: {}", new String(body, UTF_8));
        log.info("==========================request end================================================");
    }

    private void traceResponse(ClientHttpResponse response) throws IOException {
        StringBuilder inputStringBuilder = new StringBuilder();
        try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getBody(), UTF_8))) {
            String line = bufferedReader.readLine();
            while (line != null) {
                inputStringBuilder.append(line);
                inputStringBuilder.append(LINE_BREAK);
                line = bufferedReader.readLine();
            }
        }

        log.info("============================response begin==========================================");
        log.info("Status code  : {}", response.getStatusCode());
        log.info("Status text  : {}", response.getStatusText());
        log.info("Headers      : {}", response.getHeaders());
        log.info("Response body: {}", inputStringBuilder);
        log.info("=======================response end=================================================");
    }

}

Spring RestTemplate - 如何启用请求/响应的完整调试/日志记录?

半城柳色半声笛 2024-12-19 20:20:40

好吧,所以我使用了以下丑陋的代码:

uploader.bind('Refresh', function(up) {
    $('#'+up.settings.container + ' > div').css('left',0);
    $('#'+up.settings.container + ' > div').css('top',0);
    $('#'+up.settings.container + ' > div').css('width','100%');
    $('#'+up.settings.container + ' > div').css('height','100%');
    $('#'+up.settings.container + ' > form').css('left',0);
    $('#'+up.settings.container + ' > form').css('top',0);
    $('#'+up.settings.container + ' > form').css('width','100%');
    $('#'+up.settings.container + ' > form').css('height','100%');
    $('#'+up.settings.container + ' > div').children().css('left',0);
    $('#'+up.settings.container + ' > div').children().css('top',0);
    $('#'+up.settings.container + ' > div').children().css('width','100%');
    $('#'+up.settings.container + ' > div').children().css('height','100%');
    $('#'+up.settings.container + ' > div').children().css('font-size','20px');// default is 999px, which breaks everything in firefox
})

耶!它适用于 flash、htm5、htm4 runimes,并在 Chrome、Firefox、IE7、IE9 上进行了测试。垫片终于就位了。

Ok, so I went with the following ugly code:

uploader.bind('Refresh', function(up) {
    $('#'+up.settings.container + ' > div').css('left',0);
    $('#'+up.settings.container + ' > div').css('top',0);
    $('#'+up.settings.container + ' > div').css('width','100%');
    $('#'+up.settings.container + ' > div').css('height','100%');
    $('#'+up.settings.container + ' > form').css('left',0);
    $('#'+up.settings.container + ' > form').css('top',0);
    $('#'+up.settings.container + ' > form').css('width','100%');
    $('#'+up.settings.container + ' > form').css('height','100%');
    $('#'+up.settings.container + ' > div').children().css('left',0);
    $('#'+up.settings.container + ' > div').children().css('top',0);
    $('#'+up.settings.container + ' > div').children().css('width','100%');
    $('#'+up.settings.container + ' > div').children().css('height','100%');
    $('#'+up.settings.container + ' > div').children().css('font-size','20px');// default is 999px, which breaks everything in firefox
})

And yay! it works for flash, htm5, htm4 runimes, tested all on Chrome, Firefox, IE7, IE9. The shim is in place, finally.

Chrome中的plupload定位问题

更多

推荐作者

泛泛之交

文章 0 评论 0

音栖息无

文章 0 评论 0

荆棘i

文章 0 评论 0

泛滥成性

文章 0 评论 0

我还不会笑

文章 0 评论 0

假扮的天使

文章 0 评论 0

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