sandip's blog

Binary Counting !!

Binary Counting - Learn to count like a computer with your fingers!!

Get your kids thinking like a GEEK. Introduce them to the FUN projects for kids at howtoons.org .

Improving Hard Drive Performance - tuning with hdparm...

Note: You will need to be logged in as root to perform this tweak.

Default Settings:

#/sbin/hdparm -t /dev/hda

/dev/hda:
 Timing buffered disk reads:  64 MB in  3.57 seconds = 17.93 MB/sec

Identification info that was obtained from the drive at boot time:

#/sbin/hdparm -i /dev/hda
 
/dev/hda:
 
 Model=Maxtor 4D040H2, FwRev=DAH017K0, SerialNo=D21ZWSPE
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16
 CurCHS=4047/16/255, CurSects=-217054981, LBA=yes, LBAsects=80043264
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes: pio0 pio1 pio2 pio3 pio4
 DMA modes: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5
 AdvancedPM=yes: disabled (255)
 Drive Supports : ATA/ATAPI-6 T13 1410D revision 0 : ATA-1 ATA-2 ATA-3 ATA-4 ATA-5 ATA-6

See the current settings:

#hdparm -v /dev/hda
 
/dev/hda:
 multcount    = 16 (on)
 I/O support  =  0 (16-bit)
 unmaskirq    =  0 (off)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 nowerr       =  0 (off)
 readonly     =  0 (off)
 readahead    =  8 (on)
 geometry     = 4982/255/63, sectors = 80043264, start = 0

Notice that I/O support is 16-bit, but doing research on the "Maxtor 4D040H2", I found that it support 32-bit. Also, unmaskirq is turned off and DMA mode is set to: udma2 (X66). The "MaxMultiSect" is the number to use for the multicount setting.

Patch and Rebuild an RPM Package

The following describes how to derive a patch for a modification you need to make to the source code of a program, and apply that patch during the RPM building process.

1. Setup

By default, at least on a Red Hat box, rpm uses /usr/src/redhat as the location of the %_topdir macro, which specifies where most of the work involved in building an RPM takes place.

The BUILD directory is where sources will be extracted and compiled, and as such is more or less a temporary working directory. SOURCES is for source tarballs, patches, and additional files, which are extracted from SRPM packages you install, and used and included in packages you build. The RPMS and SRPMS directories are where packages you build will end up. The SPECS directory is where the specfile included with an SRPM will be placed.

Google Entices Job Searchers...

Mysterious banners at a Cambridge, Mass., subway stop have commuters scratching their heads. The signs, challenging passers-by to solve a complicated math problem, are actually a cryptic pitch by Google, which is looking to hire more brainy engineers.

The message at Harvard Square also appears on a billboard in California's Silicon Valley, but Google's name is nowhere to be found on the ads. It simply states:

{first 10-digit prime found in consecutive digits of e}.com

In case you're wondering -- or forgot -- e is the base of the natural system of logarithms, having a numerical value of about 2.71828 (though the number goes on forever).

AlternC Hosting Software

AlternC is a set of user-friendly automatic hosting software suite available in French, English, and Spanish. It features a PHP-based administration interface, shell and Perl scripts that manage server contents. It is easy to install and open-source software based on the Debian GNU/Linux system ('Woody' version), and requires other softwares such as Apache, Postfix, Mailman... It also contains a documented API, so you can customize your web panel quickly and easily.

Frequently used SCREEN reference commands

# open screen session
screen 

# list screen sessions
screen -ls 

# reattach to screen session
screen -r <name of screen session> 

# attach to a not detached session
screen -x <name of screen session> 

# detach from unattached session
screen -d 

Note: ^A = Ctrl-a (Press the "a" key while holding down Control key)

detach from screen session attached to
^A d 

# open another session
^A c 

list the screen windows
^A w 

# print screen and save a hardcopy
^A h 

# go to next window
^A n 

# go to previous window
^A p

# lock screen
^A x

Linspire Desktop

Interstesting article about Linux - no longer for techies...

http://www.linuxplanet.com/linuxplanet/reviews/5546/1/

Also, recently NRP.org featured the ABCs of Linux mentioning Linspire on 8-27-04, Talk of the Nation .

http://www.npr.org/features/feature.php?wfId=3875409

Linspire, was originally named Lindows (Linux + Windows) and had Microsoft chasing them which eventually resulted in a name change.

Some frequently used MySQL commands for reference...

# Create User
CREATE USER user [IDENTIFIED BY [PASSWORD] 'password'];

# Create Database
$ mysqladmin -u <username> -p create <nameOfDatabase>

# Drop/Delete Database
$ mysqladmin -u <username> -p drop <nameOfDatabase>

# Check Process List
$ mysqladmin -u root -p proc

# Check Status at 5 seconds interval
$ mysqladmin -u root -p -i 5 status

# Dump Database
$ mysqldump --opt -u <username> -h <hostname> <nameOfDatabase> -p > /path/to/file    

$ mysqldump --opt -u <username> -h <hostname> --all-databases -p > /path/to/file 

# Import Database
$ mysql -h <host> -u <username> <nameOfDatabase> -p < /path/to/file

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON <dbname>.* TO <dbuser@localhost> [IDENTIFIED BY '<password>'];

REVOKE ALL ON <dbname> FROM <dbuser@localhost>;

CREATE DATABASE <dbname>;

DROP DATABASE <dbname>;

DROP TABLE <tablename1[, table2, table3...]>;

# To activate new permissions
FLUSH PRIVILEGES; 

USE <nameOfDatabase>;

SHOW DATABASES;

# show tables begining with the prefix
SHOW TABLES LIKE 'prefix%'; 

SELECT * FROM <nameOfTable>;

DESCRIBE <nameOfTable>;

INSERT INTO <table> <username, password, name1, name2, ...> VALUES ('user', password('pass'), 'value1', 'value2' ...);

CREATE TABLE <newtable> AS SELECT DISTINCT <field> FROM <oldtable>;

INSERT INTO <database.table> SELECT * FROM <database.table> WHERE <field> = <value>;

ALTER TABLE <tableOldName> RENAME <tableNewName>;

UPDATE <tableName> SET <field1> = <newValue> [WHERE <field2> = <currentValue>];

Technical Reference eLibrary

Came across this great technical reference elibrary while doing some code searches on google.

Please share your findings...

How to determine the application listening to a particular port

For example, I run nmap and find that port 712 is open:

712/tcp    open        unknown

But it's easily identified:

# fuser 712/tcp
712/tcp:  2098

# ps -fp 2098
     UID    PID    PPID  C    STIME TTY    TIME   CMD
    root   22098   8999  0    Aug18 ?      22:33  /usr/etc/customd

# man -k customd
custom (1M)           - Custom daemon

Syndicate content
Comment