Search Results

Search found 69 results on 3 pages for 'williamkf'.

Page 3/3 | < Previous Page | 1 2 3 

  • Why do I get this strange output behavior?

    - by WilliamKF
    I have the following program test.cc: #include <iostream> unsigned char bogus1[] = { // Changing # of periods (0x2e) changes output after periods. 0x2e, 0x2e, 0x2e, 0x2e }; unsigned int bogus2 = 1816; // Changing this value changes output. int main() { std::clog << bogus1; } I build it with: g++ -g -c -o test.o test.cc; g++ -static-libgcc -o test test.o Using g++ version 3.4.6 I run it through valgrind and nothing is reported wrong. However the output has two extra control characters and looks like this: .... Thats a control-X and a control-G at the end. If you change the value of bogus2 you get different control characters. If you change the number of periods in the array the issue goes away or changes. I suspect it is a memory corruption bug in the compiler or iostream package. What is going on here?

    Read the article

  • How to hide keys in application?

    - by WilliamKF
    I have a C++ client/server application where the client and server are my executable. Each time a connection is made between the client and server, I generate a new encryption key for that session and I wish to transmit this session key and encrypt this session key using a static key that is built into both the client and server. However, running strings on my executable reveals the static key. How can I hide the embedded static key in my client and server application so that they are not easily extracted and thus allowing someone to decode my session key.

    Read the article

  • Way to get unsigned char into a std::string without reinterpret_cast?

    - by WilliamKF
    I have an unsigned char array that I need in a std::string, but my current way uses reinterpret_cast which I would like to avoid. Is there a cleaner way to do this? unsigned char my_txt[] = { 0x52, 0x5f, 0x73, 0x68, 0x7e, 0x29, 0x33, 0x74, 0x74, 0x73, 0x72, 0x55 } unsigned int my_txt_len = 12; std::string my_std_string(reinterpret_cast<const char *>(my_txt), my_txt_len);

    Read the article

  • How to automate detection of out of order tab navigation in Qt dialogs?

    - by WilliamKF
    Typically, a dialog wishes to have tab navigation proceed in an orderly fashion through a dialog that roughly corresponds to the order of reading a book. When new fields are added to a dialog by engineers on a team, the new widgets can often not be inserted in tab correct order. Can anyone think of a way to automate the detection of out of tab navigation order widgets within a dialog?

    Read the article

  • How to figure out why ssh session does not exit sometimes?

    - by WilliamKF
    I have a C++ application that uses ssh to summon a connection to the server. I find that sometimes the ssh session is left lying around long after the command to summon the server has exited. Looking at the Centos4 man page for ssh I see the following: The session terminates when the command or shell on the remote machine exits and all X11 and TCP/IP connections have been closed. The exit status of the remote program is returned as the exit status of ssh. I see that the command has exited, so I imagine not all the X11 and TCP/IP connections have been closed. How can I figure out which of these ssh is waiting for so that I can fix my summon command's C++ application to clean up whatever is being left behind that keeps the ssh open. I wonder why this failure only occurs some of the time and not on every invocation? It seems to occur approximately 50% of the time. What could my C++ application be leaving around to trigger this?

    Read the article

  • When encrypting data that is not an even multiple of the block size do I have to send a complete las

    - by WilliamKF
    If I am using a block cipher such as AES which has a block size of 128 bits, what do I do if my data is not an even multiple of 128 bits? I am working with packets of data and do not want to change the size of my packet when encrypting it, yet my data is not an even multiple of 128? Does the AES block cipher allow handling of a final block that is short without changing the size of my message once encrypted?

    Read the article

  • Can my thread help the OS decide when to context switch it out?

    - by WilliamKF
    I am working on a threaded application on Linux in C++ which attempts to be real time, doing an action on a heartbeat, or as close to it as possible. In practice, I find the OS is swapping out my thread and causing delays of up to a tenth of a second while it is switched out, causing the heartbeat to be irregular. Is there a way my thread can hint to the OS that now is a good time to context switch it out? I could make this call right after doing a heartbeat, and thus minimize the delay due to an ill timed context switch.

    Read the article

  • Are tr1 headers available for gcc v3.4.6?

    - by WilliamKF
    Are tr1 headers available for g++ v3.4.6? If so, how can I locate them at compile time. The following is failing to compile: #include <tr1/memory> With the following error: myModule.h:20:24: tr1/memory: No such file or directory Do I need to move to a later compiler or do I have the headers somewhere?

    Read the article

  • How to search a file for a pattern and get a new file from the match point to end of file?

    - by WilliamKF
    I need to take a file and find the first occurrence of a literal string pattern as a complete line of the file: Acknowledgments: And then I wish to create a new file from the line of match all the way to the end of the file. I expect perl is a good way to do this, but I'm not much of a perl person, alternatively maybe sed is a good way? Please suggest a simple way to reliably accomplish this in Unix.

    Read the article

  • How to push_back without operator=() for const members?

    - by WilliamKF
    How to push_back() to a C++ std::vector without using operator=() for which the default definition violates having const members? struct Item { Item(int value) : _value(value) { } const int _value; } vector<Item> items; items.push_back(Item(3)); I'd like to keep the _value const since it should not change after the object is constructed, so the question is how do I initialize my vector with elements without invoking operator=()?

    Read the article

  • How to multi-thread this?

    - by WilliamKF
    I wish to have two threads. The first thread1 occasionally calls the following pseudo function: void waitForThread2() { if (thread2 is not idle) { return; } notifyThread2IamReady(); while (thread2IsExclusive) { } } The second thread2 is forever in the following pseudo loop: for (;;) { Notify thread1 I am idle. while (!thread1IsReady()) { } Notify thread1 I am exclusive. Do some work while thread1 is blocked. Notify thread1 I am busy. Do some work in parallel with thread1. } What is the best way to write this such that both thread1 and thread2 are kept as busy as possible on a machine with multiple cores. I would like to avoid long delays between notification in one thread and detection by the other. I tried using pthread condition variables but found the delay between thread2 doing 'notify thread1 I am busy' and the loop in waitForThread2() on thear2IsExclusive() can be up to almost one second delay. I then tried using a volatile sig_atomic_t shared variable to control the same, but something is going wrong, so I must not be doing it correctly.

    Read the article

< Previous Page | 1 2 3