小编Eri*_*ski的帖子

从MySQL中的存储过程打印调试信息

MySQL中有没有办法将调试消息打印到stdout,temptable或logfile?就像是:

  • print 在SQLServer中
  • DBMS_OUTPUT.PUT_LINE 在Oracle中

mysql debugging

70
推荐指数
5
解决办法
18万
查看次数

在没有活动异常的情况下调用C++终止

我通过线程获得C++错误:

terminate called without an active exception
Aborted
Run Code Online (Sandbox Code Playgroud)

这是代码:

#include <queue>
#include <thread>
#include <mutex>
#include <condition_variable>

template<typename TYPE>
class blocking_stream
{
public:
    blocking_stream(size_t max_buffer_size_)
        :   max_buffer_size(max_buffer_size_)   
    {
    }

    //PUSH data into the buffer
    blocking_stream &operator<<(TYPE &other)
    {
        std::unique_lock<std::mutex> mtx_lock(mtx); 
        while(buffer.size()>=max_buffer_size)
            stop_if_full.wait(mtx_lock);

        buffer.push(std::move(other));

        mtx_lock.unlock();
        stop_if_empty.notify_one();
        return *this;
    }
    //POP data out of the buffer 
    blocking_stream &operator>>(TYPE &other)
    {
        std::unique_lock<std::mutex> mtx_lock(mtx);
        while(buffer.empty())
            stop_if_empty.wait(mtx_lock);

        other.swap(buffer.front()); 
        buffer.pop();

        mtx_lock.unlock();
        stop_if_full.notify_one();
        return *this;
    }

private:
    size_t max_buffer_size;
    std::queue<TYPE> buffer;
    std::mutex mtx;
    std::condition_variable stop_if_empty,
                            stop_if_full;
    bool …
Run Code Online (Sandbox Code Playgroud)

c++ multithreading deadlock c++11

70
推荐指数
3
解决办法
9万
查看次数

gem install json -v 1.7.3给出'请更新你的PATH以包含构建工具'

当我跑:

rails new blog
Run Code Online (Sandbox Code Playgroud)

我明白了:

Installing json (1.7.3)
Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)

当我跑:

gem install json -v 1.7.3
Run Code Online (Sandbox Code Playgroud)

我明白了:

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' …
Run Code Online (Sandbox Code Playgroud)

json build-tools ruby-on-rails-3 windows-8

70
推荐指数
1
解决办法
6万
查看次数

如何在Python matplotlib图中防止数字被改为指数形式

我在Python中使用Matplotlib来绘制简单的xy数据集.这会生成漂亮的图形,但是当我使用图形视图(执行时出现plt.show())在绘制图形的各个部分上"放大"太近时,x轴值从标准数字形式(1050,1060, 1070等)具有指数表示法的科学形式(例如1,1,5,2.0,其中x轴标记为+1.057e3).

我更喜欢我的数字保留轴的简单编号,而不是使用指数形式.有没有办法可以强制Matplotlib这样做?

python graph matplotlib figure

70
推荐指数
5
解决办法
6万
查看次数

Java,如何在apache kafka中获取主题中的消息数量

我正在使用apache kafka进行消息传递.我用Java实现了生产者和使用者.我们如何获取主题中的消息数量?

java messages apache-kafka

70
推荐指数
11
解决办法
10万
查看次数

如何通过快捷键清除Chrome控制台?

我想在Chrome浏览器中清除Chrome开发者工具中的控制台标签.我知道他们是一个按钮,但这样做的快捷键是什么?

他们的铬合金开发工具或铬快捷方式的任何地方都是cheatsheet吗?

google-chrome google-chrome-devtools

69
推荐指数
4
解决办法
3万
查看次数

错误:未知类型名称'bool'

我下载了源代码并想编译扫描程序文件.它会产生以下错误:

[meepo@localhost cs143-pp1]$ gcc -o lex.yy.o lex.yy.c -ll
In file included from scanner.l:15:0:
scanner.h:59:5: error: unknown type name ‘bool’
In file included from scanner.l:16:0:
utility.h:64:38: error: unknown type name ‘bool’
utility.h:74:1: error: unknown type name ‘bool’
In file included from scanner.l:17:0:
errors.h:16:18: fatal error: string: No such file or directory
compilation terminated.
Run Code Online (Sandbox Code Playgroud)

我尝试使用不同的编译器来编译它,但它出现了不同的错误.

[meepo@localhost cs143-pp1]$ g++ -o scan lex.yy.c -ll
/usr/bin/ld: cannot find -ll
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

我的操作系统是3.0-ARCH,我不知道为什么会这样.我该如何修复错误?

c gcc lex

69
推荐指数
4
解决办法
17万
查看次数

Java:有界通配符还是有界类型参数?

最近,我读了这篇文章:http: //download.oracle.com/javase/tutorial/extra/generics/wildcards.html

我的问题是,而不是创建这样的方法:

public void drawAll(List<? extends Shape> shapes){
    for (Shape s: shapes) {
        s.draw(this);
    }
}
Run Code Online (Sandbox Code Playgroud)

我可以创建一个这样的方法,它工作正常:

public <T extends Shape> void drawAll(List<T> shapes){
    for (Shape s: shapes) {
        s.draw(this);
    }
}
Run Code Online (Sandbox Code Playgroud)

我应该使用哪种方式?在这种情况下,通配符是否有用?

java generics api bounded-wildcard

68
推荐指数
2
解决办法
3万
查看次数

Javascript,^(插入符号)运算符有什么作用?

我有一些JavaScript代码:

<script type="text/javascript">
$(document).ready(function(){
  $('#calcular').click(function() {
    var altura2 = ((($('#ddl_altura').attr("value"))/100)^2);
    var peso = $('#ddl_peso').attr("value");
    var resultado = Math.round(parseFloat(peso / altura2)*100)/100;
    if (resultado > 0) {
      $('#resultado').html(resultado);
      $('#imc').show();
    };
  });
});
</script>
Run Code Online (Sandbox Code Playgroud)

什么是^(尖)运算符在Javascript中是什么意思?

javascript math operators

67
推荐指数
4
解决办法
5万
查看次数

在vim中为python突出显示语法

我该如何在Vim 7中为python设置语法高亮?

我想为一种代码文件设置我自己的colorschemes和语法高亮.

python vi syntax vim vim-syntax-highlighting

67
推荐指数
4
解决办法
7万
查看次数