Updates RSS

Recommended books and sites

Share buttons

Fixed a typo.

Calculating day of week and Easter date

A branchless code for calculating day of week, Easter date, and Jewish holidays.

Using DAWG for predictive text input

Added GitHub links.

Suffix array for full-text search

A reader asked by email if it's effective to store a full-text search index in a DAWG and how does it compare with using a trie. DAWG is useful when you need a fuzzy search, e.g. for ignoring possible typos or spelling correction. If you don't need this, you can use a simpler data structure called suffix array.

Comments RSS

Peter Kankowski:

Vengir, it returns plural2 for 21, 31, 41, etc. For Russian, modulo = 10 is specified for singular, hence the difference.


The way I understand the Polish algorithm, it returns singular for numbers 21, 31, 41, etc. To be correct, it should have returned plural2. It's a little bit different than Russian.


Beautiful ! Thanx Peter 32bit implementation was exactly what i were looking for .. Works better than native VC12


Hi Peter, I am new to x86 and am working on doing Butcher's Algorithm if you could show me how to run the Easter program I would be super appreciative!


Hi peter I am new to the x86 and was wondering If you could give me some advice on how to calculate and run butchers algorithm for easter for the next 10 years?


Discussion: the first language *

Which programming language to learn first?

Recommended books and sites *

The minimal reading list to become a good programmer.

New links: 2011

Important news, interesting finds.

Thoughts on Windows Phone 7

Why there are no serious WP7 apps.


Hash functions: An empirical comparison *

Benchmark program for hash tables and comparison of 15 popular hash functions.

Plural forms

Spelling messages like "1 file found" or "5 files found" correctly in any language.

Two-stage tables for storing Unicode character properties

A data structure for storing the properties of Unicode characters.

Using ternary DAGs for spelling correction

A ternary structure for storing dictionaries is proposed. The structure is based on ternary search trie that is "compressed" into a DAG by linking together equal subtrees. By using it, you can eliminate affix stripping and implement a faster spelling corrector.

Searching for duplicate files

Designing an effective algorithm for finding identical files.

Natural order sorting

How to sort filenames like Picture17.png.

Using DAWG for predictive text input

How to find words by their prefix, which can be mistyped, and sort them by frequency stored with the word.

Suffix array for full-text search

A simple data structure for indexing text files.

Calculating day of week and Easter date

A branchless code for calculating day of week, Easter date, and Jewish holidays.

Assembly language and machine code

Win32 Assembly Cheat Sheet

One-page reference for Win32 assembly language programming.

x86 Machine Code Statistics *

Which instructions and addressing modes are used most often. What is the average instruction length.

Redundancy of x86 Machine Code

One assembly language instruction can be encoded differently in machine code. Possible applications are steganography and compiler identification.


PHP database library

Designing a database interface for web programming.

Metaprogramming with aggressive inlining

Inlined and optimized functions can be used as macros.

Software interface design tips *

How to design easy-to-use interfaces between modules of your program.

Interpreters and compilers

Introduction: Writing a simple expression evaluator

Code generator

Reverse Polish Notation and Expression Compiler

Adding variables to expression evaluator

Four-part series about creating an expressing evaluator.

Python critique

You should choose between Python 2 and 3, find a good book, and keep in mind the diverse data types.

The future of compilers

How programming languages may look in future.

Win32 programming

Self-extracting executables

Techniques for creating SFX archives and interpreters.

Enabling additional compiler warnings

How to catch more bugs with MSVC++.

Detecting access to freed memory

Improving MSVC++ free function.

Debugging buffer overflows

A technique for debugging complex parsers.

Corrections to Raymond Chen's wheel scrolling code

For one rotation of the wheel, never scroll the window by more than one page.

Dark corners in Microsoft's documentation

Hexadecimal locale IDs, saving user data on shutdown, and other bugs.

The perils of alloca function

alloca is useful for small arrays or strings, but can be dangerous if the array is larger than you expected.

Low-level code optimization

What your compiler can do for you

You should not obfuscate you code with low-level optimizations: your compiler can do them for you.

Performance measurements with RDTSC

A method for measuring performance with RDTSC instruction.

Optimized abs function

Branchless abs function for x86 processors.

Calculating standard deviation in one pass

An example of using algebraic transformations for code optimization.

Fast strlen function

Unrolling the loop in strlen function.

Using sentinel for string manipulation

A method for optimizing search functions.

Checking if the point belongs to an interval

How to replace two comparisons with one.

Implementing strcmp, strlen, and strstr using SSE 4.2 instructions *

Using new Intel Core i7 instructions to speed up string manipulation.

SSE2 optimised strlen

Optimising strlen function using SSE2 SIMD instructions.

Table-driven approach *

How to make you code shorter and easier to maintain by using arrays.

Benchmarking CRC32 and PopCnt instructions

Exploring new instructions in Core i7/i5.

Dynamic arrays in C

A new formula for linearly growing arrays.

Web programming

JavaScript as the Next Big Language

Predictions and reality.


New features and showcase examples.

Share buttons

Create a widget for sharing your content on social networks.

Responsive web design with CSS3

How to scale down your website for mobile devices.