Questions tagged [header]

This tag is deprecated because it lacks discriminating power. Please use a more specific tag instead, e.g.: html-heading, email-header etc.

This tag is deprecated because it lacks discriminating power. Please use a more specific tag instead, e.g.: , etc.

12624 questions
190
votes
4 answers

Creating your own header file in C

Can anyone explain how to create a header file in C with a simple example from beginning to end.
Anuragdeb3
  • 1,939
  • 3
  • 12
  • 4
180
votes
10 answers

Tool to track #include dependencies

Any good suggestions? Input will be the name of a header file and output should be a list (preferably a tree) of all files including it directly or indirectly.
Agnel Kurian
  • 53,593
  • 39
  • 135
  • 210
171
votes
8 answers

jQuery and AJAX response header

So I've got this jQuery AJAX call, and the response comes from the server in the form of a 302 redirect. I'd like to take this redirect and load it in an iframe, but when I try to view the header info with a javascript alert, it comes up null, even…
Shane
  • 1,711
  • 2
  • 11
  • 3
159
votes
4 answers

Javascript : Send JSON Object with Ajax?

Is this possible? xmlHttp.send({ "test" : "1", "test2" : "2", }); Maybe with: a header with content type : application/json?: xmlHttp.setRequestHeader('Content-Type', 'application/json') Otherwise I can…
Adam Halasz
  • 51,803
  • 63
  • 138
  • 208
152
votes
11 answers

PHP page redirect

Can PHP make a redirect call after executing a function? I am creating a function on the completion of which I want it to redirect to a file located in the same root folder. Can it be done? if (...) { // I am using echo here. } else if…
amit
  • 9,215
  • 22
  • 66
  • 117
148
votes
16 answers

C++ Redefinition Header Files (winsock2.h)

How do I prevent from including header files twice? The problem is I'm including the in MyClass.h and then I'm including MyClass.h in many files, so it includes multiple times and redefinition error occurs. How to prevent? I'm using #pragma once…
akif
  • 10,753
  • 21
  • 69
  • 83
146
votes
10 answers

Adding header to all request with Retrofit 2

Retrofit 2's documentation says: Headers that need to be added to every request can be specified using an OkHttp interceptor. It can be done easily using the previous version, here's the related QA. But using retrofit 2, I couldn't find something…
Ashkan Sarlak
  • 6,071
  • 6
  • 32
  • 44
141
votes
10 answers

How can I make sticky headers in RecyclerView? (Without external lib)

I want to fix my header views in the top of the screen like in the image below and without using external libraries. In my case, I don't want to do it alphabetically. I have two different types of views (Header and normal). I only want to fix to…
Jaume Colom
  • 1,471
  • 3
  • 8
  • 5
140
votes
16 answers

Why won't my PHP app send a 404 error?

if (strstr($_SERVER['REQUEST_URI'],'index.php')) { header('HTTP/1.0 404 Not Found'); } Why wont this work? I get a blank page.
Yrrol
135
votes
12 answers

Cannot set some HTTP headers when using System.Net.WebRequest

When I try to add a HTTP header key/value pair on a WebRequest object, I get the following exception: This header must be modified using the appropriate property I've tried adding new values to the Headers collection by using the Add() method but…
Razor
  • 16,811
  • 22
  • 87
  • 137
125
votes
4 answers

Custom HTTP Authorization Header

I was wondering if it's acceptable to put custom data in an HTTP authorization header. We're designing a RESTful API and we may need a way to specify a custom method of authorization. As an example, let's call it FIRE-TOKEN authentication. Would…
NRaf
  • 6,759
  • 10
  • 47
  • 83
125
votes
3 answers

How to declare a structure in a header that is to be used by multiple files in c?

If I have a source.c file with a struct: struct a { int i; struct b { int j; } }; How can this struct be used in another file (i.e. func.c)? Should I create a new header file, declare the struct there and include that header in…
Manoj
122
votes
5 answers

Android ListView headers

I have ListView that has some kind of events on it. Events are sorted by day, and I would like to have header with date on it for every day, and then events listen below. Here is how I populate that list: ArrayList crs = new…
Rohit Malish
  • 3,141
  • 12
  • 44
  • 66
116
votes
5 answers

Should struct definitions go in .h or .c file?

I've seen both full definitions of structs in headers and just declarations—is there any advantage to one method over the other? If it makes a difference, I usually typedef a struct like so in the .h typedef struct s s_t; To be clear, the options…
Aaron Yodaiken
  • 17,660
  • 30
  • 95
  • 176
115
votes
5 answers

Node.js: How to send headers with form data using request module?

I have code like the following: var req = require('request'); req.post('someUrl', { form: { username: 'user', password: '', opaque: 'someValue', logintype: '1'}, }, function (e, r, body) { console.log(body); }); How can I set headers…
Mike G.
  • 3,512
  • 3
  • 14
  • 16