Wednesday, 26 September 2007

N73 mgmaps download map tiles to your phone

I use following procedure for offline browsing of maps in my mobile phone. So you will not pay for gprs.

Download and install Mgmaps into your mobile phone.
Generate map info from this site , you will use map file in the next step.
Download and install mapmaker for creating maps , select map file you created, use proxy option.
Copy files which created to your sd card. configure gmap settings for using offline content.

If you have gps module, GMAP supports gps.

Monday, 17 September 2007

Linux Live CD generator

Try this link to generate and download your live cd.

Understanding Load Average

Please take a look for details:


So, what have we learned? Those three innocuous looking numbers in the LA triplet have a surprising amount of depth behind them.

The triplet is intended to provide you with some kind of information about how much work has been done on the system in the recent past (1 minute), the past (5 minutes) and the distant past (15 minutes).

As you will have discovered if you tried the LA Triplets quiz, there are problems:

1. The "load" is not the utilization but the total queue length.
2. They are point samples of three different time series.
3. They are exponentially-damped moving averages.
4. They are in the wrong order to represent trend information.

Monday, 10 September 2007


I set scheduled tasks with schtasks command to create for all servers.
This command create task which runs every 5 minutes.

schtasks /create /s "\\server" /U domain\username /p "password" /SC MINUTE /MO 5 /tn taskname /tr "scriptpath"

ERROR: passing the user credential on local connection.
You have to give server name in this format "\\server"

Wednesday, 5 September 2007

Vbscript encrypt runas

I use this script to run an application with another user rights.
Do not forget to encrypt the script with screnc.exe, and move the file extension vbe

On Error Resume Next
dim WshShell,oArgs,FSO


set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
WinPath = WshEnv("SystemRoot")&"\System32\runas.exe"
set FSO = CreateObject("Scripting.FileSystemObject")

if FSO.FileExists(winpath) then
'wscript.echo winpath & " " & "verified"
wscript.echo "!! ERROR !!" & VBCRLF & "Can't find or verify " & winpath &"." & VBCRLF & "You must be running Windows 2000 for this script to work."
set WshShell=Nothing
set WshEnv=Nothing
set oArgs=Nothing
set FSO=Nothing
end if

rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2, FALSE)
wscript.echo "runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34)
Wscript.Sleep 30 'need to give time for window to open.
WshShell.AppActivate(WinPath) 'make sure we grab the right window to send password to
WshShell.SendKeys sPass 'send the password to the waiting window.

set WshShell=Nothing
set oArgs=Nothing
set WshEnv=Nothing
set FSO=Nothing


Tuesday, 4 September 2007

Vbscript write log file entries to event log

this script reads log files at these server and writes every line to windows event log for the related server.
you can specify search keyword via regex for lines. Please find detailed information here
change regex details for yourself.
If there is any error when executing script, it sends you an email about the problem.

I use this script Global Array Manager (GAM) log entries for writing them to windows event log. So we can monitor these entries and raise error via MOM.

On Error Resume Next
' v0.2

'Dont forget to update number of servers.
Dim nos

dim objFile(100)
dim objFileCopy(100)
dim patika(100)
dim strSearchString(100)
Dim server(100)
Dim xc

'Write hostnames here

path="\c$\"&"Program Files\Mylex\Global Array Manager Client\gam2cl.log"

'Shell object
Set objShell = WScript.CreateObject("WScript.Shell")

'Filesystem Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1

'Regex Object
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "^\s\s......[0-3]"

'Start checking
For xc= 1 to nos
'Open file
patika(xc)="\\" &server(xc)& path

'Check if the file exist
If objFSO.FileExists(patika(xc)) Then
Set objFile(xc) = objFSO.OpenTextFile(patika(xc), ForReading)

'Read line by line
Do Until objFile(xc).AtEndOfStream
strSearchString(xc) = objFile(xc).ReadLine
Set colMatches = objRegEx.Execute(strSearchString(xc))
If colMatches.Count > 0 Then
For Each strMatch in colMatches
'wscript.echo strSearchString(xc)
objShell.LogEvent LOGSEVERITY, strSearchString(xc) ,server(xc)
End If

'Move file
strDestination=patika(xc) &"_" & Year(now())& Right("0" & Month(now()), 2) & Right("0" & Day(now()), 2) & Right("0" & Hour(now()), 2) & Right("0" & Minute(now()), 2) & Right("0" & Second(now()), 2) &".log"
objFSO.Movefile strFilePath ,strDestination

'If there is an error, send an email
If Err.Number <> 0 then
res="There is a error, check why:"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = mailfrom = mailto
objEmail.Subject = "SC Hardware control problem" &" Error Code:" & Err.Number&" "&server(xc)
bodybody= res & vbCr & " Error Code:"& Err.Number
objEmail.Textbody = bodybody
objEmail.Configuration.Fields.Item _
("") = 2
objEmail.Configuration.Fields.Item _
("") = _
objEmail.Configuration.Fields.Item _
("") = 25
End If
end if

Monday, 3 September 2007

Wu-ftp how to restrict a ftp user to home directory

You can restrict user3 to home directry
guestuser user3

Also you can restrict all users and allow some users to other directories.
guestuser *
realuser user1 user2

Python ssh paramiko run command at every server

I have more than 40 linux server and sometimes I need to check something at servers one by one. I got tired and started to use this script.
You have to install paramiko module . You need to have same username for every server. This script asks you a username password and command to execute at servers.

#import sys, os, base64, getpass, socket, traceback, termios, tty, select
import paramiko, getpass

serverList = ["ipadress1","ipadress2"]

command=raw_input("Command: ")
userName=raw_input("User: ")
userPass=getpass.getpass("Password: ")

for server in serverList:
t = paramiko.Transport((server,22))
print server + ": Bad password or login!"
ch = t.open_channel(kind = "session")
if (ch.recv_ready):
print server + ": " + ch.recv(1000)

Sunday, 2 September 2007

Oscommerce insallation in Fedora 7 Linux

Install php
yum install php

Install mysql
yum install mysql

Start httpd service
service start httpd
chkconfig httpd on

Start mysql service
service start mysqld
chkconfig mysqld on

Change password of mysql
/usr/bin/mysqladmin -u root password 'new-password'

install phpMyAdmin
yum install phpMyAdmin

edit /etc/httpd/conf.d/phpMyAdmin.conf if you are not working from local.
edit /etc/phpMyAdmin/ and change username and password for mysql

Open url from browser http://localhost/phpMyAdmin
login with mysql username and password
Create a database and user for this database give full access. You will use these information at installation of oscommerce.

Download oscommerce package and extract it under /var/www/html/
Tip: If you extract it in another folder and copy only Catalog folder you will get error:
"You don't have permission to access /catalog/install on this server."

chmod 777 /var/www/html/catalog/includes/configure.php
chmod 777 /var/www/html/catalog/admin/includes/configure.php

open http://localhost/catalog/install/install.php
Supply information and complete configuration.

You can access oscommerce http://localhost/catalog