Slashdot is powered by your submissions, so send in your scoop


Forgot your password?
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 internet speed test! ×
User Journal

Journal Journal: Some of my Perl coding style (transferable to anything)

  • Always use "use strict;". Include "use warnings;" during development and when there will be no "users".
  • Use proper scope
    Declare all variables with "my" or "local"; "my" is preferred because it is more commonly used and understood.
  • Blocks are indented by two spaces
    All blocks are indented two spaces (not \t but spaces).
  • Blocks include their brace before the indentation and after
    If braces are used, they are placed on the line that begins the block and on a separate line after the block.
  • Comments that end before the 70th character are on a single line without leading comment lines. Comment lines that end after the 70th characters have a preceding and following comment line.
  • Arrays are instantiated with elements on individual lines, indented to match the first character of the first element with the opening parenthesis on the same line as the first element and the closing parenthesis on the same line as the last element.
User Journal

Journal Journal: Asychronous error messages suck.

I've spent a few minutes trying to debug this script I wrote. It was working but then would throw an error about failed concatenation--the error was coming up in the middle of a segment that should have worked fine. For that matter, the error was being through by a part of a script that didn't run until later.

Fuck. Stderr is running faster than Stdout.

Did I tell you to buffer Stdout? NO. Now get in the kitchen and sprintf("%s", $pumkinpie).

User Journal

Journal Journal: Problems escaping quotes in SSH

I needed to loop through a whole bunch of machines today and run some commands that included nested perl stuff. No matter what I escaped, it continued to puke and complain about something new. What I discovered was that I could set an environment variable with the command I wanted to exec remotely and interpolate that into my ssh session--this required fewer escapes than otherwise.

$ x="perl -e 'print \"\$foo\n\";'" ; ssh bar.baz "$x"

Not sure how I missed this before--maybe I found another hack a decade ago and I've since forgotten.

(My real example involved lots more quotes and "special" characters. This is a huge shortcut for me.)

User Journal

Journal Journal: Old school.

I'm still using LILO and OSS.

I migrated one machine from LILO to GRUB and it caused me headaches. Since I don't muck with my kernel often, the added step of loading it into the MBR doesn't bother me. If it ain't broke, don't fix it.

OSS, OTOH, needs to change. Flash 9 requires ALSA on Linux and I can't seem to get it to work otherwise. Maybe it's time to join this modern shit the kids are doing.

User Journal

Journal Journal: Gooeys

Some people say, "GUIs are for idiots."

I say, "GUIs are for tools."

User Journal

Journal Journal: Fluxbox Menus

One item I've always lacked in my fluxbox menus was an option to shutdown or restart the local system. I've seen those items in Gnome and KDE (and others), but I guess fluxbox just missed it (so I may submit this).

Creating a script to run shutdown from X is pretty simple:

/usr/bin/sudo -k
/usr/bin/gksudo -g -t "Confirm shutdown" -m "Enter your password to shudown the system:" "shutdown $1 $2"

I guess I could have figured out what script Gnome or KDE were using, but this was honestly faster.

Adding it to the Debian menu system in the way I wanted was less clear. Adding items is incredibly simple (see the very good documentation for menu), but it was sorted alphabetically and I wanted it listed at the bottom of the initial menu, below all of the submenus and above the options to manage my fluxbox session. These are controlled by the system.fluxbox-menu file (in /etc/X11/fluxbox/, copied to ~/.fluxbox/); manually adding "exec" commands there was what I needed.


User Journal

Journal Journal: Greater efficiency with 'screen'

I've been a screen fanatic for years. I have a tendency to work on a great number of "things" simultaneously, but I hate having lots of terminal windows hanging around. Tack on the ability to access sessions remotely (or to preserve them in case of an X crash) and screen is essential.

A standard sysadmin function will be to run the same command on multiple systems, whether it's installing a new package or modifying a file. Tools like clusterssh have allowed SAs to automate some of this, but it must open a terminal window for each session. I've now found a simple way to do it with screen.

Create a file with a list of your hostnames:

$ cat machinelist.txt

Now, instantiate a screen session:

$ screen -d -m -S test

Populate the screen session with your hosts:

$ while read h ; do
echo $h ; screen -d -r test -X screen -t $h ssh $h ; sleep 3
done < machinelist.txt

(I've had problems without the sleep statement; I think screen runs over itself)

Close (kill) the original screen window, which is not attached to a remote host:

$ screen -d -r test -p 0 -X kill

Now we can run anything we want on each host (virtually) concurrently:

$ while read h ; do
echo $h ; screen -d -r test -p $h -X stuff "groups
" ; done < machinelist.txt

User Journal

Journal Journal: Disturbance

I felt a great disturbance in the Force, as if millions of days of uptime suddenly cried out in terror and were suddenly silenced.

My office building lost power.

User Journal

Journal Journal: Thermocoupler is a go!

I installed my first thermocoupler on Friday.

At 7AM Friday morning, about three hours after I went to sleep, my wife woke me up to tell me we didn't have hot water. Ignoring for a moment that she didn't know how to check the pilot light, I wandered into the garage and tried to re-light it. It would light but wouldn't stay on once I released the pilot button. After a quick google search, there was almost unanimous internet agreement that I needed a new thermocoupler.

Essentially, a thermocoupler is a fancy thermometer. It sits in the path of the pilot light and sends input back to the gas gauge. If it detects heat then the pilot light is lit and the gauge should release gas. No heat means no pilot which means no gas (else the house fills will gas and goes BOOM!). A thermocoupler is a $10 part which can cost more than $100 to have a "professional" replace, but can usually be done without touching any gas lines and I went back to sleep with plans to get and install it at a more reasonable hour.

Lowes had them for $6 and I picked up two; one site had recommended this in case the first replacement didn't fix the issue, just in case you got a dud. I was being overly careful, so it took longer than I expected, perhaps 20 minutes, to swap it out. The pilot stayed lit properly after that.

User Journal

Journal Journal: iBook therefore iAm

Yeah, I'm sure someone's used that joke before. Sue me.

What? Fuck, I got a cease and desist letter already? Steve Jobs has trademark on any word which begins with a lowercase 'i' and the next letter is capitalized? Yeah, this helps innovation.

So I pulled out my Mac today so I could work from my living room, since my wife was working on the family computer and I figured I didn't need to be in my office to do my stuff. I didn't get much time to work, as she pulled me into her work, but whatever.

So I'm working on the Mac now and realizing (again) that one of my big annoyances is the single (small) desktop that only really lets me keep one app in view. Hmmm, what's this, a program called Desktop Manager that lets me have multiple virtual desktops a'la X? AWESOME!

So it's working pretty well and after some minor config changes I'm a bit more productive. Next I need to figure out how to repartition this bitch so I can install Linux--not sure if I want Debian Sarge or Ubuntu, but hopefully something that won't clobber the CPU on this when I want to watch a movie.

User Journal

Journal Journal: Ubuntu, Debian, Windows

I have a work laptop that I originally set up to triple boot Win2k, Debian, and Fedora, all through lilo in the MBR; Win2k so I have it for the marketing or management dork who presumes everyone is using Windows, Debian because that's what I normally use, and Fedora because I had wanted to test it for possible use on servers (at the time I was admin'ing a lot of old RH boxes). Unfortunately, I never got Fedora on there because the installer is stupid and I don't feel like wasting my time explaining why.

Anyway. So I've had this dual boot for a while and I decided to try and move from lilo to Grub on my Debian install; cool, went ok, but I couldn't get it to boot Win2k. It appears that somewhere along the way Grub nuked the Win2k boot loader at the begining of hda1. Oooh, that's bad. It also turns out that the system never realized I went to Grub, so when I upgraded kernels it configured lilo.

Anyway. I thought I would need to re-install Windows, but I was surprised to find out that I was able to reinstall the bootloader without dorking Debian. Go Microsoft! (Mark that one kids.)

So as part of this, I wanted to repartition my *nix slices and reinstall Debian using Grub. I also threw on Ubuntu because a friend has been raving about it. I was very impressed. Aside from manually partitioning the drive (it offered to do it automagically, but I don't think it would have done it properly), the system installed itself. It configured my regular user with full sudo, set up both network interfaces (and eth1 stayed eth1 when not docked, a very neat trick), configured both the scroll-wheel external mouse and my touchpad. All very awesome.

But not all was perfect: without a cd in the cd-rom drive, HAL fails to initalize; the pointer occasionally flakes, both with the touchpad and an external mouse; their default WM is Nautilus, which has very non-standard configs. Other items here and there have cropped up--no show-stoppers, nothing that can't be fixed, but obvious bugs which will hinder its adoption.

I'm considering using Ubuntu in six months to a year, when Debian Sarge is out of date but Etch isn't getting security updates. But one main issue nags at me: configuration. Sure, Ubuntu is Linux and almost infinitely configurable, but it's always harder to undo than start from scratch. In order to get Ubuntu to work in the way that I want and expect, I'll likely have to spend longer than if I started with something more bare. Like Debian.

For the great masses who need choices made for them and a system that "just works", Ubuntu is great. I got my wife to start using it on this laptop and I'll likely replace Win2k on the "family computer" with Ubuntu. Web browsing, managing money and computer games are all that machine is used for. But for my no no. Unless Ubuntu allows me to easily swap out Gnome and anything else I want, it won't make it as a desktop for me or most engineers.

User Journal

Journal Journal: The CDDL and Open Solaris and why the GPL wouldn't work.

There was a story last night regarding Sun's new OSI validated license, the CDDL. I moderated the discussion, so I couldn't comment on it then, but I felt some important things got missed and I needed to throw my voice against the angry mob.

Most of the posts I saw revolved around:
a) Why the CDDL was incompatible with the GPL
b) Why that fact would keep developers from contributing to Open Solaris
c) Sun was using this as a duplicitous attempt to garner free work from contributors without giving them anything in return.

Unfortunately, it's all crap. Well, b) and c), actually, and it's fortunate.

The CDDL and the GPL are incompatible, because the GPL is incompatible with almost every software license, including almost every OSI validated license. The GPL was intended to be incompatible in this way--the intent of almost every software license runs against what RMS wants, so this shouldn't be a surprise.

  • The BSD template license is incompatible with the GPL.
  • The Mozilla Public License is incompatible with the GPL.
  • The Apache License is incompatible with the GPL.

Every license is incompatible with the GPL. The CDDL is no different and it's being singled out by the ignorant and the antagonists.

The real issue is that Open Solaris isn't being dual licensed under the GPL and the CDDL; this is a significant issue but one which was almost completely overlooked. That it isn't being dual licensed will mean some developers won't contribute, but I doubt it will impact it significantly. I would argue that the people who are so tied to the GPL that they won't work under a more restrictive license have no incentive to work on Solaris to begin with. Open Solaris is a boon to those who already use Solaris or to those who want to use Solaris but are prevented due to some incompatibility which could be resolved with access to source code.

That's what individuals get out of the CDDL; what started RMS on his quest was an inability to fix a problem that he had identified but the vendor wouldn't resolve. In this case, you can. Sun has made it open so that you can fix it and distribute it. You don't have the same rights as under the GPL, but you won't get most of those rights under any other license. The CDDL is very generous; it makes available plenty of code Sun will write and makes available the opportunity to use and modify that code, inside or outside of Open Solaris. That's powerful.

So the three issues harped on endlessly really aren't issues at all. I think Open Solaris should be dual licensed, but that's separate from what the mob has brought up. Another concern I saw in a Groklaw article was that the CDDL does not require that anyone identify what is covered by the CDDL and what is not (as the MPL does, which the CDDL is based on). So I could write code under the CDDL and include code not licensed under the CDDL and I have not responsibility to tell you which is which. That's dangerous. The CDDL gives patent protection for code under the CDDL but not for any code included which is not part of the CDDL. Dangerous again. In this world where a company doesn't even need infringement to send threatening letters and attempt to extort money...where big players have the money and endless patent portfolios to hammer a small business that has worked entirely in good faith...

In the end, Sun should alleviate concerns by identifying code and patents not covered by the CDDL; in this way, others would know what the restrictions were and their responsibilities if they re-use the code.

As for the rest...just FUD. Sun couldn't release Open Solaris solely as GPL: Solaris is dependent upon proprietary software that would be incompatible with the GPl, so they needed a less restrictive license which would allow them to include that code. It's that simple. The GPL would not have worked. They can dual license the source that they own, and they could do it anytime in the future. The sooner they do it the better, so that contributors do not submit code under the CDDL which would be an immense project to re-license (one would have to contact each contributor and have them agree to the re-license).

There are issues with the CDDL that need to be resolved, but (as often occurs) little intelligent was discussed on Slashdot; what bothered me more was that Groklaw even managed to delve into FUD rather than fact. In this I'm finding Groklaw not to be about either law or grokking and entirely about pushing their own agenda.

Beware attempts to demonize; you're more often find the demons doing the denouncing than being the victims of it.

User Journal

Journal Journal: Encourage Women in LINUX?

Originally posted as a comment to join-the-dots

I wish I had more time to expound upon this. Maybe if I remember it in a week, I'll write a longer disection of the HOWTO. Until then, I hope this is complete enough.

I was greatly disappointed by the HOWTO. The stated intent of the paper is a noble one; unfortunately, the steps presented are counter-productive and sexist on their own. Instead of saying "Linux geeks should be nicer to newbies," it says "Guys should be nicer to women." No. Either I can be an asshole to everyone or I can't. To ask for different treatment for different genders is SEXIST, and when the stated goal is to minimize sexism, it becomes counter-productive.

The HOWTO is a mastubatory effort written by a group which defines itself by sexism: "the focus is on women and we attempt to maintain a female-dominated environment." Great. If a man tried that he would immediately be jumped on as sexist and discriminatory; but in this case, the individuals are empowered (or some such crap).

The HOWTO ignores that women are just as guilty of reinforcing the stereotypes and sexism as men are; much of this cultural conditioning occurs in school where the majority of teachers are (wait for it) women. The paper encourages vulgarity but not "bitch". It repeatedly asks not to be treated differently but then asks for special treatment-from the viewpoint of the article, it's ok for me to be an ass, just not to women.

I know, the article is directed at women so of course it singles out behavior directed at women. However, the behavior being discussed often doesn't have to do with man/women but more with bully/object. Instead of correcting the root causes which are not gender specific, the HOWTO pushes for gender specific remedies.

Eighty to ninety percent of the HOWTO can be summed up, "Don't be an asshole. Be helpful." That is something many people (man and women) in computing need to adhere to. And if we stick to it, I think you'll find interest in computing increase by _everyone_.

User Journal

Journal Journal: DNS records: HINFO

HINFO is a DNS record type to handle "the CPU and OS used by a host". Imagine that. While people might not want this published to the world, it does cover some of the requests that get covered in the nodename--which is published to the world.
User Journal

Journal Journal: Nodenames

I've seen numerous disputes regarding hostnames. Different conventions, from the abstract (within a pattern) to entirely location based to service based to some garbage that some project manager thought up.

This is a really dumb argument.

There are different points of view here and all of them contain some portion of a good final solution; what astounds me is that groups almost always miss that final solution and shoot themselves in the foot.

Every computer I have ever owned or maintained has used a hostname convention: my originals were named after areas of New York state; I moved to national capitals at home and Muppets at work; after a job change, I lost all my Muppets so I moved to Robotech characters. Even if these seem nonsensical, each host was unique and identifiable and others were easily able to identify my hosts. Those two mundane issues: service identity and host identity, are crucial to any hostname convention.

I recognize now that many people do not properly understand this purpose. I also recognize that I may be forced to justify my position on this repeatedly. As such, I need a treatise--I need a document that lays out once and for all the pros and cons of the dilemma and creates a singular conclusion I can defend.

That or I'll waste a lot of time and get shouted down by a manager who just wants to mark his terroritory like a dog on a fire hydrant.

Slashdot Top Deals

The only perfect science is hind-sight.