Geeky Stuff


Linux / Unix17 Jan 2008 11:00 am

In a press release yesterday, ComputerWorld reports that Oracle is slated to buy BEA for $8.5 billion dollars. BEA best known for it’s Tuxedo middleware application server and their Weblogic webserver, both heavily used and licensed for another of Oracle’s recent purchases, the 800lb gorilla that everyone loves to hate, PeopleSoft, the Flagship of Enterprise Resource Planning (ERP) applications.

What does this mean for BEA’s products? At this point anyone who knows isn’t saying, however another press conference is scheduld for 1/17 where more details should be released.

Linux / Unix26 Jul 2007 09:59 am

A little of the magical stuff that makes vi such a useful tool for editing text files and such.

By now everyone knows / starts up the search function, but did you know it can also do a search and replace? (more on that in a moment)

A quick review of some advanced search functions;

/s
would move the cursor to the first instance of ’s’ in the text, hit n to repeat the last command (in this case search for s)… not very efficient in most cases so read on.

/[a-z]s
is a little more specific, the search will look for any instance of s but preceded by a litter a - z. Try different combinations and you will find the pattern matching can be very precise with only a few keystrokes. This is not pico or nano, so case is sensitve.

/[^c]tem
will search for any tem preceded by any character other than a c.

/^[A-Z].*\. *$

will search for any line that begins with a capital letter and ends with a period and any number of blanks

All of the above patterns can be used to as part of search and replace (or find and replace for this coming from windoze) pattern matching.

:s/search_string/replacement_string/g

This command replaces every search_string on the current line with replacement_string. Omitting the g (global) flag at the end of the command will cause only the first occurrence of search_string to be altered. Often you may wish to confirm each replacement. This can be done with the confirm flag c. The confirm flag should be placed after or in place of the g flag. Suppose I had the following line:

Give a young man a hammer… and he’ll find something to bash

and typed

:s/find something to bash/bash something to bits/

I would be left with

Give a young man a hammer… and he’ll bash something to bits

Any command that begins with a “:” is called a line mode command and performs its duty on the line the cursor is currently on. However, you can override vi’s default of operating only on the current line by preceding them with a range of line numbers. For example, if I wanted to replace guy with gal on lines 32 through 56 I would type

:32,56s/guy/gal/g

Omitting the g would cause only the first occurrence of guy in each line to be replaced. The “.” and “$” play a special role in this sort of designation. “.” indicates the current line, and “$” indicates the last line of the file. Therefore, if I wanted to delete1 from the current line to the end of the file I would enter:2

:.,$d

I could even do something like:

:.,/Fred/d

which would delete from the current line to the next line that contained Fred.

One other shortcut that might be worth mentioning is that 1,$ and % both indicate all the lines in the file. Therefore,

:1,$s/search_string/replacement_string/g

and

:%s/search_string/replacement_string/g

do exactly the same thing.

—————————–
The marketing companies working for different businesses are also sponsoring affiliate program marketing to promote their products and services. The computers software are used to build effective websites and now with a lot of companies are offering free web hosting services to the customers to promote online trading. The internet phone is used to by the buyers and the sellers to talk at cheap rates. The online backup uses a script to follow step by step procedures to streamline the processes.

Linux / Unix25 Apr 2007 02:51 pm

Wildacrd replace in Unix

Way back when the limited wildcard replace in DOS was as simple as using a ? to represent a single character for renaming, moving, copying, or whatever you wanted to do to a file..

For example;

CODE:
  1. copy 117691???.txt test117691???.txt

would search the current directory and match any filename with 117691(any 3 chatacters).txt and copy them to test117691(same 3 characters).txt.

On Unix or Linux, it just doesn't work, but alas the key is a simple for loop, tested in bash and ksh shells;

CODE:
  1. for file in 117691????.job; do cp $file test${file%?????}; done

This command gives the same results as the old DOS method, a little more typing but with a little thought it becomes a very powerful command.

Javascript code snippets21 Sep 2006 04:21 pm

After searching around the net looking for an example snippet of javascript that would check or uncheck all of a series of checkboxes on a form... the results from Google were good, however each 'example' assumed that you I actually had a good understanding of what you were reading or that you I might actually read it instead of just pasting the pieces you liked in... Obviously I did the latter and after 20 minutes of pounding my head on the keyboard figured out what I was doing wrong...

So for all of you code slammers, this one is for you.

CODE:
  1. <script language="JavaScript">
  2.  
  3.     function checkall()
  4.     {
  5.     for(i=0; i<document .FormName.elements.length; i++)
  6.     {
  7.     if(document.FormName.elements[i].type=="checkbox")
  8.     {
  9.     document.FormName.elements[i].checked=true;
  10.     }
  11.     }
  12.     }
  13.  
  14.     function uncheckall()
  15.     {
  16.     for(i=0; i<document.FormName.elements.length; i++)
  17.     {
  18.     if(document.FormName.elements[i].type=="checkbox")
  19.     {
  20.     document.FormName.elements[i].checked=false;
  21.     }
  22.     }
  23.     }
  24.  
  25.     </script>

Simple enough, look through each form element and either mark them checked or unchecked depending on the function being called.

And of course in your markup

CODE:
  1. <a href="javascript: void(0);" onclick="javascript: checkall();">Check All</a> / <a href="javascript: void(0);" onclick="javascript: uncheckall();">Uncheck All</a>

And now where I went wrong. If you actually read the JavaScript you'll see the lines

document.FormName.elements.....

Well, FormName must be specified! Look at your markup where

CODE:
  1. <form name="get_form_data" method="POST" action="....... blah blah blah

if you change the javascript lines to read
document.get_form_data.elements.....

Life will be bliss and you can click check and uncheck all afternoon long and watch the little checkmarks magically appear and disappear from your forms. Providing you with some entertainment while waiting for the impression of the keypad to subside from your forehead.

------------------------------
The dotster offers a high speed internet service to its customers. The rogers wireless phones are very popular among the phone services and is used many businesses. The businesses are constantly working out way to make their websites popular among the customers by having seo services. The sprint wireless uses the startlogic programming to produce efficient results for the customers.

Geeky Stuff12 Sep 2006 09:52 am

The need for conditionals in shell scripts have the ability to make life easier, be it from just a quick script or setting up environment variables for logins.

In the example below taken from a login script we needed to verify if a particular directory exists and if so set enviroment variables in a particular fashion to later be added to the $PATH, if not then set them another way. This in particular (though slightly sanitized) is part of a larger script used to determine what OS the server is running Solaris or HPUX, the particular function of the server can be termined if a certain directory exists.

CODE:
  1. if [ -d /apphome/$LOGNAME/serv/prcs/$LOGNAME ]
  2.    then
  3.      export APPCONFIG=/apphome/$LOGNAME/serv/prcs/$LOGNAME/APPCFG
  4.    else
  5.      export APPCONFIG=/apphome/$LOGNAME/serv/$LOGNAME/APPCFG
  6.    fi

This list gives the file handling tests available.

-r True if file exists and is readable
-w True if file exists and is writable
-x True if file exists and is executable
-f True if file exists and is a regular file
-d True if file exists and is a directory
-c True if file exists and is a character special file
-b True if file exists and is a block special file
-p True if file exists and is a named pipe (FIFO)
-u True if file exists and is a SETUID file
-g True if file exists and is a SETGID file
-k True if file exists and the sticky bit is set
-s True if file exists and has a size greater than zero

From here this rest is up to your creativity how to employ these checks, using standardized scripts across all hosts just makes life easier.

------------------------------
The entire banking sector offers creditcard tends to hide certain facts from the customer. The credit cards cannot play a significant role in the matter of debt relief. The insurance quotes offering specific to policy holders are in the vogue these days. The real estate agents made sky rocketing profits in year 2004 to year 2006 all over the world with the sudden rise in properties and land.

« Previous PageNext Page »


eHarmony Coupon - Mortgage Calculator - Quick Collect - Send Telegram - Debt Loans
X10 Home Security|Dakar's Photos
Listed on BlogShares