Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Define



  C Preprocessor Hell

Lisp programmers should stop reading right now because they'll likely suffer severe injury of the jaw muscles as they laugh themselves silly at how hard it is to do some things in C. The C language has a pre-processor (typically called cpp) that is both infuriating and powerful. How powerful is usually best described as 'just too little' and it has happened more than once that I found myself almost - but not quite - able to do what I wanted to do. The frustration can run very deep at ti...

   C,Preprocessor,Lisp,Hell     2012-01-19 10:22:31

  do {...} while (0) in macros

If you are a C programmer, you must be familiar with macros. They are powerful and can help you ease your work if used correctly. However, if you don't define macros carefully, they may bite you and drive you crazy. In many C programs, you may see a special macro definition which may seem not so straightforward. Here is one example: #define __set_task_state(tsk, state_value) \ do { (tsk)->state = (state_value); } while (0) There are many this kind of macros which uses do{...}while(0)...

   C,macro,C++     2014-01-23 07:16:13

  Do you really understand C? 21st International Obfuscated C Code Contest winning entries

The 21st International Obfuscated C Code Contest(IOCCC) officially launched the winning source code. IOCCC requires contestants to write the most creative and the most obfuscated C codes with the size limited to 4kb and less Work of each participant is impressive. The winners, including one French, one Korean, five Americans, one Belgian, one Israeli, one British, four Japanese and one Chinese. Here we list some codes: Best short program Seonghoon Kang  from Korea- Decodes spelled out ...

   C,Obsfucation contest     2012-10-25 12:26:55

  How to write your own DSL in Ruby

DSL(Domain Specific Language) is a language defined to fulfill some domain specific requirements to ease people's work. It can be used to define attributes and actions of a domain easily and cleanly. And it is often created based on some common observations or micro patterns of some domain. In Ruby world, there are quite a few places people can find DSL. For example, Ruby itself, Chef recipes. To create a class in Ruby, the traditional OOP way would look like. class User @name = nil @email =...

   RUBY,DSL,TUTORIAL     2017-03-04 09:40:34

  Introduction to GoLang generics and advanced usage

Generics in Go allow you to write code that can work with multiple types of data, without having to write separate versions of the code for each type. This can make your code more flexible and easier to maintain, as you only need to write and test the code once, rather than maintaining multiple versions. To use generics in Go, you first need to define a type parameter, which is a placeholder for the type that the code will work with. For example, you might define a type parameter called "T" like...

   GOLANG,GENERICS     2022-12-17 05:12:21

  PHP to get access token for Twitter app

Previously we wrote an article about getting access token for Facebook app--PHP to get access token for Facebook app. Today we will introduce how to get access token for Twitter app using PHP. Since now Twitter is also using OAuth 2.0 to allow some web apps to access some users information on behalf of one user. They provided some APIs for developers to easily get them integrated with their own websites. The first step to get all these done is how to get the access token, the access token seems ...

   Twitter,OAuth,access token,PHP     2013-03-03 03:49:26

  SQLite C/C++ function interfaces

Some simple introduction to the SQLite function interfaces. First let's check some error codes defined in SQLite3 (They are in SQLite3.h file in the SQLite installation).#define SQLITE_OK           0   /* Successful result */  /* beginning-of-error-codes */  #define SQLITE_ERROR        1   /* SQL error or missing database */  #define SQLITE_INTERNAL     2&nb...

   SQLite,Function interface,C/C++     2012-07-04 12:23:43

  Java API vs Framework

What is the difference between a Java Library and a framework? The two concepts are essentially important for a Java developer. The most important difference between a library and a framework is Inversion of Control. It means that when you call a library you are in control. But with a framework, the control is inverted: the framework calls you. (This is called the Hollywood Principle: Don’t call Us, We’ll call You.) This is pretty much the definition of a framework. Basicall...

   Difference,API,Framework,Library,Java     2011-12-19 13:40:33

  PHP to get access token for Sina Weibo app

Previously I wrote two articles about getting access token for Facebook and Twitter apps using PHP. Today I will write one more article about getting access token for Sina Weibo app using PHP. OAuth 2.0 is now the authorization mechanism of Sina Weibo API. The API authorization process is similar to the process of Twitter. It has basically two steps: 1. Authorization; 2. Get access token. 1. Create an app. I hope you know how to create an app in Sina Weibo now. If not. You can access this page ...

   PHP,access token,Sina Weibo     2013-05-16 12:07:39

  PHP to get access token for Facebook app

Since Facebook is now using OAuth 2.0 to authenticate apps to access user information. the SDK of Facebook has provided developers some useful functions to get authentication done. For example, in PHP SDK, there are getAccessToken(), getLoginUrl() etc. But unfortunately, for me I cannot use getAccessToken() method to get the user access token, it only returns me the app access token. Finally I gave up this approach to get access token for the time being. I may later retry this approach if I have...

   Faceook,PHP,Access token,signed request     2012-03-27 12:37:46