Gecko’s Guide to GIT

I’ve convinced my work colleagues over at Gecko-Research to start using Git.  I’m a git neophyte myself, but now I’m in the position of setting up our Git repository, and teaching my colleagues how to use it. I’ve written up a little guide to using Git, aimed as a reference for myself and my colleagues.   As such, it’s just a list of the commands that we use on a regular basis, or the situations we are often confronted with (and how to deal with them).  The post is totally a work in progress, so it will likely change quite a bit over the next few months as I flesh it out as needs arise.

If you are interested in a general introduction to git, or a tutorial, I would suggest one of the following:

Git has a reputation for being difficult to use, or counter intuitive, but I think that’s just due to it being a distributed rather than central revisioning system (based on the concept of a central repository).  Some things do get tricky, but I think it’s primarily because git lets you work in new ways that can potentially trip you up.

Central repository systems are easy to conceptualize,  and they’re what people of our generation are used to, so they are easy to get started with.  Git  is based on a distributed model, in which each repository is equal (we can assign different roles to different repositories, but it’s not technologically imposed).    Considering that distributed systems are so becoming the norm (bittorrent, wikipedia, the free software movement, multi core computing, creative commons, blogging, twitter…) ,  I suspect tech heads growing up now will find thinking in a distributed way as simple as we old farts find the top-down, central-repository, client-server model.

Daily Use

Note that these comments are aimed at my colleagues. Your work situation may vary.

commiting

You should commit your work whenever you get anything done that can easily be summed up in one line (the commit message). There are other reasons to commit, so when in doubt, do a commit. It’s easy to go back if you need to. Committing doesn’t go on the net, it just tells your local git repository that you got some work done, and puts those changes onto the local index (git’s database of what’s what). Frequent commits will save you hassles. The command is:

 git commit -a

The -a tells git to commit all modified files (which are being tracked). You can also just commit specific files by using

 git commit <list of files>

more to come…

Configuration

gitignore file:

A gitignore file specifies intentionally untracked files that git should ignore.  It concerns files that are not tracked by git, and that you don’t want to track with git, so temporary files, results of compilation, compled documentation, etc.  The man page is here.  When git is determining what files to ignore it:

  1. Checks for a relevant command line option
  2. Check patterns from a .gitignore file in the same directory as the path, or in any parent directory.
  3. Check for patterns in $GIT_DIR/info/exclude
  4. Check for patterns in the configuration variable core.excludesfile

The man page describes the patterns, which are anyway pretty close to the usual *nix conventions that you’ll probably just get them right.  As an example, here’s my .gitignore file for a netbeans project:

*.class
*~
build/
javadoc/

This tells git to ignore any build or javadoc directories, as well as emacs temporary files.  Taking the time to setup a .gitignore file when you are starting a new project with git will make everything else more convenient down the line.

Collaboration: tracking multiple branches

Because of some wonky security policies on our institute’s network, we can’t directly push and pull from each other, so we go over a central repository. Many of us work on multiple machines, so we want to use the central repository as a convenience tool for synching up between our machines, but we don’t necessarily want out colleagues pulling our work-in-progress. The solution is for each of us to have our own branch. This post tells us how to start a new branch on a remote git repository. The steps are basically:

  1. Create a remote branch. This can be done with the command
     git push origin origin:refs/heads/new_feature_name

    (assuming your remote repository is called origin).

  2. Make sure everything is up to date with
     git fetch origin
  3. Start tracking the new branch with
     git checkout --track -b new_feature_name origin/new_feature_name
  4. Make sure everything is up to date by doing a pull.
    git pull

The third command,

 git checkout --track -b new_branch origin/new_feature_name

is one you’ll run several times, every time you clone a repository somewhere, you’ll want to use to track all the various branches you are interested in. That way you can checkout your colleagues (or bug fix) branches when you like, and merge them into your work whenever it is useful.

Situations

Deleting a branch. Okay, so you’ve been branching all over the place, and now you realize you have some dead hanging branches you really don’t want cluttering up your repository anymore.   To get rid of a branch on the remote repository, you’ll want to do the following:

git push origin :head/branch_to_delete

An open letter to Antonio Maria Costa

Antonia Maria Costa, the UN “Drug Czar”, has written a letter to the guardian asking “How many lives would have ben lost if we didn’t have controls on drugs”. It riled me up enough that I had to shoot off a response:

One has to wonder if Mr. Costa believes the nonsense he is promulgating, or he is simply performing his function as a propaganda minister for the prohibition industry to the best of his abilities. Both could reasonably be the case.

He posts the question

How many lives would have been lost if we didn’t have controls on drugs?

and goes on to discuss the current policy of drug prohibition as though “control”, “prohibition”, and “regulation” were synonymous. They are, of course, not. We have systems of control in place for the regulation of of alcohol and tobacco, both of which are significantly more dangerous and more addictive than many drugs which are currently prohibited my most nations (for example Cannabis, LSD, Ecstasy). By comparing the effect of regulation of alcohol against the effect of prohibition of alcohol, we can easily see that we protect our citizenry better through regulation than we do through prohibition. Regulation results in less crime, less overdose, less underage use, in short more control than does prohibition.

The current prohibitionist policies and irrational assessments of drug harm result in a situation that is quite simply out of control, and this is what we in the “legalization chorus” object to. Or does Mr. Costa wish to make the claim that things are in control in, say, Mexico? Or the United States for that matter?

How many lives would have been saved if our children had been obtaining honest information about the relative harms of drugs, rather than dishonest propaganda? How many lives would have been saved if our addicts (I am writing as an American here) could have gotten treatment and counselling for their problems instead of getting labelled as a criminal and ostracised as a criminal? How many lives would have been saved if clean needles were freely available? How many lives have been lost in botched drug raids, in drug violence?

The facts, Mr. Costa, speak against you, and your rhetoric and word-play is too weak to obscure them. Of course we need controls on harmful substances. We in the chorus are not asking you to stop controlling potentially harmful substances. We are asking out governments to regulate them. We simply want sane and rational regulation, rather than jingoistic prohibition.

Exit strategies for the war on drugs, part1: Framing the discussion

I am gradually of the opinion that drug-policy reform is now a sure thing, and the discussion will need to shift to alternative policies.  This is the first in a multi-part series, in which I prattle on about what comes next after the war on drugs.  This post attempts to formulate a useful basis for the discussion of the subject.

The Guardian has an excellent article: Prohibition’s failed. Time for a new drugs policy. The first line sums it up perfectly “http://www.guardian.co.uk/commentisfree/2009/sep/06/editorial-drugs-policy-latin-america”.

It’s clear that the debate now needs to be about what comes next.   We’ve created a stupid war against the citizenry our own country.  It’s completely fucking up our civil liberties, and in fact the entire premise is completely unconstitutional. Argentina’s government has realized this, and if we lived in a healthier democracy, we would have figured out the same thing by now. The good news is we seem to be getting there, so the time for figuring out an exit strategy would seem to be now.

The issues aren’t simple. We have a monstrous police-state machinery in place. We have to pull out the troops and integrate them back into society, and provide them with counselling to reintegrate them into normal society. While this should be an easy sell, as there is a peace-dividend (reduced spending on law-enforcement and prisons, improved civil liberties, reduced crime…) the drug-warriors don’t want to give up sucking at the government teat, and form a powerful lobby. The most difficult question of course is “okay, prohibition doesn’t work, what now?”.

Unfortunately, the people who should be working on this are still too afraid to admit prohibition has failed.  While they get up to speed, the most productive discussions in this arena are taking place online, in in the periphery of other discussions. I’d like to discuss the issue more directly.

Goals:

So, let’s identify some (hopefully) uncontroversial goals, by which we can judge whether a drug policy is working or not.

  • minimize addiction rates.
  • minimize overdose deaths.
  • protect children and uninformed consumers.
  • minimize crime (e.g. junkies stealing to get their ‘fix’)

There are other effects which are more difficult to quantify, such as health impacts (cancer and such) and effects on productivity. While these are worth considering, I think it’s a reasonable approach to consider them second-order effects. Once we have a policy which optimizes the easily measured first-order effects, we can worry about the second order ones. The key thing to keep in mind here is prohibition is a nightmarish failure, regardless of which effects you consider. It doesn’t accomplish any of the desired effects. The results of prohibition are so disastrously bad, that complete deregulation might end up working just as well, without the enormous cost (socially and economically) of funding the war.

An error the drug warriors make is framing the discussion in terms of “zero-tolerance”.   They want to completely eliminate all drug use.  What the last 100 years has shown is that that won’t happen. You can keep spending more money, you can keep use the constitution as toilet paper after shitting on people’s civil rights, you can get more and more violent and intolerant, you can impose increasingly draconian laws, and people will still use drugs. The figures are there.  It takes enormous cognitive dissonance to deny them, so let’s stop doing

There remains of course the question of how much we are willing to pay to achieve those goals. I suspect that the people who are so willing to spend billions on the drug war, will be less willing to spend the same billions on counselling, care, rehabilitation, education, and maintenance programs. Fortunately, the drug war has been so damned expensive, anything we come up with likely be much more effective at a greatly reduced financial cost.  This will allow us to frame all such harm reduction spending in terms of savings over the prohibitionist approach.

Having identified a set of goals which I hope we can all agree on, let us consider what will be needed to implement a sane drug policy.  It’s my conviction that a good drug policy will involve the following components.

  1. Rational evaluation of drug harm.
  2. Honest drug education.
  3. Honest drug scheduling (a rational classification system).
  4. A sane handling of the respective classes of drugs.
  5. Reality based assessment of policy effects.
  6. More power to states and communities for deciding drug policies.

Each of these points is non-trivial, and will require some discussion.  Thus they will be the subject of future posts.

Some might disagree with necessity of a drug scheduling system at all, and would advocate regulating all drugs like we do alcohol.  While I see some merits to such an extremely libratarian approach,  I would argue against pursuing such a goal for the following reasons:  It’s unrealistic in today’s political climate, it’s too rapid and extreme a change, and I suspect such a policy might be nearly as harmful as the current policy.  If it’s not clear to me, it’s going to be extremely unpalatable for the average citizen.

Keeping the classification system allows to handle the approach in a more reasonable and rationed manner.  We can agree to pursue a policy that accomplished the stated goals, and analyse each drug case by case, based on a rational assessment of its relative harm, made by qualified medical researchers. It also allows us to separate the questions “do we need drug policy reform”, and “what is a good drug policy for drug X”.  The answer to the former question is simple, the answer to the latter is, in some cases, rather difficult.  For example, I am torn on what constitutes a good policy for Heroin or Crack (I do know that current American policies are the wrong answer, but I’m not sure heroin and crack bars are the right answer).

Conclusion and caveats:

To successfully advocate for drug policy reform, I think keeping the above goals in mind is extremely useful.  It provides a concrete, uncontroversial framework for evaluating the failure of current policy, and provides some useful indications for steps in a positive direction.  There may be additional goals which are useful to bring into the discussion, but in the terrible situation we currently find ourselves in, we should strive to work toward unifying, uncontroversial goals.  Once these are acheived, we can open up more controversial, difficult discussions, such as “what right does the government have telling me what I can put in my body anyway”, or the ethical merits of a drug-free lifestyle versus the spiritual benefits of psychotropic drugs.

Advocacy anti-patterns


A few years ago it became quite trendy to attempt to isolate succesful patterns in solving certain recurrent programming problems. Not long thereafter, it became clear that it was useful to identify identify harmful anti-patterns which frequently impede or halt the success of a project. Just as studying such anti-patterns can help the success of a software-engineering project, studying anti-patterns in human behaviour can help us be more successful in our attempts at social-engineering. Among the social issues for which I advocate I have noticed several such anti-patterns, which I will attempt to identify and describe.

The purpose of studying anti-patterns is self-analysis, not to provide a convenient vocabulary for attack within an advocacy group.  Indeed, in-fighting and splintering within an advocacy group is the mother of all advocacy anti-patterns.   I called it the “People’s front of Judea” pattern, and will write about it at a future date.

That said, a  comment at www.stopthedrugwar.org inspired me to write out the first few. The context is this: An editorial was posted discussing how illegal cannabis cultivation is destroying the ecology of our national parks. The article was specifically addressing the impact on Crystal Cave, but the problem is a general one. This is one of the negative consequences of cannabis prohibition, and will disappear once prohibition is repealed. A reader, ( primus) made a comment to the effect that “hey, we should try and get the Sierra club involved in this issue.”, a good point, and useful from an advocacy point of view, as it suggests an approach to bring more people into the cause.

Another reader (“James G”) replies:

I am more than sorry to inform you Primus that with the exception of our public lands,”thank God we do have those, for now” this world is not ours,”the common home of humanity,as it should be” but the” private property” of a small percentage of the human population who thouraghly believe they should be able do anything with their private property they see fit even if the rest of us is harmed.You must understand that these people are in favor of freedom and human wellbeing only to the extent that they can profit directly from such virtues.When freedom and the wellbeing of the 90 plus percent of humanity that does not belong to the ownership class threatens the power and or profits of the elite those virtues are cast aside in favor of totalitarian and facistic acts which insure that the masses never taste real freedom and wellbeing.

The facts are quite clear;the elite will first destroy humanity and the natural enviroment with their arsenals of nukes and biochemical weopons before they will loose or sucsede power to whom power rightfully belongs”,that is the people”.

Indeed this is not our world but the private property of the elite.This is why we now live in an age when a person can be incarcerated for the personal use of a plant ,”in the name of protecting the public wellbeing” while ultra wealthy manufactorers of the most deadly of weopons,”even nukes” walk scott free and enjoy the best life has to offer,all at our expence. It is really quite insane,but yet we still call it civilization !

Apathy of Despair

These three paragraphs can be summarised as “Dude, don’t even try and do anything because everything is so shitty you can’t possibly make it better.”. I like to call this “Apathy of despair.“.

Successful advocacy relies on people being engaged and working actively to a certain goal. People are motivated to work towards social change when they 1) see that there is a problem, and 2) have some hope that the situation can be improved. One often runs into people who start off claiming that there is no problem (apathy of denial). If one confronts these people with sufficient evidence to the contrary they move directly to despair (apathy through despair). What these two states have in common is a lack of action or effort. I get the impression the apathetic individual simply doesn’t want to take responsibility for their role society, and just wants to skate through without making an effort. Some accomplish this abdication of effort through naivite, and others through cynicism, but the result is basically the same.

The overwhelming journey

Laziness is not the only path to the apathy-of-despair. In James case, I believe he arrived there through a pattern of thinking that deserves its own anti-pattern, which I’ll call the “overwhelming journey”.  (I can’t think of a better name yet, but please feel free to make suggestions). The overwhelming journey occurs when an individual sees the problems involved, but can’t see the path to improvement.  They have forgotten that “the journey of a thousand miles begins with single step”.   They may be frustrated because they have forgotten that social change takes time, and is difficult.  Perhaps their frustrations with the problems they perceive leads them to an angry state of mind, and so they are unable to calmly and rationally analyse the problem and possible solutions.  The get wrapped in a ranting, raving, rabid froth.

Some additional gripes

James’ post suffers from some additional anti-patterns, which are difficult to point out in a kindly manner.  He rants and raves about the “elite”, “fascistic act” etc.  Basically he’s falling into the “grand conspiracy” AAP (which is a close corollary to the tinfoil hat AAP).   This kind of thing dilutes a movements credibility, and drives away potentially useful collaborators.

In the end, James post encourages prohibition-repeal advocates to give up and stop giving a shit, and drives people who are undecided on the issue away.

Bing

Youngsters to the web might not remember a time before Google, where search engines basically sucked. They were based on simple and stupid algorithms which were easily gamed, and only occasionally got you to a site you wanted to visit. Google was so successful because their search engine worked vastly better than the competitions. Back then, if you were looking on information on a particular subject, you would go through a list of search engines, until you got a useful hit. There were even meta search engines which agglomerated the results of several search engines. These all died out quickly after google went up.

Since Google, pretty much everyone I know just uses Google. If a particular search is unsuccessful, we try experimenting with different terms. I don’t think I ever go to another search engine.

But I try to be open minded. So when I heard that Bing didn’t suck, I gave it a shot. I picked 5 searches I might be interested in and search in Bing and Google. I consider it effectively a tie. Sometimes Bing’s results were better, sometimes Google’s, but in neither of them did I get a bullshit result that was clearly inferior to another’s.

So chapeau Microsoft. You appear to have gotten your head out of your ass and produced a respectable product. If you’re as successful with Natal as you were with Bing, you might even get me to buy one of your products!

What the Sotomeyer confirmation hearings have to tell us about the drug war.

So, people who are well informed about drugs, and have bothered to look over the medical evidence, are perfectly aware that X (MDMH) shouldn’t be a schedule 1 drug.  This is of course no surprise, since our drug scheduling system looks as if it was chosen by throwing darts.

Why is it illegal though?  The brief history is that MDMA was created by a guy called Anton Koellisch, working for the pharmaceutical Merck in 1912.  Apparently they were trying to develop a substance to stop abnormal  bleeding.  MDMA was just an intermediary compound on the route to methylhydrastinine, and Merck wasn’t interested in its properties.

Now, the next part is fascinating.  Apparently recreational drug users first determined the drug was worth taking, around 1970.  This led to a guy called Alexander Shulgin (who would have been around 50 at the time, working (I believe) as a p0st doc at UCSF to play around with it.  Apparently he called it his “low-cal martini”.   He in turn metioned it to a psychotherapist named Leo Zeff.   MDMA is very useful for  enhancing communications, reducing psychological defenses, and increasing the capacity for therapeutic introspection.

In the early 80’s MDMA started to catch on.  All the kids who grew up playing pac-man started hanging around in dark-rooms, listening to repetitive electronic music, and popping pills.  One of those pills was MDMA, and the Reagan-Bush “Say no to drugs”, “Say no to condom  education in schools”, “say no to Foreign aid unless you teach that abstinence is the only way to prevent aids, and forbid teaching about safe-sex” administration decided to say no to young adults having a good time and feeling more empathic to each other.

MDMA is an empathogen.  I don’t know if this is the accepted medical phrasing for what MDMA does, but take it from me, MDMA is an empathogen.  It makes you care more about other people.  This can be negative.  For example, if I have a single sixteen year daughter, I would discourage her from takine X at  a party full of strangers.  I would however encourage her as an adult to take with her partner.  It makes relationships richer and stronger, I promise you.

I have an informal ranking, which I call a drugs “Scary Monster” level.  It’s how much fear a drug evokes in a particular audience or demographic.  X is one of the more maligned drugs out there.  I think the average, over 40 American, and possibly european, sees X as worse than Cocaine, for example, which certainly doesn’t fit its ranking in rational harm rating.  My point here is, beyond being illegal (which it course should not be), it is villified disproportionately to the harm it causes.

For example, when Professor David Nutt, head of Britain’s drug advisory board recommended that ecstasy be downgraded to a class B drug, he tried to explain the relative risk inherent in taking the drug as being equivalent to the risk you take in riding a horse.  The point was to get people to understand that drug harm can be equal to harms in other parts of life.  This is an importnat thing to discuss, since the debate on drugs is typically so emotional and irrational, particularly on the side of the prohibitionists.   He wrote an article titled “Equasy: an overlooked addiction with implications for the current debate on drug harms”.  Equasy being “Equine Addiciton Syndrome”, which has caused ten deaths, and causes more than 100 road traffic accidents a year.  He goes to explain that many other activities in life (like motorcycling) are much more dangerous than man illicit drugs.

The prohibitionists were up in arms, calling for his resignation.  They can’t attack his science or his reasoning, both of which are flawless.  They instead must make emotional attacks, claiming he is insensitive to the families of victims of drug abuse.  Sigh.  So victims of drug abuse suffer more than victims of horse riding?  Why?  The fundies react very badly to rational discourse on the relative risks of drugs.  Why is that?

I’ve long had the opinion that the problem is simply fundamentalism.  They see drug use as a threat against their culture.   There’s no question that this is the case for the drug policies of the Nixon, Reagan, Clinton and Bush administrations.   I also think this is part of the particularly irrational attitude towards X.  It makes you feel more empathy, and fundamentalists are anti-empathy.

Now I feel affirmed.  Warren Richey writes about the Sotomeyer Hearings that

Republicans Question Need for “Empathy”

Republicans repeatedly criticized President Obama’s stated goal of seeking judges with “empathy” for “people’s hopes and struggles.” They questioned how the concept of empathetic judges could coexist with the well-known portrayal of a blindfolded Lady Justice.

Finally I have proof that  the sector of our culture which represents religious fundamentalism and intolerance is genuinely anti-empathy.  I knew they were of course, as did a great many people.  But now they are going so far as to say it openly, which means I can make this without a burdensome process of proof.  It’s easy, they don’t deny it. We don’t need empathy in the justice system? That’s some fucked up shit right there.

I think the fundies are anti-X in part because they are anti-empathy, and X encourages empathy. Used under the proper conditions it does so in a lasting and meaningful way. Criminalizing it only encourages its use in harmful locations, and decreases its positive use.

If we consider our culture’s evolution, I think there’s a real possiblity that empathogens and psychadelics can play a meaningful role in hunting down and de-clawing harmful social memes. Thinking about it like that, religious intolerance and flexibility, which is so symbolized by the modern Republican party, is like a mind virus.  Lack of empathy in our culture can be treated effectively with MDMA (as part of a directed therapeutic process), and prohibition of MDMA is a defence mechanism of the anti-empathy meme.

When one goes further to consider that addicts and people who do abuse drugs are people with medical conditions, deserving of our empathy and support, it’s clear that entire concept of drug criminalization is a defense mechanism against empathy.

Micheal Jackson is Dead!

You know, thinking about MJ dying does make me sad. But the real tragedy isn’t his death, it was his life. All these people saying “we should remember him as the great entertainer he was” would be better off trying to learn a lesson from his life. What is that lesson? I don’t know, but I guess it has something to do with the trappings of fame and wealth, and the dangers of not looking inward.

Fedora 11 Post Install Configuration

Fedora 11 is out, so it’s time to update my notes on configuring my fedora install. In the examples I will use a default Fedora install (with development tools selected), on my 64 bit Sony vgn-s2750N laptop, which I will henceforth refer to as Sunny.

Here’s what I have to do to get Fedora 11 running like I want it:

  1. Fix the DNS lookup bug. On all the machines I administer, this manifests itself as massive dns lookup failures, with the effect that although you can ping an address, you don’t have any internet access (no web browser, no yum…).  This answers the question:  I have an internet connection, but I can’t use the web, WTF?
  2. Access to fusion
  3. Add MP3 support/get Amarok working.
  4. Get Flash working (people need their youtube).
  5. Graphics acceleration
  6. Make FAT partitions writeable by users, and add ntfs support.
  7. Disable physical file folders.
  8. Enable Ctl-Alt-Backspace

1. Fix the DNS bug
Apparently there is a known bug, which mucks up the domain name lookup with certain ISP’s, of which bluewin (my ISP) is one. In the bug description the complaint is that you get unreliable name lookups, but in the case of bluewin (my isp), you get no successful lookups.  A workaround is:

  1. Find out the network interfaces the machine has using the command “route -n”.
  2. Create a file:  /etc/dhclient-< your network interface name here >.conf consisting of the line
    prepend domain-name-servers 127.0.0.1;
  3. Start dnsmasq (‘service dnsmasq start’).
  4. tell dnsmasq to start every time the computer does (‘chkconfig dnsmasq on’)
  5. restart the network connection (‘service NetworkManager restart’)

So on Sunny the Sony I want to get my wireless LAN working right on Bluewin. Running ‘route -n’ tells me my network interface is ‘wlan0’ (which I could have guessed). So I do the following (as root of course):

echo 'prepend domain-name-servers 127.0.0.1;' >  /etc/dhclient-wlan0.conf
service dnsmasq start
chkconfig dnsmasq on
service NetworkManager restart

And presto, my internets work again. I don’t put it on this list, but at this point I run a ‘yum -y update’ to get the base install up to date.

2. Access to fusion:
Fusion is a merge of the largest existing addon repos, and means to be the extra repo for fedora, including (separate) free and non-free packages that Fedora is not able to ship of license or export regulations (see comment by ingvar).  Apparently it is now possible to add fusion support through a GUI, but I find it much more efficient to just do:

rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

This is a good time to do another yum update. You’ll have to accept a couple of no-key warnings.

3. mp3 support.
I still use Amarok, which I am still unsure about recommending. I found Amarok 1 vastly superior to the alternatives however, so I’m hoping Amarok 2 eventually becomes awesome. In addition to Amarok, I want lame for when I rip my CD’s for my car mp3 player, mp3 support for Totem, etc. So I do the following:

yum -y install amarok lame* gstreamer-plugins-ugly xine-lib-extras-freeworld

And things seem to be running all right.

4. Get Flash (i.e. Youtube) working This solution comes from here

rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
yum install nspluginwrapper.{i586,x86_64} alsa-plugins-pulseaudio.i586
yum -y install flash-plugin

Note that the third line is only required for 64 bit Fedora.

5. Enable your 3d hardware acceleration. In my case, I just run ‘yum install kmod-nvidia’ and restart X. If you have a radeon card, I suppose the solution is the obvious one.

6. Make the fat drive writeable, and add NTFS write support, so people can easily work with Windows.
For any fat partition, change the umask in fstab to 000. For NTFS support:

yum -y install ntfs-config.noarch

7. Disable “physical” file folders. This is the annoying behavior, default in gnome, that opens a new window for every folder that you open. Get rid of it by double clicking on a folder, and in the resulting window open edit->preferences->Behavior, and check the box for “Always open in browser windows”. There is a scriptable way to do this, so if someone wants to tell me, please do.

8. Enable ctl-alt-backspace.It always frustrates me when a distro moves away from supporting the power use to supporting the neophyte. I think there are plenty of neophyte oriented OS’s and distros around. I use Fedora instead of Ubuntu because Ubuntu aims too much at the dumb asses, and Fedora tends to support the people who want to learn and be efficient. Unfortunately the Fedora guys do make dumb-ass-friendly decisions, such as the decision to disable ctl-alt-backspace, which I find to be a very poor decision. Who hits this key sequence by accident? Anyway, to enable it in Fed 11 do System->Preferences->Keyboard, choose keyboard layout options and enable the checkbox for “key sequence to kill the x server”.

Exporting emacs org-mode html, ain’t sed grand.

I’ve recently begun using emacs org-mode, and I quite like it.  I do a lot of my writing, some of which might finally end up here on my blog, in org-mode these days.  For a lot of my applications it’s a perfect overlay on plain text documents.  I can export what I’ve written as html or latex, which is fantastic.

What’s less fantastic, is when I want to cut and paste the html output here to my WordPress blog.  Unfortunately org-mode puts in linefeeds between paragraph elements, and for some reason wordpress maintains these, resulting in incorrect word wrapping.  So I want a way to remove the the linefeeds between paragraph elements.

This was just a little bit beyond my capabilities with SED, and I’m often telling myself self, you should really learn how to use sed and regex terms better . So I thought bugger it, let’s figure out how to do this. So I whipped out the excellent book “sed&awk” from O’Reilly.

As someone who has only used sed for banal substitutions, I had to learn the following:

  • “:whatever” can be used to create a label.  There are two commands that allow you to utilize these lables: “b” creates a branch, while “t” jumps to a label if a successful substitution has been made on the currently addressed line.
  • “N” is needed to join two lines, since sed normally works on a one-line-at-a-time fashion.

With these two tidbits, and a basic understanding of how sed operates, we can construct the desired script.

:top
/

/ {:loop N s/\n/ / /<\/p>/{P;D;btop} bloop}

In one line the command looks like this:

 sed ':top;/<p>/{:loop;N;s/\n/ /;/<\/p>/{P;D;btop};bloop}'

If you’re like me, it’s not immediately clear what’s going on here, so let’s break it down:

  • First we create a label with “:top”.
  • “/<p>/” tells sed to look for the paragraph block tag.  The next ‘line’ of the script will be called after this tag is found.
  • The curly braces “{}” group a set of commands, so upon encountering the paragraph tag, it executes the contents of these brackets.   In the brackets:
    • Create a new label “:loop”.
    • “N” creates a multiline pattern space by reading the next line of input, and appending it to the contents of the pattern space.
    • “s/\n/ /”: substitute a space for the line feed.
    • “/<\/p>/{P;D;btop}”:  If sed encounters an end of paragraph tag, it executes “P;D;btop”, which (P) prints the contents of the multiline pattern space, (D) deletes it, and (btop) creates a branch(b) and goes to the label(top).   It’s a little like “if (<p>) goto top”.
    • “bloop” (b) branch and goto label(loop).

So as long as no closing tag (</p>) is found, we have a loop that keeps adding new lines to the multiline pattern buffer, and substituting spaces for linefeeds.  When the closing tag (</p>) is found, the loop goes back up to the “top” label.  That loop makes sure all of the  paragraph sections get handled.

So that’s it.  If anyone knows a more elegant solution to this, I’d be glad to here about it.

    Cannabis & Diabetes

    Cannabis and Diabetes

    A couple of years ago my mother started having chronic pain due some problem I don’t understand in her spine. She’s been on-and-off some pretty potent narcotics to manage the pain, and as been going to get her nerves cauterized every six months to make the pain bearable. It sounds perfectly horrible, not to mention unsustainable.

    Several months ago she was diagnosed with Diabetes. So she had to quit drinking alcohol and eating sweets. The nerve pain means she can’t play golf anymore. So this drives me nuts because it seems like she can’t enjoy so many of the things that she always has.

    All this got me thinking I’d like to get my mother to try Cannabis. The first reason would be to handle her chronic pain in a healthier way than the narcotics she currently has to take ( the risk and toxicity assessment of cannibanoids verses pharmaceutical pain relievers tends to be favorable. I would welcome any contradicting evidence). But is it safe for a Diabetic to consume cannabis?

    The propaganda problem

    The worst effect of the drug war is how difficult it makes getting good information. You simply can’t trust most of the information that’s available, particularly if it comes from a government agency (It is in the the charter of the ONDCP that they lie about the real effects of prohibited drugs. Googling the issue will help, but you first have to sort through a lot of “we have to protect our diabetic kids by feeding them propaganda” bullshit. If you’re willing to wade through the cruft, you can find some real information. Here’s a summary of what I’ve been able to find.

    Dangers to diabetics (negative indicators).

    The only real danger I have been able to find regarding cannabis use for diabetics is the decreased judgement and increased appetite. It might be best to try it for the first time with a controller.

    Benefits to diabetics (positive indicators).

    It turns out there is a overwhelming body of research to show that cannabis has many benefits for diabetics.

    • There is evidence that cannabis enables insulin production.
    • There is a large body of anecdotal evidence that medical cannabis may help stabilize blood sugar.
    • The anecdotal evidence is backed up by recent studies showing that Cannaboids arrest the onset of autoimmune diabetes in NOD mice
    • Yissum believes that Cannabidiol is a future drug against diabetes, and is in the process of patenting its cannabis extract.
    • Cannabis is a vasodilator and improves blood flow.
    • While cannabis is not generally thought to be an anti-hypertensive, (meaning it is not a replacement for ACE inhibitors), it contributes to lower blood pressure, which is an important concern for diabetics.
    • Cannabis is an effective substitute for muscle relaxants in the treatment of restless leg syndrome.

    Conclusion

    If you’re a diabetic, it would seem worthwhile to consult with a competent physician regarding using cannabis as a treatment for your condition. If you are concerned about some of the supposed dangers associated with cannabis consumption, I would refer you to this excellent table of marijuana misinformation