Fast Check for 2^N (2 power N) Numbers
To test if an integer is a power of 2 (1,2,4,8,16…256…), use the following code: if (!(x & (x-1)) then … Because 2^N-1 numbers have no common bits with 2^N
To test if an integer is a power of 2 (1,2,4,8,16…256…), use the following code: if (!(x & (x-1)) then … Because 2^N-1 numbers have no common bits with 2^N
Say Employee_Table has fields like EMP_NO, EMP_NAME, etc. In java, try this: try{ Connection conn =…//opening connection. PreparedStament ps = con.prepareStatement(“Select conn.setAutoCommit(false); Statement stmt = conn.createStatement(); stmt.addBatch( sql 1st insert
‘ Return a boolean indicating whether the input connection string is for the’ ADO.NET’s SQL Server managed provider’ Note: the function assumes the input string is a valid OLEDB or
‘ Return a boolean indicating whether the input connection string for the OLEDB ‘ managed provider points to a SQL Server DB” Examples:’ Debug.WriteLine(IsOleDbSqlConnString(“Provider=SQLOLEDB.1;Data ‘ Source=.;User ID=sa;Password=;Initial Catalog=MyDB”)) ‘ =>
When you use a web service’s proxy class, the calls to the web service might fail if you’re behind a proxy server. To solve the problem, you set the Proxy
It may happen that you have to define a lot of variable of some type, and you want the possibility to later change their type without manually change the declaration
‘ Return the Database name if the input connection string points to a SQL ‘ Server DB, or the DB path if the connection string points to a Jet (Access)
Here’s the code: #define offset(a,b) ((int) (&( ((a*)(0)) -> b))) Step by step, here’s what it does: Type-cast 0, or NULL, into a pointer of type a. So a must
XML provides many opportunities to share and store data. One of the most common and simple uses of XML is to use it to store data used by your application.