Posts

Showing posts from 2008

SQLplus basics

Several useful commands. Basic Retrieval from single table SELECT [DISTINCT] display_fields FROM tables WHERE field_conditions ORDER BY field_name [ASC | DESC]; e.g: select * from MethodParameter; e.g: select * from MethodParameter where NAME=DUNHAM; Delete the whole content of table DROP TABLE tablename ; e.g: drop table MethodParameter; Delete one or more records from a table DELETE FROM table_name WHERE record_retrieval_conditions ; e.g: delete from MethodParameter where NAME='DUNHAM BUSH';

Not enough disk space

Should you ever see these types of message, there are several 'must-know' unix commands that can be used in order to start investigating. 1. du | sort -n : lists all file usage from smallest to largest. 2. df -k -b : see how much allocation is used in the directory. For more help, go to links below:- 1. An IT-admin guide to clearing up disk space 2. df unix command definitions and usage 3. du unix command definitions and usage

How to kill a Unix process

From http://www.ncl.ac.uk/iss/unix/unixhelp/kill.html and http://www.decf.berkeley.edu/help/unix/kill.html If you are logged in to a Unix system and your session "hangs" or "freezes" (i.e. nothing happens for a long time and it does not respond to Ctrl/Q Ctrl/C or Ctrl/D), you can attempt to unfreeze it yourself by "killing" the process which has stopped your session. You can also use Ctrl/Z to get out of a process in UNIX. Login to the system where your session is frozen Type the command: w usid where usid is your own username. This will produce a line of output for each login something like this: 9:53am up 82 day(s), 15:58, 132 users, load average: 6.50, 6.25, 5.70 User tty login@ idle JCPU PCPU what nabc pts/160 9:12am -csh nabc pts/166 9:53am w nabc Note the contents of the tty column for the frozen login -- in this example attached to pts/

Unix 'Basename' command

The basename utility deletes any prefix ending in / and the suffix (if present in string) from string, and prints the result on the standard output. It is normally used inside substitution marks (``) within shell procedures. Syntax basename [string] [suffix] string - the leading part of the path name or sting suffix - additional remaining portion of name that if matches will be removed Examples basename myfile.txt .txt - Takes the basename of myfile.txt and strips the .txt portion and then just displays myfile. credits to: http://www.computerhope.com/unix/ubasenam.htm

How to Transfer a File into a Remote Desktop with shitty VPN connection

Few days back I was in this situation where by I had to transfer some files over to a remote desktop (aka the client's server). The shitty part I can't send files over through any websites or webmail; they've banned it all. No FTP softwares and the worst thing is, every time my manager sends them email with the attached packages; them packages are not sent through. Don't know where it got filtered..our site or theirs (I assume it's their's). Some thoughts are given also on mapping my drives so that it'll be accessible at the remote desktop; but some people have that said (read other blogs) the method only works if the remote desktop is not using Win2k and below. So again...i hit a wall. Anyhow, that's where this trick comes in. In essence you turn your file into something readable (read ASCII) and copy and paste the text over the remote desktop. One thing to note though is that not everything can be easily read by the notepad. Introducing 'uuencode&#

The UNIX tr command

$> tr ',' '\012' <> return.txt tr is the program doing the work. ',' is the character I want to replace (in this case a comma). '\012' is the octal value for a newline in UNIX. comma .txt is the file I am reading from. return.txt is the new file I am saving my changes to. from : http://www.flashcodersny.org/wordpress/?p=19

HOW TO: Apply Local Policies to All Users Except Administrators on Windows Server 2003 in a Workgroup Setting

This article describes how to apply local policies to all users except administrators on a Windows Server 2003-based computer that is in a workgroup setting. When you use a Windows Server 2003-based computer in a workgroup setting (not a domain), you may have to implement local policies on that computer that can apply to all users of that computer, but not to administrators. This exception permits the administrator to retain unlimited access and control of the computer, and also permits the administrator to restrict the users who can log on to that computer. The Windows Server 2003-based computer must be in a workgroup setting for this procedure to work. In this situation, the domain policies cannot overwrite the local policies because the domain policies do not exist. Microsoft recommends that you make backup copies of all the files that you edit during this procedure. ripped from : http://support.microsoft.com/kb/325351/en-us#appliesto

Group Policy application rules for domain controllers

Domain controllers pull some security settings only from group policy objects linked to the root of the domain. Because domain controllers share the same account database for the domain, certain security settings must be set uniformly on all domain controllers. This ensures that the members of the domain have a consistent experience regardless of which domain controller they use to log on. Windows 2000 accomplishes this task by allowing only certain setting in the group policy to be applied to domain controllers at the domain level. This group policy behavior is different for member server and workstations. ripped from : http://support.microsoft.com/kb/259576/en-us#appliesto

Managing Policy in Active Directory

Apply Local Policies to All Users Except Administrators in a Workgroup Setting To implement local policies to all users except administrators , follow these steps: 1. Log on to the computer as an administrator. 2. Open your local security policy. To do this, do one of the following: • Click Start, click Run, type gpedit.msc, and then press ENTER. -or- • Click Start, click Run, type mmc, press ENTER, add the Group Policy Object Editor, and then configure it for the local security policy. If the removal of the run command is one of the policies that you want, Microsoft recommends that you edit the policy by means of Microsoft Management Console (MMC), and then save the results as an icon. Then, you do not need the run command to reopen the policy. 3. Expand the User Configuration object, and then expand the Administrative Templates object. 4. Enable whatever policies that you want (for example, Desktop for "Hide My Network Places" or "Hide Internet Explorer

How to set account lockout policies in Windows 2000 and Windows Server 2003

To help secure your network, you can use account lockout policies for domain accounts or for local user accounts. An account lockout policy is a Microsoft Windows security feature that locks a user account if a designated number of failed logon attempts occur within a specified time frame. These variables are based on security policy lockout settings. You cannot log on to the network through a locked account until the lockout period has expired. In Microsoft Windows 2000 and in later versions of Windows, you can configure account lockout policies in the Active Directory directory service. To configure account lockout policies in Windows 2000, use the ADSI Edit snap-in to edit Active Directory and to change the PwdProperties attribute in the domain naming context. When you make this change on one domain controller, the change is replicated to all other domain controllers on your network. ripped from : http://support.microsoft.com/kb/885119/en-us#appliesto

How To Reset User Rights in the Default Domain Group Policy in Windows Server 2003

This article describes how to reset user rights in the default domain Group Policy object (GPO) in Windows Server 2003. The default domain GPO contains many default user-rights settings. Sometimes, if you change the default settings, unexpected restrictions may be put on user rights. If the changes are unexpected or if the changes were not recorded so that you do not know which changes were made, you may have to reset the user-rights settings to their default values. This situation may also occur if you manually rebuild the contents of the Sysvol folder, or if you restore it from a backup by using the steps that are included in the following Microsoft Knowledge Base article: http://support.microsoft.com/kb/253268/EN-US/

How To Create a System Policy Setting in Microsoft Windows Server 2003

This step-by-step article describes how to create System Policy settings for down-level client computers in a Windows Server 2003 domain. In a Windows Server 2003 network, you can use Group Policy settings to configure and control Windows Server 2003-based computers, Windows 2000-based computers, and Microsoft Windows XP Professional-based computers. However, to configure Microsoft Windows NT 4.0-based client computers, Microsoft Windows Millennium Edition-based client computers, and Microsoft Windows 98-based client computers, you must use System Policy settings. System Policy settings are different from Windows Server 2003 Group Policy settings in that they overwrite registry settings on the client computer with persistent changes. This behavior is known as "tattooing." ripped from : http://support.microsoft.com/kb/318753/EN-US/

Appending to Perl's @INC array

The @INC array is a list of directories Perl searches when attempting to load modules. To display the current contents of the @INC array: perl -e "print join(\"\n\", @INC);" The following two methods may be used to append to Perl's @INC array: 1. Add the directory to the PERL5LIB environment variable. 2. Add use lib ' directory ' ; in your Perl script. For more information, read the perlrun manpage or type perldoc lib . ripped from : http://www.brandonhutchinson.com/perl_inc.html

Using Pointer in C

Now this is not your definitive guide to using pointer, it's more of a "i hope i won't forget this" kinda guide intended for yours truly. To use pointer, you need to make sure you have 3 things:- 1. The pointer must be declared and allocated. 2. The pointee must be declared and allocated. 3. The pointer (1) must be initialized so that it points to the pointee (3). Example; int *p //step 1. int i //step 2. p = &i; //step 3. *p = 42 //now you can use... The important thing to remember is that when you declare something as a pointer - like p for instance, the value in p would be an address pointing to somewhere; so if let say you'd do a printf of p - you'll be shown the address of i, not the value of i.

How to use diff in UNIX

The following were taken from http://www.unixtutorial.org/2008/02/compare-text-files-using-diff/. All credits goes to them. If you need to compare two text files in Unix, you're mostly likely to use the diff command. Today I'll talk about the simplest scenario: you want to compare two files and understand if there are any differences. Suppose you have two files in /tmp directory: /tmp/1.txt: aaa bbb ccc ddd eee fff ggg and /tmp/2.txt: bbb c c ddd eee fff ggg hhh I have deliberately created them so short and simple - this way it's easier to explain how the comparison works. If there are no differences between the files, you will see no output, but if two text files are indeed different, all the text mismatches will be highlighted using the standard diff output: $ diff /tmp/1.txt /tmp/2.txt 1d0 <> c c 7a7 > hhh Lines like "1d0" and "3c2" are the coordinates and types of the differences between the two compared files, while lines like "<>

Finding files in UNIX

The following guide is a direct rip-off from this website: http://www.hccfl.edu/pollock/Unix/FindCmd.htm All credits goes to him. The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files that match the supplied search criteria . You can search for files by name, owner, group, type, permissions, date, and other criteria. The search is recursive in that it will search all subdirectories too. The syntax looks like this: find where-to-look criteria what-to-do All arguments to find are optional, and there are defaults for all parts. (This may depend on which version of find is used. Here we discuss the freely available GNU version of find , which is the version available on YborStudent .) For example where-to-look defaults to . (that is, the current working directory), criteria defaults to none (that is, show all files), and what-to-do (known as the find action ) defaults to -print (that is, displa

Basic Shell Scripting

This is a basic shell scripting tutorial i got off the Net. Credit goes to the writer. By the way, the site i ripped this off was at http://more-shell.blogspot.com/2007/03/easy-shell-scripting.html Easy Shell Scripting By Blessen Cherian Shell scripting can be defined as a group of commands executed in sequence. Let's start by describing the steps needed to write and execute a shell script: Step 1: Open the file using an editor (e.g., "vi" or "pico".) vi Firstshellscript.sh Step 2: All shell scripts should begin with "#!/bin/bash" or whatever other shell you prefer. This line is called the shebang, and although it looks like a comment, it's not: it notifies the shell of the interpreter to be used for the script. The provided path must be an absolute one (you can't just use "bash", for example), and the shebang must be located on the first line of the script without any preceding space. Step 3: Write the code that you want to develop.