Search This Blog
Sunday, May 25, 2008
How do I Be More Productive In Vim?
Q. I'm just starting in vim text editor but I'm annoying typing and retyping similar statements. Can you address me about it?
A. Yes. Vim offer several functionalities that improve your editing. Here are some of them.
1. Copying a whole line
yy or shift y or :ny
where n is the number of line if n is not specified then copy the current line
2. Copying from current position to end of line.
y$
3. Copying 3 lines after the current position
3yy
4. Copying a range of line
:1,5y or :1y 5
The above example copy 5 lines, from 1 to 5
5. Deleting a whole line (Deleted line is copy to the registers)
dd or :nd
Where n is the number of line if n is not specified then delete the current line
6. Deleting from current position to end of line (Deleted text is copied to the registers)
d$ or shift d
7. Deleting a range of line
:1,5d or :1d 5
The above example remove 5 lines, from 1 to 5 and copy them to a register
8. Put n times a text, previously copied, after the cursor:
np
9. Put n times a text, previously copied, before the cursor
n Shift p
10. Word completion, works in insert mode
1. Ctrl n search forward for next matching
2. Ctrl p search backward for previous matching
Very useful in programming (perl, bash, java, other)
11. Put vim in replace mode
Shift r
12. Undo
u
13. Redo
Ctrl r
14. Repeating last change
.
Prevent the browser from Caching a page
This page is an explanation of using the Meta tag to prevent caching, by browser or proxy, of an individual page wherein the page in question has data that may be of a sensitive nature as in a "form page for submittal" and the creator of the page wants to make sure that the page does not get submitted twice.
HTTP is a data access protocol currently run over TCP and is the basis of the World Wide Web.
cache:
A program's local store of response messages and the subsystem
that controls its message storage, retrieval, and deletion. A
cache stores cachable responses in order to reduce the response
time and network bandwidth consumption on future, equivalent
requests. Any client or server may include a cache, though a cache
cannot be used by a server that is acting as a tunnel.
Update on this, M.S. just had to do things differently.
Just put the following between the <head> and </head>
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
that will do it.. IE needs the expires. View source of this page for example.
Click Here for more info.
Wednesday, May 14, 2008
Javascript Redirect Scripts
Redirecting a visitor with javascript is pretty straightforward. The simplest way is to use one of the methods below.Note that in some cases a server-side redirect (i.e. one using a language such as PHP, ASP or Perl) is a better choice, since not all users will have javascript enabled. Search engine spiders are unlikely to follow javascript based redirects. <span style="font-weight:bold;">Location.href Method</span> <script type="text/javascript"> window.location.href="http://www.example.com/"; </script> Including this script on a page will immediately redirect visitors to the URL entered. Location.replace Method The difference between location.href and location.replace is that the former will create a new history entry on the visitors computer. This means that if they hit the back button, they can get stuck in a 'redirection loop'. This is usually undesirable and may have unwanted side effects - most pay per click search engines will not allow the submission of URLs that 'break' the back button. The solution is to use location.replace instead: <script type="text/javascript"> location.replace('http://www.example.com/'); </script> Conditional Redirects with Javascript Once you know how to redirect visitors, you can send them to different pages based on a variety of criteria. The example script below will redirect visitors with a resolution of 1024x768 or higher to a different page. Of course, there shouldn't be any reason to do so for most websites, which should work at any screen resolution ;) <script language="JavaScript" type="text/javascript"> if ((screen.width>=1024) && (screen.height>=768)) { window.location.replace('example.html'); } </script> <script language="JavaScript" type="text/javascript"><br />if ((screen.width>=1024) && (screen.height>=768))<br />{<br /> window.location.replace('example.html');<br />}<br /><br /></script>
Monday, May 12, 2008
CHAP, SPAP, and PAP authentication methods
CHAP
The Challenge Handshake Authentication Protocol (CHAP) is a challenge/response authentication protocol that uses the industry-standard Message Digest 5 (MD5) hashing scheme to encrypt the response. CHAP is used by various vendors of network access servers and clients. A server running Routing and Remote Access supports CHAP so that remote access clients that require CHAP are authenticated. Because CHAP requires the use of a reversibly encrypted password, you should consider using another authentication protocol such as Microsoft Challenge Handshake Authentication Protocol (MS-CHAP) version 2.
Note
• If your password expires, CHAP cannot change passwords during the authentication process.
• You cannot use Microsoft Point-to-Point Encryption (MPPE) with CHAP.
SPAP
The Shiva Password Authentication Protocol (SPAP) is a reversible encryption mechanism employed by Shiva. When a computer running Windows XP Professional connects to a Shiva LAN Rover, it uses SPAP, as does a Shiva client that connects to a server running Routing and Remote Access. This form of authentication is more secure than plaintext but less secure than CHAP or MS-CHAP.
Important•
When you enable SPAP as an authentication protocol, the same user password is always sent in the same reversibly encrypted form. This makes SPAP authentication susceptible to replay attacks, where an attacker captures the packets of the authentication process and replays the responses to gain authenticated access to your intranet. The use of SPAP is discouraged, especially for virtual private network connections.
Note
• If your password expires, SPAP cannot change passwords during the authentication process.
• Make sure your network access server (NAS) supports SPAP before you enable it on a remote access policy on an Internet Authentication Service (IAS) server.
• You cannot use Microsoft Point-to-Point Encryption (MPPE) with SPAP.
PAP
Password Authentication Protocol (PAP) uses plaintext passwords and is the least secure authentication protocol. It is typically negotiated if the remote access client and remote access server cannot negotiate a more secure form of validation.
To enable PAP-based authentication, you must do the following:
1. Enable PAP as an authentication protocol on the remote access server. PAP is disabled by default.
2. Enable PAP on the appropriate remote access policy. PAP is disabled by default.
3. Enable PAP on the remote access client.
Note
• By disabling PAP on ISA Server, plaintext passwords are never sent by the dial-up client. Disabling support for PAP increases authentication security, but remote VPN clients who only support PAP cannot connect.
• If your password expires, PAP cannot change passwords during the authentication process.
• You cannot use Microsoft Point-to-Point Encryption (MPPE) with PAP.
Subscribe to:
Posts (Atom)