background preloader

Programming

Facebook Twitter

A Guide to Python's Magic Methods « rafekettler.com. Rafe Kettler Copyright © 2012 Rafe Kettler Version 1.17.

A Guide to Python's Magic Methods « rafekettler.com

CheckIO. Sofia found Stephen working in the garden.

CheckIO

"Stephen! " she shouted. Programming miscellany. ↓ Skip to Main Content Programming miscellany Home › Software development › Programming miscellany Programming miscellany.

Programming miscellany

Python Special Edition 1. 97 Things Every Software Architect Should Know - The Book - Softarch 97Things. Boîte de réception (1 454) - zabouzamomochi - Gmail. Flex SDK / Wiki / Coding Conventions.

Read later

Gamedev. Shortcuts. Videos. Articles. Editors. Javascript. Coder interview. Mac Tips and Tricks. Algorithms. C/C++ Webdev. Friday Q&A 2012-08-24: Things You Never Wanted To Know About C. Friday Q&A 2012-08-24: Things You Never Wanted To Know About C It's been a bit since I did an article, but I'm back again, with a somewhat off-the-cuff treatment of a very twisted set of code I use to pretend that C has exceptions.

Friday Q&A 2012-08-24: Things You Never Wanted To Know About C

I delve into little-known extensions of C, Linux compatibility, and worst of all, goto, so be warned! Error handling in CC, being something of a bare-metal language by today's standards, lacks any advanced facilities for managing control flow when errors happen. Most platforms have found their own ways of coping with the situation, some with language features, some with framework conventions, and others by not coping at all. ExceptionsThe best known, and also perhaps most debated, means of handling control flow for error conditions is exceptions. Fortunately, Apple realized how ridiculous this tends to look in Cocoa and deprecated exceptions for error handling, instead opting for the NSError model. The birth of LISP – a summary of John McCarthy’s original paper. A programming system called LISP (for LISt Processor) has been developed for the IBM 704 computer by the Artificial Intelligence group at M.I.T.

The birth of LISP – a summary of John McCarthy’s original paper

8 Linux Commands Every Developer Should Know. Every developer, at some point in their career, will find themselves looking for some information on a Linux* box.

8 Linux Commands Every Developer Should Know

I don't claim to be an expert, in fact, I claim to be very under-skilled when it comes to linux command line mastery. However, with the following 8 commands I can get pretty much anything I need, done. note: There are extensive documents on each of the following commands. This blog post is not meant to show the exhaustive features of any of the commands. How RESTful is Your API? It’s been over a decade since Roy Fielding wrote his seminal dissertation on Representation State Transfer (REST).

How RESTful is Your API?

Over this period we’ve seen SOAP/WSDL fall out of favor as the cool kids transition their services over to the REST paradigm. Or so it seems on the surface. In reality, we’ve spent the last 10 years building various ad-hoc services over HTTP that borrow bits and pieces from the grand vision that Roy outlined. We’ve settled into a rhythm that, depending on your outlook, is either a naive implementation or an enlightened massaging of the initial approach. Is the glass half empty, or half full? Shit.programmers.write(); Keeping JS Sane. I gave a talk at #DDD10 this Saturday about keeping JS sane, I had some questions after about the list of things I ran through so documented in all its glory are my current thoughts on development with a dynamic language like JS.

Keeping JS Sane

Javascript sucks and it doesn’t matter Yes, you can add arrays to numbers to strings to whatever else you like and get bizarre and hilarious results. Yes, you can write code with more callbacks than Lara Croft on a dating website – but if you’re doing these things in production code then you deserve what is coming to you – and that’s before I even ask if you have tests which would exercise that code and raise the common errors anyway. Tldr: Most of the craziness in JS won’t ever affect you, and if it does your tests will save you. Use JSHint/JSLint Yeah – there are two of them and yeah you need to pick one. To get and run jshint on your project, the following steps are all you need. Clemens Vasters - Sagas. Today has been a lively day in some parts of the Twitterverse debating the Saga pattern.

Clemens Vasters - Sagas

As it stands, there are a few frameworks for .NET out there that use the term "Saga" for some framework implementation of a state machine or workflow. Trouble is, that's not what a Saga is. A Saga is a failure management pattern. Sagas come out of the realization that particularly long-lived transactions (originally even just inside databases), but also far distributed transactions across location and/or trust boundaries can't eaily be handled using the classic ACID model with 2-Phase commit and holding locks for the duration of the work. Instead, a Saga splits work into individual transactions whose effects can be, somehow, reversed after work has been performed and commited. The picture shows a simple Saga. The activities are grouped in a composite job (routing slip) that's handed along the activity chain. From IoC to require. Why should I have written ZeroMQ in C, not C++ (part II) - 250bpm. In my previous blog post I've discussed how the need for rigorous error handling in low-level infrastructure software prevents the usage of many fundamental C++ features (exceptions, constructors, destructors).

Why should I have written ZeroMQ in C, not C++ (part II) - 250bpm

The conclusion was that with such a severely limited feature set, writing the program in C yields shorter and more readable codebase. A side effect is eliminating the dependency on C++ runtime library, which shouldn't be easily dismissed, especially in embedded environments. In this blog post I would like to explore the problem from a different point of view. Namely: Are there any performance implications in using C++ vs.

So-so – Lubutu. C Static Variables and Static Functions Explained with Examples. In C language, the life time and scope of a variable is defined by its storage class. The following are four types of storage class available in C language. autoregisterexternstatic In this article, we will discuss the ‘static’ storage class and explain how to use static variables and static functions in C with some sample code snippets. Before moving ahead, lets quickly understand the difference between life time and scope of a variable. C Linked List Data Structure Explained with an Example C Program. Linked list is one of the fundamental data structures in C.

Knowledge of linked lists is must for C programmers. This article explains the fundamentals of C linked list with an example C program. Linked list is a dynamic data structure whose length can be increased or decreased at run time. How Linked lists are different from arrays? Consider the following points : Journey of a Data Packet in the Internet.

While majority of the end-users doesn’t care how Internet works, some of you might be curious to understand the basics of how Internet works. In this article we will try to peel off the first layer on this topic to understand how Internet works by elaborating the journey of a data packet from its source to destination on the Internet. From this perspective, we’ll try to keep the content of this article fairly basic. Before going further, lets first quickly and briefly understand the concepts of DHCP and DNS. 12 Interesting C Interview Questions and Answers. In this article, we will discuss some interesting problems on C language that can help students to brush up their C programming skills and help them prepare their C fundamentals for interviews. 1. gets() function Question: There is a hidden problem with the following code.

Can you detect it? #include<stdio.h> int main(void) { char buff[10]; memset(buff,0,sizeof(buff)); gets(buff); printf("\n The buffer entered is [%s]\n",buff); return 0; } Answer: The hidden problem with the code above is the use of the function gets(). 2. strcpy() function Question: Following is the code for very basic password protection. #include<stdio.h> int main(int argc, char *argv[]) { int flag = 0; char passwd[10]; memset(passwd,0,sizeof(passwd)); strcpy(passwd, argv[1]); if(0 == strcmp("LinuxGeek", passwd)) { flag = 1; } if(flag) { printf("\n Password cracked \n"); } else { printf("\n Incorrect passwd \n"); } return 0; }