Saturday, April 30, 2011

Using .htaccess to Redirect Renamed or Deleted Web Pages, Forums, and Directories

A web admin may have a good reason for renaming the stray page or directory on a web site, but doing so impacts search engine optimization. One wouldn't wish to greet visitors or search engines accessing old links with a clumsy 404 page. An elegant solution is to redirect access attempts to a new page. For a simple rename, this is easy enough:
redirect 301 /Atheism.html /atheism.html
Any hits on Atheism.html will be redirected to atheism.html. This is clear, economical code, the best choice for a simple scenario like that. But what about the case of deleted forums with variable links, such as /messages/techforum/posts/, followed by many links such as 2009/12/75433.html? A common desire is to redirect many links in a directory to a single directory or file. The 301 technique no longer serves in that scenario.

My solution is to use Apache's RewriteCond command, which requires the following line somewhere near the beginning of your .htaccess file:
RewriteEngine on
With that prerequisite in place, one can then use RewriteCond and RewriteRule to redirect requests for /messages/techforum/post/2009/12/75433.html, for instance, to notice.html:
RewriteCond %{REQUEST_URI} /messages/
RewriteRule ^(.*)$ /notice.html [R=301,L]
REQUEST_URI is an environmental variable with the specific page accessed on the web site, excluding the web site's base url. The RewriteRule drops all text after the base url and replaces it with notice.html, which then should appear on the user's browser.

IP Addresses of Spammers, Hackers, Leaches and Bothersome Bots

This is the list of banned IP addresses for the web site I admin. It is the product of countless hours pouring over my server logs and observing activity from the addresses below. Pay no mind to the date of this blog post. I update this post periodically with my latest blacklist in use on the web sites I admin.

Not all IP addresses listed below are malicious hackers or spammers. I'm an aggressive admin that takes a dim view of bots other than the big three (Google, Bing/MSN, Yahoo) and social media sites like StumbleUpon, Digg and Facebook.

My list bans bots that may be content scrapers or researchers. If they're not human and not related to a major search engine, I don't care what they are. Rule of thumb--if my site gains nothing from the transaction and if the transaction isn't a human being on a browser, ban it as a waste of system resource and a potential liability. At the very least their leaching could reduce the response time of my site for a legitimate human user.

Some humans were observed engaged in non-browser activity, in some cases attempts at modifying or exploiting our site. If a human user isn't using a browser, but an automated script seeking to exploit the site, then they do not need to visit the site at all.

My many and varied bot-traps nail several IP addresses on a weekly basis, but sometimes just for fun and recreation, I scan for bots with my own eyes. My hands-on methodology of banning IP addresses is to examine my server's log file and note the obvious non-human activity. I identify bots based upon their actions and other criteria which I will not reveal here, but anyone who has looked at a raw server log should understand what I am talking about. It is not difficult to determine who is human and who is a bot, because bots are typically very stupid and, well, robot-like in their behavior, which should not come as a surprise. The authors of these bots are not terribly bright either, judging by what I have seen. When I have identified a single IP address, then that is not the end of the story. I want to know if it belongs to an entire neighborhood which is full of bad bots, because this is often the case in my experience, and why ban one single IP when one can ban 255 or more? It is more efficient to shut down bad IP ranges than play the game of one IP address at a time, which could result in a truly massive .htaccess in the end. I research Project Honeypot (I have been a registered user of that site for years and even authored a dark .css style for the web site) and related sites to determine the true nature of an IP address and the neighborhood in which it resides.

I take a dim view of Russia and China. For one thing, these states do not value freedom of speech and do not enshrine democratic principles. Also, our site is English, and I don't envision attracting any Russian or Chinese fans in this lifetime. Unlike some admins, I don't ban the entire region. But if I notice a large number of spammers in an IP address neighborhood in Russia or China, I don't hesitate banning the entire neighborhood rather than bother with singling out individual IP addresses. I'm also skeptical of Poland and the Ukraine based on the many bad bots I've witnessed from those nations. Among all nations, I give China short shrift, because of its poor reputation and poor compliance with standards. When you look up an IP address with WHOIS, Chinese accounts sometimes don't specify a small network neighborhood, but offer a range that may encompass millions of IP addresses rather than just hundreds or thousands. Where China is concerned, if I detect numerous bad bots in a general neighborhood, and China refuses to specify a proper narrow range in WHOIS, then I will not hesitate to ban the millions. With other countries, I take a more refined approach, depending upon my evaluation of the level of corruption in their government. I am reluctant to ban entire neighborhoods in democratic nations, but if an IP range is reserved exclusively for web hosting or what is termed "Direct Allocation," then that is a red flag.

I recommend the .htaccess security measures found on Perishable Press. The .htaccess code found on Perishable Press requires testing and adjustment for specific sites, because it is more complex than a mere Deny-from. However, Jeff's code is valuable and well-worth the effort of refining, because it adds another layer of protection in case attackers slip past the Deny-from barrier. I have integrated some of the intel from his excellent "5G Blacklist 2012" into my own .htaccess, but I do not include those bits here, because the credit for that is his, not mine, and he updates it and has the best version. I recommend visiting his site and merging his intel with mine to make a synthesis. An admin that does so may notice a reduction in leach and spam traffic. My .htaccess is a synthesis of my own work with that of Perishable Press. As for Wizcraft, which I used to recommend, I do not use his intel any longer, because he does not respond to emails, and some of his deny-froms have proven problematic, causing technical issues with Wordpress, for instance. I only use Perishable Press intel and my own. My code is in use on a Wordpress site right now.

Bear in mind that intel is perishable with the changing nature of the Internet, and I'm not sure what the shelf life is. I'll try and keep it updated periodically, but there are no guarantees. Some admins grant a reprieve to addresses on an annual basis. They worry that spammers will relocate, and the IP addresses may then become legit. I don't feel like that is a worthwhile concern for my purposes. I would rather continue blocking address ranges that have a lengthy history of hosting spammers and hackers. Let's say a spammer abandons or gets booted from an IP. The hosting company will rent the IP to somebody else, and chances are that sooner or later they will rent it to another spammer, because they were lax enough to rent to one spammer and are likely to make the same mistake again in pursuit of the almighty dollar. The only good IP addresses are those in use by end-users of an Internet Service Provider and major search engines such as Google. Anything else is questionable at best and likely to be used by spammers sooner or later.

You can pop this baby right into your .htaccess file if you admin an Apache server. Beware of Blogger's word wrap, though, which sometimes creates syntax errors in copied and pasted code. Note that the last Order directive in an .htaccess file will be the one used. If you already have a Limit paragraph in your .htaccess, add the Deny's to it, but use only one Limit container.

If you would like to hire me to harden the security of your WordPress blog, my one-time flat fee is $250. I can do all of the things described here and a bit more that is not. I require a response to emailed questions, payment in advance, and for twenty-four hours, admin access as well as Secure Ftp (SFTP) access to your site. As of 2012, I no longer offer this service, because I do not have the spare time to deal with new customers.

Thursday, April 28, 2011

Infections

I was hit by two nasty, sneaky, time-consuming infections this week. Computer virus and cold virus. One I've licked, the other I haven't kicked. Guess which. Achoo!

There may be hailstones. I have a sturdy umbrella. In adversity, I swim along like a fish upstream. And when I reach the shallows, there will be others. Nature is a superb engineer that has built redundancy into all her systems.
by igor 04:20 4 replies by igor 09:32 0 comments

Tuesday, April 26, 2011

The Old Have It Best

I had been suffering from a cold for a few days, but woke up this morning feeling better. The following reflection wasn't really a dream, but any thought just upon waking could be the conclusion or resolution of a dream, so I classify it as a dream. The quaint language gives me the impression it's paraphrased poetry that I read. Lately I have been reading a book about Shakespeare, "1599", that refers to playwrights flattering the elderly Queen Elizabeth. She was said to have been vain about her appearance even to the end.



Between old and young, the old have it best. The old have seized their days in the Sun. Not disease, poverty or injustice can take those days away from them. Their joys are writ upon the Book of Days forever and ever. The young cannot say which card Fate will turn over next. And if the world ends tomorrow, the old have had the most, while the young barely supped from the cup of life.
by igor 04:20 4 replies by igor 09:32 0 comments

Sunday, April 24, 2011

White Room

A vague dream just before waking had me in a white room with two women who were talking with me about innocuous subjects, one close enough to put her arm around my shoulder, the other watching the two of us from a distance. I didn't know the watcher, but seemed to know the closer one who moved ever closer, becoming affectionate without any concern for the woman watching us. I did not decide how to respond until late, and then I moved away, because it was not the proper time or place and it was not a good idea either.

When I woke up, I concluded she was an attractive fellow student, my age, from school, who had made a point of speaking with me before and after class, piling on enough flattery to make me wonder what she was trying to sell me, until one day when I mentioned in passing but on purpose that I was going to visit a friend and identified the friend with a feminine pronoun, which eliminated her interest. (The friend was only a friend, a point left unmentioned.)

Most students in the nursing program were female, and that's one reason that I'd recommend the study of nursing to any single straight man. However, I'd be careful which school is chosen. Some are wastes of time and money, with too stringent a selection process. I invested a year of study, fees for stupid things like sports I don't play, and outrageous prices for textbooks, with nothing to show for it at the end, despite my straight A's, but dreams like this*.

* I also know about neutrophils, lymphocytes, monocytes, eosinophils, & basophils, remembered by the immortal mnemonic, Never Let Monkeys Eat Bananas.
by igor 04:20 4 replies by igor 09:32 0 comments

Saturday, April 23, 2011

Syrian Virtus

I see something of the ancient Roman virtue in the Syrian protesters who are willing to die for freedom, even marching unarmed into a hail of bullets.

Assad has long since lost whatever credibility he may have once had. He should be recognized all over the world* as a peer of Khadaffy. Whoever the Alawite are, whatever their religion is (and that is by no means clear), their history is bloodstained. Where is the religion whose followers have not committed atrocities? Possibly the Amish.

* with the possible exception of followers of Iran's immoral regime.
by igor 04:20 4 replies by igor 09:32 0 comments

Made in China

This is what Made in China is all about. One day, the U.S. may wish to challenge China, a fascist state made strong by our purchases of its exports. Our good-paying jobs and the jobs of our children were sacrificed in exchange for goods of short duration that are sometimes toxic. Long ago, western leaders succumbed to the siren song of free trade with slave nations in order to satisfy businessmen that saw a potential for short-term profits.

Greed is the main problem with suits. They don't fully appreciate objectives outside of their own personal enrichment. There needs to be a counter-balance coexisting along with the capitalists, a wise governor at the helm that looks ahead twenty years from now. Where was that wise man? He was missing. Instead there was another suit at the helm playing golf with the other suits and doing their bidding.
by igor 04:20 4 replies by igor 09:32 0 comments

Nutrition Info

I use this web site for finding out the nutritional value of any food. I had been eating mangoes every day this week, but became concerned that I might not be getting enough vitamin C. Not all fruits have vitamin C, and I wasn't sure about mangoes. According to the above site, mangoes are rich in vitamin C.

However, I'm not yet satisfied that self.com gives accurate info. A discrepancy exists between the vitamin C content of bananas as reported by Wikipedia and the amount reported by self.com. Which is accurate? I hope for the more optimistic assessment. Also, a search on self.com for "peas" brings up meals with numerous constituent parts, such as "Baby Food, boiled, with peas, carrots, ham, oats," but the results are suspect, as the nutritional value of such meals depend upon the manufacturer, method of preparation, serving size, and the proportions of ingredients.
by igor 04:20 4 replies by igor 09:32 0 comments

Thursday, April 21, 2011

Insecticide

The use of certain household pesticides has been linked to lower working memory capacity in kids.

For an insecticide, I'm partial to boric acid, which has been in use for a very long time and seems safer on the whole than other chemicals. I think that long historical usage by humans is a good indicator as to a substance's safety. If something has only been in use for half a century, then it is unlikely all the effects are known. Boric acid is not difficult to come by. It is sold at many grocery stores and Home Depot in one form or another. It's cheaper than more toxic alternatives. A year's supply for an average family should cost about $8. It is effective against a wide variety of crawling insects.
by igor 04:20 4 replies by igor 09:32 0 comments

Wednesday, April 20, 2011

Happy 4/20

Here's wishing a happy 4/20 to all those who appreciate cannabis. One day, the herb will be accepted again for all of its many uses, as it was for thousands of years.
by igor 04:20 4 replies by igor 09:32 0 comments

Go to College, Work Hard, and Remain Under-employed

A timely opinion piece in the New York Times expresses my sentiments about today's job market, where a college education means nothing, wages and benefits are slashed, and employers seek interns for free and don't hire them at the end of their volunteer term. Meanwhile, Republicans want to spend more on war and less on the people. What's new?
by igor 04:20 4 replies by igor 09:32 0 comments

Sunday, April 17, 2011

Time Travelling

If I could travel in time for a single day, I'd go back in time rather than forward in time. The future seems unreal to me. I like analyzing, interpreting and drawing conclusions, and that is easier with the past, when facts are known, than in the uncertain and ever-changing future, when I might not be. I'd like to go back thirty years to share what I know now with the individual that I was then. It would be a dicey affair, visiting myself. How would my past Self interpret such a visitation? I suppose there are ways that I could prove to my past Self that I was who I said I was, but such an intrusion would be unsettling.

I remember having had certain thoughts and feelings which seemed borrowed from a much later period of life, possibly premonitions. There was nothing specific that I could really sink my teeth into, only whisperings of the future and of certain paths that could be taken in the most ambiguous and general terms. I did not know the source, whether intuitive, spirit or telepath, and it seemed unwise to encourage such trespasses, so I shutdown the avenue of communication and listened no more. Perhaps it would have been better to listen more.

Of course, if I could go back in time, I'd carry as much gold with me as possible in order to liquidate and purchase stock in Microsoft, Wal-Mart, Toyota, and Honda. Even a $10,000 investment would have made me a rich man, I think, thirty years later. I don't know how I would have managed all the necessary business transactions in a single day. Another thing on the "must-do" list would be to attempt contact with the President of the United States via a written letter, easy enough to do. I would write down things that will occur in the next couple months or years in order to validate my authenticity, and then things that will occur later, to help the President craft public policy.
by igor 04:20 4 replies by igor 09:32 0 comments

Saturday, April 16, 2011

Special Delivery

The case of the pooping postman is funny because it is unexpected.

I'd be willing to look the other way for a price. A fee of $100 would be required. If he didn't have $100 on hand, he'd have to go to the ATM and come back at the end of his shift.

Same scenario transpired two years ago when the neighbor's tree-cutter felled a tree onto my property, devastating a bush. Inspired by mafia taxation on The Sopranos, I exacted a $50 fee, in cash, on the spot. Higher rates apply for public defecation. I'd offer a twenty-five percent discount if the postman were Asian Indian, because I understand public defecation is the norm in India.
by igor 04:20 4 replies by igor 09:32 0 comments

Free Photos of Outer Space

A web site at Berkeley University offers free recent photos of outer space.

No geek has branded any text to the pictures this time, which means the pictures might serve as desktop wallpaper or as part of a screen saver rotation.
by igor 04:20 4 replies by igor 09:32 0 comments

Tuesday, April 12, 2011

The Unwelcome Mr. Reaper

The Grim Reaper is an entity never far from my thoughts. I often imagine what it will be like to die, what will happen afterward to this collection of cells, and what will happen to the ones that I care about, who are few in number, and the ones that I'm acquainted with, a much greater number, and the human race as a whole, which encompasses everyone now living and those yet to arrive.

The physical aspect of death is scary enough. I imagine the worst pain I've ever experienced and multiply it tenfold. The thought of such pain is terrifying. Fear is enough for most people to avoid potentially fatal situations such as playing "chicken" with speeding cars. Worse is knowing, right before the end, that there will be no second chances, that the change is irreversible. I am reminded of the sad look on my Grandmother's face when she was in the hospital. She knew she was going to die and said little. But I have no doubt she would have liked to get better, even if it meant giving up the use of an arm or leg, or even both arms and both legs, anything to live a bit longer. She would very much have liked to have relocated her consciousness to another body, not displacing anyone, but cohabiting. I would gladly have hosted her consciousness, although radical adjustments would have been necessary on both sides. Perhaps the technology for such an arrangement will become available in the future, too late for my readers and me.

As for physical remains, it is humbling to accept that this body that one has taken such pains to keep clean, whole and fortified will become food for microorganisms and insects or else burnt to ashes. There is an insane fear that one might regain consciousness at a late state of decomposition to discover that one's nose, mouth or eyeballs are being devoured by worms. It is distressing to imagine other people coming upon one's corpse and being grossed out, even nauseated by the sight or smell. How embarrassing! But then, where will the embarrassment originate?

As for my dear friends, which is to say, my family and partner, the "leave" is all-important. That is, the manner and state in which I departed would be the essential thing. I would want to feel like I did well, not leaving things undone that needed to be done, and not doing things that should not be done. One does not wish to be despised, with people pissing on one's grave, but mourned truly as a genuine loss and recognized, if not as a hero, then as a basically good fellow no worse than any other sort. That is why no one should envy such villains as Khadaffy, who though rich and well-known, will not be mourned by anyone in possession of a conscience.

As for my acquaintances, those that knew me at a distance, I like to imagine what might be said in confidence. I doubt much would be said at all, because I do not think I made a great impression on anyone really. People tend not to remember the things that I said or did, but to ignore me for the most part, as though I were already a ghost. I expect that after uttering a general platitude, most would dismiss every thought of me from their mind. Thus, I would be forgotten, just as most of the dead are. Only the best and the worst of people are remembered, and I'm neither, but somewhere in the middle ranks. Even the best and the worst, they too will be forgotten if there's truth in the precognition below.

For the human race as a whole, I'm pessimistic, because I believe that man's mastery of technology overwhelms his feeble moral compass, and I also believe that this disparity will result in the annihilation of intelligent life on earth. Surviving will be microorganisms, plants and small creatures. Perhaps there is time remaining in our solar system for another process of evolution on this planet. But it may be billions of years before another intelligent species arises. Traces of humankind will linger in outer space, perhaps, and in certain areas of the earth. Another intelligent species with an appreciation for archeology may unearth our bones one day.
by igor 04:20 4 replies by igor 09:32 0 comments

Mutations are Good for You

I've said it before, and I'll say it again--mutations are good for you. Go ahead and drink that potion of mutation without a second's hesitation. If it turns ill for you, then double down by drinking another one, followed by a third and a fourth. In my experience, bad mutations tend not to be so very bad (-10% MP for a warrior? Pschaw!) whereas good mutations tend to be very good indeed, as shown below:


I always seek the altar of Jiyva, the God of Acid, who causes hallucinations has the power to cure bad mutations and grant beneficial mutations, which is highly desirable, as potions of cure mutation are scarce. But I haven't had much luck in locating an altar in the lower levels. Typically, my characters choose Okarawu instead, whose altars are easier to locate.
by igor 04:20 4 replies by igor 09:32 0 comments

Okarawu's Secret

Unlike the Troglodyte God, the wise Okarawu takes into consideration his worshippers' aptitudes, or so it would seem.

Press 'm' to access the Abilities Menu and then turn off the Throwing ability in order to minimize skill acquisition in that area, which will also minimize the chance that Okarawu will gift your character a trivial pack of darts or needles. Preferred are Okarawu's armour and melee weapons.

Employing this strategy created favorable auspices for the following gift, which can serve as a primary melee weapon even in the deepest level of Hell:

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

Friday, April 8, 2011

Mitch Hedburg

I saw a video of a standup act with the comedian Mitch Hedburg tonight. He's unique among standups. He delivers without eye contact, staring at the floor or hiding his eyes behind his long (for a man) blonde hair. One can't decide whether he's witty or crazy; smart or moronic. His deadpan delivery in a rhythmic sing-song voice makes him funny. He expresses nonchalance, weariness with the world and irony. I think we've all known a Mitch Hedburg or else posed as one in high school or college.
by igor 04:20 4 replies by igor 09:32 0 comments

Thursday, April 7, 2011

The Perfect Meal

The perfect meal consists of two sandwiches of whole-grain toast with chunks of avocado served with black or green tea.

It takes all of five minutes to make, but for my money there's nothing more delicious in the world. The only catch is that the avocado has to be a Haas and has to be perfectly ripe. It's time to snack when the skin is black.


Cost? Haas avocado, $1.49 or so; a loaf of whole-grain bread is only $1.25 at the thrift store, which is the place to go to buy cheap bread. Tea is so cheap that it is not worth itemizing--or should be so. We do live in good and prosperous times, all things considered, do we not?
by igor 04:20 4 replies by igor 09:32 0 comments

Saturday, April 2, 2011

News Gives a False Impression

The world's headlines today were suboptimal as usual. Twelve or more UN workers were killed by a mob in Afghanistan. A Catholic policeman was killed in Northern Ireland. The Libya conflict continues with no apparent end in sight. Japan is coping with radiation.

I have some ideas of my own about some of these stories. In regard to Afghanistan, I find it difficult to believe a mob became bloodthirsty just because of a small-time hick preacher in Florida burning a Koran. That is B.S., no way Jose do I believe for even one second that Afghani civilians would kill twelve U.N. workers over that. (What does the U.N. have to do with it?) I think, instead, the Taliban infiltrated a mob of offended people who might have wanted to demonstrate and let their feelings be known, but I don't think most of the people actually wanted to commit murder of random foreigners that have no connection to Pastor Putz, or at least I hope not. Maybe I'm mistaken. As for Northern Ireland, I'm willing to bet the cop was targeted because he was honest and wouldn't join the other cops that are collaborating with local hoods. I have a need to assign rational motives to irrational deeds. Again, I could be mistaken.

At any rate, there were millions of stories that went unreported in today's news. For instance, it was a beautiful day where I live, and people I saw out on the street looked nice and happy, like they were having a good time. Whenever I read the negative stories in the media, I remind myself that in ancient times such stories were commonplace, even trite. Mobs arose and slew governors, senators, and anyone they could get their hands on. Rebellions were sometimes successful, usually not though, and reprisals were severe and deadly, all over the world, through all times. Khadaffy has no monopoly on ruthlessness. He is just doing what wicked old kings have done since before Hammurabi. I accuse Khadaffy of failing to abide by the rudiments of the Western Enlightenment, and yes, I do think it is unforgivable, because knowledge and history are immediately accessible to someone of his means. I don't forgive any greedy selfish dictator who cares only about his personal power. They don't deserve being forgiven. If I were a dictator, I would at least attempt to improve the lot of my people. Why are there no benevolent dictators, like the Philosopher-King described by Plato? Why did Khadaffy have to be evil, lazy, stupid, ignorant, and delusional? I see the truth in Lord Acton's dictum, power corrupts, and absolute power corrupts absolutely.

I consoled myself with an anthology of Oscar Wilde's short stories, yarns he used to spin for dinner parties and the like. He never actually wrote them down, but others did, his enthralled listeners.
by igor 04:20 4 replies by igor 09:32 0 comments
techlorebyigor is my personal journal for ideas & opinions