Saturday, March 14, 2009

Unix and Linux Cartoons For The Weekend

Hey there,

The on-call beating continues... ;)

Enjoy these cartoons from UberGeek.tv. The first one is actually an interactive swf file called "What's Wrong With This Picture?" Enjoy finding the answer :)

I really wish I could find 5 minutes to write a decent post, but (and I don't believe in superstition) it's Friday the 13th, so every fidgety wonk with a bad refresh rate set on their monitor is calling me 24x7, just in case. Who knows, perhaps by calling me, they really have saved their own lives. I guess I'll never know... Although, I'm considering running a test very soon ;)

Cheers,










, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Friday, March 13, 2009

Not Even Linux Is Safe From Windows Viruses

Hey there,

Of course, it actually is totally safe. Linux and Unix users have nothing to worry abbout, unless they're running in VMWare on Vista ;)

Here's another funny picture I found at 10dailythings.com. I hope you enjoy it and stop by there for even more goofy pictures.

Apologies to regular readers for this week's weak writing. I either have to go back work or go pass out. It's a miracle I can even type.

Here's a little sneak peek inside my mind tonight:

abababbababbbbabbbbabbbababababbbbaabababbabbabaabbabLinuxaabbbaabababUnixagaabbabbabbabRightAwayaabbabababbbaUpForThreeDaysInARow-NoProblemabababababababab

????

And, yes, I am on-call this week;)

Cheers,

Click the picture below unless you have super-vision and can actually read that error message ;)



Windows Virus On Linux



, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Thursday, March 12, 2009

Unix and Linux Workplace Sadomasochism: Possibly As Bad As It Sounds.

Hey there,

Ever Feel Like Killing Your Boss? Me neither, officially, but after a day like today, I can't get that old Feederz album out my head. Great tunes, if you're feeling punky and vengeful ;)

As I sit and reflect on my work-day (and the non-stop Unix and Linux weekend suck-a-thon coming up) I think (for only about the third or fourth time in my life) that just hiring someone to kick me in the nuts every 10 minutes or so (at random intervals, to keep it interesting ;) has actually surpassed showing up at work, and being figuratively kneed in the sac, on my list of top ten ways to spend my day.

While I ice my bruised ego and get mentally detached enough to VPN in to do even more work tonight (so I can be almost on-track by tomorrow morning) I thought I'd put up this great piece of work-related humor that's eerily similar to what I've been thinking all week. The site I got this from is called WhyWorkSucks.com and is well worth checking out. I'm going to be hopping on this gentleman's mailing list, because I can't wait to read the book he's working on. As he states on his page, he's not looking to sucker you; just keep you informed. Kind of like we do here. No spam, just updates if you want them (In the right hand column; handled through Google - who have acquired FeedBurner - so we never know who you are or what your email address is).

Enjoy the following and find out if you've got the stuff it takes to make it in management! Also, check out whyworksucks.com. There's a lot of great stuff on that site, including interactive pages like the "Wheel Of Policy" and the "CEOmatic 2000," just in case you ever find yourself at a loss for that important sounding, but ultimately meaningless, declaration that may or may not serve to "rally the troops" (bet the other way ;)

Cheers,

NOTE: Clicking on the link, at the bottom of the excerpt below, will take you to the whyworksucks.com website to take the quiz. Hopefully, you don't have it in you. And if you do, please quit wearing the steel-toed boots ;) ...the following has only been modified to show the pictures the hosting company won't allow us to create remote-links to and to make this legible on BlogSpot.



Why Work Sucks


This is a test to see if you're ready
— or even ever capable — of holding a position in management.
This highly accurate scientific, standardized test was developed
by some highly paid consultants who in turn consulted with a
number of focus group participants who in turn consulted with
an inner demon named Lester.



Before we get started
with the test, take a quick look at your writing utensil. If
that writing utensil is a number 2 pencil, put down the test
right now and give yourself an "F." Coming to class
prepared?! How could you be so incompetent! You're never going
to succeed that way!



If — even now
— the thought of finding something to write with hasn't
crossed your mind, give yourself a 1,000-point head start.



Are you ready now?
Click here to begin the management quiz.



© Copyright 2000 Why Work
Sucks
. All Rights Reserved.





, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Wednesday, March 11, 2009

Locating New Backup Hardware Using Veritas NetBackup On The Solaris Unix Command Line

Hey there,

Yesterday we took a look at the basics of using Veritas/Symantec NetBackup to add a new TLD and drives to your existing machine. Today, we're going to go just one step beyond and assume a fairly commonplace situation, which has somehow, inexplicably arisen from THE SITUATION we found ourselves in yesterday. For some reason (and this hardly ever happens ...not sure which word to emphasize to obtain the maximum sarcastic drippage) after we connected our new Tape Loading Device (TLD or Tape Robot), and the two drives it contains, to our backup server, NetBackup - and, possibly, the server itself, is failing to recognize the new device(s). Again, we're going to assume that both the server, TLD, drives and all other hardware are absolutely fine and that all required connections between the devices are set up properly.

NOTE: Today's post is going to assume that some tried and true methods will get you to "good." Tomorrow's post will look at some other ways to make NetBackup recognize and work with your "known good" (and compliant) setup.

If we take the same direct route to initial discovery that we did yesterday, we'd run the same sgscan (which is, as one reader noted, shorthand for "sgscan all") command initially, like so (pardon the error output. I can't afford to create the situation I want to display so I'm doing it from memory):

host # /usr/openv/volmgr/bin/sgscan
/dev/sg/c0t0l0: Disk (/dev/rdsk/c0t0d0): "SUZUKI MBB2147RCSUN146G"
/dev/sg/c0t1l0: Disk (/dev/rdsk/c0t1d0): "SUZUKI MBB2147RCSUN146G"
/dev/sg/c0t2l0: Tape (???): "Unknown"
/dev/sg/c0t3l0: Cdrom: "Hyundai DV-W28E-R"
/dev/sg/c1t0l0: Changer: "Unknown"
/dev/sg/c1t1l0: Tape (???): "Unknown"


Basically, every line where it says "Unknown" is where we're interested in looking. The system can't find our TLD or its drives, so now we have to try to discover them ourselves (with and/or without NetBackup) and then come back around and use NetBackup to verify that we're okay. These steps are pretty dry, but I think if you follow them in a somewhat linear order (skipping some or doing some before others, if you're comfortable) they should get you to where you want to be. Fat, happy and with a TLD your backup server recognizes. Okay, maybe not happy ;)

Note:
If you feel uncomfortable about running any of the commands below, please enlist the assistance of someone who is either able to provide guidance (since each case is unique) and/or will get in trouble instead of you if things to go to Hell ;) j.k.

And, here we go. These steps won't be numbered, so I can't possibly screw that aspect up, but should be easy to follow since each command will be separated by space and begin with the "host # " prompt. Some of these commands, as the title of today's post suggests, may not exist on a flavour of Unix or Linux that isn't Solaris.

First, we'll take a look at our device tree. Do the device links listed in sgscan exist? Also, is /dev/rmt populated at all?

host # ls /dev/sg/c0t2l0 /dev/sg/c1t1l0 /dev/sg/c1t0l0 /dev/rmt
/dev/sg/c0t2l0 /dev/sg/c1t0l0 /dev/sg/c1t1l0

/dev/rmt:
0 0cb 0hb 0lb 0mb 0u 1 1cb 1hb 1lb 1mb 1u
0b 0cbn 0hbn 0lbn 0mbn 0ub 1b 1cbn 1hbn 1lbn 1mbn 1ub
0bn 0cn 0hn 0ln 0mn 0ubn 1bn 1cn 1hn 1ln 1mn 1ubn
0c 0h 0l 0m 0n 0un 1c 1h 1l 1m 1n 1un


They appear to be there, but they're probably bad. Let's try devfsadm, all on its lonesome and check sgscan again (From now on we'll just assume the output is the same as the train-wreck we witnessed above, until we get to the end. Hopefully, your journey will come to a close sooner!):

host # devfsadm

If this fails to produce results, you can try to run the same command with the "-C" option to remove stale links that no longer point to a valid physical device path:

host # devfsadm -C

Of course, if you know that you only had two tape drives before (/dev/rmt/0 and 1) and believe sgscan when it says it can't recognize the paths we listed, you can delete all of that stuff and try those two steps again. Sometimes it helps to force Solaris to recreate the dev links:

host # rm /dev/rmt/*
host # devfsadm -C


should be enough, but you can almost certainly do this, as well:

host # rm /dev/rmt/* /dev/sg/c0t2l0 /dev/sg/c1t1l0 /dev/sg/c1t0l0
host # devfsadm -C


Running the "ls /dev/sg/c0t2l0 /dev/sg/c1t1l0 /dev/sg/c1t0l0 /dev/rmt" listed above will, almost always, give you the same results once you've completed these steps.

You might also run this command if you have the drivers installed:

host # cfgadm -al

If you find a section with /dev/rmt1, /dev/rmt0 and the /dev/sg path to your Changer in it, and one or some of them are showing unconfigured (all the sections start with a controller number and a colon - in our setup the output is "c2:xxxx") you can either specifically configure any of the entries listed behind the controller number, by using the entire device name your rmt and disk changer devices are listed beside, or you can just configure the whole shebang. Why not?:

host # cfgadm -c configure c2

Listing it again with "cfgadm -al" should show all the appropriate devices as "configured." If it doesn't; don't worry. It probably doesn't matter, but was worth a shot.

Both "tpconfig-d" and "tpconfig -dl" will give you back the same results as sgscan (although formatted differently and limited to the tape and TLD information) if the problem still hasn't resolved. To save space and prevent carpal-knuckle syndrome, full versions of the output of these commands, as run against a working setup, are located at the bottom of yesterday's posts as a series of in-page hyperlinks. The only things that will be different in your execution of:

host # tpconfig -d

and

host # tpconfig -dl

output will be that the drives will usually either show up as DOWN ( possibly with an identifier - for us, hcart2 - and path like /dev/rmt/0) or you will get virtually no output at all ...yeah, I guess that's a "huge" difference :) If you notice that tpconfig returns a listing for you, this is positive, even if it shows your drives as "down." We won't go crazy yet, since we were going to run the next command, regardless:

host # vmoprcmd

Now we may get results that show "HOST STATUS" as <NONE> or, hopefully ACTIVE (good to go!), ACTIVE-DISK (can do local disk backups), ACTIVE-TAPE (can backup to tape, but, for some reason, can't backup to local disk) or even DEACTIVATED (either it's off or NetBackup thinks it is) or OFFLINE (Same as the last, except substitute offline for off ;) Your drives will also show as either non-existent, UP, UP-TLD, RESTART or DOWN (perhaps a few others, but all of them self-explanatory). As long as the tape drive type (hcart2 for us) is shown, you're on the way.

And the final things we'll try today will be to react to the output produced for the Tape Drives. If your TLD is still not showing, that's something for tomorrow. If you see your tapes in a DOWN state, but correctly identified as the types of tapes they are, this will probably do the trick for you:

host # vmoprcmd -up 0
host # vmoprcmd -up 1


for the first (0) and second (1) instance of the drive, listed in the first "Id" column of "tpconfig -d". You can also do this, which is easier (at least for me) to remember, since you can directly map it from the vmoprcmd output without squinting ;)

host # vmoprcmd -upbyname Drive000
host # vmoprcmd -upbyname Drive001


from the vmoprcmd output in the "Drive Name" column, which also happens to be the first column in the "vmoprcmd" output.

When you're done with that, or if your tape drives show as RESTART, do yourself a favor and stop and start NetBackup. You may not get a chance once you let everyone know it's fixed. If you don't have other startup scripts set up, you can use:

host # /usr/openv/netbackup/bin/goodies/netbackup stop

then run:

host # /usr/openv/netbackup/bin/bpps -a

and, if everything is gone (unless you're running the GUI - it's okay to not kill those PID's), start 'er up again, like so:

host # /usr/openv/netbackup/bin/goodies/netbackup start

and do another "bpps -a" to make sure all of the appropriate daemons are running. Then, just to make yourself feel better, and so you're absolutely sure, do one more "sgscan." All should look as it did in yesterday's post (see link-back above) and you should be all set. At least, you'll be ready to test some backups and pray that your troubles are over ;)

We'll be back tomorrow to look at some ways to deal with really pernicious and aggravating software and OS failures. Until then,

Cheers,

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Tuesday, March 10, 2009

Using Veritas NetBackup To Add A Changed-Robot-And-Drive On The Solaris Unix Command Line

Hey there,

Fans of useful information, skip straight to THE SITUATION (hyperlinked and in caps for easy case-sensitive searching, NOT BECAUSE I'M SCREAMING OR ANYTHING!!! ;) as soon as you grow tired of the preamble.

I think today's post's title represents the first time I've ever so blatantly hyphenated part of an awkward sentence in order to make it seem intelligible (and not so incredibly long). As I read it now, I wonder what I was thinking. Much the same as I do every time I proofread my work. The only certain thing in this world is that I will find fault with this sentence ( probably, yes, this entire paragraph ) when I proof-read it later ;) Now that my neuroses have been shoved out the back-door, we'll get on with it.

Today we're going to look at a quick way to adapt an existing Veritas/Symantec NetBackup setup to a new set of peripherals on Solaris Unix. Due to the sheer amount of output options (which may or may not be of any use to you ever) available in almost all of NetBackup's commands, I've made my examples somewhat lengthy (although, I've cut a lot out. Those points are somtimes highlighted by ellipses - not to be confused with the ellipses used to convey the sense that my mind is wandering and my inner-or-outer-voice is trailing off into an inaudible mutter... Ellipses are really hard to convey emotion with... Thank God for the winky-eyed thingy - here's hoping I've been doing it to the correct side my entire career ;)

So, for today, we're going to assume you're running Veritas/Symantec NetBackup, approximately version 6.5.x. We'll also assume that you have NetBackup fully installed on Solaris x.x and may or may not have any number of add-on's (like Oracle or Vault modules, etc). The add-on's generally won't play into this, so we're going to forget they exist. Removing extraneous elements from the equation (if you can reasonably afford to discount them) is the best way to troubleshoot (which we won't be doing today, but I had to include that line to set up the next post... ellipses again ;) Ideally, you'd only have NetBackup running, with no add-on's or extras except the Standard License. I don't know how often that happens. I've never worked any place that didn't, at least, have multiple licenses for backing up multiple OS's. But, there you have it. Your basic setup.

Also, probably important, today we're going to look at the way things "should" go for you (with multiple commands or options to explore where possible). Tomorrow, and/or the day after, we'll look at how to figure out (and fix) what's wrong when things "don't" go as they should.

THE SITUATION: Your old tape robot, along with the drives inside it has inexplicably gone bad, you've spent hours and exhausted your support contract trying to fix it somehow, but, ultimately, you're left facing the fact that your trusty old steel-and-plastic-jukebox just isn't going to come back. Ever. If you're lucky, your warranty allows for replacement of the tape robot (A Tape Loading Device or TLD) and its internal drives (2, for now, to keep things simple - hcart2 drives, just because). Worst case you've purchased suitable replacements that match the specifications listed in the previous sentence.

Probably, your /dev/rmt directory is populated and you may even have some other logical paths created on your Solaris system that are no longer valid. Once you've connected your "MaxTape24" TLD (which exists only in my imagination, with it's two internal "FACTOTUM-TD2" drives, both working properly according to the on-board diagnostics), you should be able to verify that your system (at the very least) can recognize the TLD and, hopefully, the drives inside it. Assuming all of the equipment is good, and that it's been hooked up (however you like to daisy-chain it) properly, this shouldn't be an issue. You may choose to run:

host # devfsadm -C

before proceeding, to check for new symbolic links that need to made in your hardware device tree (and, with the -C option, remove ones you no longer need - Operating System's discretion, unfortunately), although it may not be necessary.

FINDING THE NEW HARDWARE WITH NETBACKUP FIRST: Now, contrary to what it seemed like I was leading in to, we're going to try to get NetBackup to do all the OS-work for us today (because, if it works, it's f'ing brilliant. Good job. Go home and relax :) Actually, you could probably look at this more as a way of giving NetBackup a good kick in the arse. The kind of kick that makes it stand up and take account of its surroundings ;) A good way to get started is to run the following at the command line (Oh yes, there will be no GUI instruction in these posts. If you use the GUI - which is okay - just right click on the type of thing you want to do something to and select whatever seems to be the most reasonable option from the drop-down menu. ...last on that:)

host # /usr/openv/volmgr/bin/sgscan <-- I would recommend including /usr/openv/volmgr/bin, /usr/openv/netbackup/bin and /usr/openv/netbackup/bin/admincmd in your PATH variable if you spend a lot of time working with NetBackup at the command line.

/dev/sg/c0t0l0: Disk (/dev/rdsk/c0t0d0): "SUZUKI MBB2147RCSUN146G"
/dev/sg/c0t1l0: Disk (/dev/rdsk/c0t1d0): "SUZUKI MBB2147RCSUN146G"
/dev/sg/c0t2l0: Tape (/dev/rmt/1): "BMI FACTOTUM-TD2"
/dev/sg/c0t3l0: Cdrom: "Hyundai DV-W28E-R"
/dev/sg/c1t0l0: Changer: "TLDHAUS MaxTape24"
/dev/sg/c1t1l0: Tape (/dev/rmt/0): "BMI FACTOTUM-TD2"


Your output may differ (even if you run this command on the same box, since I faked up the output to protect the guilty ;), but basically, this output is positive. You'll notice that sgscan has picked up a bit more than just your new TLD and its drives but that's okay. As it stands, this output is very positive, in that you can see that /dev/rmt/0 and /dev/rmt/1 have been properly mapped to the TLD's internal tape drives and the "TLDHAUS MaxTape24" TLD has been properly identified.

Other commands you could use to, basically, get the same information (or peace of mind) would include (but not be limited to) vmoprcmd, tpconfig and tpautoconf. A few examples at the bottom of the post, with the same setup as above (some whitespace has been clipped to save the virtual trees).

And that's it for today. Tomorrow we'll look at several commands (including some we're using today, but with different options) that can be used to "find" those drives if the system doesn't discover them automatically (the first thing you can try is "devfsadm -C" as noted above, followed by another sgscan).

Until then, enjoy the output and we'll continue on tomorrow. Here are a couple of handy anchor-href's for you, so you don't have to try to figure out where the command you're interested in is hiding out amongst all the flotsam below :)

vmoprcmd
tpconfig -d
tpconfig -dl
tpautoconf -t
tpautoconf -a


Cheers,

vmoprcmd
host # vmoprcmd
HOST STATUS

Host Name Version Host Status

========================================= ======= ===========

host 652000 ACTIVE

host 652000 ACTIVE-DISK

PENDING REQUESTS



DRIVE STATUS

Drive Name Label Ready RecMID ExtMID Wr.Enbl. Type

Host DrivePath Status

=============================================================================

Drive000 No No No hcart2

host /dev/rmt/0cbn TLD



Drive001 No No No hcart2

host /dev/rmt/1cbn TLD



tpconfig -d
host # tpconfig -d

Id DriveName Type Residence

Drive Path Status

****************************************************************************

0 Drive000 hcart2 TLD(0) DRIVE=1

/dev/rmt/0cbn

1 Drive001 hcart2 TLD(0) DRIVE=2

/dev/rmt/1cbn DOWN

Currently defined robotics are:

TLD(0) robotic path = /dev/sg/c1t0l0

EMM Server = host



tpconfig -dl
host # tpconfig -dl

Currently defined drives and robots are:

Drive Name Drive000

Index 0

NonRewindDrivePath /dev/rmt/0cbn

Type hcart2

Status UP

SCSI Protection SR (Global)

Shared Access No

TLD(0) Definition DRIVE=1

Serial Number 1234567890



Drive Name Drive001

Index 1

NonRewindDrivePath /dev/rmt/1cbn

Type hcart2

Status UP

SCSI Protection SR (Global)

Shared Access No

TLD(0) Definition DRIVE=2

Serial Number 0987654321

Currently defined robotics are:

TLD(0) robotic path = /dev/sg/c1t0l0

EMM Server = host



tpautoconf -t
host # tpautoconf -t

TPAC60 BMI FACTOTUM-TD2 4C60 1110365040 -1 -1 -1 -1 /dev/rmt/0cbn - -

TPAC60 BMI FACTOTUM-TD2 4C60 1110364981 -1 -1 -1 -1 /dev/rmt/1cbn - -



tpautoconf -a
host # tpautoconf -a

TPAC60 - - - -1~-1~-1~-1 2 - - - 0 - - - - - - - 0 0 - - host 4 - - 0 - - - -

TPAC60 Drive000 BMI~~~~~FACTOTUM-TD2~~~~~4C60 /dev/rmt/0cbn -1~-1~-1~-1 1 0 0 2 8 10 - - - 1110364981 - 3 0 0 - - host 0 - - 0 - - - -
TPAC60 Drive001 BMI~~~~~FACTOTUM-TD2~~~~~4C60 /dev/rmt/0cbn -1~-1~-1~-1 1 0 0 1 8 10 - - - 1110365040 - 3 0 0 - - host 0 - - 0 - - - -
TPAC60 0 TLDHAUS~~~~MaxTape24~~~~~~~310A /dev/sg/c1t0l0 -1~-1~-1~-1 0 0 0 - 8 - 23 2 1 TLDHAUS_1_9A0206A12 - 2 0 - host host host 0 - - 0 - - - -


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Monday, March 9, 2009

Which Is Better: Linux/Unix Or Windows? ...And Why Does It Matter?

Hey There,

Today, I'm posting an interesting read I found from about a year ago on Education.ZDnet.com. Again, I'm using Monday to prime the pump for a follow up post, because I'd like to get reader input on the subject in question.

The article I'm referring to is at the bottom of this post (with one of the more - at least to me - incomprehsible Pro-Windows arguments I've ever read - although it could just as well have been a pro-Unix/Linux argument if it were written slightly differently).

I've got my own opinions on this subject, but I'm interested to know yours: If you prefer Linux or Unix (which I'm assuming most of our readers do), do you see any reason to continually engage in online-battle vs. the opposing army of Windows users?

Seriously; let me know what you think. Then I'll let you know what I think. ..well, I'll you know what I think, regardless ;) I'm pro-Unix/Linux, but I'll save the rest of it for the follow-up.

Enjoy the argument. Try not to judge the arguers and be objective. Then consider if any of this sort of behaviour is time well spent, a complete waste, enjoyable social interaction, or any combination thereof, etc.

The article, itself, isn't brand new, but then neither is this whole back-and-forth. The original article can be found at ZDnet and is entitled "Why Linux Will Not Displace Windows." I'm looking forward to reading your opinions on this :)

Cheers,



THE ONE RESPONSE TO THE ARTICLE BELOW THAT I FOUND MOST INTERESTING... SO TO SPEAK


You are kidding arent you ?


Are you saying that this linux can run on a computer without windows underneath it, at all ? As in, without a boot disk, without any drivers, and without any services ?

That sounds preposterous to me.

If it were true (and I doubt it), then companies would be selling computers without a windows. This clearly is not happening, so there must be some error in your calculations. I hope you realise that windows is more than just Office ? Its a whole system that runs the computer from start to finish, and that is a very difficult thing to acheive. A lot of people dont realise this.

Microsoft just spent $9 billion and many years to create Vista, so it does not sound reasonable that some new alternative could just snap into existence overnight like that. It would take billions of dollars and a massive effort to achieve. IBM tried, and spent a huge amount of money developing OS/2 but could never keep up with Windows. Apple tried to create their own system for years, but finally gave up recently and moved to Intel and Microsoft.

Its just not possible that a freeware like the Linux could be extended to the point where it runs the entire computer fron start to finish, without using some of the more critical parts of windows. Not possible.

I think you need to re-examine your assumptions.



THE ORIGINAL ARTICLE


Why Linux will not displace Windows


I firmly believe that, all else being equal, the differences between the Windows desktop, the Macintosh desktop, and the Linux desktop are negligible.  With the proper applications, all three platforms will be capable of providing a satisfactory experience for any user.  All three platforms have both free and commercial products available for personal productivity, web browsing, and basic multimedia.  Yet, Windows dominates.  Why?  After all …



  • Apple was first to mass market a fully-functional GUI (though invented at Xerox PARC). 

  • Apple was the first to pre-install their operating system onto their workstations.

  • Apple was first to recognize the value of personal computing to education.


Despite this, Apple's presence does not reach even ten percent of the World's desktops – in Education IT or in the mass market.  The reasons are many but up-front costs certainly play a role.  Nevertheless, Apple is not the subject of this article … I want to talk about Linux! 


In a feature-rich desktop configuration, Linux runs on the same hardware as Windows with comparable performance.  The 'cost' of Linux ranges anywhere from ZERO dollars (for the geeks among us) to $299 per seat (for a one-year RHEL-WS subscription — with 12×5 technical support and 4-hour response.)  For this, the user has complete control over their system configuration.  Yet, with its fixed-price, fixed support, fixed-configuration model, Windows still dominates.  Why?


I just finished reading Vista? No thanks, school says, converts Windows boxes to Linux and I was struck by a couple of things.  Looking to reduce annual costs, the Windsor, CA School District has adopted a variety of solutions centered around workstations running SUSE Linux and Wyse Linux thin-client terminals.  (They use a few Windows and Macintosh workstations but apparently not many.)  Quoting Heather Carver, the district's IT administrator:


"One key to all this is that we're using Citrix (as the bridge) to run Windows apps on thin-client terminals — which the adults are most used to — on the new SUSE Linux 10.1 servers," Carver told DesktopLinux.com. "The kids, well, they adjust to new operating systems and applications very quickly, so a changeover to Linux is no big deal."



Her conclusions are not at all surprising but she ignores another reason why Citrix is needed:



  • most educational software is ported to Windows (and/or Macintosh), not Linux

  • the number of Windows-based titles accompanying textbooks is growing


In short, the absence of high-performance commercial desktop software hurts Linux.  Of course, application availability is a 'chicken or the egg' kind of problem.  Without a critical mass of desktop Linux workstations in people's homes or on their desks at work, there is no incentive to write (or even to port) specialized applications for/to Linux. 


This argument sounds fine until you realize that between OpenOffice and a number of Web browsers for Linux, and a variety of free (or nearly free) applications Linux truly can meet 90% of the needs of those folks who buy Windows today instead of buying Linux.  It's the other 10% though that makes the difference.  (For instance, neither Quicken or TurboTax have Linux ports and neither does iTunes – those are not 'showstoppers' for Education IT but they certainly are for me as a consumer.)


Last week, David Berlind posed a question about the potential threat to Microsoft of the laptop being developed by the OLPC (One Laptop per Child) foundation — targeting school children in the developing world.  (See Image Gallery: Will Negroponte’s One Laptop Per Child be a problem for Microsoft?)  David's point is that this 'little laptop that could' will run a ROM-based Linux configuration.  The question applies equally well to the schoolchildren of Windsor, CA who will be running Linux on thin clients. 


The rationale, of course, is that whatever you were exposed to in school, you are likely going to want when you get out of school.  This is certainly the rationale that Microsoft uses when they grant steep discounts to K-12 public schools all over America — and when they establish enterprise license agreements with large research universities. 


So will the strategy work?  Will these school children clamor for Linux when they get to college?  Will they buy a Linux computer when they graduate from college?  Well, it remains to be seen but, unless Linux vendors get a clue, and soon, I think not. 


Why not? 


Because for Linux, its greatest asset in the machine room — the flexibility of its configuration — is it's greatest liability in the consumer space.  Consumers don't want or need to worry about configuring their computers — nor would most of them even know how. 


The consumer wants a computer which is functional and inexpensive (leaving Macintosh out of the picture for many.)  They have a limited number of needs — write a document, prepare a spreadsheet, send an e-mail, listen to music, share photos.  But, they also have limited knowledge.


If a consumer could walk into their favorite electronics retailer and see a computer running desktop SUSE Linux (or any Linux distribution, for that matter) sitting next to an equally-robust Windows machine at the same price point, and if they could take it home and plug it in a just use it, like they can with Windows, there is no reason to believe that Linux would not be as well received as Windows. 


Unfortunately, this is not a choice most people have.  The fault does not lie with Microsoft.  Nor with Dell or its competitors.  The fault lies squarely at the feet of Linux vendors who do not wish to compete against Microsoft for the commodity desktop workstation market. 


Until they figure out that they MUST compete for the consumer desktop to make a serious dent in Microsoft's dominance of the desktop, they won't make a dent – and no amount of wishing will make it so.


It doesn't matter how great that OLPC laptop turns out to be, or how much those K-12 kids like those Linux clients if they (or their parents) cannot go to the box-store down the street and buy the computer of their choice with Linux pre-installed.   





, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Sunday, March 8, 2009

Sunday Unix And Linux Humor: Vi, Emacs And The Balloon

Hey there,

Hope you're having (or are about to have) a great Sunday. If you live in the U.S.A., you're probably temporarily disoriented because of daylight savings time. I've never been a fan of the give-one-hour take-on-hour-back system, but it was actually necessary a long long time ago (See the original rationale on Wikipedia's Daylight Savings Time Page - The first paragraph alone is enough to make anyone question why we still practice this tradition). Nowadays it just seems like I'm either waking up too late or too early twice a year ;)

I also seem to have offended a few folks yesterday with my meandering religious-philosophical greeting. By way of explanation, the ending, where I wrote "There's always apathy and, quite frankly, at this point I've stopped giving a shit how your day is going ;)" I was working under the assumption that the winky emoticon (as much as I hate it ;) would be enough to let everyone know (by way of symbolic inflection) that I was just kidding. It wasn't the finest line of "goofy" I've ever written, but everything on that line after the word "apathy" was a direct play on that word's meaning (for which Random House Dictionary's primary definition is: absence or suppression of passion, emotion, or excitement). If that sort of stuff offends you, I apologize in advance. If you continue to read this blog, it'll probably happen again. Sorry :)

Today's Linux/Unix humor comes in two forms. One is a straight up joke and the other is an excerpt from an email back-and-forth regarding the Emacs/Vi aspects of a Learning-Unix book (Harley Hahn's Unix Unbound) that's good for a quick laugh. We picked the balloon joke up at get.a.clue.de and we got the Emacs/Vi bit at www.feep.net. Both sites are worth visiting, if only for the fact that they each contain even more decent quality jokes and funnies.

Enjoy, laugh and be merry. Life is short. ...where does the time go? Oh, yeah; we're saving daylight. Which means, that you've officially read this post one hour earlier than your clock may lead you to believe (unless you're like me and have an old fashioned clock that doesn't adjust automatically, and you're also as lazy as me and you just compensate in your head until DST reverts ;)

Cheers,



EMACS AND VI - NO HTML FORMATTING DUE TO LACK OF ENTHUSIASM ;) SOME EMAIL HEADERS REMOVED TO SAVE SPACE.

Subject: Re: The UNIX-Haters' Handbook? (was Re: Who are the most obnoxious computer groupies?)
....

Matthew Crosby wrote:
>In article ,
>Loren Petrich wrote:
>>
>> In my experience, vi is the absolute worst full-screen
>>(character-mode GUI) text editor I have *ever* used.
>> [ and so on in the anti-vi mode ... ]
>
>vi has the fastest, most efficient keybindings around.
> [ and so on in the pro-vi mode ... ]

Harley Hahn's book _Unix Unbound_ (which I recommend, BTW,
to anyone learning Unix) has chapters on vi and emacs. The
vi chapter contains the following paragraph:

HINT: If you are learning vi and you become temporarily
discouraged, take a break and try a little emacs. emacs
will seem so complex and impossible that you will feel a
lot better about using vi.

While the emacs chapter contains this one:

HINT: If you are learning emacs and you become temporarily
discouraged, take a break and try a little vi. vi
will seem so complex and impossible that you will feel a
lot better about using emacs.

Says it all really, doesn't it? :-)




UNIX Humor - balloon






A man is flying in a hot air balloon and realizes he is
lost. He reduces height and spots a man down below. He
lowers the balloon further and shouts: "Excuse me, can
you tell me where I am?" - The man below says: "yes
you're in a hot air balloon, hovering 30 feet above this
field."

"You must work in Information Technology" says the
balloonist. - "I do" replies the man. "How did you know.
" - "Well" says the balloonist, "everything you have
told me is technically correct, but it's no use to
anyone."

The man below says "you must work in Management." - "I
do" replies the balloonist, "but how did you know?" -
"Well", says the man, "you don't know where you are, or
where you're going, but you expect me to be able to help
. You're in the same position you were before we met,
but now it's my fault."


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Saturday, March 7, 2009

User Friendly Comic Strip: More Linux And Unix Humor

Hey There,

All right, it's Saturday again and time, once again, to wish you all a fantastic beggining-of-the-weekend and pray that your deity-of-choice smile down upon you or scowl up at you, depending upon what you believe. Maybe smile up at you, or scowl down upon you, look at you sideways from a random location, give you the stink-eye everywhere and nowhere or just continue to cease to exist. If you're having a bad day and don't like to be bullied into feeling better, feel free to remain miserable (which should be simple, since I've now rudely slapped down several "calls to action" - Have a nice day, God Damnit!!! - or it may, possibly, be more difficult, since now, in order to continue to be contrary, you'll need to be diametrically opposed to having a good day and having a bad day at the same time. No worries. There's always apathy and, quite frankly, at this point I've stopped giving a shit how your day is going ;)

Today, we're going back to the online comic-strip well, and checking out UserFriendly.org. They've been around for a while, and the web comic is also available as an actual book (as opposed to the online ones that may your eyeballs pop and twitch - No subtle suggestion happening here...)

Below are a few decent strips from the recent past. Check out their official website to access the archives and get updates daily! Good stuff most of the time. They've been around since, at least, 1998, and still put out a daily Linux/Unix/Computing-related comic :)

Cheers,












, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Friday, March 6, 2009

More Unix And Linux Wallpapers. Why, Work? Whyyyyyyy?

Hey There,

This post (especially, stuck in the middle of this week) will serve as a reminder to all of us here that not writing stuff before-hand can make the lean times difficult. We're like a bunch of chipmunks with no winter stash ;) Freezing. Cold. Alone. Just waiting for death, which is inevitable since we're starving, it's freezing out and our stomach's won't let us sleep!

OK; it's not quite that dramatic, but it's still depressing. In any event, it's always good practice to do something fun when you've just come to the realization that you're not going to be doing anything useful or helpful, no matter how much you'd like to. The only other alternatives are out-sourcing our efforts (maybe, someday, if anybody wants to ?? ;) and scraping someone else's (which is just a big "no no" ;) Seriously, forget about the emoticon this sentence follows. We don't believe in lifting other people's material unless, like today, we're writing a piece that showcases their work (or collections) and gives them proper attribution. Some unwarranted link-love, if you will. People appreciate that. Probably a lot more than they appreciate link-juice, since that (like pot-luck) could contain just about anything ;)

We hope you enjoy these pictures and, if you really like them, feel free to check out our last Linux and Unix Wallpaper Post. No one claims to have any idea how Jessica Alba ended up second to the bottom desktop graphic on the page. It was completely out of context (except for the darling little penguin), but it probably saved someone's life (Now that's "looking at the bright side" ...without shades - after having abandoned all sense of reason ;)

The first four wallpapers are from GetAWallpaper.com and the last four are from WallpaperLinux.com. The wallpapers that are larger than 800 x 600 were shrunk to fit the page and hyperlinked to. Windoze-Haters will probably like the last one the best :)

Cheers,





















, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Thursday, March 5, 2009

The Mouse That Roared: Killing A Sun Server During Lunch Break

Hey there,

We continue today with our fast-and-furious post week (brought on by a spat of work and family obligations like we've never seen before!). Like they say: "It's all right if your work gets in the way of your hobbies, but if it gets in the way of itself..." No, wait. That saying goes the other way and is completely inappropriate ;)

Today we decided to test the age-old proposition that any Goliath can be brought down by a David. In this case, we pitted a simple shell script against a SunBlade 150 with 1Gb of RAM (Half of what it can support) and a 650 MHz UltraSPARC IIi CPU (About as good as it can get). The entire experiment took about 30 minutes, because we only ran it until we got sick and tired of waiting.

The end result was a machine that was completely unusable from the console, unreachable via telnet, ftp or ssh and, somehow managed not to panic and crash after about 1000 faults of every kind and color. We're confident it would have eventually gone down, but it was surprisingly robust (in that respect). If we have hours and hours to spend at some time in the future, we'll give the same test a shot and see if the machine just comes back to its senses over time (and how long that takes). Our bet is that it will (like most Unix and Linux OS's running on halfway decent hardware). Only time will tell.

Following, a quick walkthrough of the experiment followed by the tiny little shell script (only run once) that caused all the damage. We called it tree, for some reason; perhaps because it reminded us of that old saying "If a tree falls in a forest, no one can hear you scream." ...damn! Got that one wrong, too! It's amazing what a few basic shell commands and a simple double-exec can do ;)

THE WALKTHROUGH:

1. BASELINE READING:
These are some basic statistics from when nothing much is going on.

host # date;uptime;vmstat 1 1;iostat 1 1
Tue Mar 3 16:56:17 CST 2009
4:56pm up 41 day(s), 3:25, 3 users, load average: 0.71, 1.36, 1.41
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr dd f0 rm s1 in sy cs us sy id
0 0 0 1240680 389376 1 10 1 0 0 0 0 0 -0 -0 -0 402 381 276 71 3 26
tty dad1 ramdisk1 sd1 nfs1 cpu
tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id
1 136 1 0 3 0 0 0 0 0 1 0 0 1 71 3 0 26


2. INITIAL EXECUTION OF THE SCRIPT WITH TIME/DATE STAMPING: Notice how high the uptime stats jump and the greater time differences between executions of the simple loop.

host # ./tree
host # while :;do date;uptime;vmstat 1 2;iostat 1 2;done
Tue Mar 3 17:01:22 CST 2009
5:01pm up 41 day(s), 3:30, 2 users, load average: 119.02, 27.25, 10.11
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr dd f0 rm s1 in sy cs us sy id
0 0 0 1240680 389376 1 10 1 0 0 0 0 0 -0 -0 -0 402 381 276 71 3 26
1038 0 0 981184 260848 547 6123 17 174 174 0 0 56 0 0 0 513 6623 336 20 80 0
tty dad1 ramdisk1 sd1 nfs1 cpu
tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id
1 136 1 0 3 0 0 0 0 0 1 0 0 1 71 3 0 26
0 11800 0 0 0 0 0 0 0 0 0 0 0 0 50 50 0 0

Tue Mar 3 17:02:02 CST 2009
5:02pm up 41 day(s), 3:31, 2 users, load average: 445.61, 118.66, 42.41
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr dd f0 rm s1 in sy cs us sy id
0 0 0 1240672 389376 1 10 1 0 0 0 0 0 -0 -0 -0 402 381 276 71 3 26
1271 1 0 891840 189784 581 6149 4 239 235 0 0 95 0 0 0 591 6517 359 20 80 0
tty dad1 ramdisk1 sd1 nfs1 cpu
tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id
1 136 1 0 3 0 0 0 0 0 1 0 0 1 71 3 0 26
0 550 241 31 1 0 0 0 0 0 0 0 0 0 17 83 0 0

Tue Mar 3 17:02:55 CST 2009
5:02pm up 41 day(s), 3:32, 2 users, load average: 851.80, 278.54, 102.82
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr dd f0 rm s1 in sy cs us sy id
0 0 0 1240664 389368 1 10 1 0 0 0 0 0 -0 -0 -0 402 381 276 71 3 26
870 1 0 753176 54624 159 2286 260 1085 1236 0 758 346 0 0 0 1090 5003 1533 13 87 0
tty dad1 ramdisk1 sd1 nfs1 cpu
tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id
1 136 1 0 3 0 0 0 0 0 1 0 0 1 71 3 0 26
0 170 1392 319 44 0 0 0 0 0 0 0 0 0 16 84 0 0


3. 6 MINUTES IN AND WE'VE GOT PROBLEMS: It only gets worse from here, since our script has exponentially multiplied itself so many times already that the amount of possible failed execs is infinitesimal in comparison to the system faults.

Tue Mar 3 17:07:45 CST 2009
ld.so.1: cp: fatal: /usr/lib/libc.so.1: mmap failed: Resource temporarily unavailable
ld.so.1: cp: fatal: libc.so.1: open failed: No such file or directory
Killed
ld.so.1: sh: fatal: /usr/lib/libc.so.1: mmap failed: Resource temporarily unavailable
ld.so.1: sh: fatal: libc.so.1: open failed: No such file or directory
ld.so.1: sh: fatal: /usr/lib/libc.so.1: mmap failed: Resource temporarily unavailable
ld.so.1: sh: fatal: libc.so.1: open failed: No such file or directory
ld.so.1: cp: fatal: /usr/lib/libc.so.1: mmap failed: Resource temporarily unavailable
ld.so.1: cp: fatal: libc.so.1: open failed: No such file or directory
Killed
tree: tree: cannot open
ld.so.1: cp: fatal: /usr/lib/libc.so.1: mmap failed: Resource temporarily unavailable
ld.so.1: cp: fatal: libc.so.1: open failed: No such file or directory
Killed
ld.so.1: cp: fatal: /usr/lib/libc.so.1: mmap failed: Resource temporarily unavailable
ld.so.1: cp: fatal: libc.so.1: open failed: No such file or directory
Killed
ld.so.1: cp: fatal: /usr/lib/libc.so.1: mmap failed: Resource temporarily unavailable
ld.so.1: cp: fatal: libc.so.1: open failed: No such file or directory
Killed
cp: Cannot map /lib/ld.so.1
Killed
tree: cannot fork: no swap space


4. 16 MINUTES IN AND THE CONSOLE IS TOAST: Still the brave little toaster, I mean SunBlade, stays on the net and doesn't go down. In fact, response times to echo are instant.

host # while :;do date;ping -c 10 10.99.99.99;date;done
Tue Mar 3 17:17:56 CST 2009
PING 10.99.99.99: (10.99.99.99): 56 data bytes
64 bytes from 10.99.99.99: icmp_seq=0 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=1 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=2 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=3 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=4 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=5 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=6 ttl=254 time=0 ms

Tue Mar 3 17:19:22 CST 2009
PING 10.99.99.99: (10.99.99.99): 56 data bytes
64 bytes from 10.99.99.99: icmp_seq=0 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=1 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=2 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=3 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=4 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=5 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=6 ttl=254 time=0 ms


5. 28 MINUTES IN AND WE'RE GETTING TIRED OF WAITING: The little SunBlade never tapped out (at least not in the first half hour). Even though it has been rendered completely useless, the ping responses are still sitting at 0ms. Time for a reboot.

host # while :;do date;ping -c 10 10.99.99.99;date;done
Tue Mar 3 17:30:32 CST 2009
PING 10.99.99.99: (10.99.99.99): 56 data bytes
64 bytes from 10.99.99.99: icmp_seq=0 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=1 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=2 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=3 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=4 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=5 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=6 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=7 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=8 ttl=254 time=0 ms
64 bytes from 10.99.99.99: icmp_seq=9 ttl=254 time=0 ms


6. AND THIS IS HOW EASY IT WAS TO CRIPPLE THE MACHINE: The script attached is very simple. Given a larger machine, with more horsepower, we think you'd see the exact same results within, probably, the same amount of time. Hopefully, someday, we'll be able to find out without losing our jobs ;)

If there was a lesson in today's post, it would probably read something like this: "Be mindful of the small things. They can grow into big things very fast!" (We got that one right, since we just paraphrased something that may or may not be a famous expression ;)

Cheers,


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/bin/bash

#
# tree - POC only - don't run this - it will spawn a lot of processes and slow your machine down severely.
#
# 2009 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

mkdir a b
cp tree a/
cp tree b/
(cd a;exec sh tree &)
(cd b;exec sh tree &)


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Wednesday, March 4, 2009

Using CSS To Wrap Your Pre-Formatted Blogger Text

Hey There,

Today's post is going to be a bit short, by which I mean that it's not going to be long. Of course, it also won't be short in the sense that it won't be abrupt and rude.

See ya,





Just kidding... ;)

I spent most of the time I had to come up with something to write about today, driving myself nuts trying to figure out how I could make this blog's code examples and block-quotes work in IE, FireFox and Opera; not to mention all of the other browsers out there. I don't think I'll ever be able to get the code examples to properly indent on Lynx, but at least it's readable now.

Even as I worked on that issue, I had this nagging feeling that I was going to have to go back and re-tag all 520 odd posts we've already put out, like I had to with our follow up on the absorption of knowledge in the computer age, which was the first post we'd ever done where the entire post had to look like a letter when seen from a bird's eye view. So, that was a bummer.

I started noticing that pretty much every forum I visited was filled with nothing but useless flaming. Guys who had the same question as I did, but were answered with some variation of "Why would you want your lines to wrap if you've already pre-formatted your text?" after which non-solution after non-solution would be offered up to not-answer the question ;)

Of course, there are some good reasons to want to be able to word-wrap your pre-formatted text. For instance, in this blog, we put up code from time to time. Sometimes a lot, sometimes none. But when we do put up code, we wrap it in the <pre> tags to preserve the indentation. This might not be necessary, but there's only so much leeway you have on Blogger. You have to use the tools they give you. No use putting in format tags that they don't honour. So, anyone can see that a loop within a loop within a conditional, with tabbed indents, can move the code out pretty far from the left-hand margin. So, if one of the triple-indented lines contains a good amount of text, I'd want that text to wrap around (just like it would in a standard terminal editor) instead of disappearing off under the right-side column.

Anyway, this post ends with good news that's both succinct and helpful (especially if you publish code on Blogger, too). All you actually need to do is add a "post pre" section to the CSS style section of your Blogger template. The beauty of this solution is that, not only does it work on all three of the aforementioned browsers, but it also fixed all of our previous code posts in one fell swoop :)

The code itself is here, you can add it anywhere in the:

/* Posts
-----------------------------------------------
*/


section. The CSS code is directly below, and the "post pre" container may not exist in the template you're using, just as it didn't in mine:

.post pre {
white-space: pre-wrap; /* This is for IE and other browsers that just have to be different */
white-space: -moz-pre-wrap; /* This is for FireFox and Mozilla Browsers */
white-space: o-pre-wrap; /* This is for Opera */
}


And, just like that, 500 or so wrongs have been righted. We'll be back tomorrow after we're all done being excited :)

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Tuesday, March 3, 2009

Simple Code To Implement C's stat() function On Linux And Unix

Hey There,

Today's post loosely ties back to our post last week on Perl stat() basics for Linux and Unix, although this post is not a continuation of that one. Just trying to keep it confusing ;)

I've often been bashed for my C programming skills (the "bash" in that sentence wasn't meant to be a pun), and, although I've come to expect the vicious backlash, I still like to come back to C every once in a while to look at some of the things you can do with it and to keep me awake ;) That being said, any competent C programmer out there who finds fault with this post's attached C-code is, most probably, correct. This could be written better, have more robust error-checking, implement measures to prevent buffer over-runs, under-runs, and a thousand other exploits. That being said; it works, which is miracle enough for me :) Feel free to modify it in any way, shape or form you prefer. Everything I put on this blog is considered at-your-own-risk material. There's not all that much to worry about, though, if you just use this code for yourself to test and play with. Just secure it with simple ownership and file permission settings and delete the binary when you're done.

It's been a long time since I've had to write this, but typing it will be faster than trying to find another post with C code in it ;) If you want to compile the attached code, you can do the following (should work with most any C compiler, I'm just using gcc as an example since that's what I have installed on my machine):

host # gcc -o filestat filestat.c

and the program is ready to run. That part's pretty simple, too. You just execute it and follow it with one or more file names (they can be "any" type of file: file, directory, link, socket, etc). If you want to see the usage information, just run it without any arguments, like so:

host # ./filestat
Usage: ./filestat file1 file2 fileN...


The most interesting part for me was figuring out how to decipher the "file mode" information. If you check your system's "stat" manpage, you'll see that there are actually a good deal of macros already written-in that make printing out plain English file types and modes much simpler, but I decided to keep it cryptic. I take my modes like I take my permissions; in octal ;)

Here's a sample run of the program - just using one file to make it simple (it should be noted, also, that you can only run this command against file types that you have permission to read. If you run this as your regular user on a file owned by root with 700 permissions, you'll get the "File or Directory Not Found!" error, which is, technically, incorrect. My God, am I a lazy C programmer. No wonder I get beat up so bad every time I goof around with it on here ;)

NOTE: This program interacts with the shell you're using, so if, for instance, you can access a file named "myfile" by typing "my*", the same globbing rules will be taken care of, applied to the filename and expanded by the shell before this program processes it!

host # ./filestat tct-1.18
****************************************
Checking tct-1.18
****************************************
tct-1.18 stat values are:
****************************************
File Mode: 40700
Inode Number: 17540
Device ID: 35651599
Raw Device ID: 0
Number Of Links: 12
User ID: 0
Group ID: 0
Bytes Size: 1024
Access Time: Mon, March 02, 2009 - 14:15:31
Modification Time: Mon, April 09, 2007 - 08:36:09
Status Change Time: Mon, March 02, 2009 - 15:47:38
Block Size: 8192
Number Of Blocks: 2
File System Type: ufs
****************************************


Most of the above is self-explanatory. The few things to note (if you just "really" don't want to read the manpage ;) are that the "Raw Device ID" is almost always zero unless you're dealing with a disk, or other file type, that supports raw access. From my own testing, you can definitely get back a "Raw Device ID" from any disk (/dev/rdsk/c0t0d0s0, /dev/dsk/c0t0d0s0, /dev/hda1, etc). The "Bytes Size" is simply the Size in Bytes. I left it the way it is because it reminds me that I need to eat less ;)

Lastly, you may have noted that the "File Mode" (listed first in the output, since I just went through the "stat" struct and used each value in order) seems a bit off. The last 3 digits are probably familiar to most Linux and Unix users, as they represent the file permissions. By the same virtue, the first 4 (including those original 3), probably seem familiar as well, since that 4th-left bit is used in octal permissions settings to represent setuid, setgid, and sticky-bit, etc, special permissions. So, for the above "File Mode" of 40700, you know that the file permissions are "0700" (no setuid, setgid or sticky-bit - read/write/execute for the user and no permissions for the group and world).

The only question, once you've got the right side of the "File Mode" down is, what do the variable number of numerals to the left of those stand for? The answer is pretty simple and (as I noted above) there are standard macros that you can use in your C code to test the mode and print it out so that it's more human-readable. Basically, they determine the type of file you're interrogating. Since our one number to the left of the four permission bits is "4," we know that the file we're accessing is a directory. You can see this in the table below (shamelessly lifted from the system header file - /usr/include/sys/stat.h ;) <-- This is just a subset of all available macros. There's a lot more information in that header file than I want to jam into this post... It's getting long enough now. Especially bad if you're an "F" reader ;)

As one last interesting side-note, the "File Mode" for the gzipped tarball, that was extracted to create this directory, is "100700" which gives us the same permissions, but a "10" on the left-hand "file type" side. You can also see this showing up below as a "regular" file.

#define S_IFMT  0170000  /* type of file mask */
#define S_IFIFO 0010000 /* named pipe (fifo) */
#define S_IFCHR 0020000 /* character special */
#define S_IFDIR 0040000 /* directory */
#define S_IFBLK 0060000 /* block special */
#define S_IFREG 0100000 /* regular */
#define S_IFDB 0110000 /* record access file */
#define S_IFLNK 0120000 /* symbolic link */
#define S_IFSOCK 0140000 /* socket */
#define S_IFWHT 0160000 /* whiteout */
#define S_ISVTX 0001000 /* save swapped text even after use */
#define S_IRWXU 00700 /* read, write, execute: owner */
#define S_IRUSR 00400 /* read permission: owner */
#define S_IWUSR 00200 /* write permission: owner */
#define S_IXUSR 00100 /* execute permission: owner */
#define S_IRWXG 00070 /* read, write, execute: group */
#define S_IRGRP 00040 /* read permission: group */
#define S_IWGRP 00020 /* write permission: group */
#define S_IXGRP 00010 /* execute permission: group */
#define S_IRWXO 00007 /* read, write, execute: other */
#define S_IROTH 00004 /* read permission: other */
#define S_IWOTH 00002 /* write permission: other */
#define S_IXOTH 00001 /* execute permission: other */


Hope you enjoy the attached C code and get some use out of it (or your own Frankenstein'ed version of it ;)

Cheers,

Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <locale.h>
#include <langinfo.h>
#include <fcntl.h>

/*********************************************
filestat.c - Would you like fries with that?
2009 - Mike Golvach - eggi@comcast.net
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
*********************************************/
int main (int argc, char *argv[])
{
if (argc <= 1) {
printf("Usage: %s file1 file2 fileN...\n", argv[0]);
exit(1);
}
struct stat dirfilebuf;
int arguments, dirfilestate;
const char *dirfilename;
char *nicetime, *errormessage, *divider;

dirfilename=(char*)(malloc(sizeof(char)));
nicetime=(char*)(malloc(sizeof(char)));
errormessage=(char*)(malloc(sizeof(char)));
divider=(char*)(malloc(sizeof(char)));

errormessage="File or Directory Not Found!";
divider="****************************************";

for (arguments = 1; arguments < argc; arguments++) {
dirfilename = argv[arguments];
printf("%s\nChecking %s\n%s\n", divider,dirfilename,divider);
dirfilestate = stat(dirfilename, &dirfilebuf);
if ( dirfilestate == -1 ) {
printf("%s - Quitting!\n", errormessage);
exit(1);
} else{
printf("%s stat values are:\n%s\n", dirfilename,divider);
printf("File Mode: %lo\n", dirfilebuf.st_mode);
printf("Inode Number: %-10d\n", dirfilebuf.st_ino);
printf("Device ID: %d\n", dirfilebuf.st_dev);
printf("Raw Device ID: %d\n", dirfilebuf.st_rdev);
printf("Number Of Links: %d\n", dirfilebuf.st_nlink);
printf("User ID: %-8d\n", dirfilebuf.st_uid);
printf("Group ID: %-8d\n", dirfilebuf.st_gid);
printf("Bytes Size: %jd\n", (intmax_t)dirfilebuf.st_size);
strftime(nicetime,34,"%a, %B %d, %Y - %H:%M:%S", localtime(&dirfilebuf.st_atime));
printf("Access Time: %s\n", nicetime);
strftime(nicetime,34,"%a, %B %d, %Y - %H:%M:%S", localtime(&dirfilebuf.st_mtime));
printf("Modification Time: %s\n", nicetime);
strftime(nicetime,34,"%a, %B %d, %Y - %H:%M:%S", localtime(&dirfilebuf.st_ctime));
printf("Status Change Time: %s\n", nicetime);
printf("Block Size: %d\n", dirfilebuf.st_blksize);
printf("Number Of Blocks: %d\n", dirfilebuf.st_blocks);
printf("File System Type: %s\n", dirfilebuf.st_fstype);
printf("%s\n", divider);
}
}
}


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Monday, March 2, 2009

Funny And Fun Wallpapers: Linux And Unix Humor On A Monday

Hey there,

I began attempting to write a serious tech opinion piece for today, but realized (just a paragraph or two in) that to do so would be a waste of your time and whatever mental effort I have left in store (which I may, yet, be called upon to exert, since I'm writing this the day before I'm relieved of pager duty). As of this morning I've worked 41 hours this weekend and slept for about 5 or 6. Right now, I'm so tired I can't sleep (ever had that happen to you? Probably, if you do what I do for a living).

I can hear all of the world's smallest violins (all but one, in a realistic sense, actually being the world's almost-smallest ;) playing just for me, so I'll move on. The pity party is over. Probably, plenty of folks (in technical and non-technical fields) are having a much worse time of it than I am. If you're one of them, let me preemptively write "I get it" and "you win." There; now we're all ( at the very least ) equally miserable ;)

Off-subject-but-interesting, I think: Does anyone else find it strange that the wikipedia page for Opinion is so short? You'd think that would be the one page that everyone could contribute to and have their entry accepted. It should be HUGE. In fact, there should be at least one entry stating that the entire basis of the concept of opinion is mere opinion. Just my 2 cents worth ;)

Hope you get a laugh from at least one of the fun wallpapers/backgrounds for your Linux or Unix desktop; tagged onto the bottom of the post. They're all being linked directly to LinuxHotBox.com (Don't Bogart that Linux, my friend ;). Stop on over there if you like what you see and are hungry for more. They have plenty of other cool backgrounds/wallpapers and more than just ones attempting to be funny and/or clever!

I'll be back tomorrow, after getting some rest (I think I just jinxed any hope of ever sleeping again ;)

NOTE: Some of the pictures have been trimmed by my column width. Not so much so that I want to fuss over them all. They're all available at the site linked to above :)

Cheers,






  •  

  •  














, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Sunday, March 1, 2009

Computerish Humor: Predictions For 2035 And The Reasons We're All Confused

Hola y Feliz Domingo,

Sorry if my Spanish is a little rusty. It's been a while since I was required to know it in order to get out of High School ;)

I hope everyone is having a pleasant and relaxing Sunday :) Today, we're going a little off the Linux/Unix-computing-humor beaten path with some humorous predictions for the year 2035 and a nice list of reasons why we're all so confused (it all seems so simple now...)

I found both of these entries on the Words Of Wisdom pages of CaughtAtWork.net. Coincidentally enough, even though it is the weekend, I'm actually writing this at work. Hopefully I won't get busted!

Enjoy the laughs and may the remainder of your weekend remain toil-free. Mine, too ;)

Cheers,



Stories for 2035


Fidel Castro finally dies at age 112; Cuban cigars can now be imported legally but President Chelsea Clinton has banned all smoking.



Spotted Owl plague threatens Western North America crops & livestock.



Last remaining Fundamentalist Muslim dies in the American Territory of the Middle East (formerly known as Iran, Iraq, Syria, and Lebanon).



Afghanistan still closed off--physicists estimate it will take at least ten more years before radioactivity decreases to safe levels.



Hunt continues for Osama bin Laden; believed sighted at Yasser Arafat's tomb in Detroit.



Thirty-five year study proclaims diet and exercise is the key tow eight loss.



Nursing home big news ... Bill Clinton denies allegations of affair with candy striper. Hillary's coma persists.



Texas executes last remaining citizen.



Upcoming NFL draft likely to focus on use of mutants.



Baby conceived naturally.....scientists stumped.



Authentic year 2000 Florida "chad" sells at Sotheby's for $4.6 million.



Ozone created by electric cars killing thousands in Los Angeles.



Average height of NBA players now nine foot seven inches.



Microsoft announces it has perfected its newest version of Windows so it crashes BEFORE installation is completed.



New California law requires that all nail clippers, screw drivers and baseball bats be registered by January 2036.



U.S. Supreme Court outlaws Shakespeare's 'Romeo and Juliet' as pornography. Chief Justice Clarence Thomas writes opinion.



Colorado motorist arrested for not driving SUV.



Average worker's Social Security (FICA) contribution hits $12,000 per week. Protests planned.



Congressman Gary Condit still missing.



Senator Strom Thurmond remains dead; continues to cast votes.



White House demands Saddam Hussein's resignation for 748th time. No response.



Seats for Mel Brooks' "The Producers" on Broadway, decline to $12,000 per.



Oprah Winfrey, nearing retirement, buys Illinois.


No Wonder We're Confused


Why is the third hand on the watch called the second hand?

Why do we say something is out of whack? What is a whack?

Why does "slow down" and "slow up" mean the same thing?

Why does "fat chance" and "slim chance" mean the same thing?

Why is it called "after dark" when it really is "after light"?

Why are a "wise man" and a "wise guy" opposites?

Why is "phonics" not spelled the way it sounds?

If all the world is a stage, where is the audience sitting?

If love is blind, why is lingerie so popular?

If you are cross-eyed and have dyslexia, can you read all right?

Why is bra singular and panties plural?

Why do you press harder on the buttons of a remote control when you know the batteries are dead?

How come abbreviated is such a long word?

Why do they call it a TV set when you only have one?

Christmas is weird. What other time of the year do you sit in front of a dead tree and eat candy out of your socks?



, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.