小编hak*_*8or的帖子

How to run commands which require sudo using Capistrano V3?

I would like to be able to run apt-get update and then install a few new programs (tmux) along with apt-get upgrade on all my servers when running cap setup but am fumbling around with the apparent lack of documentation regarding sudo on v3.

The gotcha on the v3 release page for sudo makes me sad. http://www.capistranorb.com/2013/06/01/release-announcement.html

For example, here is how I think sudo should work based on some googling, but I keep getting asked for a password.

desc …
Run Code Online (Sandbox Code Playgroud)

shell sudo capistrano

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

如何根据C11使用二进制前缀?

我目前正在开始使用编程微控制器C30(C基于GCC微芯片的编译器为他们的PIC24设备),我Strict ANSI warnings出于好奇而启用.首先,我不知道在C11评论标记如//是"错误的"而我应该使用/*blah blah*/,但真正令我感到惊讶的是这一行代码警告.

"警告:使用非标准二进制前缀"

代码行是:

OSCCONbits.COSC = 0b000;

我已经在线查看了C11(ISO/IEC 9899:2011)的草案之一,但在C中找不到任何关于二进制前缀的内容.http://www.open-std.org/jtc1/sc22/wg14/www /docs/n1570.pdf

根据C11,C的正确二进制表示法是什么?

c compiler-construction standards standards-compliance c11

7
推荐指数
1
解决办法
9098
查看次数

与at()或索引相比,为什么使用C++迭代器会大大增加代码大小?

我一直在寻找使用更新的C++语言功能,例如嵌入式系统上的迭代器(16KB的SRAM和64 KB的闪存,Cortex M4),并遇到了令人惊讶的障碍.为什么地球上的迭代器如此庞大?我的印象是他们基本上是一些指针算术或索引.STL是否引入了一些意想不到的代码?

这些都是从GCC-臂无- EABI-4_9工具链窗口使用的Kinetis设计工作室在这里使用了以下标志.

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fsingle-precision-constant -flto  -g3 -I"../Sources" -I"../Includes" -std=gnu++11 -fabi-version=0 -std=c++11 -MMD -MP -MF"Sources/System.d" -MT"Sources/System.o" -c -o "Sources/System.o" "../Sources/System.cpp"
Run Code Online (Sandbox Code Playgroud)

ITM_SendChar只需要一个字符并将其放入寄存器中.

std::string input = "Oh hai there! :D\n";

#ifdef char_array
    // .text              7352
    // .data               376
    // .bss                236
    for(int i = 0; i < input.size(); i++)
            ITM_SendChar(input[i]);
#endif

#ifdef char_at
    // .text              7392
    // .data               376
    // .bss                236
    for(int i = 0; i < input.size(); …
Run Code Online (Sandbox Code Playgroud)

c++ embedded gcc iterator stl

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

为什么我的PIC没有闪烁它的LED?

我正在尝试开始使用pic24,特别是PIC24FJ64GA002,我已经在寄存器中看了数据表和诸如此类的东西,但我仍然无法让它眨眼LED.当我通过调试运行它时它运行正常,但是当我尝试在pic上实际运行它时,它似乎根本不运行.

我正在使用一个外部振荡器,一个8MHZ振荡器,专门连接到引脚9(OSCI)和10(OSCO).编译器是Mplab中的C30.

数据表链接是:http://ww1.microchip.com/downloads/en/DeviceDoc/39881D.pdf

代码如下

//include basic header definition
#include <p24FJ64GA002.h>

//config
_CONFIG2(0x0200);
_CONFIG1(0x0800);

int i;

//main loop
int main(void)
{

   OSCCON = 0x2280;  //select external OSC, no PLL
   AD1PCFG      = 0xFFFF;  //set to all digital I/O
   TRISA = 0x0000;  //configure all PortA as output

   while(1)    //Loop forever
   {
  LATAbits.LATA0 = 1; //RA0 = 1
  Wait();
  LATAbits.LATA0 = 1; //RA0 = 1
  Wait(); 
   }

}


int Wait(void) // gives me a nice delay of 1/3rd a second or …
Run Code Online (Sandbox Code Playgroud)

c++ embedded microchip pic

0
推荐指数
1
解决办法
1945
查看次数

如何根据模板中的类型编译函数?

我希望能够做到这样的事情:

template <typename template_type>
class awesome_class{
public:
    void some_function(void){
        // if (template_type == type_a)
        cout << "I am of type_a and doing type_a specific methods";
        // endif

        cout << "I am not of type_a and doing my normal methods";
    }
}
Run Code Online (Sandbox Code Playgroud)

我基本上想扩展一个模板化类,如果它是一个包含特定成员变量的类型,那么运行一些由于成员变量而可能的优化代码,但是如果它不属于那个类型那么只需忽略该部分代码

这在C++中是否可行?或者我是否完全错了?

编辑:我专门的功能基本上要求我这样做几乎班上的每一个功能.那时,我不妨再做一个专门针对有关类型的课程.再次,谢谢你,学到了一些新的和有价值的东西,可能会在其他情况下派上用场!

c++ templates metaprogramming template-meta-programming c++11

0
推荐指数
1
解决办法
126
查看次数