Hint from securebadshah on superuser.com here
Probably the reverse DNS resolution (server trying to get client’s name given IP) is taking time. Can you check if /etc/ssh/sshd_config has setting “VerifyReverseMapping yes” ? Set it to “VerifyReverseMapping no” and check if helps.
Edit: It seems VerifyReverseMapping is now deprecated and useDNS is the new configuration in the sshd_config.
Adding a “useDNS no” line to /etc/ssh/sshd_config made my ssh login via Putty happen much faster.
…That is the question!
The Stackoverflow discussion linked to here contains a number of useful bits and bobs with regard to elucidating the difference between the dup and clone methods, and also using “=” to copy a value.
Ruby – DUP vs CLONE
Both DUP & CLONE can be used to create shallow copy of an object. Both copies the instance variables of obj. But we need to be selective in their usage.Few difference between these are1) CLONE copies both FROZEN and TAINTED state of an object, where as DUP only copies TAINTED state of an object.2) With CLONE you can copy any singleton methods of an object but DUP does not support this.
CLONE is used to duplicate an object, including its internal state, DUP typically uses the class of the descendent object to create the new instance.
– Open source is wide open
Operator “=” does not make a copy, shallow or tainted: it will merely copy the object reference.
A good article on Object states can be found here.
The Ruby Newbie Guide to Symbols is a decent introduction to symbols in Ruby, though it doesn’t get into how symbols actually are implemented within the system. In short, though:
- The only reason that symbols could be found preferable over strings is because they save on data, this because every use of the same symbol refers to the same object. Even though the programmer refers to it with its name the system can find it by referring to its number, which results in a faster lookup.
- Note however that Symbols of course will not have String methods, so are relatively deficient if what you really want is a string with all its inherent string functionality.
- The things a programmer might find valuable about a using symbol is that it’s immutable (it can’t be changed on runtime) – which sometimes is exactly what you want. In this respect, they can be used as constants – perhaps if you really, really want a constant whose identifier doesn’t begin with a capital letter.
- Arguments for taking such an approach? Because you benefit from abiding by variable-naming conventions (for example, Ruby doesn’t enforce the constancy of constants, but variables that start with a capital letter in Ruby are automatically constants, and Ruby does automatically and helpfully warn you if you try to change these), and a constant with a non-uppercase first letter breaks conventions and thus could cause confusion to people reading your code. As such, a symbol – which is by its nature immutable – is a good choice both in terms of being functionally what you’re after (ie you can’t change its value) and for communicating to readers of your code that the variable in question, even with its non-uppercase first letter, really is a constant.
The Difference Between Ruby Symbols and Strings also emphasises the way that symbols are immutable, and the more predictable results + performance you therefore get when using them.
I was having a spam problem on a website I look after recently and thought I’d try an alternative to Akismet, since the latter now needs to be paid for on commercial websites. I installed Anti-spam, which uses a honeypot style trap to catch bots, and left on the core WordPress setting where problem comments are emailed to you, so as to keep an eye on things.
Well, the spam comments came in: all the usual rot, just now largely getting rejected (though notifications are sent to me by email) rather than marked as spam but still requiring me or my client to sort through them and delete them. I’m satisfied enough to switch the email option off and let it do its thing silently from here.
The honeypot technique won’t stop manual spammers (though there’s a paid version that claims to be able to ward off 70% of them) but it’s taken care of a good chunk of the problem. If it ramps up again, the paid version at $14 might be worth a stab.
The term confused me for ages when I first started looking into WordPress plugin development. Anything I’ve learned about them I feel like I’ve done despite rather than because of the tutorials I consulted about them. Feeling like you’ve missed something can really undermine the learning process and chip away at the satisfaction you feel about doing things right.
So it’s nice to read an article whose author notes specifically that the term is often used incorrectly and confusingly to refer to two different things:
Just as in pop-music, the term “hook” is sometimes ambiguous—different people use the term to refer to different things. Technically, the term “hook” should refer to a WordPress event, such as get_header or the_content, but sometimes it is used generally to refer to the add_action() or add_filter() functions which reference the hook. Pay attention to the context, and it should be clear which meaning was intended. The most important thing to understand here is that you determine when your functions execute by attaching them to a WordPress event by using the add_action() or add_filter() functions. Remember: hooks are events.
From Anatomy of a WordPress Plugin, which incidentally is all quite well-explained.