BLOG / HTML / special characters





For display of special characters, refer to

If you have to, say, change a lot of < into <, type the code as it
is in Notepad, then use (in the menu bar) EDIT > REPLACE to replace
all the <

Peter (Blog*Star 2006 and 2007)


MAKE - automatic variables

10.5.3 Automatic Variables

Suppose you are writing a pattern rule to compile a `.c' file into a `.o' file: how do you write the `cc' command so that it operates on the right source file name? You cannot write the name in the command, because the name is different each time the implicit rule is applied.

What you do is use a special feature of make, the automatic variables. These variables have values computed afresh for each rule that is executed, based on the target and prerequisites of the rule. In this example, you would use `$@' for the object file name and `$<' for the source file name.

It's very important that you recognize the limited scope in which automatic variable values are available: they only have values within the command script. In particular, you cannot use them anywhere within the target list of a rule; they have no value there and will expand to the empty string. Also, they cannot be accessed directly within the prerequisite list of a rule. A common mistake is attempting to use $@ within the prerequisites list; this will not work. However, there is a special feature of GNU make, secondary expansion (see Secondary Expansion), which will allow automatic variable values to be used in prerequisite lists.

Here is a table of automatic variables:


The file name of the target of the rule. If the target is an archive member, then `$@' is the name of the archive file. In a pattern rule that has multiple targets (see Introduction to Pattern Rules), `$@' is the name of whichever target caused the rule's commands to be run.


The target member name, when the target is an archive member. See Archives. For example, if the target is foo.a(bar.o) then `$%' is bar.o and `$@' is foo.a. `$%' is empty when the target is not an archive member.


The name of the first prerequisite. If the target got its commands from an implicit rule, this will be the first prerequisite added by the implicit rule (see Implicit Rules).


The names of all the prerequisites that are newer than the target, with spaces between them. For prerequisites which are archive members, only the member named is used (see Archives).


The names of all the prerequisites, with spaces between them. For prerequisites which are archive members, only the member named is used (see Archives). A target has only one prerequisite on each other file it depends on, no matter how many times each file is listed as a prerequisite. So if you list a prerequisite more than once for a target, the value of $^ contains just one copy of the name. This list does not contain any of the order-only prerequisites; for those see the `$|' variable, below.


This is like `$^', but prerequisites listed more than once are duplicated in the order they were listed in the makefile. This is primarily useful for use in linking commands where it is meaningful to repeat library file names in a particular order.


The names of all the order-only prerequisites, with spaces between them.


The stem with which an implicit rule matches (see How Patterns Match). If the target is dir/a.foo.b and the target pattern is a.%.b then the stem is dir/foo. The stem is useful for constructing names of related files. In a static pattern rule, the stem is part of the file name that matched the `%' in the target pattern.

In an explicit rule, there is no stem; so `$*' cannot be determined in that way. Instead, if the target name ends with a recognized suffix (see Old-Fashioned Suffix Rules), `$*' is set to the target name minus the suffix. For example, if the target name is `foo.c', then `$*' is set to `foo', since `.c' is a suffix. GNU make does this bizarre thing only for compatibility with other implementations of make. You should generally avoid using `$*' except in implicit rules or static pattern rules.

If the target name in an explicit rule does not end with a recognized suffix, `$*' is set to the empty string for that rule.

`$?' is useful even in explicit rules when you wish to operate on only the prerequisites that have changed. For example, suppose that an archive named lib is supposed to contain copies of several object files. This rule copies just the changed object files into the archive:

lib: foo.o bar.o lose.o win.o
ar r lib $?

Of the variables listed above, four have values that are single file names, and three have values that are lists of file names. These seven have variants that get just the file's directory name or just the file name within the directory. The variant variables' names are formed by appending `D' or `F', respectively. These variants are semi-obsolete in GNU make since the functions dir and notdir can be used to get a similar effect (see Functions for File Names). Note, however, that the `D' variants all omit the trailing slash which always appears in the output of the dir function. Here is a table of the variants:


The directory part of the file name of the target, with the trailing slash removed. If the value of `$@' is dir/foo.o then `$(@D)' is dir. This value is . if `$@' does not contain a slash.


The file-within-directory part of the file name of the target. If the value of `$@' is dir/foo.o then `$(@F)' is foo.o. `$(@F)' is equivalent to `$(notdir $@)'.



The directory part and the file-within-directory part of the stem; dir and foo in this example.



The directory part and the file-within-directory part of the target archive member name. This makes sense only for archive member targets of the form archive(member) and is useful only when member may contain a directory name. (See Archive Members as Targets.)



The directory part and the file-within-directory part of the first prerequisite.



Lists of the directory parts and the file-within-directory parts of all prerequisites.



Lists of the directory parts and the file-within-directory parts of all prerequisites, including multiple instances of duplicated prerequisites.



Lists of the directory parts and the file-within-directory parts of all prerequisites that are newer than the target.

Note that we use a special stylistic convention when we talk about these automatic variables; we write “the value of `$<'”, rather than “the variable <” as we would write for ordinary variables such as objects and CFLAGS. We think this convention looks more natural in this special case. Please do not assume it has a deep significance; `$<' refers to the variable named < just as `$(CFLAGS)' refers to the variable named CFLAGS. You could just as well use `$(<)' in place of `$<'.


RCS ident fields

man ident

    "$Author: $"
    The login name of the user who checked in the revi­sion.

    "$Date: $"
    The date and time the revision was checked in.

    "$Header: $"
    A standard header containing the full pathname of the
    RCS file, the revision number, the date and time, the author,
    the state, and the locker (if locked).

    "$Id: $"
    Same as $Header$, except that the RCS filename is without
    a path.

    "$Locker: $"
    The login name of the user who locked the revision
    (empty if not locked).

    "$Log: $"
    The log message supplied during checkin. For
    ident's purposes, this is equivalent to $RCSfile$.

    "$Name: $"
    The symbolic name used to check out the revision, if any.

    "$RCSfile: $"
    The name of the RCS file without a path.

    "$Revision: $"
    The revision number assigned to the revision.

    "$Source: $"
    The full pathname of the RCS file.

    "$State: $"
    The state assigned to the revision with the -s
    option of rcs(1) or ci(1).


VBA getConfig: retreive key:value from a config sheet

    Function getConfig(key As String) As String
    Dim i As Integer
    Dim xKey As String, strFila As String
    Dim sh

    Set sh = Sheets("config")

    For i = 1 To 500
    strFila = Trim(Str$(i))
    xKey = sh.Range("A" + strFila).Value

    If (key = xKey) Then
    getConfig = sh.Range("B" & strFila).Value
    Exit Function
    End If

    If (xKey = "[end]") Then Exit For

    Next i

    MsgBox "ERROR key not found in config page: [" & key & "]", _
    vbOKOnly + vbCritical, "ERROR"

    End Function

Outlook security error: A program is trying to send mail using Item.Send

Outlook Email Security Update :

Also see Reinforcing Dialog-Based Security, a paper by two U.S. Air Force Academy professors that demonstrates how to get around the object model guard prompts using VBScript code and the SendKeys method to, in effect, click the buttons on the prompts.

Reinforcing Dialog-Based Security
Reinforcing Dialog-Based Security
Martin C. Carlisle, Scott D. Studer
Proceedings of the 2001 IEEE
Workshop on Information Assurance and Security
United States Military Academy, West Point, NY, 5-6 June, 2001
Reinforcing Dialog-Based Security

    Sub bypass()
    Dim fName As String, fDesc As Integer

    fName = getConfig("bypassFile")
    fDesc = FreeFile

    Open fName For Output As fDesc
    Print #fDesc, "Set fso = CreateObject(""WScript.Shell"")"
    Print #fDesc, "While fso.AppActivate(""Microsoft Outlook"") = FALSE"
    Print #fDesc, "wscript.sleep 1000"
    Print #fDesc, "Wend"
    Print #fDesc, "wscript.sleep 7000"
    Print #fDesc, "fso.SendKeys ""{LEFT}"", True"
    Print #fDesc, "fso.SendKeys ""{ENTER}"", True"
    Close #fDesc

    Shell ("WScript.exe " & fName)

    End Sub

    Sub sendMail(strSubject As String, strBody As String)

    Dim OutApp As Object
    Dim OutMail As Object

    Dim strTo As String

    strTo = getConfig("mailTo")

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    Call bypass

    On Error Resume Next
    With OutMail
    .to = strTo
    .CC = ""
    .BCC = ""
    .Subject = strSubject
    .body = strBody
    .Send 'or use .Display
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

    End Sub

Wait Method

Wait Method (VBA help)

Pauses a running macro until a specified time. Returns True if the specified time has arrived.

Important The Wait method suspends all Microsoft Excel activity and may prevent you from performing other operations on your computer while Wait is in effect. However, background processes such as printing and recalculation continue.


expression Required. An expression that returns an Application object.

Time Required Variant. The time at which you want the macro to resume, in Microsoft Excel date format.

This example pauses a running macro until 6:23 P.M. today.

    Application.Wait "18:23:00"

This example pauses a running macro for approximately 10 seconds.

    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 10
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime

This example displays a message indicating whether 10 seconds have passed.

    If Application.Wait(Now + TimeValue("0:00:10")) Then
    MsgBox "Time expired"
    End If

How to use SendKeys to imitate the keyboard


How to use SendKeys to imitate the keyboard

Posted: 15 Apr 04

If you perform the process using the keyboard you will note that things do not happen instantly on screen - especially the initial opening of a dialog box where the action takes place. The main problem with SendKeys is that the code usually runs faster than Windows can carry out the required activity - this is especially so if manipulating an external (not the one with the code) application or opening a dialog box or menu. We therefore need to slow the action down by using Wait statements. SendKeys also has its own "Wait" argument True or False which needs to be used correctly. One example of using it set to True is when manipulating external applications that require extra time to carry out actions. This is not always sufficient, so extra code is required.

A big key to success in this area is to break down the process into small steps. It does need a bit of trial and error to get it right. Experience shows that operators are prepared to wait a bit longer if it works. Sometimes the speed of external applications varies so much that the job is impossible using SendKeys, when using API calls with KeyUp and KeyDown work better. This area is never an exact science. See VBA Help 'SendKeys' and 'Shell' for more information.

This is some sample code to demonstrate the principle :-

    Sub SET_A3()
    '- change Printer setting to A3 size
    '- nb. assumes current setting is A4
    Dim AltKey As String
    Dim CtrlKey As String
    Dim ShiftKey As String
    Dim TabKey As String
    Dim EnterKey As String
    AltKey = "%"
    CtrlKey = "^"
    ShiftKey = "+"
    TabKey = "{TAB}"
    EnterKey = "~"
    '- open print dialog
    SendKeys AltKey & "(FP)", False
    '- delay 1 second
    Application.Wait Now + TimeValue("00:00:01")
    '- open printer properties
    SendKeys AltKey & "(R)", False
    '- tab to paper size
    SendKeys TabKey, False
    SendKeys TabKey, False
    '- change A4 to A3
    SendKeys "{UP}", False
    '- Enter twice
    SendKeys EnterKey, False
    SendKeys EnterKey, False
    End Sub

SendKeys Statement, (VBA help)

Sends one or more keystrokes to the active window as if typed at the keyboard.


SendKeys string[, wait]

The SendKeys statement syntax has these named arguments:

Part Description
string Required. String expression specifying the keystrokes to send.
Wait Optional. Boolean value specifying the wait mode. If False (default), control is returned to the procedure immediately after the keys are sent. If True, keystrokes must be processed before control is returned to the procedure.


Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter A, use "A" for string. To represent more than one character, append each additional character to the one preceding it. To represent the letters A, B, and C, use "ABC" for string.

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use {+}. Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces. In other applications, brackets do have a special meaning that may be significant when dynamic data exchange (DDE) occurs. To specify brace characters, use {{} and {}}.

To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent actions rather than characters, use the codes shown below:

    Key Code
    END {END}
    ENTER {ENTER}or ~
    ESC {ESC}
    TAB {TAB}
    F1 {F1}
    F2 {F2}
    F3 {F3}
    F4 {F4}
    F5 {F5}
    F6 {F6}
    F7 {F7}
    F8 {F8}
    F9 {F9}
    F10 {F10}
    F11 {F11}
    F12 {F12}
    F13 {F13}
    F14 {F14}
    F15 {F15}
    F16 {F16}

To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes:

    Key Code
    SHIFT +
    CTRL ^
    ALT %

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".

To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.

Note You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows or Macintosh. Sendkeys also can't send the PRINT SCREEN key {PRTSC} to any application.

SendKeys Statement Example

This example uses the Shell function to run the Calculator application included with Microsoft Windows. It uses the SendKeys statement to send keystrokes to add some numbers, and then quit the Calculator. (To see the example, paste it into a procedure, then run the procedure. Because AppActivate changes the focus to the Calculator application, you can't single step through the code.). On the Macintosh, use a Macintosh application that accepts keyboard input instead of the Windows Calculator.

    Dim ReturnValue, I
    ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
    AppActivate ReturnValue ' Activate the Calculator.
    For I = 1 To 100 ' Set up counting loop.
    SendKeys I & "{+}", True ' Send keystrokes to Calculator
    Next I ' to add each value of I.
    SendKeys "=", True ' Get grand total.
    SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.


ISO 3166 Codes & Top level domains

International Country Codes


The following information was downloaded on 15 June
1995 from "http://www.ics.uci.edu/WebSoft/wwwstat/country-codes.txt">http://www.ics.uci.edu/WebSoft/wwwstat/country-codes.txt.
Additional useful information may be found in the "Table of Global and
Country Top Level Internet Domains, which is dated 16 April 1995 (as of 15
June 1995), and is stored at "http://www.isoc.org/domains.html">http://www.isoc.org/domains.html


    AD Andorra
    AE United Arab Emirates
    AF Afghanistan
    AG Antigua and Barbuda
    AI Anguilla
    AL Albania
    AM Armenia
    AN Netherlands Antilles
    AO Angola
    AQ Antarctica
    AR Argentina
    AS American Samoa
    AT Austria
    AU Australia
    AW Aruba
    AZ Azerbaijan
    BA Bosnia and Herzegovina
    BB Barbados
    BD Bangladesh
    BE Belgium
    BF Burkina Faso
    BG Bulgaria
    BH Bahrain
    BI Burundi
    BJ Benin
    BM Bermuda
    BN Brunei Darussalam
    BO Bolivia
    BR Brazil
    BS Bahamas
    BT Bhutan
    BV Bouvet Island
    BW Botswana
    BY Belarus
    BZ Belize
    CA Canada
    CC Cocos (Keeling) Islands
    CF Central African Republic
    CG Congo
    CH Switzerland
    CI Cote D'Ivoire (Ivory Coast)
    CK Cook Islands
    CL Chile
    CM Cameroon
    CN China
    CO Colombia
    CR Costa Rica
    CS Czechoslovakia (former)
    CU Cuba
    CV Cape Verde
    CX Christmas Island
    CY Cyprus
    CZ Czech Republic
    DE Germany
    DJ Djibouti
    DK Denmark
    DM Dominica
    DO Dominican Republic
    DZ Algeria
    EC Ecuador
    EE Estonia
    EG Egypt
    EH Western Sahara
    ER Eritrea
    ES Spain
    ET Ethiopia
    FI Finland
    FJ Fiji
    FK Falkland Islands (Malvinas)
    FM Micronesia
    FO Faroe Islands
    FR France
    FX France, Metropolitan
    GA Gabon
    GB Great Britain (UK)
    GD Grenada
    GE Georgia
    GF French Guiana
    GH Ghana
    GI Gibraltar
    GL Greenland
    GM Gambia
    GN Guinea
    GP Guadeloupe
    GQ Equatorial Guinea
    GR Greece
    GS S. Georgia and S. Sandwich Isls.
    GT Guatemala
    GU Guam
    GW Guinea-Bissau
    GY Guyana
    HK Hong Kong
    HM Heard and McDonald Islands
    HN Honduras
    HR Croatia (Hrvatska)
    HT Haiti
    HU Hungary
    ID Indonesia
    IE Ireland
    IL Israel
    IN India
    IO British Indian Ocean Territory
    IQ Iraq
    IR Iran
    IS Iceland
    IT Italy
    JM Jamaica
    JO Jordan
    JP Japan
    KE Kenya
    KG Kyrgyzstan
    KH Cambodia
    KI Kiribati
    KM Comoros
    KN Saint Kitts and Nevis
    KP Korea (North)
    KR Korea (South)
    KW Kuwait
    KY Cayman Islands
    KZ Kazakhstan
    LA Laos
    LB Lebanon
    LC Saint Lucia
    LI Liechtenstein
    LK Sri Lanka
    LR Liberia
    LS Lesotho
    LT Lithuania
    LU Luxembourg
    LV Latvia
    LY Libya
    MA Morocco
    MC Monaco
    MD Moldova
    MG Madagascar
    MH Marshall Islands
    MK Macedonia
    ML Mali
    MM Myanmar
    MN Mongolia
    MO Macau
    MP Northern Mariana Islands
    MQ Martinique
    MR Mauritania
    MS Montserrat
    MT Malta
    MU Mauritius
    MV Maldives
    MW Malawi
    MX Mexico
    MY Malaysia
    MZ Mozambique
    NA Namibia
    NC New Caledonia
    NE Niger
    NF Norfolk Island
    NG Nigeria
    NI Nicaragua
    NL Netherlands
    NO Norway
    NP Nepal
    NR Nauru
    NT Neutral Zone
    NU Niue
    NZ New Zealand (Aotearoa)
    OM Oman
    PA Panama
    PE Peru
    PF French Polynesia
    PG Papua New Guinea
    PH Philippines
    PK Pakistan
    PL Poland
    PM St. Pierre and Miquelon
    PN Pitcairn
    PR Puerto Rico
    PT Portugal
    PW Palau
    PY Paraguay
    QA Qatar
    RE Reunion
    RO Romania
    RU Russian Federation
    RW Rwanda
    SA Saudi Arabia
    Sb Solomon Islands
    SC Seychelles
    SD Sudan
    SE Sweden
    SG Singapore
    SH St. Helena
    SI Slovenia
    SJ Svalbard and Jan Mayen Islands
    SK Slovak Republic
    SL Sierra Leone
    SM San Marino
    SN Senegal
    SO Somalia
    SR Suriname
    ST Sao Tome and Principe
    SU USSR (former)
    SV El Salvador
    SY Syria
    SZ Swaziland
    TC Turks and Caicos Islands
    TD Chad
    TF French Southern Territories
    TG Togo
    TH Thailand
    TJ Tajikistan
    TK Tokelau
    TM Turkmenistan
    TN Tunisia
    TO Tonga
    TP East Timor
    TR Turkey
    TT Trinidad and Tobago
    TV Tuvalu
    TW Taiwan
    TZ Tanzania
    UA Ukraine
    UG Uganda
    UK United Kingdom
    UM US Minor Outlying Islands
    US United States
    UY Uruguay
    UZ Uzbekistan
    VA Vatican City State (Holy See)
    VC Saint Vincent and the Grenadines
    VE Venezuela
    VG Virgin Islands (British)
    VI Virgin Islands (U.S.)
    VN Viet Nam
    VU Vanuatu
    WF Wallis and Futuna Islands
    WS Samoa
    YE Yemen
    YT Mayotte
    YU Yugoslavia
    ZA South Africa
    ZM Zambia
    ZR Zaire
    ZW Zimbabwe

    COM US Commercial
    EDU US Educational
    GOV US Government
    INT International
    MIL US Military
    NET Network
    ORG Non-Profit Organization
    ARPA Old style Arpanet
    NATO Nato field


    ISO 3166 Codes & Top level domains

    Code Country Conn Notes main nameserver

    AD Andorra
    AE United Arab Emirates * ns.uu.net
    AF Afghanistan
    AG Antigua and Barbuda * upr1.upr.clu.edu
    AI Anguilla
    AL Albania P gwd2i.cnuce.cnr.it
    AM Armenia Ex-USSR
    AN Netherland Antilles
    AO Angola
    AQ Antarctica FI * luxor.cc.waikato.ac.nz
    AR Argentina FI B * ns.uu.net
    AS American Samoa
    AT Austria FI B * pythia.edvz.univie.ac.at
    AU Australia FI * munnari.oz.au
    AW Aruba
    AZ Azerbaidjan Ex-USSR
    BA Bosnia-Herzegovina Ex-Yugoslavia
    BB Barbados * upr1.upr.clu.edu
    BD Bangladesh
    BE Belgium FI B * ub4b.buug.be
    BF Burkina Faso * orstom.orstom.fr
    BG Bulgaria FI B * pythia.ics.forth.gr
    BH Bahrain B * Gulfnet
    BI Burundi
    BJ Benin
    BM Bermuda * ns.uu.net
    BN Brunei Darussalam
    BO Bolivia * ns.uu.net
    BR Brazil FI B * fpsp.fapesp.br
    BS Bahamas * upr1.upr.clu.edu
    BT Buthan
    BV Bouvet Island
    BW Botswana * hippo.ru.ac.za
    BY Belarus * Ex-USSR
    BZ Belize P upr1.upr.clu.edu
    CA Canada FI B * relay.cdnnet.ca
    CC Cocos (Keeling) Isl.
    CF Central African Rep.
    CG Congo
    CH Switzerland FI B * scsnms.switch.ch
    CI Ivory Coast
    CK Cook Islands
    CL Chile FI B * dcc.uchile.cl
    CM Cameroon FI * in .fr domain inria.inria.fr
    CN China PFI * iraun1.ira.uka.de
    CO Colombia B * cunixd.cc.columbia.edu
    CR Costa Rica FI B * ns.cr
    CS Czechoslovakia FI B * still works... ns.cesnet.cz
    CU Cuba * igc.org
    CV Cape Verde
    CX Christmas Island
    CY Cyprus B * pythia.ics.forth.gr
    CZ Czech Republic FI * ns.cesnet.cz
    DE Germany FI B * deins.informatik.uni-dortmund.de
    DJ Djibouti
    DK Denmark FI B * ns.dknet.dk
    DM Dominica P upr1.upr.clu.edu
    DO Dominican Republic P upr1.upr.clu.edu
    DZ Algeria *
    EC Ecuador FI B * ecua.net.ec
    EE Estonia FI * Ex-USSR uvax2.kbfi.ee
    EG Egypt PFI B * frcu.eun.eg
    EH Western Sahara
    ES Spain FI B * sun.rediris.es
    ET Ethiopia
    FI Finland FI B * funet.fi
    FJ Fiji * truth.waikato.ac.nz
    FK Falkland Isl.(Malvinas)
    FM Micronesia
    FO Faroe Islands P danpost.uni-c.dk
    FR France FI B * inria.inria.fr
    FX France (European Ter.) ???
    GA Gabon
    GB Great Britain (UK) FI * X.400 & IP ns1.cs.ucl.ac.uk
    GD Grenada P upr1.upr.clu.edu
    GE Georgia * Ex-USSR ns.eu.net
    GH Ghana
    GI Gibraltar
    GL Greenland
    GP Guadeloupe (Fr.)
    GQ Equatorial Guinea
    GF Guyana (Fr.)
    GM Gambia
    GN Guinea
    GR Greece FI B * pythia.ics.forth.gr
    GT Guatemala * ns.uu.net
    GU Guam (US)
    GW Guinea Bissau
    GY Guyana
    HK Hong Kong FI B * hp9000.csc.cuhk.hk
    HM Heard & McDonald Isl.
    HN Honduras * ns.uu.net
    HR Croatia FI * Ex-Yugo dns.srce.hr
    HT Haiti
    HU Hungary FI B * sztaki.hu
    ID Indonesia * ns.uu.net
    IE Ireland FI B * nova.ucd.ie
    IL Israel FI B * relay.huji.ac.il
    IN India FI B * sangam.ncst.ernet.in
    IO British Indian O. Terr.
    IQ Iraq
    IR Iran B *
    IS Iceland FI B * isgate.is
    IT Italy FI B * dns.nis.garr.it
    JM Jamaica * upr1.upr.clu.edu
    JO Jordan
    JP Japan FI B * jp-gate.wide.ad.jp
    KE Kenya * rain.psg.com
    KG Kirgistan Ex-USSR
    KH Cambodia
    KI Kiribati
    KM Comoros
    KN St.Kitts Nevis Anguilla P upr1.upr.clu.edu
    KP Korea (North) P
    KR Korea (South) FI B * ns.kaist.ac.kr
    KW Kuwait FI * No BITNET dns.kuniv.edu.kw
    KY Cayman Islands
    KZ Kazachstan * Ex-USSR in .su domain
    LA Laos
    LB Lebanon P
    LC Saint Lucia P upr1.upr.clu.edu
    LI Liechtenstein PFI * scsnms.switch.ch
    LK Sri Lanka * ns.eu.net
    LR Liberia
    LS Lesotho * hippo.ru.ac.za
    LT Lithuania PFI * Ex-USSR aun.uninett.no
    LU Luxembourg FI B * menvax.restena.lu
    LV Latvia FI * Ex-USSR lapsene.mii.lu.lv
    LY Libya
    MA Morocco P
    MC Monaco
    MD Moldavia Ex-USSR
    MG Madagascar
    MH Marshall Islands
    ML Mali
    MM Myanmar
    MN Mongolia
    MO Macau * hkuxb.hku.hk
    MP Northern Mariana Isl.
    MQ Martinique (Fr.)
    MR Mauritania
    MS Montserrat
    MT Malta P ns.iunet.it
    MU Mauritius
    MV Maldives
    MW Malawi
    MX Mexico FI B * mtecv1.mty.itesm.mx
    MY Malaysia FI B * mimos.my
    MZ Mozambique * hippo.ru.ac.za
    NA Namibia * rain.psg.com
    NC New Caledonia (Fr.)
    NE Niger * in .fr domain inria.inria.fr
    NF Norfolk Island
    NG Nigeria
    NI Nicaragua * ns.uu.net
    NL Netherlands FI B * sering.cwi.nl
    NO Norway FI B * nac.no
    NP Nepal
    NR Nauru
    NT Neutral Zone
    NU Niue
    NZ New Zealand FI * truth.waikato.ac.nz
    OM Oman
    PA Panama B *
    PE Peru B * rain.psg.com
    PF Polynesia (Fr.)
    PG Papua New Guinea * munnari.oz.au
    PH Philippines * ns.uu.net
    PK Pakistan * ns.uu.net
    PL Poland FI B * danpost.uni-c.dk
    PM St. Pierre & Miquelon
    PN Pitcairn
    PT Portugal FI B * ns.dns.pt
    PR Puerto Rico (US) FI B * sun386-gauss.pr
    PW Palau
    PY Paraguay * ns.uu.net
    QA Qatar
    RE Reunion (Fr.) FI * In .fr domain inria.inria.fr
    RO Romania FI B * roearn.ici.ac.ro
    RU Russian Federation P Ex-USSR
    RW Rwanda
    SA Saudi Arabia B * GulfNet
    SB Solomon Islands
    SC Seychelles
    SD Sudan
    SE Sweden FI B * sunic.sunet.se
    SG Singapore FI B * solomon.technet.sg
    SH St. Helena
    SI Slovenia FI * Ex-Yugos via .yu klepec.yunac.yu
    SJ Svalbard & Jan Mayen Is
    SK Slovak Republic FI * ns.eunet.sk
    SL Sierra Leone
    SM San Marino
    SN Senegal * rain.psg.com
    SO Somalia
    SR Suriname P upr1.upr.clu.edu
    ST St. Tome and Principe
    SU Soviet Union FI B * Still used. ns.eu.net
    SV El Salvador
    SY Syria
    SZ Swaziland
    TC Turks & Caicos Islands
    TD Chad
    TF French Southern Terr.
    TG Togo
    TH Thailand FI * chulkn.chula.ac.th
    TJ Tadjikistan Ex-USSR
    TK Tokelau
    TM Turkmenistan * Ex-USSR in .su domain
    TN Tunisia FI B * alyssa.rsinet.tn
    TO Tonga
    TP East Timor
    TR Turkey FI B * knidos.cc.metu.edu.tr
    TT Trinidad & Tobago P upr1.upr.clu.edu
    TV Tuvalu
    TW Taiwan FI B * moevax.edu.tw
    TZ Tanzania
    UA Ukraine FI * Ex-USSR via .su ns.eu.net
    UG Uganda
    UK United Kingdom FI B * ISO 3166 is GB ns1.cs.ucl.ac.uk
    UM US Minor outlying Isl.
    US United States FI * see note (4) venera.isi.edu
    UY Uruguay B * ns.uu.net
    UZ Uzbekistan Ex-USSR
    VA Vatican City State
    VC St.Vincent & Grenadines P upr1.upr.clu.edu
    VE Venezuela FI * nisc.jvnc.net
    VG Virgin Islands (British)
    VI Virgin Islands (US) *
    VN Vietnam *
    VU Vanuatu
    WF Wallis & Futuna Islands
    WS Samoa
    YE Yemen
    YU Yugoslavia FI B * Bitnet is cut klepec.yunac.yu
    ZA South Africa FI * rain.psg.com
    ZM Zambia
    ZR Zaire
    ZW Zimbabwe * rain.psg.com

    See section Main nameservers for the next top
    level domains (*rs.internic.net*):

    ARPA Old style Arpanet * alias still works ns.nic.ddn.mil
    COM Commercial FI * ns.internic.net
    EDU Educational FI B * ns.internic.net
    GOV Government FI * ns.internic.net
    INT International field FI * used by Nato ns1.cs.ucl.ac.uk
    MIL US Military FI * ns.nic.ddn.mil
    NATO Nato field * soon to be deleted
    NET Network FI * ns.internic.net
    ORG Non-Profit OrganizationFI * ns.internic.net


python: comments

There are two styles of comments in python

    # single line comment

    " " " (this line MUST be valid indented in the block!)
    this is a multiline comment
    which spawns many lines
    The quick brown fox jumps over the lazy dog
    The quick brown fox jumps over the lazy dog
    The quick brown fox jumps over the lazy dog
    the next end line may be NOT indented!
    " " "

multiline comments are also used to embed what are called doc strings in a function, i.e.:

    class school:

    """ this class is useful for defining a type of school (1rst. level indented)
    with its strength,affiliation,address etc
    this class has following methods and properties
    def affiliation(board):
    def address(add):

in above piece of code the triple qouted string not only is a comment
but when i declare an object say

    t = school





will return those comments


the quick brown fox jumps over the lazy dog


    The quick brown fox jumps over the lazy dog 0123456789

    The quick brown fox jumped over the lazy dog's typewriter
    The quick brown fox jumped over the sleeping lazy dog
    The quick red fox jumps over the lazy brown dog

    El veloz murcielago hindu comia feliz cardillo y kiwi
    La ciguena tocaba el saxofon detras del palenque de paja


shell: expresiones aritmeticas

Hay dos posibilidades, utilizar el operador aritmetico $(()):

    echo $i

o bien el comando shell 'expr':

    i=`expr $i + 1`
    echo $i


noclobber / shell options / overwrite files

    set -o noclobber
    set -C (es equivalente al anterior)

overwrite: NOT ALLOWED

    % set -C
    % ll > 1
    bash: 1: cannot overwrite existing file
    % set | grep SHELLOPTS

overwrite: ALLOWED

    % set +C
    % ll > 1
    % set | grep SHELLOPTS

create or set a file to null length

is this form a valid form to create or to set a file to length = 0???


# ---
Joachim Schmitz
Provided the variable $FILE isn't empty: yes
Bye, Jojo

# ---
If $FILE might contain spaces or shell metacharacters it should be
enclosed in double quotes.

Mans Rullgard

Only with bash or with POSIX shells when they are interactive.
But it's always better to quote variables anyway.


# ---

Not with every shell (not with bash where you need to quote
$FILE, not with shells like zsh that have a default command when
you don't provide any).

: > "$FILE"

is more correct and more portable and more legible.

":" can be replaced with any command that doesn't output
anything like true, eval... but ":" is the best bet as it's in
every shell and it's builtin in everyshell.



regular expresions / eval / php

revisar, tomado de:


Archive for the ‘PHP’ Category
Using PHP to highlight links in html
Sunday, March 4th, 2007 by Rob Thomson

Seems to me that there are loads of code samples that show you how to ‘auto highlight’ email addresses and web addresses in a string. Useful, but what happens when the link is already surrounded by an A tag?

I put together this little function (a little dirty but effective) to ‘ignore’ links that are already surrounded by an A tag. This prevents any unexpected double linking of your code.

function findlinks($string){

$string = $string ;

# regular expresion to find matches
$href_regex =”<”; // 1 start of the tag
$href_regex .=”\s*”; // 2 zero or more whitespace
$href_regex .=”a”; // 3 the a of the tag itself
$href_regex .=”\s+”; // 4 one or more whitespace
$href_regex .=”[^>]*”; // 5 zero or more of any character that is _not_ the end of the tag
$href_regex .=”href”; // 6 the href bit of the tag
$href_regex .=”\s*”; // 7 zero or more whitespace
$href_regex .=”=”; // 8 the = of the tag
$href_regex .=”\s*”; // 9 zero or more whitespace
$href_regex .=”[\”‘]?”; // 10 none or one of ” or ‘
$href_regex .=”(”; // 11 opening parenthesis, start of the bit we want to capture
$href_regex .=”[^\”‘ >]+”; // 12 one or more of any character _except_ our closing characters
$href_regex .=”)”; // 13 closing parenthesis, end of the bit we want to capture
$href_regex .=”[\”‘ >]”; // 14 closing chartacters of the bit we want to capture

$regex = “/”; // regex start delimiter
$regex .= $href_regex; //
$regex .= “/”; // regex end delimiter
$regex .= “i”; // Pattern Modifier - makes regex case insensative
$regex .= “s”; // Pattern Modifier - makes a dot metacharater in the pattern
// match all characters, including newlines
$regex .= “U”; // Pattern Modifier - makes the regex ungready

# first find and subst out all text area content
preg_match_all($regex, $string, $regs);
# replace all textarea content with a custom tag
$count = “1″;
foreach($regs[”0″] as $tag){
$string = str_replace($tag,”{link-” . $count . “}”,$string);
$textarea[] = array(”field” => “{link-” . $count . “}”,”data” => $tag);

$string = preg_replace(”/([\w\.]+)(@)([\S\.]+)\b/i”,”$0“,$string);
$string = preg_replace(”/((http(s?):\/\/)|(www\.))([\S\.]+)\b/i”,”$2$4$5“, $string);

# reassemble to handle php code input into text areas
foreach($textarea as $x){
$string = str_replace($x[field],$x[data],$string);

return trim($string);

Anyone got anything better than this?

Posted in PHP | No Comments »
Using EVAL to parse an html file
Sunday, March 4th, 2007 by Rob Thomson

Every now and again I stumble upon a little bit of code that just ‘works’. Anyone who as ever coded in PHP and tried to ‘eval’ and html file is almost certain to have ended up a bit frustrated. It would seem that eval can only process pure PHP, and not a file that has any html tags etc in it.

Never mind! After trawling the net for a while I found this great code snippet that does the trick.

function eval_buffer($string) {
$return = ob_get_contents();
return $return;

function eval_print_buffer($string) {
eval(”print $string[2];”);
$return = ob_get_contents();
return $return;

function eval_html($string) {
$string = preg_replace_callback(”/(<\?=)(.*?)\?>/si”,
return preg_replace_callback(”/(<\?php|<\?)(.*?)\?>/si”,


Works perfectly!