Archive for June, 2009

Micheal Jackson is Dead!

 | June 26, 2009 3:13 am

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.

Share on Facebook

Fedora 11 Post Install Configuration

 | June 15, 2009 12:23 am

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”.

Share on Facebook

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

 | June 7, 2009 2:45 am

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.

    Share on Facebook

    Cannabis & Diabetes

     | June 3, 2009 7:56 am

    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

    Share on Facebook