Articles summary - what every programmer should know about.
CPU and memory
Ulrich Drepper - What Every Programmer Should Know About Memory
Take away:
Memory architecture is very complex: caches of different size on speed, several cores which could share data. Locality of memory access in time and space lead to serious benefit in execution time.
What Every Programmer Should Know About SEO.
kate{mats} - What Every Programmer Should Know About SEO
Take away:
- Use alt for pictures, use actual keywords, emphasize titles with H-tags;
- Use standard urls, make sure content is crawable;
- Don’t put too many links on page to not be classified as spam;
- Update content often. Websearch will notice that your site is changing and will apply shorter periods to recrawl;
10 Things Every Java Programmer Should Know about String.
10 Things Every Java Programmer Should Know about String
Take away:
- String backed by char[], they are immutable and final;
- JVM caches them in String pool -> don’t keep sensitive data in strings;
- String can have different encoding. If you don’t know encoding, you can’t interpret String correctly;
- SubString creates new instance in last versions of java (to avoid memory leaks). This could make additional pressure on gc;
- Split uses regexes, therefore it is slow.
What should every programmer know about security.
stackoverflow - What should every programmer know about security?
Take away:
- Don’t trust any input, use whitelists instead of blacklists;
- Decrease complexity;
- Adhere principle of last privilege;
- Use well-tested frameworks/libraries instead of own code.
What every web developer must know about URL encoding.
Stéphane Épardaud - What every web developer must know about URL encoding
Take away:
- Reserved characters are different for each segment of URL;
- Use pynny-code encoding for hostnames and percent-encoding for the rest;
- analyze url before decoding, since after reserved characters appears and segment borders may change;
- Original -> Decode -> Encode -> Reencoded. Reencoded may differ from Original with same reason. Decoded URL may be valid without encoding;
- Java URLEncoder/URLDecoder can’t be used for whole URL: they are for HTML form encoding. Best suits query part;
- Construct URL from properly encoded parts;
- If you need path segments - be sure you do use unencoded path;
Every Computer Scientist Should Know About Floating-Point Arithmetic.
Goldberg - What Every Computer Scientist Should Know About Floating-Point Arithmetic
Take away:
- Floating-point number consist from base and precision. 0.1 (base=10, pr=3) = 1.00 * 10^(-1); 0.1 (base=2, pr=24) =[approx]> 1.10011001100110011001101 * 2^(-4);
- Floating-point repr. could be not unique;
- IEEE 754 assume base=2, pr=24 (single precision) and pr=53 (double precision);
- IEEE 854 assume base=(2 OR 10), pr=24 (single precision) and pr=53 (double precision);
- In IEEE std. zero could have sign;
What every programmer needs to know about game networking.
What every programmer needs to know about game networking
Take away:
- First approach was peer-to-peer connections, when local machine receives commands of all players; Bad things: not synchronized movements on all machines, only for LAN;
- Secondly client-server scheme was used, it was better in latency but still not responcive enough;
- Then Carmack in Quake allowed local machine to predict movements of other player till it receives real actions.
What technical details should a programmer of a web application consider before making the site public.
Take away:
- Test across different browsers and mobile;
- Plan how to deploy updates, setup good logging, automate backups;
- Redirect after POST to prevent refresh cycle;
- Use caching, optimal image size, gzip/deflate;
Time.
Take away:
- UTC=GMT = Greenwich time. Other timezones have offset from UTC;
- epoch its seconds from UTC beginning of 1970;
- Timezones is a presentation problem. Better to use UTC in software.
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets.
- Unicode is a set of code points. Each letter has own code point, but Unicode don’t say anything about physical way to keep letter in memory;
- Encoding determine that. First encodings used 2 bytes for each code point, but they may keep bytes in direct or reverted order to make processing faster;
- Most of letters in English use 1 byte, therefore UTF-8 was invented to save space. 1 byte for code points 0-127 and up to 6 bytes for upper code points.