background preloader

Fundamentals

Facebook Twitter

Paradigms

Problems. Tools. Languages. Compilers. Algorithms. Abstract data types and data structures. Numbers Every Programmer Should Know By Year. Big-O Algorithm Complexity Cheat Sheet. Programming Sucks. Users.ece.utexas.edu/~adnan/pike.html. Rob Pike's 5 Rules of Programming Rule 1.

users.ece.utexas.edu/~adnan/pike.html

You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is. Rule 2. Measure. AntiPattern. Bad things · writing tags: Andrew Koenig first coined the term "antipattern" in an article in JOOP[1], which is sadly not available on the internet.

AntiPattern

The essential idea (as I remember it [2]) was that an antipattern was something that seems like a good idea when you begin, but leads you into trouble. Since then the term has often been used just to indicate any bad idea, but I think the original focus is more useful. From Switch Statement Down to Machine Code - Ranting @ 741 MHz. Introduction Most of us know what a switch statement is and have probably been using it very often.

From Switch Statement Down to Machine Code - Ranting @ 741 MHz

No wonder why — switch statement is simple yet extremely expressive. It allows keeping the code compact while describing complex control flow. Putting the syntactic sugar aside, most developers also believe that using a switch statement results in a lot better, faster code. The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) By Joel Spolsky Wednesday, October 08, 2003 Ever wonder about that mysterious Content-Type tag?

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

Regex Golf. WorldWideWeb: Proposal for a HyperText Project. Daily Builds Are Your Friend. By Joel Spolsky Saturday, January 27, 2001 In 1982, my family took delivery of the very first IBM-PC in Israel.

Daily Builds Are Your Friend

We actually went down to the warehouse and waited while our PC was delivered from the port. Somehow, I convinced my dad to get the fully-decked out version, with two floppy disks, 128 K memory, and both a dot-matrix printer (for fast drafts) and a Brother Letter-Quality Daisy Wheel printer, which sounds exactly like a machine gun when it is operating, only louder. I think we got almost every accessory available: PC-DOS 1.0, the $75 technical reference manual with a complete source code listing of the BIOS, Macro Assembler, and the stunning IBM Monochrome display with a full 80 columns and ... lower case letters!

Numbers Everyone Should Know. Google AppEngine Numbers This group of numbers is from Brett Slatkin in Building Scalable Web Apps with Google App Engine.

Numbers Everyone Should Know

Writes are expensive! Datastore is transactional: writes require disk accessDisk access means disk seeksRule of thumb: 10ms for a disk seekSimple math: 1s / 10ms = 100 seeks/sec maximumDepends on:* The size and shape of your data* Doing work in batches (batch puts and gets)Reads are cheap! Reads do not need to be transactional, just consistentData is read from disk once, then it's easily cachedAll subsequent reads come straight from memoryRule of thumb: 250usec for 1MB of data from memorySimple math: 1s / 250usec = 4GB/sec maximum* For a 1MB entity, that's 4000 fetches/secNumbers Miscellaneous This group of numbers is from a presentation Jeff Dean gave at a Engineering All-Hands Meeting at Google.

Paging Through Comments. How Non-Member Functions Improve Encapsulation. I'll start with the punchline: If you're writing a function that can be implemented as either a member or as a non-friend non-member, you should prefer to implement it as a non-member function. You aren't gonna need it. "You aren't gonna need it"[1][2] (acronym: YAGNI)[3] is a principle of extreme programming (XP) that states a programmer should not add functionality until deemed necessary.[4] Ron Jeffries writes, "Always implement things when you actually need them, never when you just foresee that you need them.

You aren't gonna need it

"[5] The phrase also appears altered as, "You aren't going to need it"[6][7] or sometimes phrased as, "You ain't gonna need it". YAGNI is a principle behind the XP practice of "do the simplest thing that could possibly work" (DTSTTCPW).[2][3] It is meant to be used in combination with several other practices, such as continuous refactoring, continuous automated unit testing and continuous integration.

Used without continuous refactoring, it could lead to messy code and massive rework. Continuous refactoring in turn relies on automated unit tests and/or static analysis tools as a safety net and continuous integration to prevent wider integration problems. Rationale[edit] See also[edit] Always Multiply Your Estimates by π. Project estimation is a black art, nowhere more so than in game development.

Always Multiply Your Estimates by π

I once heard of a mysterious cabal of numerologists that multiplied their time estimates by π. The practice allegedly gave them sufficient buffer for new requirements, testing, iteration, and other arcane changes in scope. This struck me as curious and arbitrary, but I was intrigued. Bret Victor, beast of burden. Feedback mechanisms and tradeoffs. Rapid feedback is one of the cornerstones of agile development.

Feedback mechanisms and tradeoffs

The faster we can get feedback, the less it costs to correct errors. Unit testing is one of the ways to get feedback, but not the only one. Design Smell: Temporal Coupling. This post is the first in a series about Poka-yoke Design - also known as encapsulation.

Design Smell: Temporal Coupling

A common problem in API design is temporal coupling, which occurs when there's an implicit relationship between two, or more, members of a class requiring clients to invoke one member before the other. This tightly couples the members in the temporal dimension. The archetypical example is the use of an Initialize method, although copious other examples can be found - even in the BCL. As an example, this usage of EndpointAddressBuilder compiles, but fails at run-time: var b = new EndpointAddressBuilder(); var e = b.ToEndpointAddress(); Html - RegEx match open tags except XHTML self-contained tags. Web application - when to escape user input. EDIT: Luc has pointed out in the concept that I'm unduly slanted towards high-performance solutions.

If, in your situation, performance isn't a concern, then it's perfectly acceptable (and preferable, in fact) to store the original data alone and transform it on output. This gives you flexibility to use the data however you need you without maintaining versions. Original answer below ------------------------------------------------------ HTML Codes - Table of ascii characters and symbols. The First Few Milliseconds of an HTTPS Connection.

Convinced from spending hours reading rave reviews, Bob eagerly clicked “Proceed to Checkout” for his gallon of Tuscan Whole Milk and… Whoa! What just happened? In the 220 milliseconds that flew by, a lot of interesting stuff happened to make Firefox change the address bar color and put a lock in the lower right corner. With the help of Wireshark, my favorite network tool, and a slightly modified debug build of Firefox, we can see exactly what’s going on. By agreement of RFC 2818, Firefox knew that “https” meant it should connect to port 443 at Amazon.com: Most people associate HTTPS with SSL (Secure Sockets Layer) which was created by Netscape in the mid 90’s.

Client Hello TLS wraps all traffic in “records” of different types. The next two bytes are 0x0301 which indicate that this is a version 3.1 record which shows that TLS 1.0 is essentially SSL 3.1. The handshake record is broken out into several messages. Server Hello Checking out the Certificate Why should we trust this certificate?