Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

**StringBuffer** is synchronized, **StringBuilder** is not.
4 years ago
On Linux, macOS and Unix to display the groups to which you belong, use:
***id -Gn***
which is equivalent to **groups** utility which has been obsoleted on Unix (as per Unix manual).
On macOS and Unix, the command **id -p** is suggested for normal interactive.
Explanation of the parameters:
***-G, --groups - print all group IDs
-n, --name - print a name instead of a number, for -ugG
-p - Make the output human-readable.***
4 years ago
For the bourne shell:
***sh myscript.sh***
For bash:
***bash myscript.sh***
4 years ago
When you compile your program you must supply the path to the library; in g++ use the -L option:
***g++ myprogram.cc -o myprogram -lmylib -L/path/foo/bar***
4 years ago
The most common answer, however, is either /etc/apache/conf or /etc/httpd/conf
Generically, you can determine the answer by running the command:
***httpd -V***
(That's a capital V). Or, on systems where httpd is renamed, perhaps **apache2ctl -V**
This will return various details about how httpd is built and configured, including the default location of the main configuration file.
One of the lines of output should look like:
***-D SERVER_CONFIG_FILE="conf/httpd.conf"***
which, combined with the line:
***-D HTTPD_ROOT="/etc/httpd"***
will give you a full path to the default location of the configuration file
4 years ago
Depending on your workplace, you may also need to specify the **-k** or the **--insecure** option for curl in order to get past potential issues with CA certificates.
***curl -x : -k -O -L ***
4 years ago
Use a **case** statement:
***select id,
case report.type
when 'P' then amount
when 'N' then -amount
end as amount
from
`report`***
4 years ago
You can use multiple ordering on multiple condition,
***ORDER BY
(CASE
WHEN @AlphabetBy = 2 THEN [Drug Name]
END) ASC,
CASE
WHEN @TopBy = 1 THEN [Rx Count]
WHEN @TopBy = 2 THEN [Cost]
WHEN @TopBy = 3 THEN [Revenue]
END DESC ***
4 years ago
In SQL, the 'WHERE' and 'ON' clause,are kind of Conditional Statemants, but the major difference between them are, the 'Where' Clause is used in Select/Update Statements for specifying the Conditions, whereas the 'ON' Clause is used in Joins, where it verifies or checks if the Records are Matched in the target and source tables, before the Tables are Joined
**For Example: - 'WHERE'**
***SELECT (asterisk) FROM employee WHERE employee_id=101***
For Example: - 'ON'
There are two tables employee and employee_details, the matching columns are employee_id.
***SELECT (asterisk) FROM employee
INNER JOIN employee_details
ON employee.employee_id = employee_details.employee_id***
4 years ago
You can use the stored procedure sp_columns which would return information pertaining to all columns for a given table.
You can also do it by a SQL query. Some thing like this should help:
***SELECT * FROM sys.columns WHERE object_id = OBJECT_ID('dbo.yourTableName') ***
Or a variation would be:
***SELECT o.Name, c.Name
FROM sys.columns c
JOIN sys.objects o ON o.object_id = c.object_id
WHERE o.type = 'U'
ORDER BY o.Name, c.Name***
This gets all columns from all tables, ordered by table name and then on column name.
4 years ago
Use stat like this:
***
#include // stat
#include // bool type

bool file_exists (char *filename) {
struct stat buffer;
return (stat (filename, &buffer) == 0);
}
and call it like this:

#include // printf

int main(int ac, char **av) {
if (ac != 2)
return 1;

if (file_exists(av[1]))
printf("%s exists\n", av[1]);
else
printf("%s does not exist\n", av[1]);

return 0;
}***
4 years ago
Here is a quick hack to demonstrate techniques to do what you want.
***#include /* printf */
#include /* strcat */
#include /* strtol */

const char *byte_to_binary
(
int x
)
{
static char b[9];
b[0] = '\0';

int z;
for (z = 128; z > 0; z >>= 1)
{
strcat(b, ((x & z) == z) ? "1" : "0");
}

return b;
}

int main
(
void
)
{
{
/* binary string to int */

char *tmp;
char *b = "0101";

printf("%d\n", strtol(b, &tmp, 2));
}

{
/* byte to binary string */

printf("%s\n", byte_to_binary(5));
}

return 0;
}***
4 years ago