"; */ ?>

linux


7
Apr 07

Verizon’s ignorance – “Linux does not support Javascript and Tables”

Checking a speedtest tool from Verizon? Would like to ask Verizon whether or not it works for you? Here is one of Verizon’s question/answers:

    Q: My computer is a Mac, PC, or Linux – will this test work for me?
    A: Yes. The techniques used to build these pages are not operating system specific. However, the Speedtest tool should work for every browser that supports simple JavaScript and tables. The noted exception to this is Linux, which supports neither JavaScript nor tables.

Here is the snapshot:

verizon ignorance linux

Way to go Verizon! There is a good book you can buy for FiOS department to read “Linux for Dummies” :)


7
Apr 07

Happy birthday IBM System/360!

Exactly 43 years ago, on April 7, 1964 the entire concept of computers has changed, when Big Blue announced its baby – IBM System/360 (S/360).

According to wiki The design is considered by many to be one of the most successful computers in history, influencing computer design for years to come. (The 360 and its successors are unquestionably the most profitable line of computer systems in history).

image is taken from ibm
ibm os360

Today, S/360 would seem like a total archaism – with several CPUs, it performed less than a MIPS or a 1,000,000 Instructions (operations) Per Second, having only 24KB of RAM (the cheapest model).

But the real “secret weapon” of S/360 was not at all its speed, but its ability to multitask, where many tasks could run concurrently. This was a huge step forward which doubled, or in some cases, tripled the overall system performance. Instead of sequential time distribution among users who stayed in line to get a machine’s time portion, S/360 could serve them simultaneously. Today we would say that S/360 was a server, and users were clients (terminals).

Another important innovation to computer industry that came with S/360 was a clear separation of hardware and operating system (OS/360). First time in computer history Operating System was introduced as a separate and independent component. Today mainframes use VMs (virtual machines) which are used to run many operating systems simultaneously on a single box. It’s worth to mention that Linux (zLinux what it is called on mainframes) is one of such OSs. More on zLinux here.

System/360 was an extremely risky project for IBM. Company invested $5 billion dollars (which made this project the most expensive computer/system project in history), and hired 60,000 people. However, this risk was justified in 5 years, when IBM’s revenue doubled.

According to IBM, today mainframes hold 65% of all the data accumulated by humanity in computer based format. Which is an interesting fact. Another amusing fact is that IBM zSeries (modern mainframes) sales grew 10.3 percent in 2006. ;)


4
Apr 07

SED to parse and modify XML element nodes

In one of my previous articles I showed how AWK can be used to get a very useful statistic from server log. Today I want to introduce my other friend – SED, which will help us to modify values of element nodes within an XML file.

Here is a little info on SED from wikipedia:

sed (which stands for Stream EDitor) is a simple and powerful computer program used to apply various textual transformations to a sequential stream of text data. It reads input files line by line, applying the operation which has been specified via the command line (or the sed script), and then finally outputs the line. It was originally developed from 1973 to 1974 as a Unix utility by Lee E. McMahon of Bell Labs, but today sed is now available for Unix (BSD, Mac OS X), Linux, and Win32, as well as many other platforms.

Ok, let’s see what is given. By complete accident we have an access to an XML request (file) from Yanik’s bank (ING), that performs a transfer of $1,000,000.00 dollars to his account today in exactly one hour. Here is what the request looks like (goodnews.xml):

<?xml version="1.0" encoding="ISO-8859-1"?>
<goodnews>
 
      <to>Yanik</to>
      <from>ING Bank</from>
      <date>04/01/2007</date>
      <amount>$1,000,000.00</amount>
      <account>0024549Y48K3-843</account>
      <message>We are pleased to inform you that the above amount was transferred to your bank account</message>
 
</goodnews>

Now, what if we could just made a slight change to this request, and become a receiver of that million dollars – would not that be cool!? Well, I am not asking Yanik here, for an obvious reason… The answer is – yes, it’d be cool and SED can help us archive our goal. Here is how.

Below, I wrote a small shell script that will be using SED. The script will take three parameters from a command line:

    “xml filename”, “element name” and “new value”

Then it will extract the value from the “element name”, and substitute it with a “new value” – that’s it – that is how simple it is. Does it smell like a million dollars already? :)

Here is the code (relement.sh):

# Check that exactly 3 values were passed in
if [ $# -ne 3 ]; then
echo 1>&2 “This script replaces xml element’s value with the one provided as a command parameter \n\n\tUsage: $0 <xml filename> <element name> <new value>exit 127
fi
 
echo "DEBUG: Starting... [Ok]\n"
echo "DEBUG: searching $1 for tagname <$2> and replacing its value with '$3'"
 
# Creating a temporary file for sed to write the changes to
temp_file="repl.temp"
 
# Elegance is the key -> adding an empty last line for Mr. “sed” to pick up
echo ” ” >> $1
 
# Extracting the value from the <$2> element
el_value=`grep<$2>.*<.$2>$1 | sed -e “s/^.*<$2/<$2/| cut -f2 -d”>| cut -f1 -d”<`
 
echo "DEBUG: Found the current value for the element <$2> - '$el_value'"
 
# Replacing elemen’s value with $3
sed -e “s/<$2>$el_value<\/$2>/<$2>$3<\/$2>/g” $1 > $temp_file
 
# Writing our changes back to the original file ($1)
chmod 666 $1
mv $temp_file $1

Let’s run it now and get that million dollars, that we are after:

[me at server]~: ./relement.sh goodnews.xml account my-secure-account
DEBUG: Starting... [Ok]
 
DEBUG: searching goodnews.xml for tagname <account> and replacing its value with 'my-secure-account'
DEBUG: Found the current value for the element <account> - '0024549Y48K3-843'
DEBUG: <account>0024549Y48K3-843</account> was successfully changed to <account>my-secure-account</account>
 
DEBUG: Exiting... [Ok]
 
[me at server]~: cat goodnews.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<goodnews>
 
      <to>Yanik</to>
      <from>ING Bank</from>
      <date>04/01/2007</date>
      <amount>$1,000,000.00</amount>
      <account>my-secure-account</account>
      <message>We are pleased to inform you that the above amount was transferred to your bank account</message>
 
</goodnews>

Now we are getting all the money and not Yanik (well it is MY-secure-account, so technically I get it :) ).

Here is the nitty-gritty details of how that financial operation was possible…

Of course, the heart of this script is this line:

el_value=`grep "<$2>.*<.$2>" $1 | sed -e "s/^.*<$2/<$2/" | cut -f2 -d">"| cut -f1 -d"<"`

And here is what happens here:

    1. We grep “<element>whatever</element>” from the file ($1)

    2. Then we apply sed to search to ignore everything from the beginning of the line to the “<element”

    3. And finally we cut the value of this element which is located in between greater and less signs “>value<“

Easy, right?

Now let us look at this line:

sed -e "s/<$2>$el_value<\/$2>/<$2>$3<\/$2>/g" $1 > $temp_file

which uses sed’ (or vi’s) ‘s/search/replace/g” pattern to do the job – to replace all the “<element>oldvalue</element>” to “<element>newvalue</element>”. After that it saves it in a temp file, before replacing the original file.

The line

echo " " >> $1

makes sure that the source file has an empty last line, so sed can identify the “end of file” correctly

There is also one thing to mention – if you export Microsoft (e.g. M$ Word) document to XML, in order to change anything (properties) there, add these lines:

sed -e "s/<w:t>$el_value</<w:t>$3</g" $1 > $temp_file
chmod 666 $1
mv $temp_file $1

it will change all the corresponding elements to the property you need to change.

Now we are completely empowered! Quit your job – learn SED, and earn millions! No.. rather – billions!

Feel free to ask questions or leave comments.


1
Apr 07

Dell will sell PCs pre-installed with Linux

Go Linux!

Computer giant Dell announced that it is to start selling PCs pre-installed with the Linux operating system.

Dell is the second-largest computer manufacturer in the world controlling 16 per cent of the market and the move could dent Microsoft’s dominance of the software market. The Windows operating system is installed on 90 per cent of PCs with Linux believed to be used on six per cent.

Dell made its move in response to a survey of 100,000 customers that it carried out earlier this year. Some 70 per cent of respondents said that they wanted to use Linux.

“I think it will be a big blow to Microsoft,” said Alfred Thompson, technical director of First PointLtd., the local importer of Dell computers.

Microsoft’s head office, located near Seattle in the United States, declined to comment.

source: jamaica-gleaner


22
Mar 07

Installing Sun’s Looking Glass on Ubuntu

From Ubutu’s wiki:

Looking Glass – If you wanna dazzle Vista wannabees, there’s the package you’d want to consider. A 3D Desktop with much less requirements than Vista

Here is a demo:

Below are the instructions on how to install Looking Glass on Ubuntu:

    1. Edit the /etc/apt/sources.list file
    sudo vi /etc/apt/sources.list

    2. Add one of these two-liners, whichever is more applicable (most likely stable will be the one to go with):

    For stable
    # LG3D repsoitories
    deb http://javadesktop.org/lg3d/debian stable contrib

    For testing
    # LG3D repsoitories
    # deb http://javadesktop.org/lg3d/debian testing contrib

    For unstable
    # LG3D repsoitories
    # deb http://javadesktop.org/lg3d/debian unstable contrib

    (Since a stable version is suggested, it is the one uncommented)

    3. Save the file and close it

    4. Update the repositories using the following command
    sudo apt-get update

    5. Install looking glass using the following command
    sudo apt-get install lg3d-core

Stop here. Smile broadly.

Although there are less requirements for Looking glass, the video card requirements still apply ;)