Archive for March, 2010

Outlook 2007 Switch List

Found very useful for outlook.

Have used /cleanrules.

http://office.microsoft.com/en-us/outlook/HP012185891033.aspx

Legal Information Templates

Doc.zip

Please find attached zip file.
Inside are two .asp files.

These documents contain basic legal cover for your wesite, Disclaimer information.

These can be changed to .htm,.html or .php if required.
You will need to read through them and edit where required.

ASP randomize number

ASP, set randomize


<%
randomize
StoreNumber = int(rnd*100)+1
%>

  • result is a number between 1 and 100

Windows Auto Login

Copy the below text into a .reg file and edit as required.

This works on a std PC and a Domained Machine


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DisableCAD"=dword:00000001
"AutoAdminLogon"="1"
"ForceAutoLogon"="1"
"DefaultPassword"="PASSWORD"
"DefaultDomainName"="DOMAIN"
"DefaultUserName"="USERNAME"

Check Registry Settings

Paste the following text into a .vbs file and edit as required.

The code allows you to check registry settings


On Error Resume Next

sResults = ""

Set oWShell = CreateObject("Wscript.Shell")
Call GetAppVersion("Internet Explorer", "HKLM\SOFTWARE\Microsoft\Internet Explorer\Version")
Call  GetAppVersion("Java",  "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83216016FF}\DisplayVersion")

msgbox sResults

Set oWShell = Nothing

Sub GetAppVersion(sApplication, sRegPath)
On Error Resume Next

sTemp = oWShell.RegRead(sRegPath)
If Err.Number <> 0 Then
sResults = sResults & "Version not found for " & sApplication & "." & vblf
Err.Clear
Else
sResults = sResults & sApplication & " Version: " & sTemp & vblf
End If
End Sub

Useful Ubuntu Commands

A list of usful commands.

  • gksudo nautilus (opens file browser as admin)
  • sudo -i (open a sudo terminal)
  • apt-get update (get apt-get uptodate)
  • apt-get install nautilus-gksu (Open folder as root)
  • apt-get install compizconfig-settings-manager (Extra cool graphics)
  • apt-get install x11vnc (VNC for linux, nice to have remote desktop viewer on reverse)
  • apt-get install xrdp (xRDP application)
  • apt-get install ddclient (dyndns.org updater)
  • apt-get install hplip-gui (GUI HP Printer Tools)
  • dpkg -l | grep ii >file.txt (Get a list of software installed and put into file |grep not required)
  • Image Resizer
  • Install SSH
  • Batch Image Editor

Windows 7 GodMode

Windows Vista/7 God mode is a list of every config available(Windows)

  1. Create a new folder
  2. Rename the folder
    GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
  3. The icon will change and your done.

ASP Select description from large string

You can use below code to select the first n of chars from a string.

This can also be done from an ASP string. (not tested but the command is still left.) – Select LEFT(ColumName,1) from TableName where id = ’100′ ?? Anyone care to confirm?


<%
String1="MyText"
response.write(LEFT(String1,3))
%>

  • Result is MyT

Replace vbCrLf with <br>

When you create a textara and then save it to a DB, When you go to use it later on the output page, you will find

that if you used the return key when you wrote your textarea is now on one line. It seems to have foggtten the returns, unless you put it back into a textara.

When in a textarea the return key must be key “vbCrLF” but when in html must be “<br>”. Use this code to switch between the two.

  • replace(inputtext,lookfor,replease with)

<%
Replace(StoredVAR,vbCrLf,"<br>")
%>

Make form input safe from SQL Injection

  • Add the following code to a global Function page or the header page

<%
Function clean(inputtext)
dim badChars
clean = inputtext
badChars = array("select", "drop", ";", "--", "insert", "delete", "xp_", "=", "'", ":")
for i = 0 to uBound(badChars)
clean = replace(clean , badChars(i), "")
next
end Function
%>

  • The following code is a static use of the Function

<%
RawText = "asdasd--ad;ddelete=,qw:"
CleanText = clean(RawText)
response.write(RawText & "<br>" & CleanText)
%>

  • output text will have none of the banned chars.