Search Results

Search found 48 results on 2 pages for 'ereon'.

Page 2/2 | < Previous Page | 1 2 

  • Discovering maximum packet size

    - by ereOn
    I'm working on a network-related project and I am using DTLS (TLS/UDP) to secure communications. Reading the specifications for DTLS, I've noted that DTLS requires the DF flag (Don't Fragment) to be set. On my local network if I try to send a message bigger than 1500 bytes, nothing is sent. That makes perfect sense. On Windows the sendto() reports a success but nothing is sent. I obviously cannot unset the DF flag manually since it is mandatory for DTLS and i'm not sure whether the 1500 bytes limit (MTU ?) could change in some situations. I guess it can. So, my question is : "Is there a way to discover this limit ?" If not, what would be the lowest possible value ? My software runs under UNIX (Linux/MAC OSX) and Windows OSes so different solutions for each OS are welcome ;) Many thanks.

    Read the article

  • Vim open file under cursor

    - by ereOn
    Hi, Let's say I have the following file tree: / include/ library/ a.hpp b.hpp src/ a.cpp b.cpp And the following /src/a.cpp file: #include "a.hpp" #include "b.hpp" I always open Vim at the root directory. So when I want to load a.hpp I do : :tabnew include/library/a.hpp or: :tabnew **/a.hpp I'd like to map <F4> to open the file under the cursor in a new tab, using a recursive search. I tried the following mapping command: :map <F4> :tabnew **/expand("<cfile>")<cr> But obviously, this can't work, as it tries to open the file "/expand(" instead. Any clue on how I could do that ? Thanks.

    Read the article

  • Changing default compiler in Linux, using SCons

    - by ereOn
    On my Linux platform, I have several versions of gcc. Under usr/bin I have: gcc34 gcc44 gcc Here are some outputs: $ gcc --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48) $ gcc44 --version gcc44 (GCC) 4.4.0 20090514 (Red Hat 4.4.0-6) I need to use the 4.4 version of gcc however the default seems to the 4.1 one. I there a way to replace /usr/bin/gcc and make gcc44 the default compiler not using a symlink to /usr/bin/gcc44 ? The reason why I can't use a symlink is because my code will have to be shipped in a RPM package using mock. mock creates a minimal linux installation from scratch and just install the specified dependencies before compiling my code in it. I cannot customize this "minimal installation". Ideally, the perfect solution would be to install an official RPM package that replaces gcc with gcc44 as the default compiler. Is there such a package ? Is this even possible/good ? Additional information I have to use SCons (a make alternative) and it doesn't let me specify the binary to use for gcc. I will also accept any answer that will tell me how to specify the gcc binary in my SConstruct file.

    Read the article

  • Extracting public key from private key in OpenSSL

    - by ereOn
    Hello, I need to extract the RSA public key from a RSA private key using OpenSSL. I'm currently using RSAPublicKey_dup() passing the RSA* private key to get the public key. However, while the call seems to work, I cannot load (or use) this public key using the openssl command-line tool. If I generate the public key using the command-line tool ("$ openssl rsa -in private.pem -pubout > public.pem"), I can use it and it works like a charm. Do you guys know how I can get this work ? Maybe another function ? The OpenSSL documentation is quite hard to browse... Thank you.

    Read the article

  • What is the nicest way to parse this in C++ ?

    - by ereOn
    Hi, In my program, I have a list of "server address" in the following format: host[:port] The brackets here, indicate that the port is optional. host can be a hostname, an IPv4 or IPv6 address. port, if present can be a numeric port number or a service string (like: "http" or "ssh"). If port is present and host is an IPv6 address, host must be in "bracket-enclosed" notation (Example: [::1]) Here are some valid examples: localhost localhost:11211 127.0.0.1:http [::1]:11211 ::1 [::1] And an invalid example: ::1:80 // Invalid: Is this the IPv6 address ::1:80 and a default port, or the IPv6 address ::1 and the port 80 ? ::1:http // This is not ambigous, but for simplicity sake, let's consider this is forbidden as well. My goal is to separate such entries in two parts (obviously host and port). I don't care if either the host or port are invalid as long as they don't contain a : (290.234.34.34.5 is ok for host, it will be rejected in the next process); I just want to separate the two parts, or if there is no port part, to know it somehow. I tried to do something with std::stringstream but everything I come up to seems hacky and not really elegant. How would you do this in C++ ? I don't mind answers in C but C++ is prefered. Any boost solution is welcome as well. Thank you.

    Read the article

  • Arguments to convince to switch from CVS to SVN

    - by ereOn
    Hi, The UNIX department of my company currently uses CVS as source-version control system. They use it in a very strange way: different repositories for development/testing/production code (for the same project), no one tags anything, weird directory architecture, and so on. The system has been set for ages but now, I have an opportunity to organize a meeting where I have to suggest changes. I'd like to make them change from CVS to SVN (Mercurial or Git might be even better, however I can't really recommand using a system I don't know well, and switching to SVN will already be a great step forward). I don't have much experience with CVS so I can't compare them efficiently: I just know it doesn't support atomic operations and that it is deprecated. What killer arguments would you use to convince my collegues to do the switch ? Thank you very much.

    Read the article

  • Does Qt support virtual pure slots ?

    - by ereOn
    Hi, My GUI project in Qt has a lot of "configuration pages" classes which all inherit directly from QWidget. Recently, I realized that all these classes share 2 commons slots (loadSettings() and saveSettings()). Regarding this, I have two questions: Does it make sense to write a intermediate base abstract class (lets name it BaseConfigurationPage) with these two slots as virtual pure methods ? (Every possible configuration page will always have these two methods, so I would say "yes") Before I do the heavy change in my code (if I have to) : does Qt support virtual pure slots ? Is there anything I should be aware of ? Here is a code example describing everything: class BaseConfigurationPage : public QWidget { // Some constructor and other methods, irrelevant here. public slots: virtual void loadSettings() = 0; virtual void saveSettings() = 0; }; class GeneralConfigurationPage : public BaseConfigurationPage { // Some constructor and other methods, irrelevant here. public slots: void loadSettings(); void saveSettings(); };

    Read the article

  • Detect/Redirect core dumps (when a software crashes) on Windows

    - by ereOn
    Hi, For my work, I need to create a service that will detect an abnormal program termination and, instead of displaying a message to the user (default behavior), send the generated core dump to a remote server. I'm pretty sure this can be done, but I have absolutely no clue on where to start. Is there any API/registry settings for this ? Thank you.

    Read the article

  • What elegant method callback design should be used ?

    - by ereOn
    Hi, I'm surprised this question wasn't asked before on SO (well, at least I couldn't find it). Have you ever designed a method-callback pattern (something like a "pointer" to a class method) in C++ and, if so, how did you do it ? I know a method is just a regular function with some hidden this parameter to serve as a context and I have a pretty simple design in mind. However, since things are often more complex than they seem to, I wonder how our C++ gurus would implement this, preferably in an elegant and standard way. All suggestions are welcome !

    Read the article

  • Is Microsoft Workflow Foundation really used ?

    - by ereOn
    Today, I had a training on "Microsoft Workflow Foundation". While I think the idea is neat, I still see it as a Proof Of Concept and not as a real-life solution. Building an entire application without having to type a single line of code (or only a few of them) seems just wrong. Have you ever used this technology and if so, can it really fit to big company projects ? What drawbacks/advantages have you got using it ?

    Read the article

  • An exception to the "only one implementation" rule ?

    - by ereOn
    While I was reading the accepted answer of this question, I had the following question: Typically, methods are defined in header files (.hpp or whatever), and implementation in source files (.cpp or whatever). One of the main reasons it is bad practice to ever include a "source file" (#include <source_file.cpp>) is that its methods implementation would then be duplicated, resulting in linking errors. When one writes: #ifndef BRITNEYSPEARS_HPP #define BRITNEYSPEARS_HPP class BritneySpears { public: BritneySpears() {}; // Here the constructor has implementation. }; #endif /* BRITNEYSPEARS_HPP */ He is giving the implementation of the constructor (here an "empty" implementation, but still). But why then including this header file multiple times (aka. on different source files) will not generate a "duplicate definition" error at link time ?

    Read the article

  • Comparing objects and inheritance

    - by ereOn
    Hi, In my program I have the following class hierarchy: class Base // Base is an abstract class { }; class A : public Base { }; class B : public Base { }; I would like to do the following: foo(const Base& one, const Base& two) { if (one == two) { // Do something } else { // Do something else } } I have issues regarding the operator==() here. Of course comparing an instance A and an instance of B makes no sense but comparing two instances of Base should be possible. (You can't compare a Dog and a Cat however you can compare two Animals) I would like the following results: A == B = false A == A = true or false, depending on the effective value of the two instances B == B = true or false, depending on the effective value of the two instances My question is: is this a good design/idea ? Is this even possible ? What functions should I write/overload ? My apologies if the question is obviously stupid or easy, I have some serious fever right now and my thinking abilities are somewhat limited :/ Thank you.

    Read the article

  • Cannot bind to IPv6 address

    - by ereOn
    I am facing a strange problem on my Ubuntu Karmic system. When I call getaddrinfo() with AI_PASSIVE and AF_UNSPEC, for an empty host and the UDP 12000 port to get a bindable address, I only get back one IPv4 result (0.0.0.0:12000 for instance). If I change my call and specify AF_INET6 instead of AF_UNSPEC, then getaddrinfo() returns "Name or service not known". Shouldn't I get [::]:12000 as a result ? The same thing happens if I set the host to ::1. When I call getaddrinfo() without AI_PASSIVE (to get a "connectable" address) for the host "localhost" and the UDP 12000 port, I first get [::1]:12000 then 127.0.0.1:12000. So apparently, my system is IPv6 ready (I can ping to both IPv4 and IPv6 addresses, as well as DNS resolution). But how is it that I can't get an IPv6 address to bind to with getaddrinfo() ? Do you guys have any idea about what could be wrong ? My OS is Ubuntu Karmic, fresh install without any networking tweaking. Thank you.

    Read the article

  • How-to handle errors in Vim Script ?

    - by ereOn
    In my .vimrc file, I have the following function, which folds the licensing information on the top of some .hpp and .cpp files: " Skip license function! FoldLicense() if !exists("b:foldedLicense") let b:foldedLicense = 1 1;/\*\//fold endif endfunction au BufRead *.hpp call FoldLicense() au BufRead *.cpp call FoldLicense() This works well, but if I open a .cpp file which doesn't have any licensing information block, Vim complains that the pattern is not found. Fair enough, but is there a way so that he stops complaining and just does nothing if the pattern is not found ? Thanks !

    Read the article

  • How to get information about a Windows executable (.exe) using C++

    - by ereOn
    Hi, I have to create a software that will scan several directories and extracts information about the executables found. I need to do two things: Determine if a given file is an executable (.exe, .dll, and so on) - Checking the extension is probably not good enough. Get the information about this executable (the company name, the product name, and so on). I never did this before and thus am not aware if there is a Windows API (or lightweight C/C++ library) to do that or if it is even possible. I guess it is, because explorer.exe does it. Do you guys know anything that could point me in the right direction ? Thank you very much for your help.

    Read the article

  • Portable way of counting milliseconds in C++ ?

    - by ereOn
    Hi, Is there any portable (Windows & Linux) way of counting how many milliseconds elapsed between two calls ? Basically, I want to achieve the same functionnality than the StopWatch class of .NET. (for those who already used it) In a perfect world, I would have used boost::date_time but that's not an option here due to some silly rules I'm enforced to respect. For those who better read code, this is what I'd like to achieve. Timer timer; timer.start(); // Some instructions here timer.stop(); // Print out the elapsed time std::cout << "Elapsed time: " << timer.milliseconds() << "ms" << std::endl; So, if there is a portable (set of) function(s) that can help me implement the Timer class, what is it ? If there is no such function, what Windows & Linux API should I use to achieve this functionnality ? (using #ifdef WINDOWS-like macros) Thanks !

    Read the article

  • What to throw in a C++ class wrapping a C library ?

    - by ereOn
    I have to create a set of wrapping C++ classes around an existing C library. For many objects of the C library, the construction is done by calling something like britney_spears* create_britney_spears() and the opposite function void free_britney_spears(britney_spears* brit). If the allocation of a britney_spears fails, create_britney_spears() returns NULL. This is, as far as I know, a very common pattern. Now I want to wrap this inside a C++ class. //britney_spears.hpp class BritneySpears { public: BritneySpears(); private: boost::shared_ptr<britney_spears> m_britney_spears; }; And here is the implementation: // britney_spears.cpp BritneySpears::BritneySpears() : m_britney_spears(create_britney_spears(), free_britney_spears) { if (!m_britney_spears) { // Here I should throw something to abort the construction, but what ??! } } So the question is in the code sample: What should I throw to abort the constructor ? I know I can throw almost anything, but I want to know what is usually done. I have no other information about why the allocation failed. Should I create my own exception class ? Is there a std exception for such cases ? Many thanks.

    Read the article

  • Is the XML processing instructions node mandatory ?

    - by ereOn
    I had a discussion with a colleague of mine about the XML processing instructions node (I'm talking about this = <?xml version="1.0" encoding="UTF-8"?>). I believe that for something to be called "valid XML", it requires a processing instructions node. My colleague states that the processing instruction node is optionnal, since the default encoding is UTF-8 and the version is always 1.0. This make sense, but what does the standard says ? In short, given the following file: <books> <book id="1"><title>Title</title></book> </book> Can we say that: It is valid XML ? It is a valid XML node ? It is a valid XML document ? Thank you very much.

    Read the article

  • Where do you find images and graphics for your softwares ?

    - by ereOn
    Hi, As a programmer, I'm sure some of you already experienced the same problem: You create a good software (free, open-source, or for friend-only diffusion, whatever) relying on good code and good ideas but since you're a programmer and not an image designer, your program looks just bad. While it seems pretty easy to find motivated developpers to join for free an open-source project, it seems quite hard to find a single free graphic designer. What free and good resources do you usually use for your programs/websites ? Do you have any cool tip that you're willing to share ?

    Read the article

  • Friendness and derived class

    - by ereOn
    Hi, Let's say I have the following class hierarchy: class Base { protected: virtual void foo() = 0; friend class Other; }; class Derived : public Base { protected: void foo() { /* Some implementation */ }; }; class Other { public: void bar() { Derived* a = new Derived(); a->foo(); // Compiler error: foo() is protected within this context }; }; I guess I could change it too a->Base::foo() but since foo() is pure virtual in the Base class, the call will result in calling Derived::foo() anyway. However, the compiler seems to refuse a->foo(). I guess it is logical, but I can't really understand why. Am I missing something ? Can't (shouldn't) it handle this special case ? Thank you.

    Read the article

  • Where do you find images and graphics designers for your softwares ?

    - by ereOn
    Hi, As a programmer, I'm sure some of you already experienced the same problem: You create a good software (free, open-source, or for friend-only diffusion, whatever) relying on good code and good ideas but since you're a programmer and not an image designer, your program looks just bad. While it seems pretty easy to find motivated developpers to join for free an open-source project, it seems quite hard to find a single free graphic designer. What free and good resources do you usually use for your programs/websites ? Do you have any cool tip that you're willing to share ? Do you know any place where to find people involved into graphic design willing to participate to open-source projects ?

    Read the article

  • Correct usage(s) of const_cast<>

    - by ereOn
    Hi, As a common rule, it is very often considered a bad practice to use const_cast<>() in C++ code as it reveals (most of the time) a flaw in the design. While I totally agree with this, I however wonder what are the cases were using const_cast<>() is ok and the only solution. Could you guys please give me some examples you know/you encountered ? Thank you very much.

    Read the article

  • What code commenting style should I use for both C++ and C# ?

    - by ereOn
    Hi, I was recently hired in a company. They have a lot of C++ and C# code source files and almost one different commenting style per file. (Well this is exagerated, but you have the picture) This morning, I show my new collegues how my personnal code was commented and how easy it was to generate a documentation from it (I use Doxygen). I somehow convinced them to use a coherent commenting style. I would suggest using Doxygen for C++ source files and native C# style commenting style for C# files. However, I'm not sure that's the best solution here. Are you aware of a commenting style that would work for both C++ and C# allowing us to generate a documentation from it ? If so, what software/tool should we use ? Having a solution that would work on Linux platforms as well would be even better. Thank you very much.

    Read the article

< Previous Page | 1 2