Gotcha: Chrome IFrames Don’t Render

While creating a website that needed an IFrame, I ran into a peculiar problem: my IFrame rendered in all the browsers except Google Chrome. But in Chrome, my Iframe doesn’t show up at all.

My code looked like this:

<html>
<head>
</head>
<body>
  <center>Stuff</center>
</body>
</html>

The solution is simple, just flesh out your page a little more, making sure to declare the doctype and title tags, like this :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>My Stuff</title>
</head>
<body>
  <center>Stuff</center>
</body>
</html>
Advertisements

Drupal Gotcha : hook_install()

It may not be immediately obvious why your new database schema doesn’t appear to be installing, updating, or doing anything, really.

The answer is because hook_install() is exactly as it says – it only is called when the module is installed. But not when it is disabled/enabled.

If your tables arent being created, disable, uninstall, reinstall .

Database Restore (Restoring…)

MS SQL can be a little overly complicated sometimes, especially when it comes to backing up and restoring your databases.
If you’re restoring a database with the NO RECOVERY option, you could end up with a database that’s constantly in the (Restoring…) state.

The solution is simple: Ditch the wizard, and restore with recovery.

RESTORE DATABASE MyDatabase
   FROM DISK = 'MyDatabase.bak'
   WITH REPLACE,RECOVERY

Understanding Spam

The first step to defeating your enemy is to know them. Read more about what spam is, how it works, and how it’s done.

How Spam Works

Your email address is worth 1 cent. If it’s known that a living being is behind the address, it’s worth more. And if it’s advertising likes and dislikes are known, it’s worth around 20 cents. Of course, one email address is not going to do a spammer much good. Instead, they buy, sell, and harvest millions of email addresses at a time.

Unsubscribing to a legitimate email should be just that, but unsubscribing from a spam mail only means that there is a human who reads spam at that address. Men are 50% more likely to buy things from spam than women, which explains why so much of it are products for males. It’s also worth noting that it’s easier for a spammer to continue sending emails to non-existant, dead, or blocking addresses rather than to detect this and cease sending them.

Spam Email

Phising Spam Sample

Phising Spam Sample

With modern day aggressive spam detection that can automatically direct spam into the trashcan without the user ever seeing it or even prevent it from reaching an email address at all, spammers have also stepped up their game. They no longer use words easily detectible by bayesian (self-learning) spam filters such as male and female anatomical parts, and instead use ones that convey the same idea – ‘member’, for example. Other techniques involve using pictures, not including hyperlinks, adding books or quote text, or even including random garbage in the email to all try to avoid the recipient’s spambin. It doesn’t matter if the resulting email has misspellings, grammar errors, or makes no sense, because users are likely to read curious looking emails. What makes spam so easy is that it can all be done from a program that automates sending different email messages from a template to a plethora of unfortunate email addresses with a single click of a button.

Phising is also a common technique. It’s all too easy to fake sender email addresses, url links, and content, especially since so few people know to examine email headers for validity.

Botnets

A botnet is a group of large compromised computers (usually in the thousands) used for spam mail sending and other malicious purposes. Botnets are either rented from other hackers or simply stollen. Botnets have made past headlines for sending massive amounts of spam ( Rustock Botnet Responsible for 39% of All Spam)

From The Spammer’s Perspective

It’s all too easy (watch a video of xrumer in action) to get started into the spam business, which is centered around our modern culture of instant gratification. $1,000 will buy 1 million email addresses, and referral sites will usually offer a portion of the sales (25%-50%). From there, a mass-mailer can be aquired for little cost, and mass-mailed in a matter of minutes. Of course, if the employment source decides not to pay up, there’s little a spammer can do. To avoid authorities and taxes, spammers employ money laundering techniques.

Product Buyer’s Pricetag Referral Profit Profit for 0.0001% of Sales to 1 Million Email Addresses
Male Parts Enhancer $300 25-50% %7,500-15,000
Online Casino $100 25%-50% $2,500-5,000

Forum and Blog Spam

Forum and blog spam works much the same way that email spam does, only with different guardians: spam blockers like Askimet and services like Captcha. Spammers obtain lists of sites by buying them, crawling for popular software, or simply by human inclusion. Forums simply employ captchas and other human validation techniques like logic puzzles, pictures, honey pots, and timing the form submission time to prevent spambot signups and posting. Since most forums and blogs use the same names for fields, automatic form fillers can easily generate random names and emails, and even register and validate spam email accounts.

Captchas and Other Validation

Some spambots can solve logic puzzles while most others have employed optical recognition (OCR) to crack traditional captchas and picture-puzzles. But that’s not all – spammers also have a black market for outsourcing to better captcha breaking services, or even to human solvers for as low as $1 per thousand captchas. With human crackers, a screenscraper is employed to send a copy of the image to the cracker’s screen who then types in the answer and sends it back.

Stack Overflow's Re-Captcha

Stack Overflow's Re-Captcha

GitHub Accidentally Wipes Their Database : How to Do Customer Service the Right Way

Sunday, Nov 14, during a testing session, GitHub accidentally mis-configured their test plans and ended up deleting their entire production database (full article).

How did they receive 100+ comments saying ‘No worries, mate. Keep up the good work.’ ? With good customer service. Notice how they did it.

They publicly announced their blunder, summarizing what happened for tl;dr readers and with a fully-detailed explanation for all who cared to read. They got things straightened out, set up a plan and schedule for the remainder of what needed to be corrected, and announced what they are doing to prevent this situation. And notice what they didn’t do – make excuses, pass blame, or hide the situation.

Talk about excellent customer service. When’s the last time you deleted a database and didn’t receive angry calls and emails?

 

ASP.NET: Scrolling (Or Not), On Demand

I make quite a few ‘fast and dirty’ web applications where the application needs validation, or there are other post backs involved.

EASY: With MaintainSrollPositionOnPostback
Set the ‘MaintainScrollPositionOnPostback’ to ‘true’ to keep the page from scrolling (or, if not specified, defaults to ‘false’). So for example, if it is set to ‘true’ and there is a postback, the page will not be scrolled. (With the exception of built-in Validators throwing validation errors).

<%@ Page Title="" Language="C#" AutoEventWireup="true" MaintainScrollPositionOnPostback="true" %>

With JavaScript
I found a neat little snippet to scroll the page when the submit button is clicked. Built-in Valdiators cause the page to jump to the top when the user tries to submit but the form is not complete. But custom validation in your code does not, so the user doesn’t see these messages and thinks the form is broken when they press ‘submit’ but nothing happens. You could build your own validators, but hey, who has time for that …

<asp:Button ID="uxSubmit" runat="server" Text="Submit Form" OnClick="submit_Click" OnClientClick="window.scroll(0,0);" />

HARDER: With UpdatePanels
Use AJAX UpdatePanel’s to contain the piece of code that should not scroll while you do postbacks. Make sure that events fire the postbacks properly, etc. The less code the UpdatePanel contains, the faster it will reload (so wrapping the entire page is generally not a good idea). Keep in mind that usually clicking Button’s inside of UpdatePanels is buggy (try using LinkButton instead). These come with ASP.NET 3.5, but if you have 2.0 you can reconfigure your web.config to allow them.