Why don’t include guards make a circular #include work?

The preprocessor is a program that takes your program, makes some changes (for example include files (#include), macro expansion (#define), and basically everything that starts with #) and gives the “clean” result to the compiler. The preprocessor works like this when it sees #include: When you write: #include “some_file” The contents of some_file almost literally … Read more

How do I add a header to urllib2 opener?

You can add the headers directly to the OpenerDirector object returned by build_opener. From the last example in the urllib2 docs: OpenerDirector automatically adds a User-Agent header to every Request. To change this: import urllib2 opener = urllib2.build_opener() opener.addheaders = [(‘User-agent’, ‘Mozilla/5.0’)] opener.open(‘http://www.example.com/’) Also, remember that a few standard headers (Content-Length, Content-Type and Host) are … Read more

Set TabPage Header Color

If you want to color the tabs, try the following code: this.tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed; this.tabControl1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.tabControl1_DrawItem); private Dictionary<TabPage, Color> TabColors = new Dictionary<TabPage, Color>(); private void SetTabHeader(TabPage page, Color color) { TabColors[page] = color; tabControl1.Invalidate(); } private void tabControl1_DrawItem(object sender, DrawItemEventArgs e) { //e.DrawBackground(); using (Brush br = new SolidBrush (TabColors[tabControl1.TabPages[e.Index]])) { e.Graphics.FillRectangle(br, … Read more

Best place to addHeaderView in ListFragment

I don’t know if you have solved your problem but here is a solution that worked for me: Do not call ListFragment.setListAdapter() in your ListFragment.onCreate(). Make sure you have a field variable that can hold the header view, maybe like: View mheaderView; Then in your ListFragment.onCreateView(), inflate the header View and assign it to your … Read more

Calling a function from another file in the same directory in C

There’s a few different things going on here. First I’ll go over how basic compilation of multiple files works. If you have multiple files, the important thing is the difference between the declaration and definition of a function. The definition is probably what you are used to when defining functions: You write up the contents … Read more

Ruby https POST with headers

The problem it was a json. This solve my problem. Anyway, my question was not clear, so the bounty goes to Juri require ‘uri’ require ‘net/http’ require ‘net/https’ require ‘json’ @toSend = { “date” => “2012-07-02”, “aaaa” => “bbbbb”, “cccc” => “dddd” }.to_json uri = URI.parse(“https:/…”) https = Net::HTTP.new(uri.host,uri.port) https.use_ssl = true req = Net::HTTP::Post.new(uri.path, … Read more

How to install the Python development headers on Mac OS X?

The latest Python 3 formula links a program called python3-config. You can use it to find the headers like this: python3-config –include On my machine, this outputs: -I/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/include/python3.3m -I/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/include/python3.3m You may need to brew update && brew rm python3 && brew install python3 to enable this. There is an equivalent program called python-config for Python … Read more

Clean up your #include statements?

To verify that header files are including everything they need, I would creating a source file that all it does is include a header file and try to compile it. If the compile fails, then the header file itself is missing an include. You get the same effect by making the following rule: that the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)