Simon Willison’s Weblog

Subscribe
Atom feed for c

47 posts tagged “c”

2017

C is a bit like Latin these days. We no longer write everything in it, but knowing it affords deeper knowledge of more-recent languages.

Norman Wilson

# 8th October 2017, 4:03 pm / c

2012

Do people still write and compile programs from the command line, instead of an IDE? Why or why not?

Being an expert with command line tools gives you super powers.

[... 94 words]

2010

Building a GeoIP server with ZeroMQ. ZeroMQ makes it trivially easy to write a network service in raw C that makes functionality from a C library (in this case the MaxMind GeoIP library) available to clients written in many different client languages.

# 9th November 2010, 9:36 am / c, geoip, zeromq, recovered

Mongrel2 is “Self-Hosting”. Zed Shaw’s Mongrel2 is shaping up to be a really interesting project. “A web server simply written in C that loves all languages equally”, the two most interesting new ideas are the ability to handle HTTP, Flash Sockets and WebSockets all on the same port (thanks to an extension to the Mongrel HTTP parser that can identify all three protocols) and the ability to hook Mongrel2 up to the backend servers using either TCP/IP or ZeroMQ. I’m guessing this means Mongrel2 could hold an HTTP request open, fire off some messages and wait for various backends to send messages back to construct the response, making async processing just as easy as a regular blocking request/response cycle.

# 17th June 2010, 8:11 pm / async, c, http, webserver, websockets, zed-shaw, zeromq, recovered, mongrel2

Redis weekly update #3—Pub/Sub and more. Redis is now a publish/subscribe server—and it ended up only taking 150 lines of C code since Redis internals were already based on that paradigm.

# 30th March 2010, 3:15 pm / c, nosql, pubsub, redis

2009

I think that what's particularly hard with C is not the details about pointers, automatic memory management, and so forth, but the fact that C is at the same time so low level and so flexible. So basically if you want to create a large project in C you have to build a number of intermediate layers (otherwise the code will be a complete mess full of bugs and 10 times bigger than required). This continue design exercise of creating additional layers is the hard part about C. You have to get very good at understanding when to write a function or not, when to create a layer of abstraction, and when it's worth to generalize or when it is an overkill.

Salvatore Sanfilippo

# 18th December 2009, 3:50 pm / c, redis, salvatore-sanfilippo

Mac OS X 10.6 Snow Leopard: the Ars Technica review. The essential review: 23 pages of information-dense but readable goodness. Pretty much everything I know about Mac OS X internals I learnt from reading John Siracusa’s reviews—this one is particularly juice when it gets to Grand Central Dispatch and blocks (aka closures) in C and Objective-C.

# 1st September 2009, 7:05 pm / apple, blocks, c, closures, grandcentraldispatch, john-siracusa, macos, objectivec, snowleopard

New Gearman Server & Library in C, MySQL UDFs. Gearman, the job queue written for LiveJournal and now used by Digg and Yahoo!, has been rewritten in C. Looks like a good candidate for an easily configured lightweight message queue. Also includes hooks for writing MySQL functions that can interact with queues.

# 13th January 2009, 4:41 pm / c, digg, eric-day, gearman, livejournal, message-queues, mysql, queues, scaling, yahoo

The compiler only pays attention to the semicolons and braces while ignoring the line breaks and indentation, but humans usually only pay attention to the line breaks and indentation while ignoring the semicolons and braces. This gives the code the opportunity to lie about what it’s really doing. Consequently we need to take extra care when writing in C, Java, C++, C# etc.

Elliotte Rusty Harold

# 2nd January 2009, 10:26 am / c, codestyle, elliotte-rusty-harold, indentation, java, syntax

2008

Running C and Python Code on The Web. Adobe are working on a toolchain to compile C code to target the Tamarin VM in Flash. This will allow existing C code (from CPython to Quake) to execute in a safe sandbox in the browser.

# 4th July 2008, 8:26 am / adobe, browser, c, flash, python, quake, tamarin

2007

Emiller’s Guide To Nginx Module Development. Extremely detailed guide to extending the nginx Web server using C.

# 29th May 2007, 7:38 pm / c, nginx, evan-miller

2005

2005 Underhanded C Contest. Write code that looks innocent but does something evil.

# 5th July 2005, 12:15 pm / c

2004

Ned Batchelder: Showing C header structure. Using Python to maked other languages less painful

# 4th February 2004, 1:19 am / c, ned-batchelder, python

2003

Javascript from Python

In a way I’m disappointed to see python-spidermonkey released. It’s a Python wrapper around the Mozilla project’s SpiderMonkey Javascript engine which allows Python scripts to execute Javascript code in a rock-solid, battle-tested embedded interpreter.

[... 187 words]

Jonathan Caves: Adventures in Visual C (via) Who’d have thought Microsoft would have all the best in-house bloggers?

# 23rd November 2003, 11:59 pm / c, microsoft

More lightweight software: SQLite

The other toy I’ve been playing with recently is SQLite. SQLite is an embeddable SQL database engine written in just under 25,000 lines of (heavily commented) C. Don’t let the size fool you—it’s phenomenally powerful and is released under a no-holds-barred public domain license that practically begs you to include it in your applications, commercial or not.

[... 239 words]

2002

Security and coding style

A couple of good web development security resources:

[... 127 words]