Sunday, October 18, 2009

Reset XP Admin Password

Reset XP Administrator's password using Linux Backtrack Live CD
1. umount /mnt/hda1
2. modprobe fuse
3. ntfsmount /dev/hda1 /mnt/hda1
4. cd /mnt/hda1/windows/system32/config
5. chntpw -i sam system security
6. choose Administrator id
7. Enter new password or * to reset blank

Note :
above example is for NTFS partition. If not, use these commands:
umount /mnt/hda1
mount -o rw /dev/hda1 /mnt/hda1

Monday, September 07, 2009

SED-insert quotes symbol

SED (stream editor) is a program to replace text in a file. Its easier to use VI, but sometimes, VI program is not available. Like in my case, I logged into z/Linux Server from Mainframe z/VM panel. I cant login remotely via SSH because network conf file (/etc/sysconfig/network/ifcfg-qeth*) is missing an important " symbol.

IPADDR="192.168.1.233

Typical SED command. Example to change ip from .233 to .234
sed -i ifcfg-qeth* -e 's/233/234/g'

but to add symbol " will not work straight away because ' and " is part of SED input.

Solution : use " twice, like this.
sed -i ifcfg-qeth* -e 's/233/234""/g'

Result :
IPADDR="192.168.1.234"


Thanks to Wan Uni Azran for helping me figure this out!

Tuesday, August 18, 2009

GNU Screen

GNU Screen provides virtual multiple screen for a user. Logging in remotely via SSH, a process or program will still continue running even if the line disconnects or the user logs out.

Required to install GNU Screen package.
eg, yum install screen

To start a virtual screen, eg session name=myview01
screen -S myview01

To disconnect/detach
Ctrl+a, d

To reconnect/reattach
screen myview01

Type 'exit' to end screen session

To share/remote Screen
Local machine (user01)
chmod u+s /usr/bin/screen
chmod 755 /var/run/screen

screen -S mywork
Ctrl+a :multiuser on
Ctrl+a :acladd user02

Remote user (user02)
SSH to machine
screen -x user01/mywork

Wednesday, July 29, 2009

Problem reinstall XP on HP nx6310

I was unable to reinstall a fresh copy of Windows XP on my HP nx6310 laptop. Error displayed is that no hard disk was found.

Solution : Disable SATA Native Mode in BIOS setting.

You can also create a bootable WinXP Setup CD from your preloaded system. Follow instructions from here
http://www.howtohaven.com/system/createwindowssetupdisk.shtml

Saturday, July 25, 2009

Z/VM Commands

Z/VM Commands... so that i wouldn't forget

query dasd
query users
query names
filelist user direct
directxa

logon maint here
force LNX01
xautolog LNX01

i cms
det 7500-7503 system
att 7500-7503 maint

ddr
in 7500 dasd
out 7600 dasd
copy all (or copy 1 to 3338)

vi /etc/sysconfig/network/ifcfg-qeth*
vi /etc/hostname
vi /etc/hosts

i cms
cpfmtxa
label
7600
LNX700

PA[2] = next screen message
#cp disc

Monday, June 08, 2009

Download Youtube videos

Simple, go to youtube video clip of your choice. For example,
http://www.youtube.com/watch?v=rIb_MUGJwDY
change the url to
http://www.voobys.com/watch?v=rIb_MUGJwDY

click on the download button and save to your computer.
Rename it to videoname.flv
--

Wednesday, May 06, 2009

A nice quote I created sometime ago

Of all the music in the world, sound of your voice is all I want to hear.
Of all the places in the world, next to you is all I want to be...
--

Friday, April 24, 2009

Tiny C Compiler

A very small (275kb) and fast C compiler. Available for Linux & Windows version.
For windows version, just download and uncompress the zip file.
Create a simple C program, example (hello.c)
#include <stdio.h>
main()
{ printf ("Hello world!");
return 0;
}
compile using this command: tcc hello.c
execute your program : hello <enter>

Note : too bad I can't compile a C++ program with this.
Link : http://bellard.org/tcc/

Foxit Reader 3.0

Foxit Reader 3.0 - fast,free,lightweight,simple PDF reader.
Better than the usual Adobe Acrobat Reader.
http://www.foxitsoftware.com/pdf/reader/download.php
--

Thursday, April 09, 2009

C++ Function example

#include <iostream>

using namespace std;

int getTotal(int, int);

main()
{
int num1,num2,total;
cout << "Enter first number :";
cin >> num1;
cout << "Enter second number :";
cin >> num2;
total=getTotal(num1,num2);

return 0;
}

int getTotal(int a, int b)
{
int result;
result=a+b;
return result;
}


Notes :
int getTotal() means that this functions returns an integer type variable.
In Linux, compile using this command
g++ yourfile.cpp -o yourfile.exe

Saturday, April 04, 2009

IE Icon on Vista desktop

-run Regedit
-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Explorer\HideDesktopIcons\NewStartPanel
-create new DWORD (32bit) name {871C5380-42A0-1069-A2EA-08002B30309D}
do not forget the curly bracket {}
-set its value to 0
-refresh desktop by pressing F5. IE icon will be on you desktop now.

Friday, April 03, 2009

Disable Vista security alert

Start-Control Panel-Security-Security Center
Change the way security center alerts me
--Dont notify me, but display the icon

Wednesday, March 25, 2009

Virtual PC-switch mouse cursor with [Right Alt]

Microsoft Virtual PC 2007 software enables running of another operating system (Eg, Linux) from within your current Windows XP desktop.
Most important key to remember is [Right Alt] key which move your mouse cursor from guest OS to the host desktop. 

Monday, March 16, 2009

AT Command

AT is linux simple scheduling command to execute a program or script at a specific date/time. This command will run hello.script file at 1.45pm 16 Mar 2009.

at -f /home/hello.script 13:45 03/16/09

other options are...
atq --list all pending commands and its job number.
atrm 99 --delete job number 99

more info - http://linux.about.com/library/cmd/blcmdl1_at.htm

Thursday, February 19, 2009

Set permanent IP

edit file /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.1.255
HWADDR=00:30:0a:4b:72:f0
IPADDR=192.168.1.15
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
GATEWAY=192.168.1.1
TYPE=Ethernet

to configure route table on every boot
edit file /etc/rc.d/rc.local
route add default gw 192.168.1.1 dev eth0
route add -net 10.0.8.0 netmask 255.255.255.0 gw 10.0.8.1

Thursday, January 22, 2009

Routing Table

Editing routing table will enable the use of more than 1 network card in a pc/server. For example, using both Local Network and WIFI connection at the same time. The purpose is to tell the computer which network card for which ip's. These are the commands, a slight difference in Windows and Linux.

Windows
route add 10.8.2.25 10.8.1.1
route add 0.0.0.0 mask 0.0.0.0 192.168.2.1
route print (to display routing table)

Linux
route add 10.8.2.25 gw 10.8.1.1
route add default gw 192.168.1.1

or to add the whole network segment
route add -net 10.8.2.0 netmask 255.255.255.0 dev eth0

route -n (to display routing table)

Friday, January 16, 2009

SSH Tunnelling

connecting to office's Application server from home, securely via SSH Server using putty.exe

Putty Settings
SSH-Tunnels
--Source Port : 23
--Destination : 192.168.5.20:23

Applications Setting
IP : 127.0.0.1
Port : 23

Wednesday, December 24, 2008

PSCP-Putty Secure Copy Program

PSCP is secure way of downloading file from an SSH Server instead of using FTP protocol. This is an example of how to copy file flower.jpg from an SSH server ip 202.190.128.115 using port 447

pscp -P 447 username@serverhostname.com:flower.jpg .

note: do not forget the last dot (.) which means that you're saving the file to current local directory.

command for uploading file to SSH server
pscp -P 447 flower.jpg username@serverhostname.com:flower.jpg

Wednesday, December 03, 2008

Linux SysLog

Linux system log function is to record every activity that took place in a server. It provides information about who logs in or what program is being executed and at what time. I found out sometime ago that someone tried to hack into my server using root id and guessing passwords from the system log. To solve that problem, I disable root id from remote login and a waiting period of 5 minutes if number of tries with wrong password exceeded 3 times.

By default, linux syslog will create a MARK in the log file every 20 minutes just to inform you that it is running in the background. This can make the log file, cluttered and harder to read. Just change this default interval into something better like once every 3 hours (180 minutes) with a command like this.

# /sbin/syslogd -m 180

to view the last 50 lines of the log messages, type this :
# tail -n 50 /var/log/messages

Tuesday, December 02, 2008

DB2 SQL - Select Distinct

Select Distinct is used to ensure that data retrieved from a query will not display duplicate records. It is useful if you want to get a list of users list of names from a database. The format of the sql is SELECT DISTINCT column-name.

Here's an example :
SELECT DISTINCT GRANTEE FROM SYSIBM.SYSTABAUTH WHERE GRANTEETYPE <> 'P';

Updating Blog By Email

I can now update my blog via email. Simply by sending an email to
rayrosliabas.secretword@blogger.com
Make sure you set your Email Address and SecretWord in your blogs'
Settings - Email options.
--
Regards,
Rosli Abas... via email

Wednesday, November 12, 2008

DB2-Limit SQL Query

This is and example on how to limit a no of lines to display during DB2 SQL Query.

SELECT * FROM TEST.CUSTOMER WHERE LASTNAME='SMITH' FETCH FIRST 10 ROWS ONLY;

IRC with Opera browser

I'm not a frequent chatter. If I feel like chatting online, yahoo messenger is for sure the only choice I know. However public chatrooms are very limited and quite a limited number of users allowed in a room.

Today is the first time (after quite some time) that I'm (back) on IRC. First I browse for IRC clients that is available because mIRC, a popular client is actually not a freeware. To my surprise, IRC Client is included in Opera browser. (I'm using Opera as my default browser because Firefox is not too efficient on memory and sometimes unable to display certain webpages correctly. There is also IRC client in Firefox addons).

Here's simple guide on using IRC in Opera.
-Tools - Mail and Chat Account
-fill in your name, email and nickname
-choose a server. I choosed Dalnet Asia
-join a room. The only room I know is "kampung"

Thats it. You can now start chatting with other users.
Dont ask me about IRC commands... I'm a newbie too...

Monday, October 13, 2008

Playing Videos on Linux Fedora 8

Configuring Fedora 8 to play videos is one of the toughest task. This
is because Redhat & Fedora are designed not for entertainment and in
respect of multimedia license and copyright issues.

Here's a list of task I performed to enable my laptop to play MPEG, AVI,
FLV and WMV files.

1. install repositories of livna
#wget http://rpm.livna.org/livna-release-8.rpm
#rpm
-ivh livna-release-8.rpm

2. install pulseaudio-libs
-due to dependency problem during mplayer installation
-download and install pulseaudio-libs-0.9.8-5.fc8.i386.rpm from
http://rpm.pbone.org

3. install lzo and libdvdnav-4 required by mplayer
download and install these packages
-lzo-2.02-3.fc8.i386.rpm
-libdvdnav-4.1.2-2.fc8.i386.rpm

4. install mplayer (multimedia player) package
yum install mplayer

5. install mplayer gui application and related codec
yum install gnome-mplayer
yum install mencoder

Friday, October 10, 2008

Configure Linux DNS setting

Installing a dual booting Linux & WinXP on my laptop is fairly easy for me. But configuring it afterwards to suit my daily work/leisure needs is quite hard. Heres the solution I got to set up internet connection which main problem is unrecognised DNS server list.

-edit the file
# vi /etc/resolv.conf
-enter dns server ip
nameserver 192.168.1.1
nameserver 61.6.32.163

Note : ip numbers depends on what is assigned by your internet service providers (ISP).

Wednesday, October 08, 2008

Playing MP3 in Linux-Fedora

By default, Redhat & Fedora Linux are unable to play mp3 files due to copyright restrictions. To enable my laptop (installed with Fedora 8) to play mp3 songs, i just need to install these 2 files.
1. XMMS - available from installation dvd & listed in package list.
2. XMMS-MP3 - download rpm from www.rpm.pbone.net

Thursday, June 26, 2008

Simple Yahoo Messenger

My yahoo messenger is always in 'Online' mode most of the time whenever I'm in front of my pc. To me, its an effective and fast mode of communication. Emails? considered as a 'snail' mails nowadays. But what if instant messaging protocols are not allowed in workplace? IM's despite its advantages could also be distracting. Meebo is an alternatives but sometimes its url is also blocked through network restrictions.

Well, try this site - www.m.yahoo.com

Its yahoo mobile website developed for PDA's and mobile devices. Minimum graphics and interactivity. You can check your yahoo email & yahoo messenger communication.
Just remember that you need to press [Refresh] link to check for new messages.

Friday, January 04, 2008

Using both LAN and WIFI

My work requires me to connect to a Server via Local Area Network. But to browse the internet, I had to plug it off and switch to a Wireless Network. I found a way to use both LAN and WIFI at the same time by configuring the Routing Table. Its easier in Linux/Unix environment.
After searching for quite some time, I've finally succeeded to apply the same method in Windows. So here's the commands :

1. Create routing of 10.23.179.100 to use gateway 10.23.184.1 using network card no.3
ROUTE ADD 10.23.179.100 10.23.184.1 METRIC 25 IF 0X3
Note : if the above command failed, type again without the "IF 0x3"

2. Create 192.168.1.1 as default gateway, ie using the internet
ROUTE ADD 0.0.0.0 MASK 0.0.0.0 192.168.1.1

3. Display the routing table.
ROUTE PRINT

Ping to both the local server ip and Yahoo website to check the connection.

Monday, September 03, 2007

My Javascript code

I tried to write a complex javascript code in this blog post but I guess blogspot.com does not allow all the features of javascript as a way to prevent people with bad intention from spreading spywares and viruses.

Therefore here's a simple one...


And this is the code :
[script type="text/javascript"]
document.write ("Hello, world!");
[/script]

note : replace [ ] with < >

Saturday, March 24, 2007

Shortcut Keys

Windows XP Shortcut Keys
1. [WinKey]+D = minimise desktop. repeat same key to resume
2. [WinKey]+M = minimise
....[WinKey]+Shift + M = restore
3. [WinKey]+L = lock your screen. require password to continue. all running program remains.
4. [WinKey]+R = run program
5. [WinKey]+E = Explorer (My Computer)

Shutdown Button
how to create a shutdown shortcut key on desktop
-right click-New-Shortcut
-type "c:\windows\system32\shutdown.exe -s -f -t 0"
(meaning -shutdown, force, time=0)
-change icon to your liking.