Sunday, December 30, 2007

MIT's OpenCourseWare Model is Proliferating Online

The Massachusetts Institute of Technology OpenCourseWare effort has been offering free lecture notes, exams, and other resources from more than 1800 courses per its website. Some of their courses offer a substantial amount of video and audio content. I remember stumbling across this resource via my employer's intranet about a year ago. Frankly speaking, I didn't think the concept would go very far because you couldn’t earn credit…

Well, I was wrong. It’s catching fire and over 100 universities worldwide have setup similar models and some are top tier schools such as Johns Hopkins and Tufts.

I was searching for a good UNIX course but I haven't found one yet. Surprisingly, it appears MIT’s Linear Algebra course is quite popular with the OpenCourseWare community.

By the way, I don't have any affiliation with OCW or any of the higher learning institutions mentioned.

Added later:

UC Irvine OCW
Notre Dame OCW
Utah State OCW
Osaka OCW
Japan OCW Consortium

Friday, December 28, 2007

Shutdown a Sybase Adaptive and Backup Server

Lately, I have seen a number of searches related to terminating an Sybase Adaptive server process. I wrote a post for starting a Sybase DBMS in July but not vice versa.

Typically, the DBMS is started and terminated by using common startup and kill scripts. But SysAdmins can also gracefully shut down both the dataserver and backup servers via the command line. Here is a run.

# isql –Usa –Ppassword
1> shutdown SYB_BACKUP
2> go
1> shutdown
2> go

If you can not shutdown the dataserver by the aforementioned methods, you might have to employ brute force: the kill -9 command. But note, this should only be performed in an emergency.

# ps –ef | grep backupserver
# kill -9 PID

# ps –ef | grep dataserver
# kill -9 PID

Tuesday, December 25, 2007

Assign Unique Numbers to Columns in Database - Oracle

The other day I had someone ask me how to automatically assign unique numbers (integers) to a column in an Oracle database. I took an Oracle SQL class a few years ago and I remember learning about the “create sequence” command. After reviewing a couple archived homework assignments for syntax, here are three typical examples of its use.

create sequence myblog_ID increment by 1 start with 100;
insert into MYBLOG (Blog, Author, ID) values (‘My SysAd Blog’,’esofthub’,myblog_ID.Nextval);

create sequence topblog_ID increment by 1 start with 1000;
insert into TOPBLOG (Blog, Author, ID) values (‘TopBlogLists’,’esofthub’,topblog_ID.Nextval);

create sequence mysysad_ID increment by 1 start with 10000;
insert into MYSYSAD (Blog, Author, ID) values (‘My SysAd Blog’,’esofthub’,mysysad_ID.Nextval);

Saturday, December 22, 2007

Search String Within Paragraph and Print the Paragraph - UNIX

Here is another guest post by Mary M. Chaddock. She is a Network Security Administrator for a major university in Texas. Here is her time saving tip. Thanks Mary.

This little routine searches a file for a string and then prints the paragraph associated with that string.

Note: The Blogger application parsed out the greater-than and less-than characters so an underscore was used to preserve the contiguous nature of the <_string> <_filename> symbols.

Mary says…

Grep'ing from a file with more than one line per record:

You can do this with a Perl one-liner command: 'perl -00 -ne 'print if /'<_gstring>'/' <_filename>'

But I can rarely remember the Perl syntax, so I put this small shell script in my $HOME/bin directory:

# grep a string in a paragraph and print the paragraph.
# A paragraph is delimited by a blank line.
# syntax: gparagraph <_string> <_filename>
perl -00 -ne 'print if /'$gstring'/' $gfile

Friday, December 21, 2007

Merge Multiple Files and Sort Simultaneously

The other day I was gathering historical files populated with multiple logins. I was trying to determine how many user logins were created over the past three years. Obtaining a unique login count would involve simultaneously merging the files and then sorting.

The actual run was much larger than the example run below.

# ls
user1.txt user2.txt user3.txt user4.txt group1.txt group2.txt
# more user[1-4].txt

# wc -l user[1-4].txt
7 user1.txt
9 user2.txt
11 user3.txt
5 user4.txt
32 total

Here is the merged, sorted and unique output
# sort user[1-4].txt | uniq

There are 19 unique logins for this example
# sort user[1-4].txt | uniq | wc -l

Friday, December 14, 2007

Java Programming Language Tutorial

Nowadays, I am more interested in PHP and mySQL because of activities related to my websites, so it has been awhile since I dabbled with the Java programming language.

So why the concern?

Lately, I have been thinking about writing a small Java utility for a personal project of mine. But I definitely needed a quick refresher. I found a reliable Java tutorial that covers the fundamentals of programming in the Java programming language. Here are the topics covered: object-oriented programming concepts, language basics, classes and object, interface and inheritance, numbers and strings, generics and packages.

I will, undoubtedly, have to look over my old programs, too.

You can also download The Java Tutorial

Sunday, December 09, 2007

The Irony of a UNIX System Administrator

A colleague of mine emailed me this funny animated gif about a frustrated user. I thought it was comical from my own user experiences, especially prior to my UNIX system administration days.

I hated going through the troubleshooting part, particularly when the SysAd showed up to resolve my issue after it had “magically” resolved itself. I remember the “all knowing” system administrator explaining away the issue or looking at me as if I had “timing and head space” issues.

Frankly speaking, I find some irony in this rumination… ;)

Saturday, December 08, 2007

Convert Length, Weight, Pressure, Volume and Temperature

Here is a fairly comprehensive calculator by World Wide Metric that converts length, weight, pressure, volume, and temperature. Living in South Korea, I’m always converting some metric unit, especially Celsius to Fahrenheit.

Length: meter, kilometers, feet, yards, millimeters, centimeters, miles, and inches.
: metric tons, kilograms, pounds, ounces, grams, and tons
Pressure: bar, kg/cm, and psi
Volume: milliliters, liters, fluid ounces, pints, cups, quarts, and gallons
Temperature: Celsius and Fahrenheit

Convert quantities via the Unix command line

Wednesday, December 05, 2007

HTTP Response Status Code List

The other day I was creating a sitemap for one of my websites. Unfortunately, I had a number of errors reported with several of my pages. I was trying to make sense of the error status codes but didn't have a handy reference readily available. Here's a compiled listing of common HTTP status codes.

Common HTTP status codes and standard phrases:
100 - Continue
200 - OK - No error or successful response
301 - Permanent Redirect
302 - Redirect
400 - Bad request
401 - Unauthorized or this page requires authentication
402 - Payment Required - Not used
403 - Forbidden
404 - Page not found
405 - Method Not Allowed
406 - Not Acceptable
407 - Proxy Authentication Required
408 - Request Timeout
409 - Conflict
410 - Gone
411 - Length Required
412 - Precondition Failed
413 - Request Entity Too Large
414 - Request-URI Too Long
415 - Unsupported Media Type
416 - Requested Range Not Satisfiable
417 - Expectation Failed
500 - Internal Server error
501 - Not Implemented
502 - Bad Gateway
503 - Service Unavailable
504 - Gateway Timeout
505 - HTTP Version Not Supported
0 - Some network connection error - possible time out
990 - Blocked by robots.txt file
999 - Undefined error - not sure what