development
Install and test a basic Drupal installation
an Open Mission (something anyone can can do any time) by Agent0x45 Tue, 2008-07-22 17:23 Tags:
Rating for all content, not just comments
a Mission (something one person can do once) by Agent0x45 Tue, 2008-07-22 17:00Groups: Empowerment Drupal Dev
Tags:Ruby on Rails
C++
book posted by Agent0x45 Mon, 2008-03-31 00:05 Tags:See also
C++ in Game Development
Objective-C
C++ (originally known as "C with Classes") is a programming language invented by Bjarne Stroustrup in the late 1970's. It is one of two major variations on the idea of extending the C language with object oriented features. Since its inception, C++ has matured greatly and gained many features, though not at a performance cost. Many design decisions in the language were made that favor performance over ease of use. Here are a few:
- Static Typing:
- All types must be known at compile time. Polymorphism requires the use of a (sometimes dangerous) cast operator, and subclasses must be compatible at a binary level. That is, if B inherits from A, then instances of B must begin with the exact data and structure of A.
- Virtual functions, which can produce similar functionality to dynamic typing, must be declared as virtual in the root parent class, and the function pointers must be stored in a "virtual function table."
- Impure object orientation
- Not all data can be treated as objects. Many "primitive" data don't have a class.
- Classes, functions, most numbers, and many strings are examples of things that don't have a class, and in many cases, cannot be treated as data at all.
- Limited or non-existant reflection.
- No message passing.
- This limits late binding, as the caller must be able to locate the methods it calls.
- "Late binding" in the context of C/C++ usually means that the linker can refer to symbols in files that might not have the same value at run time as they do at link time (such as when a dll gets updated). The exact symbol name must be known, which is problematic due to name mangling by the compiler and linker.
- As a workaround, one can use virtual function, use the same compiler and linker for all binaries involved, and/or use elaborite makefiles.
- Weak typing
- Since the compiler must know all types at compile time, the compiler does not guarantee the safety of type conversion operations that aren't or can't be known at compile time.
- It is perfectly possable to call a function that doesn't exist, or takes different arguments. This usually results in the program crashing.
- Null references are treated as valid references.
All of the above limitations are deliberate design decisions that result in better performance. Many of them can be worked around fairly easily. For example, you can check your own references, use a dispatch model where the built-in inheritance model is inadequate, etc.
High level features of the language are largely things that can be done with the c textual preprocessor. Instead of having different macros for each task, the functionality was built into the language directly. Here are some of the nifties. Note that many are recent additions to the language
- Templates allow functions and even classes to be created to simulate dynamic typing. A template resembles a single function or class in source code, but compiles into several different functions or classes, each of which operates with different types.
- This could be implimented using macros in the c preprocessor, and the syntax is essentially a much cleaner version of the macros that Stroustrup developed and used immediatly before creating "C with Classes"
- The compiler produces highly optimized versions. The optimization is largely geared toward greater speed, the code still comes out significantly smaller than creating each "instance" of a template by hand.
- Virtual functions allow something resembling late binding. Rather than calling a function directly, invoking a virtual function involves finding the function's address in a table at run time.
- Every instance of any class with any virtual functions has a table (generally, but not necessarily as its first instance variable).
- When a virtual function is called, the function is looked up within the table at runtime.
- The compiler optimizes the lookup primarily for speed. This can be dangerous when used in conjunction with a cast operation.
- Contract based exception handeling
- The c++ implimentation of exception handeling supports explicite contracts that allow a high degree of compile-time optimizations.
- Multiple inheritance and clean interfaces
- Traditionally, inheritance in statically typed languages have made multiple inheritance impossable. Specifically a subclass must store its instance members in a structure that is appended to the end of the structure that stores the instance members of its superclass.
- The current implimentations of C++ have worked around that limitation, though at a slight performance penalty.
- Operator overloading
- Virtually any operator in the C language can be made to work with any user-defined data type.
- At design time, the operators map to specially named functions.
- This makes code much more readable.
C++ is a nice compromise language. It has performance very close to a low level language, and a carefully chosen set of high level features that make it much more suitable for large projects than raw C or lower level languages.
C++ is not a strict subset of C. The greatest areas incompatability involve type casting. C++'s weak typing system is considerably stronger than raw C. From Wikipedia:
One commonly encountered difference is that C allows implicit conversion from void* to other pointer types, but C++ does not. So, the following is valid C code:
int *i = malloc(sizeof(int) * 5); /* Implicit conversion from void* to int* */
... but to make it work in both C and C++ one would need to use an explicit cast:
int *i = (int *) malloc(sizeof(int) * 5);
...and in C++-only code, the static cast is recommended:
int *i = static_cast<int*>(malloc(sizeof(int) * 5));
In this common case, for C++-only code the issue can be avoided completely by switching from malloc to new:
int *i = new int[5];
Setup Drupal Galleries Module
a Mission (something one person can do once) by cidviscous Mon, 2007-10-01 05:38 Tags:When clicking on galleries, you get an error that says the OG Galleries have not been set up.
The module for uploading images seems to work fine, but I find the possibility of galleries to be a lot more robust. Like I always say, I'm pretty new to drupal, so if this is harder than it sounds or there's a reason for things being the way they are feel free to tell me to hold my horses of fuck off or whatever. Also, if we are not going to use galleries (at least for the time being) we might think about removing the link to the galleries feature, as it is just useless clutter at the moment.
I cannot tinker with this sort of thing directly as I do not have admin access, but there is a basic rundown of intructions at http://drupal.org/node/157715
-cid
Evolution by Choice
Evolution by Choice. Two simple parts--evolution--growing, surpassing the former, adapting, changing, and choice--decision, action based on a specific intention, deliberate.
Part of the beauty of this meme is it's ability to function across several layers of abstraction. For instance, you could take this idea at the personal level and choose to adapt to some part of your life that has changed, or perhaps that you weren't taking full advantage of.
On the other end of the spectrum you have the entire species and the possibilities for enhancement beginning to look like real possibilities--genetic alterations, cybernetic enhancements.
Not only in the science fiction turning reality front, but the concept can be identified in more subtle roles as well--the steady homogenizing flow of information/education to the general masses. As the gestalt of human society becomes more and more saturated with the combined general knowledge of the species as a whole, people are empowered with the ability to start with knowledge somebody else has already discovered, and thus go further than before, or avoid certain pitfalls, to 'Stand on the shoulders of Giants' as it were.
Does it ever seem like people are smarter than they used to be? Maybe they've just got better mental tools to use.
The point is, we all make choices every day that affect who we are becoming as a person, and what direction our society is going, as a whole. You may not think about it like that, but perhaps you should. Every person has a little bit of power. We've all got our own ideas on what's 'good' or 'bad' or whatever labels you want to apply--things we want versus things we don't want to have happen. Anyway, in a democratic situation, everybody's putting their energy/time/resources/votes into whatever they want to see happen, and when ideas line up, there's motion--when there are equally opposed ideas/opinions, there is stalemate.
But everybody _does_ exert _some_ level of influence, whether they realize it or not. So, make your decisions like they count.
When you have a choice to make, make it with the intent of improving yourself, and your society as a whole. Make the choice to help Evolve into a better form.
-cid





