Monday, October 4, 2010

A Batch that Parses Filenames in a Directory

This batch file is deceptively simple. What does it do? Absolutely nothing. However, each filename within a directory is parsed and made available for use. A programmer may add commands to manipulate each file within the :process subroutine. I created this for my brother, who needed this particular capability. Many thanks to innumerable strangers on the Internet that have written guides and tutorials on Batch language, because I often forget the syntax of the FOR command, which must be the most complicated in Batch language. If it were not for Google, I would be tempted to abandon Batch altogether, as most programmers have. But there is something cool about running a program straight from Windows that doesn't require compilation or any additional interpreter.

---------

@echo off
cls

dir /b /a-d *.mp3 > temp.txt
if not exist temp.txt echo No Mp3 files found!
if not exist temp.txt pause
if not exist temp.txt exit
echo Temporary file has been created.
pause

rem -----------------------------------------------------
rem The following FOR statement must be one line, not two
rem (Beware of Blogger's word wrap.)
rem -----------------------------------------------------
FOR /F "usebackq tokens=1,2 delims=-" %%a in (temp.txt) DO call :process "%%a" "%%b"
rem -----------------------------------------------------
echo.
echo Alas, We Have Reached The End.
echo.
pause
exit

:process
set VAR1=%1
rem Trim quotes
for /f "useback tokens=*" %%a in ('%VAR1%') do set VAR1=%%~a
echo VAR1=%VAR1%

set VAR2=%2
rem Trim quotes
for /f "useback tokens=*" %%a in ('%VAR2%') do set VAR2=%%~a
echo VAR2=%VAR2%

set filename=%VAR1%- %VAR2%
echo %filename%
pause
goto :EOF

by igor 04:20 4 replies by igor 09:32 0 comments

Sunday, October 3, 2010

Social Darwinism

I emerged from an impromptu debate this morning with a conservative Republican more convinced than ever that social Darwinism is the belief underpinning many right-wing views.

It is easy to judge the poor and to assume that their failings are the result of inferior blood. I do not believe this is so, but it is a commonly held viewpoint. The homeless, in particular, are not easy on the eyes, in some cases, and they are visible, whereas rich business criminals are invisible, cloistered away upon private estates. The poor are tainted by the accusations of laziness, ignorance, and criminality. How do I explain to someone that a rich person is not necessarily superior in virtue and merit to a poor person? It seems like an uphill battle. Conservative Republicans are enraged by the thought that a poor black man may be sitting on his front porch all day long without working. The thought of a wealthy business criminal cheating the city out of millions of dollars inspires not the faintest annoyance--in fact, the behavior is defended in the name of freedom! I suspect that racism plays a role in the appeal of social Darwinism.

Many people say that they oppose Obama's health care plan because they do not want their tax money to be used to provide medical services to the poor. They would even prefer that the poor die, if it comes to that. In their view, the poor are poor because they are lazy or stupid. That is sometimes true, but not always. Should our society allow the lazy and the stupid to die? The Republican answer appears to be yes. In the name of evolution, or a stronger country at any rate, we should dispense with the weak, and favor the strong, or so it is thought.

I believe that the rich are often made so by their parents. They receive the right kind of encouragement and reinforcement and go on to be successful or at least inherit their parent's wealth and become adequate stewards of the savings bonds, real estate or other investments. Some people become rich through their own efforts. They may have been honest in doing so, although some are corrupt and become rich through dishonest schemes that harm the public.

The poor are often born into poverty or may have been disadvantaged in any number of ways. Why should we keep them alive? What benefit accrues to society when the poor are offered free medical care? That question, I cannot answer with statistics or sound bites, because I'm not a policy wonk. I don't know whether any practical benefit accrues to society by offering free medicine to a poor person. Perhaps there is no benefit at all. Even so, I would prefer to be in a society where we do not throw people away. It is an aesthetic choice, like my preference in art or music. I want a beautiful world, a compassionate world. I think it will be better and even stronger, but can I prove it? I cannot. Perhaps someone like Richard Dawkins could prove it--he has tried, at any rate. See "Nice Guys Finish First," his 1987 video on the practical benefits of cooperation.

If material success is, indeed, the end-all and be-all of a human being, then the obvious implications would come as a rude shock to many conservative Republicans that are far from wealthy. Those that society deems inferior are not necessarily so. Society has many delusions. Assumptions that are made in one generation can be turned upon their face in the next.

Once a human being is born into this world, he has become a member of our extended family, and his medical needs should be attended by the government. In our modern world, no one should have to face injury, cancer, or heart disease alone without any resources to assist them. If a man is troubled in his mind, then he should receive psychiatric care. If a man has a bodily ailment, he should receive the care of a physician or nurse. Lack of medical care assists the enemies of humankind, pathogenic bacteria and viruses, and it is not only the poor who will suffer, but those that they later infect. We are not isolated beings, but networked in a multitude of ways, and what afflicts one can afflict others. Lack of medical care results in more crime, more traffic accidents, more tragedy, and unintended consequences. Furthermore, when people find themselves in desperate situations, they sometimes lash out against society, with unpleasant consequences for everyone. I believe it is correct to avoid unpleasant circumstances or at least seek to mitigate them.
by igor 04:20 4 replies by igor 09:32 0 comments

Friday, October 1, 2010

What if I Lose My Two Pet Issues?

On this blog, it must be obvious that my two pet issues are gays, or at least gay rights, and marijuana prohibition, to which I am opposed.

Once pot becomes legal and regulated in a similar manner as alcohol, and gays achieve parity with straights, the question arises--what do I blog about next? I see victory on the horizon on both fronts, at least in the long-term. The facts are out there for people to access via the Internet, and I don't think the misinformation that was used in the past to block reform will be able to survive for much longer.

If homosexuality were no longer an issue, then I would be most concerned with issues that are held in common with many others. Primarily, the environment would be of concern to me. I am for government regulation and intervention in order to protect our shared heritage, the planet Earth, for future generations of human beings. Even though I won't be contributing any future generations myself, I still consider the human race my "family" and want what is best for them. I think that underneath the skin, we are pretty much the same, regardless of sexuality, race, and so on.

There are many other issues, of course, such as corruption in government, the electoral process, and immigration. However, the only issue that really seems of paramount importance is the environment. Global warming seems like a threat to our comfortable modern lifestyle, and I would be interested in seeing the problem addressed in an effective manner. At a minimum, our leaders should be discussing it in an informed and realistic manner.
by igor 04:20 4 replies by igor 09:32 0 comments

Monday, September 27, 2010

If I Were President

If I were President, I'd abolish the DEA and transfer their budget over to the Department of Energy. And when the Prohibitionists started weeping and moaning, I'd point out that the DEA did not exist for most of our nation's history, yet somehow the country got by just fine.
by igor 04:20 4 replies by igor 09:32 0 comments

Saturday, September 25, 2010

I Learned How to Play Fetch

A dog of my acquaintance likes to play "grab the toy" with a squeezable, squeaking plastic fish. I didn't know this game to begin with, but she taught the rules to me. Holding it in her jaws, she approached me as though to surrender the toy. When I reached for it, she turned her head away. Indifferent, I walked away, but she followed, again offering the toy. When I lunged for it, she darted away. When I gave up, she dropped the toy on the ground and let me grab it, even though we both knew that she's faster than me. She pretended to be furious about this theft and pursued me, barking, until I threw it for her to fetch. We had several repetitions of this nature. She enjoyed this a great deal, and I did too. I was amused by the observation that the dog was smart enough to get me to do what it wanted me to do.
by igor 04:20 4 replies by igor 09:32 0 comments

Our Decline

One of the problems with our nation's decline in power and prestige relative to China is that China has been emboldened to take the stick to its neighbors.
by igor 04:20 4 replies by igor 09:32 0 comments

Clumsy

Legal decisions handed down by judges are not usually hilarious, but this one is. I think Judge Ed Carnes may have a second career awaiting him as a humorist.
by igor 04:20 4 replies by igor 09:32 0 comments

Friday, September 24, 2010

Ahmadinejad at the UN

One of the less irritating aspects of Iranian President Ahmadinejad is that I always have to copy and paste his name. The spelling is not intuitive.

I disagree with his assertion that "the majority of the American people as well as most nations and politicians around the world" agree with the view that "some segments" in U.S. government orchestrated the 9/11 attacks. No one I know believes such a thing, and I mingle in liberal groups. I certainly have more faith in my government than to think a stunt like that would be pulled. The news would be explosive, many times worse than Watergate. It's unthinkable. Unless some excellent proof were made available, I would not even consider it. There is no parallel in American history, at least to my knowledge. Besides my faith in government, there is also my faith in government incompetence. A system that can't cover up Abu Ghairab certainly couldn't have gotten away with staging 9/11. They're just not that clever.

Now the Iranian government, on the other hand, is a different story. They indeed engage in deceit against their own citizens, having fixed an election, and they employ violence against peaceful protests. Perhaps Ahmadinejad is projecting his own values (or lack thereof) onto his enemy, failing to appreciate that his enemy is more scrupulous than he. Ethics are not understood by those who lack them.
by igor 04:20 4 replies by igor 09:32 0 comments

Thursday, September 23, 2010

HIV Infections

The gay community continues to suffer a high infection rate from HIV. When I was young, I regarded getting tested as a rite of passage, besides a source of free condoms (they gave them out at the clinic). I was all about safe sex and could recite all the major recommendations. I'm not sure many young people are as vigilant about disease as they could be. Instead of approaching the ritual with the reverence it deserves, young lovers rush into things under the influence of hormones and alcohol. Sometimes things that should be remembered, such as a condom and how to use it, are forgotten. Then begins a lifetime of coping with unpleasant maladies such as gonorrhea, herpes, genital warts or worse, HIV. Worse is the knowledge that one may infect future lovers. Not everyone is forthcoming with crucial information regarding their infection status. It is the rare individual that is honest about such a matter.

Our college professor preaches to us about political subjects, even though she is supposed to be teaching chemistry. Today she offered us her opinion on sex education, which to her mind ends with abstinence. That road leads to death. Young people should be aware of condoms and how to use them. There is nothing gained by withholding lifesaving information. Her opinion about condoms is that "well, they don't always work." Condoms are the best known defense against HIV during the sex act, period, end of story. No, they are not a perfect protection, but what is? I have yet to meet anyone that contracted HIV while engaging in safer sex.

Abstinence is a good idea for those that are still in high school. I'm all for it. I am also in favor of monogamy, although it is not the choice of everyone. But teenagers should be taught about condoms and supplied with condoms and other forms of birth control if they request them. Today, with HIV, it is a matter of life and death.
by igor 04:20 4 replies by igor 09:32 0 comments

Zucchini

I knew zucchinis were good for you, but I didn't know they could protect you, as well.
by igor 04:20 4 replies by igor 09:32 0 comments

Saxby Chambliss and a Call for Murder

Recently, someone traced to an IP address associated with the office of Senator Saxby Chambliss (R-Ga.) posted on a blog, "all faggots must die," which summarizes the Republican viewpoint. Although some are protesting this, I think it is a rare example of honesty on the Republican side. Republican hate is real, motivating all of their actions. The rest of their argument against "Don't Ask, Don't Tell" is composed of lies.

If Saxby Chambliss or his out-of-control henchmen go gunning for gays, then I am prepared to defend myself and my property. I am not afraid to die and do not fear cold-blooded murderers.



Update: Chambliss apologized and fired a member of his staff, who remains anonymous. That's good enough for me. I have always been impressed by apologies. It always surprises me to learn that someone has a bigger heart and a wiser head than I had assumed based upon a previous observation. I think that Chambliss did the right thing in this instance. I would have done the same.

However, I do hope the incident causes Chambliss to reflect upon his positions on other issues involving gays, and in particular, our brave gay soldiers. The comment had said, "all faggots must die." The "faggots" serving our country in uniform are willing to die to protect our country. They should be treated with dignity and respect, not kicked out of the military. I don't think it is much to ask to request that their sexual orientation be left alone. We are lucky that they are willing to put their lives at risk for us.
by igor 04:20 4 replies by igor 09:32 0 comments

Wednesday, September 22, 2010

Bravo for Zuckerberg

Bravo to Mark Zuckerberg for pledging $100 million dollars to the Newark public school system in New Jersey.

I don't care what the movie says about him. I think that with philanthropy, no one should look a gift horse in the mouth. It a fine thing when a wealthy person gives back to the community. I think it is a good way of polishing one's legacy.
by igor 04:20 4 replies by igor 09:32 0 comments

Tuesday, September 21, 2010

Sen. McCain, Nothing but an Empty Suit

"I regret to see that the long-respected and revered Senate Armed Services Committee has evolved into a forum for a social agenda of the liberal left of the Senate," Sen. John McCain (R-Arizona) said last week on the Senate floor.

What's McCain talking about? An attempt to lift the "Don't Ask, Don't Tell" rule that discriminates against gays in the military. Someone needs to point out to Mr. McCain that a majority of Americans now support lifting the ban.

I used to like Sen. John McCain when he was running against George W. Bush. He used to favor allowing gays in the military. He used to be a rare maverick in the Republican party about ten years ago, but for the sake of political expediency, he degenerated into an empty suit filled up with prejudices from conservative Christian groups. I have lost all respect for McCain and will be pleased when his time in public office has come to an end.


Update:

Even though military leaders, rank and file service members, and the majority of the American public wanted to end the discrimination, the US Senate was unable to block a filibuster on the National Defense Authorization Act (NDAA).

Led by John McCain, Senate Republicans have stopped the recall of "Don't Ask, Don't Tell" for now.

For more information, check here.
by igor 04:20 4 replies by igor 09:32 0 comments

Monday, September 20, 2010

The DEA Should Relocate to Iran

In a CNN article on Proposition 19, which will legalize marijuana, there is a link given that supposedly explains why the former DEA chiefs frown on legalization. The real reason is that they want to continue soaking taxpayers for billions of dollars to wage war against American citizens. The proper place for a former DEA chief is in Iran, where he will feel right at home. The country founded by George Washington and Thomas Jefferson--both marijuana farmers--is not the right country for them.

Proposition 19 certainly has made some odd bedfellows. The Mexican Mafia, pot dealers, and pot growers are on the same side as the DEA. Both sides of the drug war want the war to continue, because it has proven extremely lucrative for their selfish interests. The same scenario applied during Prohibition (of alcohol).

by igor 04:20 4 replies by igor 09:32 0 comments

Here's to Home Depot

I've opened up the "good news" category because most news tends to be bad news. Worse, most of my blog entries tend to criticize the negative elements in the world. Writers everywhere often focus upon the negative--political writers more so than others. The reasons why are obvious. What is the point of extolling something that is already working fine? Most people will agree if something is working without any problems, so there does not seem to be any point in discussing it.

My electric Black & Decker weed eater broke after three years of service. I imagined I'd have to buy a new one. I emailed the manufacturer and got the runaround. They told me I did not enter the model number in the correct space in my email. They have an automated email bot that requires all information to be entered in a precise location. After my second email bounced, I called the toll-free number, was put on hold, and then spoke with a CSR, who told me the nearest repair facility was a hundred miles away. I called the repair center, and they said the weed eater's warranty had probably expired, but they weren't sure, so they suggested that I take it back to the store I bought it from, Home Depot. Trouble was, I didn't have any receipt.

The CSR at Home Depot said, "Go ahead and pick out a new one." I was flabbergasted. I expected to come home empty-handed, and at any other store, that would have been the case. I felt grateful and picked a box that had been damaged in shipping, although the weed eater itself was fine. That was my way to pay back Home Depot for doing the right thing.

Some people probably abuse the privilege of return. In areas where returns are abused, store policy may require a valid receipt.

I remain a big fan of the Home Depot chain and prefer it over all competitors. I have had good experiences there on a consistent basis.

by igor 04:20 4 replies by igor 09:32 0 comments

Tuesday, September 14, 2010

We are Marvelous Machines

The complexity of human physiology intimidates me. I find myself more sympathetic of doctors. Their job must be the toughest one of all, with such high stakes. One of the problems with medical science is that there is a great deal we still don't know. Mysteries remain. Research continues in order to verify new theories and test new treatments.

My college updated our textbook after only two years, leaving students like me stranded with an unsellable edition. However, I think it will be a good reference to have on my shelf. I may want to do some recreational reading in the future. Many of my long-standing questions about the human experience seem to be answered in its pages.

We are marvelous machines.
by igor 04:20 4 replies by igor 09:32 0 comments

A Stimulus Story

$800,000 of the stimulus money was used to teach African men how to wash their uncircumcised genitals.

Perhaps the stimulus managed to stimulate something after all.
by igor 04:20 4 replies by igor 09:32 0 comments

Sunday, September 12, 2010

Can't Refute Calderon

I have to agree with Mexican President Felipe Calderon.

Five seconds ago, CNN posted his remarks, and then deleted them. However, I remember what was posted.

"We live next to the world's largest drug consumer, and all the world wants to sell them drugs through our door and our window. We also live next to the world's largest arms supplier, which arms our criminals."

The legalization of marijuana would crush the Mexican drug lords. No other illegal drug approaches the popularity, safety and usefulness of marijuana. Legalization of all drugs would be the best scenario, but even the legalization of marijuana alone would have a most profound impact upon the underground economy.
by igor 04:20 4 replies by igor 09:32 0 comments

50 Cent: Talentless Airhead

I saw 50 Cent on The Graham Norton Show and thought him a talentless, egotistical know-nothing. Now he has proven himself beyond doubt to be exactly what I thought he was.
by igor 04:20 4 replies by igor 09:32 0 comments

Iran Sets a Ransom

Iran has set a ransom of half a million dollars for the kidnapped American female hiker. The nerve of those barbarians. No one should visit that barbarous region of the world without a stockpile of grenades, a machine gun, and a cyanide capsule in the event of imminent capture, because the fanatics are fond of torture. Sadism is institutionalized in Iran.

If the kidnapped hikers were spies, then it is a great pity they were apprehended without inflicting any Iranian casualties. They should have slain the maximum number of fanatics prior to capture and then detonated their own suicide vests to give the fanatics a nice little dose of their own medicine. The more of the regime's henchmen converted into fertilizer, the better for the race of men.
by igor 04:20 4 replies by igor 09:32 0 comments
techlorebyigor is my personal journal for ideas & opinions