GCC C++ “Hello World” program -> .exe is 500kb big when compiled on Windows. How can I reduce its size?

The problem here is not so much with the library as it is with the way the library is linked. Granted, iostream is a moderately huge library but I don’t think it can be so huge as to cause a program to generate an executable that is 900KB larger than a similar one that uses … Read more

Determining the size of a JPEG (JFIF) image

The compressed data will not include SOI or EOI bytes, so you are safe there. But the comment, application data, or other headers might. Fortunately, you can identify and skip these sections as the length is given. The JPEG specification tells you what you need: http://www.w3.org/Graphics/JPEG/itu-t81.pdf Look at Table B.1, on page 32. The symbols … Read more

Node.js: how to limit the HTTP request size and upload file size?

Just an update (07-2014), as I’m not able to add comments: As correctly noted above, newer Express versions have deprecated the use of the limit middleware and now provide it as a built-in option for the BodyParser middleware: var express = require(‘express’) var bodyParser = require(‘body-parser’) var app = express() app.use(bodyParser.json({ limit: ‘5mb’ }))

Size of empty UDP and TCP packet?

TCP: Size of Ethernet frame – 24 Bytes Size of IPv4 Header (without any options) – 20 bytes Size of TCP Header (without any options) – 20 Bytes Total size of an Ethernet Frame carrying an IP Packet with an empty TCP Segment – 24 + 20 + 20 = 64 bytes UDP: Size of … Read more

How can I set size of a button?

The following bit of code does what you ask for. Just make sure that you assign enough space so that the text on the button becomes visible JFrame frame = new JFrame(“test”); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPanel panel = new JPanel(new GridLayout(4,4,4,4)); for(int i=0 ; i<16 ; i++){ JButton btn = new JButton(String.valueOf(i)); btn.setPreferredSize(new Dimension(40, 40)); panel.add(btn); } … Read more