« January 2007 | Main | March 2007 »

February 28, 2007

Need to run as root?

Every now and then, I find myself in a locked down account on a restricted access box where I need to run something as root.

Say, for example, you were running BigBrother (why?) on AIX (why?) and you need to run bootinfo -r. In this case the AIX partition is a NIM - so no sudo available....

What you need is a little C program:

main()
{
setuid(0);
seteuid(0);
setgid(0);
seteuid(0);
system("/usr/sbin/bootinfo -r");
}

Note the full pathname used in the system call and the lack of externally passed variables - we don't want to make too big a hole here...

Compile this (obviously not on the NIM because there is no installed compiler). Install it somewhere safe - so that root and bigbrother are the only users that can access it and then:

chown 0:0 filename
chmod a+rx filename
chmod ug+s filename

Of course, if you are more security concious, you should have checked the userid in the C program as well....

Posted by Ozguru at 07:00 AM

February 27, 2007

Simplicity

simplicity.gif

Posted by Ozguru at 07:00 AM

February 26, 2007

Teamwork

teamwork.gif

Posted by Ozguru at 07:00 AM | Comments (0)

February 25, 2007

Yesterday / Tomorrow (in C for AIX)

Why does AIX have to be so different?

Oh well, this will do it:

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
while (--argc)
{
int *i = (int *)atoi(argv[argc]) ;
(void) printf("%s %s", argv[argc], ctime(&i)) ;
}
}

You run this by giving it the epoch times as arguments. This can then be used with date +%s in some of the other articles in this series.

Example:

./ctime `date +%s`
1172183288 Fri Feb 23 09:28:08 2007

Posted by Ozguru at 06:00 AM | Comments (1)

February 24, 2007

Yesterday / Tomorrow (in shell)

This is the most elegant shell solution I have come across:

#!/bin/sh
let today=`date '+%s'`
let yesterday=$today-86400
let tomorrow=$today+86400
echo "He is the same yesterday (" `date -r $yesterday` "),"
echo "  today (" `date -r $today` ") and"
echo "  tomorrow (" `date -r $tomorrow` ")."

Of course, this doesn't work on AIX....

Posted by Ozguru at 07:00 AM

February 23, 2007

Vista Secure? NBL!

There is an interesting (for IT support staff) article over at The Register entitled Vista security overview: too little too late which says in the summary:

So, what have we got here? An adequately secure version of Windows, finally? I think not. We have got, instead, a slightly more secure version than XP SP2. There are good features, and there are good ideas, but they've been implemented badly. The old problems never go away: too many networking services enabled by default; too many owners running their boxes as admins and downloading every bit of malware they can get their hands on. But MS has, in a sense, shifted the responsibility onto users: it has addressed numerous issues where too much was going on automatically and with too many privileges. But this simply means that the owner will be the one making a mess of their Windows box.
Data hygiene is still an absolute disaster on Windows. In fact, it's worse than it ever was in some ways, and that's very bad indeed. Browser traces still in the registry, heavy and complicated indexing to improve search, new locations where data is being stored. It all adds up to a privacy nightmare. Keeping a Vista box "clean" is going to be impossible for all but the most knowledgeable and fastidious users.
So don't rush out to buy Vista in hopes of getting much in return security-wise. I do like some of the changes, at least in theory, or as a decent platform on which to build an adequately secure version of Windows one day. But that day, if it ever comes, will be well in the future.

The comment that sprang out at me was about the default user being the administrator. Still. After all these years.

It just goes to show that Microserfs may have been inspecting the Apple GUI so they could copy it but they never looked underneath the flashy pictures to see how the security model worked....

[NBL = Not Very Likely (but in the Australian vernacular)]

Posted by Ozguru at 06:00 AM

February 22, 2007

Promotion by Merit?

[SARCASM ON]

Apparently the federal education minister is indulging in a little heresy when she suggests Families get say in teachers' pay rises...

If you give pay rises and promotions to teachers who perform well, you run the extreme risk of improving the education system. We cannot allow that. We luddites members of the Communist Union of Naive Teachers Teachers Federation stand totally behind promotion by seniority. We feel that anyone prepared to stick it out for a considerable length of time should be amply rewarded for the effort. Forget about merit. No-one has any innovation after the first couple of years and so you would just cause discontent by promoting newbie teachers who would then want to make changes to the system. They might even try to improve things which every sane (senior, promoted) person knows cannot work (unless you are talking about the evil non-public system). Besides, if you start promoting teachers by merit, all the parents will want their kids to go to the schools with good teachers who would then be overworked and stressed while the incompetent more senior teachers would be at schools with no students.

I tell you it won't work. There is no point in improving education. After all if you teach the little buggers children to think, there is no way they will grow up to become members of the Union who always vote for the Communist Green Democrat Labor party.

[SARCASM OFF]

[NOTE: My children do not participate in public education.]

Posted by Ozguru at 08:00 PM

Yesterday / Tomorrow (in perl)

#!/usr/bin/perl
$one_day = 60*60*24 ;
$today = localtime(time) ;
print "today: $today\n" ;
$tomorrow = localtime(time+$one_day) ;
print "tomorrow: $tomorrow\n" ;
$yesterday = localtime(time-$one_day) ;
print "yesterday: $yesterday\n" ;

Gnu date makes this easy:
date -d "tomorrow"

Posted by Ozguru at 06:00 AM | Comments (2)

February 21, 2007

Changing a lightbulb....

How many managers does it take to change a light bulb?

1) A roomful - they have to hold a meeting to discuss all the ramifications of the change.

2) None, they like to keep employees in the dark.

3) "This topic was resumed from last week's discussion, but is incomplete pending resolution of some action items. It will be continued next week. Meanwhile ..."

4) "We've formed a task-force to study the problem of why light bulbs burn out, and to figure out what, exactly, we as supervisors can do to make the bulbs work smarter, not harder."

Posted by Ozguru at 06:00 AM

February 20, 2007

More Aussie Politics

[Aside for US Readers: Yesterday and today we have posts about the NSW state election. There are two main parties and a host of minor after-work-drinks (too small to be a party): Labor (socialist, left-wing, like Democrats), Liberal/National (business, right-wing, like Republicans). Currently the state is run by Labor (12 years) and the federal government is Liberal/National. It is extremely unlikely that Labor will loose this election due to their majority in the parliament.]

The more I read It's more time: a jingle that jangles, the more I like it. In particular the comment:

Labor's focus groups are telling the party that people in NSW are still very angry at the 10 years of inaction during the Carr regime, when the key measures on services such as public transport and health went backwards and not forwards.
The trains ran later and later until they reached crisis point. The hospital waiting lists remained entrenched and emergency wards were often full, prompting ambulances to be sent between hospitals in search of beds on the weekends.
...
But, at the same time, it's now clear the Government took its eye off the ball when it came to ensuring that the public's other major interfaces with state government - transport, utilities and hospitals - were up to scratch.
So Iemma's big challenge is to convince you, the voter, that he has the recipe to fix the problems left by the other bloke. (It must have been another Iemma in cabinet.)
The first message is to tell you that Iemma is new and different and he's only been in the job for 18 months. Step two is to tell you he's a hard worker with a plan, and step three is to tell you that he needs more time.

The bottom line is that things are worse now, not better and Iemma has been part of the problem (i.e. he has been there during the decline - even if he was only the leader for the last little while). Given that, what can the average voter do? Is there any alternative waiting in the wings? Nope. There are the minor parties (after-work-drinks) who are a best a nuisance and at worst a complete hinderance to reasonable governance. What about the main opposition party? Headed by whats-his-name. You know the fellow. Wasn't he on tele last week? What IS his name?

Tune in on the 3rd weekend in March to see if the voters prefer the incompetant or the unknown.

Posted by Ozguru at 07:00 AM

February 19, 2007

Gone to pot?

Cannabis goes to pot in young people's eyes:

ONE in three young people find cannabis use unacceptable, according to research suggesting the drug is now seen as addictive and linked to health and social problems.
A new survey by the National Drug and Alcohol Research Centre found marijuana use has become socially unfashionable, with three-quarters of the 1500 adults surveyed believing it is dangerous or very dangerous.
Nearly half believed cannabis can cause schizophrenia, depression and anxiety disorder to a moderate or large degree.

A quick visit to Nimbin to repeat the survey failed because those surveyed were depressed, anxious or just plain stoned.

Posted by Ozguru at 08:00 AM | Comments (1)

More to do, but heading in the right direction

That assumes of course that the "right direction" is a downward death spiral.

After 12 years of Labor, what do we have? Is the education system better than 12 years ago (measured by results not money spent)? Is the hospital system bettter than 12 years ago (think every increasing waiting lists for "elective" surgery)? Is the amount of crime comparable to 12 years ago? Are the roads and infrastructure as good as 12 years ago? Are essential utilities (water, electricty) in the same (or better) position than 12 months ago? Is public investment (i.e. assets held by the government on behalf of the voters) as significant as 12 years ago (or have they privatised everything to pay off the ever-increasing debt)?

Basically, they would have been better off saying "look we stuffed everything up but we want to try and set things right" - at least that would have been honest....

Pity that we have a one party state system....

Links: Iemma recycles $2b pledges, It's more time: a jingle that jangles.

Posted by Ozguru at 06:00 AM | Comments (0)

February 18, 2007

A new phone...

My old mobile (Sony Ericsson) is just about dead. It has been a good phone but I need to replace it because the buttons don't work most of the time - you sort of have to press the battery on the back at the same time as pressing the 'yes'/'no' buttons before they will register.

Obviously I should try and hold out until the iPhone is available....

Or then again, maybe not. Telstra (the national carrier and most likely candidate for Apple to use for Australian coverage) has dissed the iPhone. Idiots. I can guess the reaction from Steve - let Australia go hang itself.....

Fortunately there was a better reaction from (Fake) Steve Jobs:

Telstra to Apple: Stick to your knitting
Some dude from Telstra says we're making a mistake building the iPhone and we should "stick to our knitting." See here. Now, I don't know who this guy is. And I don't see why some refrigerator manufacturer in New Zealand should be telling us how to run our business. But the iPhone is a perfectly natural next step for us. Second, we go into any business we want. And we win. If we want to make Apple iToasters, we will. And you know what? They'll rock. And they'll cost a fortune. And people will line up to buy them. Or watch out, Telstra man. Maybe we'll start making refrigerators, and put you guys right out of business. Put that on the barbie and grill it.

Maybe we are still in with a chance.... where do I put that duct-tape to hold my phone together....

Posted by Ozguru at 12:00 PM

Playing it backwards...

They say when you play that Microsoft Vista CD backward you can hear satanic messages ...

... but that's nothing. If you play it forward it will do something far more evil - install Windows.

Posted by Ozguru at 06:00 AM

February 17, 2007

Got the "untitled folder" blues?

If you have, then MacWorld has the answer: Change the default new folder name:

With just a bit of mucking about in the Finder’s internals, you can set the default name for new folders to anything you like. In the Finder, navigate to /System -> Library -> CoreServices. In the CoreServices folder, Control-click on Finder and choose Show Package Contents from the pop-up menu. In the new window that opens, navigate into Contents -> Resources -> English.lproj. The file we’re going to modify is named Localizable.strings, and the first thing we’re going to do is make a backup copy of the file. Do that by dragging Localizable.strings to the Desktop; since you don’t have rights to modify the English.lproj folder, the Finder will automatically copy, and not move, the file.

The rest of the article explains who to change the N2 variable to some other string.

I like this because it annoys me to have a new folder vanish to the end of the directory (it starts with 'u') ....

Posted by Ozguru at 06:00 AM

February 16, 2007

Macrovision Madness

Some of you may have come across Macrovisions Response to Steve Jobs which has every appearance of being composed by someone who is 90% stoned. My reading of it seemed to suggest that Macrovision (a buggy whip company) was asking Apple to give it (for free) proprietary encryption systems so that Macrovision could make oodles of money. The reasoning was that Macrovision (who have yet to achieve anything technically brilliant and effective) would be able to outperform Apple (who have a proven track record).

It is completely obvious that Macrovision did not understand (or intentionally misunderstod) Job's comments about DRM (namely that the world would be better without it).

A far more lucid translation of the entire affair can be found at Daring Fireball including this gem:

Macrovision: While your thoughts are seemingly directed solely to the music industry, the fact is that DRM also has a broad impact across many different forms of content and across many media devices. Therefore, the discussion should not be limited to just music.
Translation: We recognize that if getting rid of DRM works for the music industry, it’s going to open the eyes of executives in other fields, and it could unravel Macrovision’s entire business.
Macrovision: DRM increases not decreases consumer value
Translation: Up is down. Black is white.
Macrovision: I believe that most piracy occurs because the technology available today has not yet been widely deployed to make DRM-protected legitimate content as easily accessible and convenient as unprotected illegitimate content is to consumers.
Translation: I have, to date, succeeded in convincing the entertainment industry that DRM can stop piracy.

With apologies to Billy Joel, it's all about soul money ....

Posted by Ozguru at 06:00 PM

February 15, 2007

zPhone?

It looks like the complete failure of the Zune has not discouraged Micro$oft. Now (according to CARS) they are going to make a phone version:

Zune Phone To Also Suck.
The technology world was rocked yesterday as news leaked that Microsoft is planning a Zune phone.
Today, as details of the Zune phone began to leak on the Internet, analysts quickly came to the conclusion that the Zune phone would suck as badly as the Zune itself.

I guess that instead of being black, it will be brown. Instead of having a finger controlled display, it will require you to lug around a keyboard. Best of all will be the DRM features:

For example, all calls will be wrapped in Microsoft’s DRM and the end-user license agreement will state that the contents of each call will be the property of Microsoft in perpetuity. Also, the Zellular Phone Call will only allow you to call someone three times. After that, every time you try to call that person you will hear a recording of a representative of the Recording Industry Association of America calling you a thief and yelling obscenities and threats at you.

Posted by Ozguru at 12:00 PM | Comments (0)

February 14, 2007

How to avoid shopping (for men)....

Proof of what can happen if a wife or girlfriend drags her husband or boyfriend along shopping.

This letter was recently sent by Tesco's Head Office to a customer in Oxford:

Dear Mrs. Murray,

While we thank you for your valued custom and use of the Tesco Loyalty Card, the Manager of our store in Banbury is considering banning you and your family from shopping with us, unless your husband stops his antics.

Below is a list of offences over the past few months all verified by our surveillance cameras:
1. June 15: Took 24 boxes of condoms and randomly put them in people's trolleys when they weren't looking.
2. July 2: Set all the alarm clocks in Housewares to go off at 5-minute intervals.
3. July 7: Made a trail of tomato juice on the floor leading to feminine products aisle.
4. July 19: Walked up to an employee and told her in an official tone, "Code 3" in housewares..... and watched what happened.
5. August 14: Moved a 'CAUTION - WET FLOOR' sign to a carpeted area.
6. September 15: Set up a tent in the outdoor clothing department and told shoppers he'd invite them in if they would bring sausages and a Calor gas stove.
7. September 23: When the Deputy Manager asked if she could help him, he began to cry and asked, "Why can't you people just leave me alone?"
8. October 4: Looked right into the security camera; used it as a mirror, picked his nose, and ate it.
9. November 10: While appearing to be choosing kitchen knives in the Housewares aisle asked an assistant if he knew where the antidepressants were.
10. December 3: Darted around the store suspiciously, loudly humming the "Mission Impossible" theme.
11. December 6: In the kitchenware aisle, practised the "Madonna look" using different size funnels.
12. December 18: Hid in a clothing rack and when people browsed, yelled "PICK ME!" "PICK ME!"
13. December 21: When an announcement came over the loud speaker, assumed the foetal position and screamed "NO! NO! It's those voices again."

And; last, but not least:
14. December 23: Went into a fitting room, shut the door, waited a while; then yelled, very loudly, "There is no toilet paper in here."


Posted by Ozguru at 06:00 AM

February 13, 2007

Inept Chicken Thieves

A blond, a redhead, and a brunette (all boys*) went into a farm to steal chickens. The police were nearby and they heard them and came in. The boys quickly jumped into three potato sacks so they wouldn't be seen.

One policeman kicked the sack with the redhead, and he said "meow" pretending to be a cat.

He kicked the second one with the brunette, and he said "ruff", pretending to be a dog.

When he kicked the third sack with the blond, he said "potatoes".

[* If they had been girls, they wouldn't have been stealing chickens....]

Posted by Ozguru at 06:00 AM | Comments (1)

February 12, 2007

Thinking about Vista (more)?

So you weren't convinced by this post? Check out the following (slighly edited*) BOFH article:

BOSS: "So you're not really suggesting I install Vista?"
PFY: "No. Even if you could you shouldn't - not with this baby/"
BOSS: "So I should keep XP?"
PFY: "No."
BOSS: "Downgrade to 2000?"
PFY: "No."
BOSS: "Windows 98?"
PFY: "No."
BOSS: "95?"
PFY: "No."
BOSS: "What am I supposed to do with it then?"
PFY: "Take my advice," the PFY says. “Nail a couple of planks to either side and use it as a bedside table."
BOSS: "But... I thought you could do something with it."
PFY: "Yeah - the bedside table idea!"

[* I added the 'BOSS:' and 'PFY:' to make it clear who was speaking....]

Posted by Ozguru at 07:00 AM | Comments (0)

February 11, 2007

Thinking about Vista?

If you are seriously thinking about upgrading to Vista, you should check out the detailed review over at Forbes. A few choice quotes include:

Windows Vista: more than five years in the making, more than 50 million lines of code. The result? A vista slightly more inspiring than the one over the town dump.

Vista is a fading theme park with a few new rides, lots of patched-up old ones and bored kids in desperate need of adult supervision running things. If I can find plenty of problems in a matter of hours, why can't Microsoft? Most likely answer: It did--and it doesn't care.

Should you upgrade your current machine? Are you nuts?

Hmmm..... looks like installing Vista is about as appealing as a frontal lobotomy....

[Hat tip to Secret Diary of Steve Jobs for the link...]

Posted by Ozguru at 12:00 PM | Comments (0)

February 10, 2007

DRM

Once again it looks like Jobsey was right on the money with his anti-DRM rant. The Register has an article from an ex-Sony-lawyer who says (in part):

The DRM walls are crumbling. Earlier this week, Steve Jobs called on the major record labels to allow online music sales unfettered by digital rights management restrictions.
Today, the Wall Street Journal disclosed that EMI is in negotiations with several digital music services to sell unprotected MP3s of its catalogue. Jobs was motivated at least in part by legal actions against Apple in Europe and the US as discussed below. But whatever his motivation, Jobs is right: DRM has been a disaster for the recording business. This article will outline the brief but sad history of DRM, the current legal attacks on it, and the reasons why the recording business would be far better off without it.

The author then goes on to discuss the problem from a historical perspective and finally concludes:
Even if the legal attacks against DRM do not prevail, the majors should take note: get rid of DRM, because it's bad for business.

Fingers crossed....

Posted by Ozguru at 12:00 PM | Comments (0)

February 09, 2007

Breaking wind....

Q: Why do men break wind more than women?

A: Because women don't stop talking long enough to build up the required pressure.

:-)

Note: All the women who tell me they don't talk too much now run the risk of having people assume they break wind like men. Hmmmm. That means I just have to avoid being punched by my wife for this joke....

Posted by Ozguru at 06:00 AM | Comments (0)

February 08, 2007

Politics

My wife is doing a TAFE course this year and one of her instructors is pushing his personal political opinions in class. Of course, if she challenges him then she will not pass. The instructor is a pro-Labor (actually pro-Communist) and he is using class time to promote the current state premier (Labor) and denigrate the current Prime Minister (Liberal). Note that both state and federal governments face re-election this year.

[Quick aside for Americans: Labor is closer to Democrats and Liberal is closer to Republican - not an exact match but close enough to follow the discussion. In Australian politics, Labor is left of centre, Liberal is right of centre. Further left are the Greens and Communists, further right is the National Party.]

In particular this bozo hammered the Liberals (who hold federal power) for the failings of: education, health, police and water shortages. All four key items are actually state managed (the Labor party hold control of the state government). So the four big issues he is whinging about are actually failings resulting from his favourite party....

I am happy that not everyone holds the same political views that I do but I do require you to have thought carefully and logically about your political position before you can spout off about it. This idiot has absolutely no clue and it makes you wonder if he has any intelligence in other areas - such as his teaching....

Posted by Ozguru at 12:00 PM | Comments (0)

February 07, 2007

Busy, busy, busy...

A while back I was working for a Unix sales/consulting/support oragnisation. The work was interesting and challenging but the big boss did not know how to treat people well. It got to the point of working 80 hours weeks, every week and being on call all the time (24x7x52). Eventually the strain got too much and I quit and ended up in another job with a 35 hour a week limit. The salary was lower (10%) but the hours were lower, the stress was lower and the environment was far more relaxed.

Now, more than twleve months later, I find that I am just as busy as I ever was but the difference is that a lot of that time is non-work. I have more time with my kids, more time for my local church and more time working for non-profit organisation. All round, a mure fulfilling life.

It is kind of interesting but I feel that working in IT is not satisfying in a long-lasting way. It doesn't leave the world a better place, it doesn't "make a difference'. On the other hand it pays the bills, provides a day-to-day challenge and "enables" me to make a difference in other ways.

Posted by Ozguru at 12:00 PM | Comments (0)

February 06, 2007

Macalope, The

This is a blog (apparently) by an antelope with a Mac. At least we get regular references to hooves on the keyboard :-)

http://www.macalope.com/

Posted by Ozguru at 12:00 PM

February 05, 2007

Secret Diary of Steve Jobs, The

Completely tongue-in-cheek blog which reads just like the public perception of Steve Jobs. Well worth reading, and a great start to the day...

http://fakesteve.blogspot.com/

Posted by Ozguru at 12:00 PM

February 04, 2007

Lucky Lottery Winner

Did you hear about the $3,000,000 Kentucky State Lottery?

The winner gets $3 a year for a million years.

Posted by Ozguru at 06:00 AM | Comments (0)

February 03, 2007

Stolen Credit Card

A man had his credit card stolen.

He however decided not to report it because ....

.... the thief was spending less than his wife did.

Posted by Ozguru at 06:00 AM | Comments (0)

February 02, 2007

Format C: Yes Yes

I wonder if I can set up an audio file on this blog :-)

From Slashdot:

"George Ou writes in his blog that he found a remote exploit for the new and shiny Vista Speech Control. Specifically, websites playing soundfiles can trigger arbitrary commands. Ou reports that Microsoft confirmed the bug and suggested as workarounds that either 'A user can turn off their computer speakers and/or microphone'; or, 'If a user does run an audio file that attempts to execute commands on their system, they should close the Windows Media Player, turn off speech recognition, and restart their computer.' Well, who didn't see that coming?"

Posted by Ozguru at 06:00 AM | Comments (1)

February 01, 2007

Opening files from inside vi

Like most vi-fanatics, I have always known about :split but someone asked me if it was possible to open a file when the name of the file was in the file you were editing.

Confused?

Imagine you are editing the file "foo" and it contains something like:
The really useful data is in the file bar, not in the file foo...

If you place the cursor over the word bar and type gf then vi will open the file bar in the current buffer. Pretty neat hey!

Of course, if you want to keep the current file open and also open the new file, use :split first.

Posted by Ozguru at 06:00 AM | Comments (1)