2009-04-16
Perl one liner for dos2unix
There are two choices:
Use dos2unix - this will change the newline characters one file at a time. Trouble is, that dos2unix writes to stdout, so you'd have to pipe the output to a temporary file and move it back to your script...
Use the following perl one-liner:
perl -pi -e 's/\r\n/\n/g' *
You guessed it - Windows/DOS uses "\r\n" for newline, while Unix uses only "\n"
Back again
I'm currently in Romania, after surviving a near death experience in a local taxi (which of all things, was about to hit a Police car, or maybe it was the other way around)... no one was hurt, though I was shaken... a lot!
I'm going to try to be more regular here now.
2008-09-21
Sunshine, you are my sunshine!
Hope you like it too!
2008-08-29
Nigella damascena, White
I had no idea what this was, but one of my friends on Flickr (jacilluch) pointed out very kindly that it was Nigella damascena. Quick googling revealed its also called devil-in-the-bush, presumably because of its beauty! :-)
2008-08-25
Look at me! Look at me!
He allowed me to get in pretty close, and if you view this in the large version, he seems to be enjoying the attention :-) And while I'm at it, this was one of the most difficult pictures I've ever taken (bugs all around me, the fear of upsetting this guy and spilling the raindrops, high winds)... I captured about 19 shots, and am uploading what I think is the best
And if you look closely, you can see my silhouette in two of the water droplets!
2008-08-24
Freeze Action!
2008-08-22
Hmm...maybe there's some nectar left in there...
So I found myself outside this house, with wonderful flowers in the garden, and a low-low fence, so I could shoot them.
Of course I started clicking away, and then a woman came out of the house and she was startled! :-) I quickly had to explain what I was doing (while she instead thought we were taking pictures of the house, which she had just bought!)..close call :-) ..but here's the effort.
2008-02-22
Word Tables and cells with VBA
Objective:
INPUT FILE
Header text to be copied on every output file
Second line of header text to be copied on every output file (if having more than one line screws things up I can have just one)
| Column Heading 1 | Column Heading 2 | Column Heading 3 | Column Heading 4 | Column Heading 5 | Column Heading 6 | Column Heading 7 | Column Heading 8 |
| 98000 | John | data | data | data | data | data | data |
| 98000 | Cyndee | data | data | data | data | data | data |
| 98001 | Kevin | data | data | data | data | data | data |
OUTPUT FILE 1 (i.e. has all data where the first column’s data = 98000)
Header text to be copied on every output file
Second line of header text to be copied on every output file (if having more than one line screws things up I can have just one)
| Column Heading 2 | Column Heading 3 | Column Heading 4 | Column Heading 5 | Column Heading 6 | Column Heading 7 | Column Heading 8 |
| John | data | data | data | data | data | data |
| Kevin | data | data | data | data | data | data |
OUTPUT FILE 2 (i.e. has all data where the first column’s data = 98001)
Header text to be copied on every output file
Second line of header text to be copied on every output file (if having more than one line screws things up I can have just one)
| Column Heading 2 | Column Heading 3 | Column Heading 4 | Column Heading 5 | Column Heading 6 | Column Heading 7 | Column Heading 8 |
| Cyndee | data | data | data | data | data | data |
---------------
- So, I got around to read the input word document, and wanted to then create an "array" of word documents, and thought I could use the entry in the first column (such as "98000"), as the key - especially with the examples I saw on the web. Alas, none of them worked, so I had to use a Scripting.Dictionary object.
- Second, I had trouble browsing or navigating a Word table, one row and one cell at a time.
- When I finally got around that, I then had to worry about ensuring the Font styles were copied across. Again, turns out there isn't a direct mechanism in VBA to do that.
- When I do copy the text across, the table's Autofit behaviour no longer remains the same - and has to be reapplied before saving.
- If that wasn't enough, the documents created for output were by default saved in "Outline" mode - one of the vagaries of word that I would never understand.
There were other problems faced, not worth mentioning here..but here's the key snippet of the code:
'Add rows to table as required
Private Sub PopulateAndExtendTable(tbl As Word.Table, aData As Word.Range)
Dim nrRows As Long, nrCols As Long
Dim oCell As Cell
Dim oRow As Row
'tbl.Range.FormattedText = aData.FormattedText
'tbl.Rows(tbl.Rows.Count).Range.FormattedText = aData.FormattedText
tbl.Rows(tbl.Rows.Count).Range.Font = aData.Font
tbl.Rows(tbl.Rows.Count).Range.Font.Bold = aData.Font.Bold
For Each oRow In aData.Rows
For Each oCell In oRow.Cells
'MsgBox "Hi" & oCell.Range.Text
tbl.Cell(oRow.Index, oCell.ColumnIndex).Range.Text = oCell.Range.Text
tbl.Cell(oRow.Index, oCell.ColumnIndex).Range.Font = oCell.Range.Font
Next
If aData.Rows.Count > tbl.Rows.Count Then tbl.Rows.Add
Next
tbl.Rows.Add
End Sub 'Populate existing rows
Finally, here are some useful links
- Word and VBA Applications FAQ
- Word VBA Tables, Fields and Forms
- Sample MS Word VBA scripts
- Automating Word Tables for Data and Extraction
2008-01-29
Installing Ubuntu from USB flash drive....
Turns out there are several people in the same rut as me, not to mention the countless on Ubuntu forums begging to know what to do once thrown to the BusyBox console (what's up with that name anyway?).
However, I did find a couple of new URLs:
- http://learn.clemsonlinux.org/wiki/Ubuntu:Install_from_USB_drive
- http://kmandla.wordpress.com/2006/12/11/install-ubuntu-from-usb/
So time now to experiment all over again.
This time I will format my USB drive in FAT16, instead of FAT32. I have downloaded another fresh image of Ubuntu 7.10 iso, and verified md5 checksum. So far, so good.
So,
- Create a virtual floppy drive using vfd
- Format and make bootable the virtual floppy using Windows
- Create bootable USB flash, with FAT16, using HP's utility, and supplying boot files from the virtual floppy.
- Install bootloader on USB using syslinux. Verified ldlinux.sys appeared in the root folder
- Copied over all 712,508 KB of Ubuntu distrib on to the freshly formatted USB drive. Boy, is FAT16 slow or what?
- The clemsonlinux.org page above insists that initrd.gz and vmlinuz must be downloaded from Ubuntu archives. Well, what the hey... and yes, that falls flat on its face.
- So back to the drawing board. This time, I followed instructions to the letter from here, and everything seems ok, until it just... "hung"... no messages on the screen...
- At this point I have no clue what to do..
2008-01-28
Booting from USB drive
So then, I got a new Thinkpad t61p, with 2 GB RAM and 100 GB HDD pre-installed. Another 2 GB RAM was provided later, as well as a 200 GB HDD (wahey!). However, now that I have 300 GB HDD (I got rid of the DVD/RW drive), I wanted to install Ubuntu. So, off I went and downloaded all ~700 MB of Ubuntu distro.The problem of course is that, although the Ubuntu distro (*.iso) can be opened via WinRaR, the "start.exe" supplied with the distro, only fires up the Ubuntu browser, and wubi-cdboot.exe complains "Could not find any appropriate CD"... well fair enough.
But I do have USB pen drives available - so I should be able to boot from them right? Bad idea....
Quick googling gave me quite a few promising results, and I'm going to explore them all here one at a time.
- http://www.bootdisk.com/pendrive.htm - if you get past the tacky colour scheme, you find that it presents a number of options. Let's try and run through them all here
- Option 1 - Using mkbt
- You can pretty much disregard option 1, since it expects you to have a floppy drive in this day and age. Right (!). And it expects you to have created one using Windows....
- Option 2 - using HP's utilities, a USB Disk format tool and another to probably copy the boot files off to USB key, but a 45 MB utility for that? No way am I using it.
- Option 3 - Third party links 1 and 2 - While the first one wants you to have a bootable CD already, the second is merely a list of recommendations from MS when booting from USB Storage Devices...
- Option 4 - Provides a way of copying over windows bootable files on Win98 (!). Another option was to use the Windows Enabler utility, which seemed promising, but it doesn't work for me either, since it won't startup on my PC. Further examination revealed that it won't start up since it cannot find a CD/DVD drive.
- Option 5 - The last option provided was to create a virtual floppy drive, which is a neat idea (reminds me of my favourite utility deamontools). After a couple of attempts (and a reboot), it finally managed to create a virtual floppy drive, and assign it a drive letter.
- The rest of the websites have variations on these options.
I finally managed to work with two different options:
1. Use vfd to create a virtual floppy drive
2. Format and make this floppy drive DOS-bootable ,using Windows Explorer
3. Used rawrite to write binary image of this floppy on to the USB drive.
4. Boot from USB (after of course, suitable changes to BIOS startup config).
However, the drawback of this is the USB drive effectively becomes the size of the floppy disk (so, if vfd was used to create a 1.44 MB floppy disk, then writing that image on the USB disk renders it to 1.44 MB drive).
Lastly, I did resort to using HP's utility to create a bootable USB disk - and yes, that worked.
Next step, trying to get Ubuntu to intall, without sticking me at Busybox console!
By and by, I decided it would be a neat idea to be able to boot from my USB drive
2007-11-05
More Tulips...
I took over a dozen shots to finally get something useable.
2006-04-22
VOIP Network Elements
—By IP-enabling an existing telephony network
—By voice-enabling an existing IP or other packet network
—By building a pure IP telephony network from scratch
Regardless of a service provider gets to a Voice over IP architecture, the end result is the same. Whether the network is a pure IP network or uses other existing packet infrastructure, the architecture will have these elements in common:
2006-03-09
Telecom resources
- International Engineering Consortium, Tutotials
- Next generation networking
- Telecom resources
- Ericsson - Understanding telecommunications
Note to self: Submit info on the following Wikipedia stub:
http://en.wikipedia.org/wiki/Internet_traffic_engineering
Latest books ordered
- Surely You're Joking, Mr.Feynman!: Adventures of a Curious Character - Richard Feynman
- Men of Mathematics - E T Bell
While I've ordered these two, others that I'm contemplating are:
The Art of Computer Programming: Vol 1-3 by Donald Knuth
Though I've read at least the first volume, I didn't know the following:
In addition to his writings on computer science, Knuth is also the author of 3:16 Bible Texts Illuminated (1991), ISBN 0895792524, in which he attempts to examine the Bible by a process of stratified random sampling, namely an analysis of chapter 3, verse 16 of each book. Each verse is accompanied by a rendering in calligraphic art, contributed by a group of calligraphers under the leadership of Hermann Zapf.
Knuth published his first "scientific" article in a school magazine in 1957 under the title "Potrzebie System of Weights and Measures." In it, he defined the fundamental unit of length as the thickness of MAD magazine #26, and named the fundamental unit of force "whatmeworry". MAD magazine bought the article and published it in the June 1957 issue.
- source Wikipedia
Which of course makes me want to read the book even more!2. Prisoner's Dilemma: John Von Neumann, Game Theory and the Puzzle of the Bomb
This one sounds even more interesting. Particularly, since I've forgotten everything every Game theory, and also because:
The various games that are explained and, "played", for the reader actually utilize little in the way of math. Game Theory in practice is about the number of participants, the choices they have, how the games should rationally be played, and how there are played when people replace theory. The results of these games are applicable to daily life, whether it explains how a network will decide the placement of their commercials, why a person will stand in a line of unknown length, or pay more than the true value of an item (like a dollar bill). Peoples behavior often crosses from the irrational to the absurd, and many of these games will point out courses of action almost all readers will have taken at one time or another, when the rational decision was the opposite of what they chose to do.
Even more intriguing. Guess I'll wait for once before filling up the stack again!
Other interesting websites of note:
- http://foldoc.org/ - free online dictionary of computing
- http://xmlliterate.sourceforge.net/index.html - XML Literate documentation
- http://en.wikipedia.org/wiki/Category:FOLDOC_sourced_articles - Wikipedia FOLDOC sourced articles
2006-02-26
Quality of Service
quality of service
In the fields of packet-switched networks and computer networking, the traffic engineering term Quality of Service (QoS) refers to the probability of the telecommunication network meeting a given traffic contract, or in many cases is used informally to refer to the probability of a packet succeeding in passing between two points in the network.
In the field of telephony, telephony quality of service refers to lack of noise and tones on the circuit, appropriate loudness levels etc., and includes grade of service.
Problems
When the Internet was first being created, there was no perceived need for a QoS application. So in fact the entire internet ran on a "best effort" system. There were four "type of service" bits and three "precedence" bits provided in each message, but they were largely unused. There are many things that can happen to packets as they travel from origin to destination and they result in the following problems, as seen from the point of view of the sender and receiver:
- dropped packets - the routers might fail to deliver (drop) some packets if they arrive when their buffers are already full. Some, none, or all of the packets might be dropped, depending on the state of the network, and it is impossible to determine what happened in advance. The receiving application must ask for this information to be retransmitted, possibly causing severe delays in the overall transmission.
- delay - it might take a long time for a packet to reach its destination, because it gets held up in long queues, or takes a less direct route to avoid congestion. Alternatively, it might follow a fast, direct route. Thus delay is very unpredictable.
- Jitter - packets from source will reach the destination with different delays. This variation in delay is known as jitter and can seriously affect the quality of streaming audio and/or video.
- out-of-order delivery - when a collection of related packets are routed through the Internet, different packets may take different routes, each resulting in a different delay. The result is that the packets arrive in a different order to the one with which they were sent. This problem necessitates special additional protocols responsible for rearranging out-of-order packets once they reach their destination.
- error - sometimes packets are misdirected, or combined together, or corrupted, while en route. The receiver has to detect this and, just as if the packet was dropped, ask the sender to repeat itself.
Applications requiring QoS
A traffic contract (
- streaming multimedia may require guaranteed throughput
- IP telephony may require strict limits on jitter and delay
- dedicated link emulation requires both guaranteed throughput and imposes limits on maximum delay
- a safety-critical application, such as remote surgery may require a guaranteed level of availability (this is also called hard QoS).
These types of service are called inelastic, meaning that they require a certain level of bandwidth to function - any more than required is unused, and any less will render the service non-functioning. By contrast, elastic applications can take advantage of however much or little bandwidth is available.
Obtaining QoS
There are essentially two ways to provide QoS guarantees. The first is simply to provide lots of resources, enough to meet the expected peak demand with a substantial safety margin. This is nice and simple, but some people believe it to be expensive in practice, and can't cope if the peak demand increases faster than predicted: deploying the extra resources takes time.
The second one is to require people to make reservations, and only accept the reservations if the routers are able to serve them reliably. Naturally, you can then charge people money for making reservations! There are two popular variations on this:
DiffServ are typically used with:
- weighted round robin, WRR.
- RED, WRED - Lessens the possibility of port queue buffer tail-drops and this lowers the likelihood of TCP global synchronization.
- Traffic shaping
- A number of port queue buffers.
- VLAN IEEE 802.1p and IEEE 802.1D.
Network equipment, that supports DiffServ and perhaps IntServ, are called multilayer network equipment. A switch that supports DiffServ and perhaps IntServ is called a multilayer switch.
However, the market has not yet favoured QoS services. Some people believe that this is because a "dumb" network that offers sufficient bandwidth for most applications, most of the time, is already economically stable, with little incentive to deploy non-standard stateful QoS-based applications.
Internet peering arrangements are already complex, and there appears to be no enthusiasm among providers for supporting QoS across peering connections, or agreement about what policies should be supported in order to do so.
QoS skeptics further point out that if you are dropping many packets on elastic low-QoS connections, you are already dangerously close to the point of congestion collapse on your inelastic high-QoS applications, without any way of further dropping traffic without violating traffic contracts.
QoS problems with some technologies
The following properties may only be used on end ports, but not on server, backbone or other ports that mediate many concurrent flows.
- half duplex - link collisions make delay variations (jitter), because the packets are delayed with each collision by the backoff-time.
- Port queue buffer IEEE 802.3x "flow"-control.
IEEE 802.3x "flow"-control does not really specify a flow control protocol, but rather a kind of queue-control. An example of an IEEE 802.3x problem is "head of Line"-blocking. Many of today's switches have IEEE 802.3x on as default - even on uplink/backbone ports.
Quote from Network World, 09/13/99, 'Flow control feedback': "...Hewlett-Packard points out that quality of service is a better way to handle potential congestion, and Cabletron and Nortel note that QoS features can't operate properly if a switch sends [IEEE 802.3x] pause frames...."
This quote suggests that QoS and IEEE 802.3x are incompatible.
An Ethernet connection with 100 Mbit/s full duplex instead of 100 Mbit/s half duplex increases the effective speed from ca. 60-100 Mbit/s half duplex to 200 Mbit/s (100 Mbit/s transmit + 100 Mbit/s receive).
See also
- ATM
- Class of Service
- Internet
- Network congestion avoidance
- Video quality
- PSTN
- Telephony quality of service
- Traffic Shaping
- 802.11e: Quality of Service enhancements for WiFi standard 802.11b
- Wireless Multimedia Extensions (WME) also known as Wi-Fi Multimedia (WMM)
- Broadband Remote Access Server
Reference
- A Framework for QoS-based Routing in the Internet
- IEEE 802.1 P,Q - QoS on the MAC level, 24.4.1999, Niclas Ek
- IEEE 802.1 LAN/MAN Bridging & Management
- "Good old days" IP QoS: Type of Service in the Internet Protocol Suite
- On the Effects of the IEEE 802.3x Flow Control in Full-Duplex Ethernet LANs, Oliver Feuser, Andre Wenzel, University of Bonn
- sslug.dk: Hyggemøde tirsdag den 11. juni 2002: Båndbreddebegrænsning
- sslug.dk: Hyggemøde tirsdag den 11. juni 2002: Båndbreddebegrænsning. Eksempler
- Linux Advanced Routing & Traffic Control
- Linux Advanced Routing & Traffic Control, HowTo
- lartc.org: The Wonder Shaper
- Commercial Windows QoS Software
- WRR and WIPL
- Packeteer PacketShaper 2500: Traffic Control on Autopilot, September 4, 2000, By David Newman
- Packeteer PacketShaper
- Traffic Shaping application for Windows (has free version)
- ALTQ: Alternate Queueing for BSD UNIX
- Cisco Quality of Service Networking
- MasterShaper - QoS Webinterface for Linux Traffic Shaping
2005-06-02
vi 'ed
Now that I had some time, I've been able to explore a few things:
Search and Replace
Search: as we probably all know, a pattern can be searched by:
/search_string
Replace: (This was the tricky one for me, since I could never get it to work in the past)
:s/search_string/replace_string - replaces the first occurence of 'search_string' with 'replace_string' on the current line
:s/search_string/replace_string/g - replaces all occurences of 'search_string' with 'replace_string' on the current line
:1,$s/search_string/replace_string/g or :%s/search_string/replace_string/g - will replace all occurences of the 'search_string' with 'replace_string' in the entire file
Moving Around
h move the cursor one character to the left
j move the cursor one character down
k move the cursor one character up
l move the cursor one character to the right
0 move to the beginning of a line
$ move to the end of a line
G move to the end of a file
1G move to the first line of a file
Ctrl+F move down one screen
Ctlr+B move up one screen
2005-06-01
Managing PuTTY settings
HKEY_CURRENT_USER\Software\SimonTatham
To export settings to a file:
regedit /e putty.reg HKEY_CURRENT_USER\Software\SimonTatham
To import settings:
regedit /s putty.reg
2005-05-18
Oracle for Unix - I
Found usually in /etc or /var/opt/oracle.
oratab is used by ORACLE utilities. It is created by the root.sh script (a part of Oracle installer), and is updated by the Database Configuration Assistant when creating a database.
Entries in this file have the following format:
$ORACLE_SID:$ORACLE_HOME:
A colon, ':', is used as the field terminator. A new line terminates the entry. Lines beginning with a pound sign, '#', are comments.
The first and second fields are the system identifier and home directory of the database respectively. The third filed indicates to the dbstart utility that the database should , "Y", or should not, "N", be brought up at system boot time.
List all installed Oracle products
For Oracle 8i and above:
cd $ORACLE_HOME/install
cat unix.rgs
Verify Oracle installation
select host_name, instance_name, version, status from v$instance;
TNS-12542: TNS:address already in use
Check if the TNS port is not already in use by another Oracle instance.
- Check if the host name specified in listener.ora is correct.
- Do a netstat - a to check if any other application is using the port specified in listener.ora
- If the listener.ora has been copied from somewhere (samples or elsewhere), check the ORACLE_HOME
Set the Listener Process for Automatic Startup
Edit /var/opt/oracle/lsnrtab, and change/add a line containing the name of your listener (as specified in listener.ora and change the start-up value to "Y")
2005-05-10
Cisco SAA
The Cisco Service Assurance Agent (SAA) is a Cisco IOS feature that allows users to monitor network performance between a Cisco router and a remote device (which can be another Cisco router, an IP Host or an MVS host). Performance can be measured for real world scenarios through the configuration of SAA operations that are executed periodically. Metrics measured include round trip response time, connect time, packet loss, application performance, inter-packet delay variance ( jitter), and more.
The SAA Support for Frame Relay, VoIP, and MPLS VPNs feature enhances the functionality of the Cisco SAA network monitoring solution as follows:
- SAA Frame Relay - operations allow the user to monitor key performance metrics (round trip latency, packet loss, and data integrity) over Frame Relay permanent virtual circuits (PVCs).
- With VPN Awareness, SAA allows monitoring within Multiprotocol Label Switching (MPLS) Virtual Private Networks (VPNs), enabling service providers to plan, provision, and manage IP VPN services according to the service level agreement (SLA) for a customer.
Benefits
- Frame Relay Monitoring - The SAA Frame Relay operation allows users to measure parameters such as response time (round trip latency), frame loss, and data integrity over frame relay circuits (PVCs). By measuring these parameters, providers can verify if the protocol is working correctly to meet customer needs.
- Path Jitter Monitoring for VoIP Networks - The SAA Path Jitter operation allows the monitoring of interpacket-delay-variance a hop by hop basis. The Path Jitter operation provides measurements not only for jitter, but for other parameters such as response time, packet loss. The ability to monitor jitter is a key performance metric for VoIP networks. By using this operation, providers can monitor the performance of different paths in the VoIP network to insure Voice transmission quality for customers.
- MPLS VPN Monitoring (VPN Awareness) - This enhancement to the SAA allows users to launch SAA operations on an MPLS VPN PE router. Being able to launch SAA operations allows providers to plan, provision, and manage IP VPN services according to the SLA for their customers. VPN Awareness means that montoring can be performed for a specific VPN by specifying a VPN routing/forwarding (VRF) name.
References
- Cisco SAA Support for Frame Relay, VoIP, and MPLS VPN Monitoring
- Network Performance Management with Cisco SAA
- Cisco Systems Service Assurance Agent (SAA) (pdf)
Categories: Cisco, SAA, MPLS, monitoring






