Top 10 reads of July 2015

These are our Top 10 reads of July 2015.

  • How to match strings using wildcards in C# and VB.NET
  • IsSmallerThan generic extension method for C# and VB.NET
  • How to prevent your IOS app from going into sleeping mode using Objective-C
  • How to convert Color to Hex and Hex to Color using C# and VB.NET
  • How to read a embedded resource to String in C# and VB.NET
  • How to convert a Securestring to String using C# and VB.NET
  • How to change the encoding of a String using C# and VB.NET
  • How to get focusedrow cell value using Devexpress XtraGrid in C# and VB.NET
  • How to get the selected row index in Devexpress Xtragrid Control using C# and VB.NET
  • thanks to all visitors, bookmark us, share us, talk about us, Follow us!, Like us! let’s grow bigger! You can even participate in our Github Projects!

    Please rate this snippet

    How to Set / Clear and Toggle a single bit in C/C++

    To Set / Clear and Toggle a single bit in C++ see the methods below.

    Setting a bit

    Use the bitwise OR operator (|) to set a bit.

    number |= 1 << x;
    

    Clearing a bit

    Use the bitwise AND operator (&) to clear a bit.

    number &= ~(1 << x);
    

    Toggling a bit

    The XOR operator (^) can be used to toggle a bit.

    number ^= 1 << x;
    

    Source

    Please rate this snippet

    How to check if a file exists in C++

    To check if a file exists in C++ you can use the following snippet.

    Sample C++

    #include <sys/stat.h>
    
    inline bool fileExists (const std::string& fileName) {
    	struct stat buff;   
    	return (stat (fileName.c_str(), &buff) == 0); 
    }
    

    Please rate this snippet