|
What error? like so many people here you do not explain what error you are talking about, and we have no way of guessing.
|
|
|
|
|
Quote: Input 1: It will be string which tells two integers separated by a single comma that represent M and N respectively.
Input 2: It will be the integer B, the maximum cost you can afford (i.e., your budget). It is the cost of removing ith plot.
Input 3: It will be the integer P, the residential plots found in the list.
Input 4: It will be string array where: Does't match with the sample input, for instance:
Quote: 6,9 - Input 1
42 - Input 2
5 - Input 3
5 - ??????
4,1,6,3,12 - Input 4
3,6,5,6,9
1,3,3,8,24
3,8,6,9,21
5,1,6,2,20
|
|
|
|
|
Hi,
I am trying to use Ribbon control in my outlook addin but could not find
"Microsoft Office xx.x Object Library" in available type library.
I am using Microsoft Office 365 ProPlus. Please help.
|
|
|
|
|
I need to split a paragraph into lines based on a given width in pixels. The idea being that as a user resizes the window, they can see more or less of the paragraph as the window is made wider or narrower in the same was as notepad would with word wrap on. Is there anything in the Windows API that has already solved this problem?
|
|
|
|
|
Depends on the context. What are you doing exactly?
If you're drawing the string yourself, the Graphics method DrawString already does this for you. You just have to provide the rectangle to fit the string in.
|
|
|
|
|
Thanks for the suggestion but I'm looking to determine the starting offset of each line within the paragraph. I could manually parse the string and use GetTextExtentPoint32() to work it out myself but I imagine that will be slow and I thought maybe an API might already exist as something like an edit control will already be doing something similar.
|
|
|
|
|
|
|
+100 to that answer .. Multiline edit boxes already exist why re-invent the wheel.
In vino veritas
|
|
|
|
|
|
|
I wanna change this C code from persistent to none persistent in HTML
please help me i don't know about that
<pre lang="c++"> int main(int argc, char *argv[])
{
struct sockaddr_in server_addr, client_addr;
socklen_t sin_len = sizeof(client_addr);
int fd_server, fd_client;
char buf[2048];
int fdimg;
fd_server = socket(AF_INET, SOCK_STREAM, 0);
if(fd_server < 0)
{
perror("socket");
exit(1);
}
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = INADDR_ANY;
server_addr.sin_port = htons(8080);
if(bind(fd_server, (struct sockaddr *) &server_addr, sizeof(server_addr)) == -1)
{
perror("bind");
close(fd_server);
exit(1);
}
if(listen(fd_server,10) == -1)
{
perror("listen");
close(fd_server);
exit(1);
}
while(1)
{
fd_client = accept(fd_server, (struct sockaddr *) &client_addr, &sin_len);
if(fd_client == -1)
{
perror("Connection Failed! Can't Conneect to Client .... \n");
continue;
}
printf("Accepted the Client Connection ..... \n");
if(!fork())
{
close(fd_server);
memset(buf, 0, 2047);
read(fd_client, buf, 2047);
printf("%s\n", buf);
if(!strncmp(buf, "GET /testicon.ico", 16))
{
fdimg = open("testicon.ico", O_RDONLY);
sendfile(fd_client, fdimg, NULL, 200000);
close(fdimg);
}
else if(!strncmp(buf, "GET /testpic.jpg", 16))
{
fdimg = open("testpic.jpg", O_RDONLY);
sendfile(fd_client, fdimg, NULL, 60000);
close(fdimg);
}
else
write(fd_client, webpage, sizeof(webpage)-1);
close(fd_client);
printf("Closing ... \n");
exit(0);
}
close(fd_client);
}
return 0;
}
|
|
|
|
|
What exactly do you mean by "change this C code from persistent to none persistent in HTML ". Your code looks to be a simple HTTP message handler.
|
|
|
|
|
Your server code doesn't even appear to be sending a header at the moment, so client will assume you are http 1.0 server and default of close connection.
Look at the rosseta code for a Web server .. goto the C section .. you should recognize the code
Hello world/Web server - Rosetta Code[^]
The moment it connects to the client it sends a header to the client
write(client_fd, response, sizeof(response) - 1);
The header is at top of code and looks like this
char response[] = "HTTP/1.1 200 OK\r\n"
"Content-Type: text/html; charset=UTF-8\r\n\r\n"
"<!DOCTYPE html><html><head><title>Bye-bye baby bye-bye</title>"
"<style>body { background-color: #111 }"
"h1 { font-size:4cm; text-align: center; color: black;"
" text-shadow: 0 0 2mm red}</style></head>"
"<body><h1>Goodbye, world!</h1></body></html>\r\n";
So they are sending a header telling client the server is HTML 1.1 and will have persistent connections.
The alternative is to send a 1.0 header with the keep-alive tag
Then you simply don't close the connection until it times out. It's designed as a start point you need to
flesh out the rest from there.
In vino veritas
modified 17-Oct-18 10:16am.
|
|
|
|
|
My app is C++ based (no .net) and I need to know where on earth my app is started. This is in order to access a website (e.g. www.xyz.cn/info for china; www.xyz.com/info for the rest) with the correct region.
I've tried with ILocation Com interface but it tells me that there are 'no devices detected'.
Any thaughts?
|
|
|
|
|
jung-kreidler wrote: 've tried with ILocation Com interface but it tells me that there are 'no devices detected'.
What method of ILocation gives you this error?
|
|
|
|
|
spLocation->GetReportStatus(IID_ILatLongReport, &status) returns REPORT_NOT_SUPPORTED.
The code is from one of the Microsoft samples.
|
|
|
|
|
Well, from MSDN:
Quote: REPORT_NOT_SUPPORTED
The requested report type is not supported by the API. No location providers of the requested type are installed.
Does the PC have any means to locate GPS posituion?
|
|
|
|
|
No, this is a normal PC without GPS.
I just need the country where my app was started in order to access the right webaddress provided for the country.
|
|
|
|
|
Then you need some device or some tool giving you current PC geo-coordinates....
|
|
|
|
|
As I do only need the country where my app was started the following code does the job:
std::string get_country_code()
{
HINTERNET net = InternetOpen("IP retriever",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
0);
HINTERNET conn = InternetOpenUrl(net,
"http://ip-api.com/csv/?fields=countryCode",
NULL,
0,
INTERNET_FLAG_RELOAD,
0);
char buffer[12096];
DWORD read;
InternetReadFile(conn, buffer, sizeof(buffer) / sizeof(buffer[0]), &read);
InternetCloseHandle(net);
return std::string(buffer, read);
}
|
|
|
|
|
G lad you have solved your problem!
|
|
|
|
|
Hi
Below code does some memory corruption due to which access violation happens at sub subsequent steps
If I remove this block of code every thing is working fine. Unable to figure out the issue in the below code. Please help
while ((int)tax % 10 != 0)
{
tax *= 10;
decimals++;
}
decimalpoints = decimals-1
|
|
|
|
|
There is nothing in that code that will cause memory corruption, unless decimals and decimalpoints are pointers to a block of memory and go beyond its limit. You need to show some more of your code.
|
|
|
|
|
Both are not pointers. one issue I found with this is the loop iterates for 19 times for the value of tax = 8.995.
by end of the loop decimal = 19.
I except decimal = 3 by end of the loop
|
|
|
|
|