Blog
Thinking about intuition - some short notes
I recently read De Waal's Tanner lecture "Morality and the social instincts : continuity with other primates". It seems a fairly useful introduction to to the notion that our emotions are the product of evolutionary processes, and not only the "nasty" emotions like jealousy, shame, fear, guilt, disgust etc. but also - and in particular - those nice emotions that help us get along with others are, too, products of a process that isn't particularly "nice" - in de Waal's own wordsThe ... error is to think that, since natural selection is a cruel, pitiless process of elimination, it can only have produced cruel and pitiless creatureswhile the lecture itself is rather thin on technical detail - it contains, primarily, results from de Waals own work - its great virtue is as a source for new intuitions. I've not read much else of de Waal's but I imagine that if it is anything like this paper / lecture it can be an extremely useful tool in bridging the gap that exists within our imagination between us and our closest animal relatives.
Dennett notes, quite rightly, in his introduction to his book Darwin's dangerous idea is that people are seldomly swayed by arguments. Following him, I would guess that those of us who believe that evolution explains the origin of species were not knocked down by the clean logic of it (and it is a beautiful logic) but, when first presented with the idea most likely found that it fit our intuitions about the way things were,
"yes, that seems to ring true, it kind of fits, doesn't it?"
No doubt our eyes grew wider and wider with shock and awe as we came to realise the full implications of evolutionary theory, about just how much it explains, but on first contact with it we most likely had an intuition that there was something right about it. We had, with some luck, been prepared to receive this startling insight by a lucky confluence of reading, observation, thinking ("my cat has eyes and ears just like mine"), and our parents (and, failing that, hopefully teachers and friends), so that when the day came, we recognised that this was something worth closer attention, and, for some of us, further study.
De Waal's work helps us develop new intuitions about our relationship with animals by showing us the ways in which his non-human primate friends engage in behaviour that is remarkably close to the kinds of behaviour that we see as being essentially human. Consider his discussion of "consolation behaviour"
Consolation is defined as reassurance and friendly contact directed by an uninvolved bystander to one of the combatants in a preceding aggressive incident. For example, a third party goes over to the loser of a fight and gently puts an arm around her shoulders. Consolation is not to be confused with reconciliation, which seems mostly self-interested, such as by the imperative to restore a disturbed social relationship. The advantages of consolation for the actor remain unclear. The actor could probably walk away from the scene without any negative consequences.What could be more "human" than walking over to someone who has just been handed their ass, putting one's arm around their shoulder's and telling them that everything is going to be alright?
The more we're exposed to this kind of story, the more difficult we find it to see there being an unbridgable gap between human and animal.
This is the kind of thing I have in mind when I speak about it being a source of new intuitions, in this case, intuitions about the - false - absolute human/animal distinction.
Most of us are in desperate need of new intuitions, because the ones that come standard aren't that great.
Against naive intuition
A while back I had the distinct displeasure of watching Ray Comfort on Pat Robinson's show.
One thing you'll notice about Ray Comfort is that whenever he argues against atheism, or evolutionary theory, he appeals to our "common sense" intuitions about how things work.
For example, his appeal to the design argument for the existence of a god - sure, when we're faced with some complex artifact, like a computer or a car, we intuit that said artifact would have been designed and built by some reasonably intelligent person (or, at least, something possessed of active intelligence). So it's natural, when faced with something as complex at a cat or a cow, for us to have the same kind of intuition - "Of course it was designed, look how complicated it all is, that could never come about by chance".
The problem is, though, that in a lot of cases, our intuitions, our common sense about how things hang together is just plain wrong. If we take a look at some of the most important scientific discoveries, we see the extent to which our intuitions fail to correspond to the way things are. Things like space(-time) being curved or the strange ways that subatomic particles go about their daily routines. For anything other than our experience world of "medium sized dry goods" - operating at a time scale of minutes, days, hours, years, decades, even centuries - our intuitions begin falling apart.
And in the case of complex living beings needing a creator, our intuitions are, again, dead wrong regardless of how right our intuitions feel.
Smarter intuitions
This brings us back to my first point - our naive intuitions stand in need of some serious straightening out - we need to find good sources of new intuitions.
In a perfect world we would all get a good few years of quality science education under our belts before we are unleashed on a world that is, no doubt, sick of our misunderstanding the way it hangs together (like me, with my constant personification).
Failing that, we turn to our best popularizers of science.
Now, an intuition isn't just "knowing a fact", it's more about that fact having taken hold of you, and structuring the way you see things. In this way, educating our intuitions is a lot more difficult than preparing ourselves for an exam. And it is at this task where the best science writers shine.
The finest example of intuition education that I have ever come across is to be found in the first few chapters of Richard Dawkins' The Blind Watchmaker.
In it he describes a computer program that allows one to build up "creatures" - biomorphs - through selection. You start with a simple critter and are presented with a few variations of this "parent" biomorph. You can then select which "child" will survive to become the next parent of the next generation of biomorphs (each of which will vary in their own way from their parent). With this process of random variation and selection in place (is this beginning to sound familiar?) one can actually force the development of these creatures down a certain path of development. One can select biomorphs to look like, for example, crabs - at every generation one would just need to select the biomorph that most looks like a crab, and after a few generations you have what can reasonably pass for a graphical representation of said crustacean.
Why not give it a go yourself?
The point is that through this process of playing around with biomorphs, one gets a kind of wax-on-wax-off education of our intuitions. And when one is presented with the fact of evolution, it just doesn't run up against one's common sense, because you've already got a feel for how something complex could be built up in little steps. It feels more plausible because your intuitions have been well prepared for it.
I don't want to use this post to speculate on how well or badly our naive intuitions affect high level decision making policy, but one can only guess - but one thing is certain, if we are making decisions that are informed by misleading "common sense" intuitions, we have a duty to reeducate our intuitions.
Psychological analogies applied to countries
In a newspaper article, a young black South African woman, having recently turned 21, relates how she might be the South African success story. She was raised by single women who were born in rural areas, and in a short time has come further than what was ever dreamed about for most young women of the preceding generations. However, at the same time, she explains, she is anxious. Anxious because she is surrounded by poverty. While she may be living the “South African dream”, she explains how she knows her experience is not widely shared.
She admits, she is not a specialist in the field, but however doubts there are many who would disagree with her when she says there is a need for a "psychological revolution in the minds of all South Africans".
This is the exact sort of whiney, twenty first century, psycho-babble that drives me crazy. South African journalists love to employ this device when discussing the South African transformation or redress agenda. They seem to take great pride in the analogy. If we all fix our own "mindsets", then... because we all share a collective consciousness, the "national mind" will be healed.
In the article, she analyses her position as a now privileged member of society, after tertiary education at one of the “finest” institutions in the country. The concept of finest seems to be both descriptive as well as qualitative. In the former, it means to refer to the international and local standards to which the institution holds its members, both student and teacher, and their ranking against those standards in an objective manner. In the later understanding, “finest” refers to the institutions of the highest quality. Quality in this sense is how the society values associations with the institution, or its product, that being degreed professionals in this case.
But perhaps there is another way of understanding the concept of a “fine” institution, and that is the institution's capacity to deliver what society expect it to. Although no clear definition is provided in the article, it appears that she has biased her thinking in favour of the initial understanding. The “finest” university is the one that society values the most. The one that stacks up the best against the external standards to which these institutions are held.
Her thinking about her privileged access to education is a materialistic understanding of education, and is linked closely to her privilege regarding other material possessions such as
vehicles and gourmet food.
The author's notion of the South African dream is also unclearly stated in the article. However the implication is that every South African dreams about having access to prestigious universities, luxury vehicles and expensive food.
Clearly this is unashamedly borrowing from the same notion found in the United States' narrative. She however applies it in such a way that she creates a contradiction. The “American Dream” version of capitalism is orientated towards social progress through self-interested economic action. Admittedly, this is an oversimplification on my part as well. But, she claims she is living the "South African dream”. And moments later we are told that “once we have healed, then and only then can we learn to appreciate ourselves and not feel the need to import foreign values and systems when we are fully capable of finding solutions ourselves”. Now which is it? Are we importing western liberal notions of the South African Dream, or are we avoiding the need to "import foreign values and systems"? It surely cant be both.
This direct import of liberal individualism is carried further in the suggestion that if we all “heal ourselves” as individuals – then society itself can be healed over time. This takes no notice of the fact that South African society, and the communities that make up our society, exist as the result of a discontinuous historical process. The system that privileged few find themselves in is fundamentally different from the one that the majority of South Africans experience. Regardless of the fact that the author managed to escape the trap of her
particular place in society, expecting everyone to have enough strength, conviction or plain luck to overcome being born into a social structure characterised by poverty and inequality exposes an extreme simplification bias in her views. The assertion is that everyone should “heal themselves” in the same way as the author managed to. But this is simply unrealistic for most people.
The author also makes the claim that it is not the South African government that should "heal the wounded minds", but rather the individuals making up the society. Surely it is precisely here that government ought to involve itself with the opening up of access to opportunity for everyone? The fact that this access is not available shows a failing of government and leadership, not of individuals suffering under poverty laden conditions.
Finally, when drawing attention to the complaints of her friends about their BMWs and Prawn Salads, she totally misses the point that this phenomenon shows clearly that inequality in South Africa is no longer only about skin tone, but is now concerned with concepts such as access to education, financial and human capital, and political affiliations. It is no longer black and white. In fact it never was. Its much more complicated than she makes out. Its so much more complicated than most journalists make it out to be.
The author makes a psychological analogy to the human mind when she claims that a “healing conversation” will go someway to achieving transformation. Perhaps she would do well to extend the analogy to its limits, taking into account that a gangrenous limb will still be lost if corrective action is not taken at the appropriate time... regardless of the patients mental health. We need to stop thinking that all South Africa needs is the "right conversation". Much more is needed. We need leaders to skill-up, step-up and step-in. We need them to take the time to understand the complexities and the dynamics of the world that must be navigated. We need them to stop letting "national mental health" posturing set social policy agendas. We do need them to have the tough conversations... and then we desperately need them to go about leading.
MIT OCW Modal logic
Click here to check it out.
Only problem is that one needs to purchase a textbook (or not, depending on how you feel about piracy) ...
Be sure to also check out OCW's Logic 1 and Logic 2 - both are really excellent resources and you can get away without any text book purchases because the lecture notes are the readings.
Now, go do some logic.
Carnival of the Africans #15

Right, time for rounding up the best African scientific and skeptical blogging from the last couple of months - we haven't had a Carnival for a while, so while foraging for posts I decided to consider stuff written in June and July only, so that the posts would be relatively fresh.
Angela, the Skeptic Detective, has managed to cover the whole spectrum of woo-craziness, from its most air-headed and harmless, to its most grave and seriously shocking. In the former category she's given us a great series of posts of psychics and the Soccer World Cup. In the latter category, she's written what has to be one of the darkest blog posts I've read in a long while in which she deals with practice of "magic" and the associated "muti" killings which are a consequence of this system of beliefs. If you read only one of the blog posts in this Carnival, I suggest that it be this one.
Over at ionian-enchantment, Michael has been doing some interesting work. Firstly, he's posted about a commentary that he and his supervisor have just had published in Behavioral and Brain sciences (go Michael!). The target of their commentary is an article that points to a potentially significant problem in the behavioral sciences, which is that for the most part the subjects of their studies are WEIRD (that is, Western, Educated, Industrialized, Rich, and Democratic) and thus not representative of human beings in general. The problem being analogous to trying to say something about human fitness in general through studying professional athletes, or trying to draw conclusions about the average state of human livers through studying people who abuse alcohol - you just don't know if what you find can be legitimately generalized. Michael and Prof. Spurrett take this one step further, pointing out the fact that, if the subjects of these studies are WEIRD, then the researchers undertaking these subjects are extremely WEIRD, and that this fact itself has far reaching implications that have themselves been overlooked. Check out Mike's post summarizing the target article and his commentary, as well as a follow up post on the target articles authors' response to the commentary. Be sure to also check out his post on the ASA and the Rock solid church of "miracles" (how did those shudder-quotes slip in there?)
At 01 and the Universe Owen defends SETI against some spurious, skeptical objections. He does a really great job of taking SETI's detractors to task, but I think that a little more can be said about the very first objection raised against them in his piece - I'm sure Owen wont mind if I add a little to his defense. The point I have in mind is that "SETI is 'almost science', which [Massimo Pigliucci] justified by saying that although SETI is employing scientific methods in their endeavor, their hypothesis (that extra-terrestrial intelligence exists) is virtually unfalsifiable".From the tone of his reply to this point, I think Owen would agree with me that this is an unsatisfactory objection to SETI's project. It's unsatisfactoriness can be demonstrated by a very unsatisfactory response, one that nevertheless meets this formal objection head on. Lets assume that the biggest worry is that SETI's working hypothesis, namely that "aliens exist" is unfalsifiable. Would SETI, without changing their day to day activities one iota, be rendered "scientifically acceptable" by adopting the eminently falsifiable "working hypothesis" of "Extra-terrestrial intelligence doesn't exist" - a hypothesis that can be easily falsified at the very first instance of prime numbers encoded in a signal from Vega? A hypothesis that is corroborated every single time they boot up their radio-telescopes and find nothing?Somehow I don't think that SETI's critics would be satisfied with this response, but - without spending too much more time on this point - I think the fact that we can fudge the hypothesis to meet their formal requirement so easily speaks to the fact that there isn't much substance to their objection (at least, this simple version of it) in the first place. The point needs to be seriously developed before we should take it ... well ... seriously.
Sticking with space, at Communicating Science, the African way there is an interesting (if a little short) piece that asks whether Africans should care about space exploration. Also well worth checking out is the piece about whether we should be worrying about whether cell phones cause cancer - this latter question is particularly interesting because cell-phone technology has penetrated almost every level of African society. This is certainly not only a "first world" concern.
A few other notable highlights I found while looking for posts are Jacques Rousseau's article To ask for evidence is not (necessarily) scientism and Fluxosaurus' Cnidarian ecstasy. Both well worth a look.
And if you've not yet exhausted your enthusiasm on all this great writing above, feel free to take a squizz at my humble offerings on the reactive emotions, and Shame.
Okay - that about sums it up for this month - if I've missed anyone's awesome blog posts, I apologize, but - then again - shame on you for not submitting it. The only way you can make amends for not submitting is by hosting this very carnival on your own blog in the following months. If you're interested, browse over to this page, where you'll find all the relevant details.
Carnival of the Africans : call for submissions
You can find the guidelines for the Carnival here.
A brief note regarding Oatley's brief history of emotions
In his first chapter, Oatley gives a useful taxonomy of broad emotional types. We have reactive emotions, those emotions that have a sudden onset in response to some immediate environmental stimulus, say, the way that anger overcomes you when you're cut off while driving. We have moods, which unlike the ephemeral reactive emotions typically last for a few hours or days. They're also distinguished by the fact that they need not have an intentional object, they're often not directed at anything in particular. We then have sentiments, which last longer still. These do have an object, typically a person. Love, hate, and distrust are examples of sentiments. Finally, Oatley lists preference as part of our emotional types, he says that we should "think of it as a silent emotion waiting for an opportunity to express itself in a choice we make".
Oatley then turns to the "workings of emotions" - and here is where I take issue. In his discussion of how reactive emotions are "triggered" he says the following.
Reactive emotions occur when the appearance of the world as we assume it to be is pierced by reality. In our assumed world, objects and people take on the colors of our understandings, of our hopes, of our desires, of our likes and dislikes. A reactive emotion occurs with the unexpected; it is a meeting of what we assumed with what we did not assume ...We know from dreams that our brains have the machinery to make scenes that we experience. So eyes are not windows that let in aspects of the world. Instead they pick up clues to enable us to construct the world as we experience it. the clues are used, along with our assumed and implicit knowledge of the way the world works, to construct what we perceive.Reactive emotions are caused when something in the assumed world unexpectedly affects a concern. Sometimes the unexpected is delightful, and we have the sense of new possibilities. Sometimes the unexpected is painful : in anger, for instance, the world narrows to plans of how we might confront the offender with the offense.I would like to give him the benefit of the doubt and would especially like to see the idea developed further; perhaps there is more to it than what can be expected to be delivered in this non-technical introduction to emotions? But I don't think that this provides us with anything like a satisfactory account of how and why our emotions are "triggered".
As a simple counterexample let us consider anger. Anger is a paradigm case of the reactive emotions but I don't think that it's necessary for me to have my expectations frustrated in order to experience anger, far from it. I may experience anger even in cases where what I expect is exactly what plays out in reality. Suppose there is some individual in my office is an apartheid-era-style white South African blockhead who can't go for an hour without uttering some racist remark. It's thus part of my "assumed world" that this idiot will regularly vomit up some disgusting hateful comment. Not only that, but I expect myself to get angry! I know beforehand that this is what's going to happen but I still get angry when it does happen.
This is not to say that surprise, or the unexpected, doesn't play a role in triggering emotions - think about surprise itself - but it seems to me that in order to make this workable, we'd need to either restrict the domain of reactive emotions to those emotions that are essentially characterized in terms of this relationship between the "real" world and our "assumed" world, or we need to drop the whole notion as defining of reactive emotions in general. I have a feeling that the problem may well run in another direction as well. We experience our expectations coming up short the whole time without an accompanying emotional experience. For example, I thought my wife was sitting in the living room and when I get there I see that she isn't, she's outside. Unless there is something seriously wrong with me I don't think that we can expect me to feel anything at all. I make the appropriate adjustments to my beliefs and move on. In this case there is still something "extra" that needs to be added into the mix to get an emotional response, the fact of there being a difference between my "assumed" world and reality isn't a sufficient condition for an emotional response at all. And if we do, in fact, require another "extra" something to pick out emotions from non-emotional reactions, why even bother with this notion at all?
First mobile post
I just got the mobile posting working.
Now I can blog on the go - that's kinda cool for logging ideas etc.
Gödel without tears
On Shame
Plus, if one spends their time studying Shame rather than, say, Love - there is the added bonus of sounding like a tortured existentialist. But that's just more to impress people in coffee shops ... now, where did I put my beret?
I recently read Michael L. Morgan's little book "On Shame". What I imagined I had ordered was a popular book that would give a useful synthesis or review of the literature on Shame, but what it turned out to be was - on one hand - rather more interesting than all that, but - on the other - a little less satisfying than what I had hoped for. In his book Morgan wants to put Shame into action, he want to use it as a force for moral change. In doing this he is making use of the fact that part of Shame's intentional content is a self-reflexive judgement. Barring edge cases - and in the study of emotion there are always edge cases - Shame tends to signal that we have found ourselves to have fallen short of some standard that we've internalized. Shame tends to be holistic in its condemnation of the self - it is the whole self that has failed, that isn't worthy etc.
There are a few typical reactions to this kind of negative self-evaluation. The first is to hide one's self - we avert our eyes from the Other, we withdraw into ourselves, and in extreme cases we may wish the self extinguished, to dissapear completely.The second reaction is the desire to change the Self - to become other than what one is (or at least, other than one is presented as being in the judgement at the heart of Shame).
In essence these kinds of responses involve the same kind of reaction - doing something with or to the self - the only difference is that the second kind of reaction is positive - Shame, in the second instance, is used as a vehicle for change.
Philosophers tend to be divided on the utility of Shame. Those philosophers who doubt that Shame is a useful moral emotion tend to emphasize the first type of reaction, while those who champion Shame tend to focus on it as a source of motivation for change. While I don't want to get into this question now, I just wanted to point out that Morgan falls squarely in the camp of the pro-shamers. He thinks that Shame's power to motivate deep change in our selves makes it an extremely useful emotion.
Morgan's endorsement of Shame isn't at all interesting or exceptional in itself, it's a fairly common position. However, where his book gets interesting is in his endorsement of Shame as a collective emotion, and in particular, as a collective emotion in response to us living in a "world of genocide". His book is an attempt to work on the consciences of it's readers, to get us to actively invoke Shame in ourselves for the existence and persistence of genocide in our world. It is in these respects that his book is most provocative. Collective emotions, and especially Shame, have long been neglected in the philosophy of emotions - most theories tend to explore individual instances of emotions and leave it there. But we cannot ignore the existence of collective emotions. Collective Guilt and collective Shame are serious players in our emotional repertoire and we miss the point if we merely reduce them to collections of coordinated individual emotional episodes. Furthermore, his suggestion that we employ Shame as an active emotional strategy for change challenges the (by no means universally held) notion that emotions are passive, that they are - in a sense - beyond conscious control. These two points alone take us deep into the heart of the philosophy of emotion. And this is where, for me at least, the book dissapoints. Morgan introduces a novel and potentially illuminating approach to Shame, and yet does hardly any work to back it up. My complaint isn't that he gets his account of Shame wrong but rather that he doesn't give us enough to tell if he gets it wrong. There just isn't enough theoretical detail to evaluate his argument.
As I mentioned earlier, the point of the book is to galvanize the reader to change his or her self. Responding to genocide is serious business, and perhaps theoretical issues can be put on hold by the exigencies of the mass slaughter of fellow human beings. The problem is, though, that a book like this sits uncomfortably between a philosophical investigation of a problem, and a manifesto for change, and although I can't really say whether it hits it's mark as a manifesto, it fails to satisfy philosophically.
I hope that what we're seeing here is the first salvo in a longer philosophical project dealing with Shame by Morgan (although, it must be pointed out that his work seems to have always had Shame on it's periphery). The brief sketch that he provides in this book is barely enough to whet the appetite, but what he does provide is enough to make me pay attention.
Drush Presentation
Drupaler.co.za
![]() |
Drupaler.co.za is part of the Perceptum Thought Squad |
Drupal is a free software package that traditionally allows an individual or a community of users to easily publish, manage and organize a wide variety of content on a website. Tens of thousands of people and organizations are already using Drupal to power scores of different web sites.
At Perceptum Thought Squad, we harness the potential that Drupal offers as a community developed Web Application Framework. Using Drupal as a base, we rapidly develop back-office applications, system integration layers and work-flow systems. Using Drupal this way means that we spend less time developing repetitive subsystems (like user management, theme and template systems, etc) and more focus is given to the core business features of your application.
For contact details and more information on Perceptum, please visit our company site @ http://www.perceptum.biz/.
Drupal Behaviors - What I have learned so far
"Behaviors" provides is a framework for doing jQuery in a consistent way. Its particularly cool at making sure that you dont have a lot of "document.onLoad()" js calls in theme files. Ideally what we are trying to avoid is ANY <script> tags inside our theme files. We want to decouple the JS <scripts> from the HTML (tpl.php) output.
So "Behaviors" are pretty much function pointers on an array of pointers that Drupal core calls on page load and sometimes when ajax calls are made. When I make ajax calls to get dynamic content, I explicitly call them so I know that all my behaviors are called. If I fetch some content that ends up in response.content... I put the response.content in some HTML container (lets say "div id=dynamic-holder"), and then call drupal.attachBehaviors($("div#dynamic-holder"));
// Ajax call... (pseudo code really)
$.ajax({
....
success: function(...) {
$("div#dynamic-holder").html(response.content);
// anything else that needs doing to the content...
drupal.attachBehaviors($("div#dynamic-holder"));
}
}); // ajax done
The core script looks at the JS "global array" and iterates over them, passing a context variable. So for example, imagine that I want a behavior that is kicked off on page load, that looks for all divs with a class of "hideme" and literally does that - hides them.
In my module I would add the js to the file that has the behavior in it. lets say bg_test.js...
//---------------- bg_test.module
<?php
// DONT PUT THIS IN _init() I.R.L
// ITS IMORAL
function bg_test_init() {
drupal_add_js(drupal_get_path("module","bg_test")."/bg_test.js"));
}
//----------------- bg_test.js
Drupal.behaviors.go_hide_my_schnitz = function(context) {
$("div.hideme").not(".sc-processed").each( function () {
$(this).addClass("sc-processed");
$(this).hide();
}); // each done
}
//----- WORKS on HTML like
<div class='hideme'>Please hide this. Its ugly.</div>
Ok - so that is a simple example. What we end up with here is a Drupal.behaviors array like this...
Drupal.behaviors <=== array
Drupal.behaviors.go_hide_my_schnitz <===== function
Drupal.behaviors.some_other_function <===== function
Drupal.behaviors.yet_another_lame_js_function <===== function
Then core adds ONE document.onLoad() {} call to the page that then calls drupal.attachBehaviors(context), which in turn iterates over the Drupal.behaviors array and calls each function. On the initial page load it sends the whole page as the "context" variable. But subsequent calls can specify a separate context, possibly a dynamically fetched piece of HTML or something like that.
Now... settings are relatively simple - but pretty cool. Lets say I want to make our function a little smarter. Instead of hiding everything with the class "hideme", I want to be able to specify that dynamically inside my Drupal module. This is an example where settings bridge the gap between Drupal and jQuery very nicely.
//---------------- bg_test.module
<?php
// DONT PUT THIS IN _init() I.R.L
// ITS IMORAL
function bg_test_init() {
// ok ... here we add in some settings
$settings['bg_test'] = array(
'hidetheclass' => 'ohhideme';
);
drupal_add_js($settings, 'setting'); // notice the 'setting' special word there. Drupal does magic here.
// Now we add in our js file
drupal_add_js(drupal_get_path("module","bg_test")."/bg_test.js"));
}
----------------- bg_test.js
Drupal.behaviors.go_hide_my_schnitz = function(context) {
// notice below that we can now get at our setting!
$("div." + Drupal.settings.bg_text.hidetheclass ).not(".sc-processed").each( function () {
$(this).addClass("sc-processed");
$(this).hide();
}); // each done
}
----- WORKS on HTML like
Please hide this. Its ugly. -->Being sociable
It was becoming a useless distraction that was filled with nonsense about Farms and Gangs, and occasionally messages from God. God, it seems, is very much concerned with whether I'm having a good week or not - and is rather tech savvy, which is to be expected since he came up with science.
So I've decided to spend my time focused on online communities that are at least a constructive time-spend.Which brings me to the point of this all, which is a shameless plug for github. I've checked it out before, but since I've decided to contribute (patches/bug fixes) to jQuery UI I've really come to realize just how cool a site it is.
If you're at all interested in coding, or are in the process of learning how to code and want to find some great programmers and interesting projects - check out github.
jQuery and views_embed_view. An awesome pair.
Here is a snippet showing how to fetch a view, passing some arguments, and returning the view over jQuery to a jQuery ajax fetcher and handler.
This is assuming there is some menu entry that calls this page.
function sc_networks_membership_list_page($account_id,$group_id) {
$return = array();
$group = node_load($group_id);
$viewName = 'sc_network_members_list'; // This is the view name
// NULL can also be the name of a particular view display
// All arguments after the view display (NULL) are passed to the view as arguments
$return['content'] = views_embed_view($viewName, NULL, $group_id);
// We cleverly theme_status_messages to get and drupal_set_message calls returned
$return['content'] = theme_status_messages() . "<h2 class=title>".t('!name - Membership List',array('!name'=>$group->title))."</h2>".$return['content'];
// Finally encode and send
drupal_alter('ajax_data', $return, 'sc_networks_membership_list');
drupal_json($return);
exit();
}
Creating an organic group programmatically
Here is a snippet we are using to create organic group nodes programmatically. It assumes you have a module called "sc_networks" in which the function will reside.
function sc_networks_enrollments_create($title = null, $description = null, $owner_name = null, $uid = null) {
# Adapted from ideas
# @ " title="http://www.manumilou.com/blog/creating-node-programmatically
">http://www.manumilou.com/blog/creating-node-programmatically
// This is needed to load the node functions
module_load_include('inc', 'node', 'node.pages');
$node = new stdClass();
$node->type = 'sc_enrollment_network'; // Replace this with the content type of the group you want to create
$form_state['values']['name'] = $owner_name; // This is the text username from users table
$form_state['values']['uid'] = $uid; // The owner admin of the group
$form_state['values']['title'] = $title; // The title of your group
$form_state['values']['og_selective'] = 3; // 3 = CLOSED but you can use 0=>2 as well corresponding to the different types of groups
$form_state['values']['og_description'] = $description; // The brief group description
$form_state['values']['vid'] = 1;
$form_state['values']['status'] = 1; // publish the group
$form_state['values']['created'] = strtotime("now"); // Creating date
$form_state['values']['changed']= strtotime("now"); // This is needed so drupal doesnt freak out :)
$form_state['values']['comment'] = 0; // Comments disabled
$form_state['values']['promote'] = 0; // Dont promote to frontpage view
$form_state['values']['moderate'] = 0; // No Moderation
$form_state['values']['sticky'] = 0; // Not sticky at top of lists
$form_state['values']['format'] = 5; // This is a custom input type - check filter_formats table
// The operation to perform when submitting
$form_state['values']['op'] = t('Save');
// Save the node object into the database with drupal_execute
drupal_execute('sc_enrollment_network_node_form', $form_state, (object)$node);
}
Bug in CaseTracker shipped with openatrium (1-0-beta3-2)
The old version of Open Atrium (version: atrium-1-0-beta3-2) shipped with a casetracker version that has a bug in the view filter. If you added cases to the a project, and tried to filter the resulting view by "Assigned to:", the wrong users assignations would be shown.
This resulted from a call to array_splice in the casetracker.module file that was loosing the user_id => user_name indexing. The casetracker developers have rewritten that function, but upgrading our version of atrium is not trivial because of the custom stuff we have done to it.
So basically to fix the bug... edit casetracker.module and change...
array_splice($options, 0, 0, array($anon_user));
to
$options[0] = $anon_user;
HTH someone out there.
-->