1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502
|
<html>
<head>
<link href="../lg.css" rel="stylesheet" type="text/css" />
<title>
Linux Gazette : February 2004 (#99)
</title>
<style type="text/css">
<!--
.twdtarticle {
margin:0px;
left:0px;
}
#twdtbody {
margin-left:0px;
margin-right:0px;
}
.twdtarticle h1 {
font-size:19px;
text-align:center;
}
-->
</style>
</head>
<body id="twdtbody">
<img src="..//gx/2003/newlogo-blank-200-gold2.jpg" alt="Linux Gazette" id="twdtlogo"/>
<div class="content" id="lgissuecontents">
<h2>February 2004 (#99):</h2>
<ul>
<li><a href="lg_mail.html">The Mailbag</a>
<li><a href="lg_tips.html">More Two Cent Tips!</a>
<li><a href="lg_answer.html">The Answer Gang</a>
<li><a href="ingles.html">Lightweight, (Almost) Crypto-Free Remote System Operation</a>, by <i>Ray Ingles</i></li>
<li><a href="lovett.html">XMLTV</a>, by <i>Bill Lovett</i></li>
<li><a href="pramode.html">Let's Build a Cool Linux Toy</a>, by <i>Pramode C.E</i></li>
<li><a href="stellingwerff.html">OCaml, an Introduction</a>, by <i>Jurjen Stellingwerff</i></li>
</ul>
<p id="twdt">
<i>or read <a href="TWDT.html">TWDT</a></i>
</p>
</div>
<br />
<div class="content twdtarticle">
<h1>The Mailbag</h1>
</b>
</p>
<p>
<HR>
<center>
<BIG><STRONG><FONT COLOR="maroon">HELP WANTED : Article Ideas</FONT></STRONG></BIG>
<BR>
<STRONG>Submit comments about articles, or articles themselves (after reading <a href="../faq/author.html">our guidelines</a>) to <A HREF="mailto:gazette@linuxgazette.net">The Editors of <i>Linux Gazette</I></A>, and technical answers and tips about Linux to <A HREF="mailto:tag@linuxgazette.net">The Answer Gang</A>.
</STRONG>
</center><HR>
<UL>
<!-- index_text begins -->
<li><A HREF="#wanted.1"
><strong>Bash Scripting</strong></a>
<li><A HREF="#wanted.2"
><strong>Article suggestion - Clustering (formatting correction)</strong></a>
<li><A HREF="#wanted.3"
><strong>RV: Sendmail Help</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted.1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Bash Scripting</FONT></H3>
Sat, 07 Jun 2003 20:01:53 +0530
<BR>Robin Chhetri (<a href="mailto:tag@linuxgazette.net?cc=robinchhetri@fastmail.fm&subject=%20Re%3A%20%5BLG%2099%5D%20help%20wanted%20%231">robinchhetri from fastmail.fm</a>)
<P><STRONG>
Hi Gang,
I asked another question around one month ago and even though I could not
come up with a answer I decided to come up here again.(Incidentally I
tried it also in linuxquestions.org).
What would be the equivalent to the zsh script given below in bash
</STRONG></P>
<pre><strong>$echo ${${(z) $(whereis libcrypto)}[2]}
</strong></pre>
<P><STRONG>
if the output of $(whereis libcrypto) is
</STRONG></P>
<pre><strong>libcrypto: libcrypto.so libcryto.a
it returns libcrypto.so only.
</strong></pre>
<P><STRONG>
Now I could come up with
</STRONG></P>
<pre><strong>$robin=($(whereis libcrypto)); echo ${robin[1]}
</strong></pre>
<P><STRONG>
But can it be done in one go using some construct?
I am not a shell guru so I wonder if it can be done!
</STRONG></P>
<P><STRONG>
Robin
</STRONG></P>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted.2"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Article suggestion - Clustering (formatting correction)</FONT></H3>
Wed, 31 Dec 2003 04:05:55 -0800
<BR>Dave Bechtel (<a
href="mailto:articles@linuxgazette.net?cc=kingneutron@yahoo.com&subject=%20Re%3A%20%5BLG%2099%5D%20help%20wanted%20%232">kingneutron
from yahoo.com</a>)
<br>Answered By Heather Stern, Ashwin
<P><STRONG>
Dear God, yahoo really b0rked that one. All because I wanted to
underline .net... Sorry 'bout that.
</STRONG></P>
<HR width="10%" align="center"><P><STRONG>
--I've been vaguely interested in clustering for a while, but really
don't know what I could do with it. I have 3 machines:
</STRONG></P>
<ul>
<li><strong>P166 Dell laptop (Intel) 128MB</strong>
<li><strong>P233 Squid / DSL server (Intel) 256 MB</strong>
<li><strong>900 MHz Duron desktop (AMD) 512 MB</strong>
</ul>
<P><STRONG>
--I can't recompile a kernel intended for the slow Intel machines on
the fast AMD, it just doesn't work. However, I could go out and buy
some cheap machines at a computer show for ~$30-$40 apiece, or get
some loaners from a friend.
</STRONG></P>
<P><STRONG>
--My question is, what are clusters good for besides graphics /
animation <TT>/</TT> video editing <TT>/</TT> number crunching (none of which I'm
interested in)? Can I gzip/ bzip2 compress a 4-8GB tar file on a
distributed cluster and save time? Can I recompile a 2.4 kernel that
way so it doesn't take an hour and a half? (Yes, even using "make -s
-j 3".)
</STRONG></P>
<P><STRONG>
--I've heard of OpenMosix, but haven't looked into it very far. Just
a note, my network is 100MBit Ethernet. Any info the LG.net folks
could provide would be welcome, TIA.
</STRONG></P>
<P><STRONG>
=====
Contents above ThisLine (C)ThisYear KingNeutron Ltd.
</STRONG></P>
<BLOCKQUOTE>
[Heather]
We'll need permission to publish your message and responses related to
the thread for the world wide webzine Linux Gazette, it you want a
decent chance at an answer.
</BLOCKQUOTE>
<BLOCKQUOTE>
This is clear enough to post as a Wanted if none of the Answer Gang want
to take a pop at it, but we're past deadline for the current issue; it'd
end up in February.
</BLOCKQUOTE>
<BLOCKQUOTE><em>And of course, he did grant that, and here you have it.
But it's worth noting to folks who copyright their usenet posts,
we need your intent to be public or we can't publish it :) And
if we can't publish it, we often won't answer it either.
</em></BLOCKQUOTE>
<P><STRONG>
===== Check out KNOPPIX <A HREF="http://www.debian.org/">Debian</A>/Linux 700MB Live CD:
===== <A HREF="http://www.knopper.net/knoppix/index-old-en.html"
>http://www.knopper.net/knoppix/index-old-en.html</A>
"C00K13 M0N573R 0WNZ J00!! PH34R C00K13 M0N573R 4ND 0SC4R 4ND
3LM0 4ND 5NUFFL3UP46U5 4ND 7H3 31337 535AM3 57R337 CR3W!!"
.dotgoeshere.
</STRONG></P>
<BLOCKQUOTE>
[Heather]
To the tiniest portion of an answer: there's a mosix aware variant of
Knoppix. Check out LWN's Distributions page. (lwn.net/Distributions)
If you get things going, I agree wholeheartedly -- this could make a
really fun article by you about getting your cluster going. Are you
suggesting that you could write this, or that you would like to see
the topic come up?
</BLOCKQUOTE>
<BLOCKQUOTE>
As such I've changed the gazette@ (main editor) cc to articles@ (article
ideas and submissions)
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ashwin]
Have you tried Cluster Knoppix?
</BLOCKQUOTE>
<BLOCKQUOTE>
<A HREF="http://bofh.be/clusterknoppix"
>http://bofh.be/clusterknoppix</A>
</BLOCKQUOTE>
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="wanted.3"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">RV: Sendmail Help</FONT></H3>
Sun, 25 Jan 2004 17:52:44 -0500
<BR>Juan Carlos Diez (<a href="mailto:tag@linuxgazette.net?cc=jdiez@eluniversal.com&subject=%20Re%3A%20%5BLG%2099%5D%20help%20wanted%20%233">jdiez from eluniversal.com</a>)
<br>Answered By Thomas Adam, Mike Orr (Sluggo)
<P><STRONG>
Dear Ben, hello.
</STRONG></P>
<P><STRONG>
My name is Juan Carlos Diez, a novice Unix Sysadmin with no experience at all
with sendmail, who needs desperately your kindly help
<IMG SRC="../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">
</STRONG></P>
<P><STRONG>
I read your sendmail notes on <A HREF="../issue58/okopnik2.html"
>http://www.linuxgazette.com/issue58/okopnik2.html</A>
and I thought maybe you could help me.
</STRONG></P>
<P><STRONG>
Currently we have a <A HREF="http://www.redhat.com/">Red Hat</A> v6 server with sendmail v 8.9.3 running. We have
set a new server with Red Hat 7.3 and sendmail 8.11.6 in order to migrate all
of our services from the current server to the new one.
</STRONG></P>
<P><STRONG>
My question is: May I use the current sendmail.cf and sendmail.mc files in the
new server to avoid manually configuring sendmail again? I mean, to copy such
files to the new server and restart sendmail, do you think it will work fine?
</STRONG></P>
<P><STRONG>
Thank you very much.
</STRONG></P>
<BLOCKQUOTE>
[Thomas]
Why have you not tested it yourselves? You certainly have nothing to loose
by doing so
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> To answer your question though, you will have no problems
using the configuration files. They're based in a rather interesting
scripting language called m4 which is a separate entity to sendmail.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Sluggo]
He may not know what TAG is, Thomas.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<BLOCKQUOTE>
TAG is The Answer Gang, the group of volunteers at Linux Gazette that
answers tech-support questions. All questions and answers are
considered for publication in a future issue. Please address follow-ups or
future questions to <A HREF="mailto:tag@linuxgazette.net"
>tag@linuxgazette.net</A>. More information about
The Answer Gang is at: <A HREF="../tag/ask-the-gang.html"
>http://linuxgazette.net/tag/ask-the-gang.html</A>
</BLOCKQUOTE>
<P><STRONG>
Thank you all for answering, I really appreciate it.
</STRONG></P>
<P><STRONG>
Best regards,
</STRONG></P>
<P><STRONG>
JCD.
</STRONG></P>
<!-- end 3 -->
<HR>
<center>
<BIG><STRONG><FONT COLOR="maroon">GENERAL MAIL</FONT></STRONG></BIG>
<BR>
</center><HR>
<UL>
<!-- index_text begins -->
<li><A HREF="#mailbag.1"
><strong>Jython article</strong></a>
<li><A HREF="#mailbag.2"
><strong>Windows Defectors</strong></a>
<li><A HREF="#mailbag.3"
><strong>About solving priblem of /bin/bash access denied</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag.1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Jython article</FONT></H3>
Thu, 13 Nov 2003 22:09:46 -0500
<BR>Rob Tougher (<a href="mailto:gazette@linuxgazette.net?subject=%20Re%3A%20%5BLG%2099%5D%20mailbag%20%231">robt from robtougher.com</a>)
<P>
BTW, thanks for your comments on the article. Your editorial
<BR>efforts make LG a better magazine.
</P>
<P>
Editorial oversight <EM>does matter</EM>. People will see that in
the magazine's quality.
</P>
<P>
- Rob
</P>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag.2"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Windows Defectors</FONT></H3>
Mon, 5 Jan 2004 16:32:06 +0000 (GMT)
<BR> Tony Dearson (<a href="mailto:gazette@linuxgazette.net?cc=ajdearson@lycos.co.uk&subject=%20Re%3A%20%5BLG%2099%5D%20mailbag%20%232">ajdearson from lycos.co.uk</a>)
<P><STRONG>
I would disagree with a softening of the advise never to log in as root.
Respectively, I would remind that there are two types of Linux/Unix
Administrators --
</STRONG></P>
<P><STRONG>
1. Those who have trashed the entire system by mistake.
</STRONG></P>
<P><STRONG>
2. Those who will trash the entire system some time in the future.
</STRONG></P>
<P><STRONG>
Personally, I avoid logging in as root as much as possible, preferring
to su for a brief perioed when necessary.
</STRONG></P>
<P><STRONG>
Kind regards
<BR>Tony Dearson
</STRONG></P>
<BLOCKQUOTE>
[Sluggo]
I don't see much difference between logging in as root vs su'ing. Root
is root.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
Ever dip your finger in liquid nitrogen, Mike? It's a geek thing, FSVO
"geek" (e.g., radars and black-body targets.) In-and-out, no problem.
Keep it there for a full second or so, and you'll have frostbite that
may require amputation. (Five seconds or so, and you'll be able to
shatter it like glass.) When you log in as root, <EM>everything</EM> you do -
and the chain of consequences that proceeds from it - is done as root,
and you must consider that consequence tree for every single command you
type including "ls". When I type a command, then realize that I need
root privs for it, I just hit the up-arrow, type:
</BLOCKQUOTE>
<blockquote><pre>"<Ctrl-A>su -c "
</pre></blockquote>
<BLOCKQUOTE>
<EM>think</EM> about the effects, and press 'Enter'. Somehow, typing 10
characters (7 if I know it beforehand) does not seem to me to be the
Sysyphus' burden (with a bit of Prometheus thrown in for effect) that
you insist it is.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Sluggo]
I hate typing
"su[Enter][password][Enter][command][Enter][ctrl-D]" all the time, or
even worse, "su -c 'command in quotes'[Enter][password][Enter]".
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
[shrug] Everyone has their pet hates, of course. This does not in any
way correlate to what makes for reasonable system usage.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Sluggo]
I love
the fact that konsole has a "Root console" menu option, so I can get a
root session any time without using the arcane su syntax.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
In what way is it arcane? Is "-c" in some way connected to the Norse
Edda and the Boghaz-keuy Babylonian tablets? I wasn't aware. Molehill ->
mountain requires a sufficient amount of dirt, and I'm afraid there just
isn't enough.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Sluggo]
(You do have
to type the root password, of course.) Even with that, I usually leave
the session open in the background for a while in case I need it again.
</BLOCKQUOTE>
<BLOCKQUOTE>
The most important thing I ever learned (from sysadmin Pann McCuaig if
he's reading) is, <EM>sit on your hands</EM> before pressing [Enter] after
any potentially destructive command like "rm -rf", "rsync", etc.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
[grin] I prefer to use my other end to control my hands when using root
privilege, thanks.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Sluggo]
Make
sure you're the right user, on the right system, and in the right
current directory. (Actually sitting on your hands is optional, but the
metaphor is good so you don't forget it.)
</BLOCKQUOTE>
<BLOCKQUOTE>
If all that information doesn't appear in your shell
prompt, read the manpage for your shell and set PS1 or PROMPT
accordingly. My favorite prompt strings for zsh are:
</BLOCKQUOTE>
<blockquote><pre>PROMPT="%S%n@$HOST_:%~%#%s "
PROMPT2='%S%_>%s '
</pre></blockquote>
<BLOCKQUOTE>
For root I use bash with these lines:
</BLOCKQUOTE>
<blockquote><pre>export PS1='ROOT@`hostname`:`pwd`$ '
export PS2='> '
</pre></blockquote>
<BLOCKQUOTE>
[Ben]
I've done the following in my "~/.bashrc":
</BLOCKQUOTE>
<p align="center">See attached <tt><a href="misc/mailbag/ben.bashrc.txt">ben.bashrc.txt</a></tt></p>
<BLOCKQUOTE>
Whenever I'm root, my text is all in red. Makes for a decent clue, hard
to miss.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Sluggo]
(Normally people use '#' to distinguish their root prompt, but I find
that too easy to miss. I also need '$' to show it's bash rather than
zsh (whose conventional symbol is '%').
</BLOCKQUOTE>
<BLOCKQUOTE>
Another important thing to remember is that "su -" gives you root's (or
anybody's) full shell environment,
</BLOCKQUOTE>
<BLOCKQUOTE>
[Thomas]
...so that $SHELL, and other ~/.profile
files, etc are sourced, as well as various other exported $VARIABLES are
updated.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Sluggo]
while "su" alone gives you a partial
environment that doesn't include all their environment vars. E.g.,
"echo $USER" (or "echo $LOGNAME" in some shells) shows your login rather
than root's. That may cause some programs to do the Wrong Thing; e.g.,
'mutt' will read your mail rather than root's.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Thomas]
Will not change $SHELL, and other variables.
</BLOCKQUOTE>
<BLOCKQUOTE>
This can be negated with the:
</BLOCKQUOTE>
<blockquote><pre>su -m
</pre></blockquote>
<BLOCKQUOTE>
switch.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Sluggo]
(No, you still shouldn't
read mail as root anyway! Put those dark classes back in your pocket,
Ben.)
</BLOCKQUOTE>
<P><STRONG>
Mike,
</STRONG></P>
<P><STRONG>
That's a good tip, thanks. A small detail I've never come across before
</STRONG></P>
<P><STRONG>
Tom
</STRONG></P>
<!-- end 4 -->
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="mailbag.3"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">About solving priblem of /bin/bash access denied</FONT></H3>
Wed, 7 Jan 2004 20:56:46 -0500
<BR>sameer sonaikar (<a href="mailto:gazette@linuxgazette.net?subject=%20Re%3A%20%5BLG%2099%5D%20mailbag%20%233">sonaikar from yahoo.com</a>)
<blockquote><font color="#000066">Privately sent to Ben, and forwarded to the <EM>Linux Gazette</EM>
for publication.
-- Heather</font></blockquote>
<P><STRONG>
Dear sir,
</STRONG></P>
<P><STRONG>
I am using <A HREF="http://www.redhat.com/">Red Hat</A> 7.2 and facing same problem after
installing sendmail. Might I have made mistake while
confugering Sendmail. But I am trying to find the
mistake.
</STRONG></P>
<P><STRONG>
I got a lot Encouragement from ur efforts.
</STRONG></P>
<P><STRONG>
Thanking you.
</STRONG></P>
<P><STRONG>
With Regards,
<BR>Sam
</STRONG></P>
<BLOCKQUOTE>
[Thomas]
Are you saying that you followed Ben's article
(<A HREF="../issue52/okopnik.html"
>http://linuxgazette.net/issue52/okopnik.html</A>)
and that after you installed sendmail the problem arose that <TT>/bin/bash</TT> access
denied? That being the case I would either do:
</BLOCKQUOTE>
<blockquote><pre>rpm -qilp sendmail
</pre></blockquote>
<BLOCKQUOTE>
to generate a list of files belonging to that package, and check the perms
for each (assuming you're using an RPM-based distro), or under debian:
</BLOCKQUOTE>
<blockquote><pre>dpkg -L sendmail
</pre></blockquote>
<BLOCKQUOTE>
I am deliberately being vague here.
</BLOCKQUOTE>
<BLOCKQUOTE>
Your question as it stands lacks structure, information and meaning. I
suggest you look here:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
<A HREF="../tag/ask-the-gang.html"
>http://linuxgazette.net/tag/ask-the-gang.html</A>
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
for further information.
</BLOCKQUOTE>
<BLOCKQUOTE>
-- Thomas Adam
</BLOCKQUOTE>
<!-- end 3 -->
<HR>
<center>
<BIG><STRONG><FONT COLOR="maroon">GAZETTE MATTERS</FONT></STRONG></BIG>
<BR>
</center><HR>
<UL>
<!-- index_text begins -->
<li><A HREF="#gaz.1"
><strong>Clear writing</strong></a>
<li><A HREF="#gaz.2"
><strong>stylesheet problem??</strong></a>
<li><A HREF="#gaz.3"
><strong>Linux Gazette</strong></a>
<li><A HREF="#gaz.4"
><strong>how to join the TAG mailing list?</strong></a>
<li><A HREF="#gaz.5"
><strong>bum link</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="gaz.1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Clear writing</FONT></H3>
Thu, 1 Jan 2004 21:29:08 -0500
<BR>Ben Okopnik (<a href="mailto:gazette@linuxgazette.net?subject=%20Re%3A%20%5BLG%2099%5D%20gazette%20matters%20%231">the <em>LG</em> Answer Gang</a>)
<P><STRONG>
I'm not sure where this should be shoehorned into our FAQs, but - having
just read this excellent 25-page paper, I think it should be required
reading for prospective authors (or anyone who wants to write a
technical paper). "Clarity in Technical Reporting", which had a long run
as an underground publication at NASA, was officially published by The
Powers That Be once they caught on (thus proving that they were worthy
of their positions. All hail, etc.)
</STRONG></P>
<P><STRONG>
<A HREF="http://techreports.larc.nasa.gov/ltrs/PDF/NASA-64-sp7010.pdf"
>http://techreports.larc.nasa.gov/ltrs/PDF/NASA-64-sp7010.pdf</A>
</STRONG></P>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="gaz.2"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">stylesheet problem??</FONT></H3>
Fri, 02 Jan 2004 10:39:15 -0700
<BR>Bob van der Poel (<a href="mailto:gazette@linuxgazette.net?subject=%20Re%3A%20%5BLG%2099%5D%20gazette%20matters%20%232">bvdpoel from kootenay.com</a>)
<P><STRONG>
Hi all. Just grabbed the #97 and am having some problems reading it on
Mozilla 1.6b on Mandrake 9.0. The navigation box overlays the first
several lines of each article. I played a bit with lg.css (which I don't
know anything about) and got it readable by outcommenting the line:
</STRONG></P>
<pre><strong> position: absolute;
</strong></pre>
<P><STRONG><CODE>
at line 53.
</CODE></STRONG></P>
<P><STRONG>
Now, the article text overlays the nav. box. Not what you intended, but
it is readable... a <EM>real</EM> fix would be appreciated. Hey, this bug might
even spur me on to learn how to use stylesheets
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</STRONG></P>
<P><STRONG>
And: keep up the great work!
</STRONG></P>
<BLOCKQUOTE>
[Mike]
Thanks. Our stylesheet editor, Rob Tougher, is away on family business,
and I have only a rudimentary knowledge of CSS. Are the menu links
showing up one per line with a black bullet left of each? And the
breadcrumbs (=Yahoo bar) too? That was something I specifically fixed
yesterday, because our stylesheet fixes this month (for Netscape 4 and
Phoenix) broke compatibility with issue 97. If you do "View Source" on
an offending page and scroll to the bottom, the menu links should <EM>not</EM>
have <li>...</li> around them. If they do, your browser is caching an
obsolete version of the page.
</BLOCKQUOTE>
<BLOCKQUOTE>
I tried your solution but it breaks in my Galeon: it moves the menubar
to the very top, covering part of the logo and Tux. While this is
readable, it's not acceptable. Thanks for letting us know anyway, and
for any other ideas you might have later.
</BLOCKQUOTE>
<BLOCKQUOTE>
A new problem we have is that after I added the "Contact Us" link, the
menubar is extending too far to the right past Tux. I couldn't figure
out how to prevent that. Do you have any ideas?
</BLOCKQUOTE>
<P><STRONG>
Well, problem is solved. I dl'd the version on the site just now and it
works just fine. Guess I grabbed while you were putting, or something.
Thanks!
</STRONG></P>
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="gaz.3"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">Linux Gazette</FONT></H3>
Sat, 3 Jan 2004 10:16:33 +0000
<BR>Martin J Hooper (<a href="mailto:gazette@linuxgazette.net?subject=%20Re%3A%20%5BLG%2099%5D%20gazette%20matters%20%233">martinjh_linux from blueyonder.co.uk</a>)
<P>
Heather,
</P>
<P>
Been reading for a while and lost the site when you started having problems.
Nice to find it again!
</P>
<P>
Keep up the good work.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</P>
<P>
Martin
</P>
<blockquote><font color="#000066">Thanks, Martin, I'm glad you like how we've kept it. Happy New Year
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
-- Heather</font></blockquote>
<!-- end 3 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="gaz.4"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">how to join the TAG mailing list?</FONT></H3>
Wed, 31 Dec 2003 17:29:51 -0800
<BR>sanjaya singharage (<a href="mailto:gazette@linuxgazette.net?subject=%20Re%3A%20%5BLG%2099%5D%20gazette%20matters%20%234">sanjayas from opensource.lk</a>)
<br>Answered By Mike Orr (Sluggo), Breen Mullins, Ben Okopnik, Thomas
Adam, Heather Stern
<P>
This is a multi-part message in MIME format.
</P>
<P>
<font color="red"><blockquote><em>You'd think that if Sanjaya had been on this list before that he would
have remembered that none of us appreciate MIME encoded e-mails.... oh
well...</EM>
</font></blockquote>
<blockquote><font color="#003F00">I guess a beneficial reading of:
</font></blockquote>
<blockquote><font color="#003F00"><A HREF="http://linuxgazette.net/tag/ask-the-gang.html"
>http://linuxgazette.net/tag/ask-the-gang.html</A>
</font></blockquote>
<blockquote><font color="#003F00">is in order. -- Thomas
</font></blockquote>
<blockquote><font color="#003F00">
I used to be on the tag mailing list some time ago. Does it still exist?
How can I join it?
thanks.
</font></blockquote>
<blockquote><font color="#003F00">[Mike]
<A HREF="http://linuxgazette.net/mailman/listinfo/tag"
>http://linuxgazette.net/mailman/listinfo/tag</A>
</font></blockquote>
<blockquote><font color="#003F00">We couldn't carry the subscribers over from the old linux-questions-only
list because SSC wouldn't give us the member roster. Now the list is
fully under our control.
</font></blockquote>
<blockquote><font color="#003F00">[Breen]
By the way, I'm back too. It's been pretty busy IRL, but I finally got
around
to moving here.
</font></blockquote>
<blockquote><font color="#003F00">Cheers and Happy New Year,
</font></blockquote>
<blockquote><font color="#003F00">
doesn't seem obvious to find <A HREF="http://linuxgazette.net/mailman/listinfo/tag"
>http://linuxgazette.net/mailman/listinfo/tag</A> on
the home page of <A HREF="http://linuxgazette.net"
>http://linuxgazette.net</A> Did I miss something?
</font></blockquote>
<blockquote><font color="#003F00">Wishing all a happy new year!
</font></blockquote>
<blockquote><font color="#003F00">sanjaya.
</font></blockquote>
<blockquote><font color="#003F00">[Ben]
It's not supposed to be obvious; you were just shown a shortcut. If you
want to join, the what you're <em>really</em> supposed to do is read the TAG
FAQ at:
</font></blockquote>
<blockquote><font color="#003F00"><A HREF="http://linuxgazette.net/tag/members-faq.html"
>http://linuxgazette.net/tag/members-faq.html</A>
</font></blockquote>
<blockquote><font color="#003F00">which will direct you to the subscription address, etc. after explaining
the necessary facts of life - such as, you do not need to subscribe to TAG
in order to ask a question. Subscriptions to TAG are for those who are
willing and able to <EM>answer</EM> Linux questions.
</font></blockquote>
<blockquote><font color="#000066">Good point - we should update the "About TAG" blurb on the mailman link
given above to include this concept, give the hotlink to member policy,
and advise querents to read ask-the-gang and then just send mail.
-- Heather</font></blockquote>
<!-- end 4 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="gaz.5"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
<FONT COLOR="navy">bum link</FONT></H3>
Thu, 15 Jan 2004 10:01:22 -0800
<BR>Carla Schroder (<a href="mailto:gazette@linuxgazette.net?subject=%20Re%3A%20%5BLG%2099%5D%20gazette%20matters%20%235">carla from bratgrrl.com</a>)
<P><STRONG>
Thanks. We've been debating how much to change the back issues.
Plus it's a big job, and we can't change the mirrors that don't resync
back issues.
</STRONG></P>
<P>
Hello Mike,
</P>
<P>
No worries.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> Just letting you know, what you do about it is up to you.
</P>
<P>
"<A HREF="../issue98/pranevich.html">The Wonderful World of Linux 2.6</A>" is absolutely incredible.
What a great
article.
</P>
<P>
cheers
</P>
<!-- end 5 -->
<hr>
<CENTER><font face="Helvetica"><STRONG>
This page edited and maintained by the Editors of <I>Linux Gazette</I><br>HTML script maintained by <A HREF="mailto:star@starshine.org">Heather Stern</a> of Starshine Technical Services, <A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</STRONG></font></CENTER>
<HR>
</p>
<!-- *** BEGIN author bio *** -->
<!-- *** END author bio *** -->
<div id="articlefooter">
<p>
Published in Issue 99 of Linux Gazette, February 2004
</p>
</div>
</div>
<br />
<div class="content twdtarticle">
<h1>More Two Cent Tips!</h1>
</b>
</p>
<p>
<center><STRONG>See also: The Answer Gang's
<a href="../tag/kb.html">Knowledge Base</a>
and the <i>LG</i>
<a href="http://www.linuxgazette.net/search.html">Search Engine</a></STRONG>
</center><HR>
<UL>
<!-- index_text begins -->
<li><A HREF="#tips.1"
><strong>no-floppy system configuration</strong></a>
<li><A HREF="#tips.2"
><strong>Nice value in XFree86 startup</strong></a>
<li><A HREF="#tips.3"
><strong>CPU Support on Linux</strong></a>
<li><A HREF="#tips.4"
><strong>mac 5200</strong></a>
<li><A HREF="#tips.5"
><strong>Miller-Daemon</strong></a>
<li><A HREF="#tips.6"
><strong>what is "no"? (missing prog for binutils compile)</strong></a>
<li><A HREF="#tips.7"
><strong>What is Linux Torvalds wife famous for</strong></a>
<li><A HREF="#tips.8"
><strong>pppd problem</strong></a>
<li><A HREF="#tips.9"
><strong>PPP & ETH won't work concurrently</strong></a>
<li><A HREF="#tips.10"
><strong>Red Hat Linux Install issues</strong></a>
<li><A HREF="#tips.11"
><strong>pam and ssh</strong></a>
<li><A HREF="#tips.12"
><strong>Pctel modem ................NO CARRIER..........?????</strong></a>
<li><A HREF="#tips.13"
><strong>Which VT? Custom prompts.</strong></a>
<li><A HREF="#tips.14"
><strong>workaround for black lines on Radeon mobility 7500</strong></a>
<li><A HREF="#tips.15"
><strong>Cool toy of the week: XaoS</strong></a>
<!-- index_text ends -->
</UL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.1"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">no-floppy system configuration</FONT></H3>
Thu, 8 Jan 2004 11:47:45 -0500
<BR>Ben Okopnik (<a href="mailto:tag@linuxgazette.net?cc=ben@callahans.org&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%231">The <em>LG</em> Answer Gang</a>)
<P>
Many new laptops come without a floppy drive; the one that I just
bought, an Acer Aspire 2003LMi, does not have one - it's available as an
extra option, but I don't see myself needing it. However, part of my
standard method for converting Win-machines to dual-boot involves using
FIPS, which I use to "shrink" the Wind0ws partition to a minimal size -
and FIPS normally runs from a floppy. What to do?
</P>
<P>
Here's an interesting fact that many people may not be aware of: the
bootable part of a CD consists of nothing more than a bootable <EM>floppy</EM>
image. So, I simply took a DOS boot floppy containing FIPS, and made a
byte-by-byte copy:
</P>
<blockquote><pre># Create a directory to hold the CD data (none at the moment) plus "boot"
ben@Fenrir:~$ mkdir -p /tmp/cdrom/boot
</pre></blockquote>
<blockquote><pre># Create byte-by-byte copy in "boot.img"
ben@Fenrir:~$ dd if=/dev/fd0 of=/tmp/cdrom/boot/boot.img
</pre></blockquote>
<P>
I then created an ISO image containing that disk copy. If I wanted any
other data on that CD (I'll probably make another one with a bunch of
DOS utilities on it later; I've been using bootable DOS "tool" floppies
for over 20 years to repair broken Wind0ws systems), I'd copy that data
into "<TT>/tmp/cdrom</TT>", and it would become part of that image.
</P>
<blockquote><pre>ben@Fenrir:~$ cd /tmp/cdrom
ben@Fenrir:/tmp/cdrom$ mkisofs -r -b boot/boot.img -c boot/boot.catalog -o bootcd.iso .
</pre></blockquote>
<P>
All that was left was to burn the newly-created image to a CD:
</P>
<blockquote><pre>ben@Fenrir:/tmp/cdrom$ sudo cdrecord -v -eject speed=8 dev=0,0,0 bootcd.iso
</pre></blockquote>
<P>
The only downside to this is not being able to save the boot sector to
the floppy before repartitioning... but in the worst case, it's a new
system without any of my data on it, and it's not a concern. Besides, I
have Linux, and boot sector recovery is rather trivial.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</P>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.2"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Nice value in XFree86 startup</FONT></H3>
Sat, 24 Jan 2004 21:56:43 +0000
<BR>Thomas Adam (<a href="mailto:tag@linuxgazette.net?cc=jacobo221@hotmail.com&cc=thomas_adam16@yahoo.com&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%232">The <em>LG</em> Weekend Mechanic</a>)
<BR>Question by Jacobo ;-) (jacobo221 from hotmail.com)
<P><STRONG>
Hi,
first of all, sorry for my english, I try my best, but I use to fail in
spelling and grammar
<IMG SRC="../gx/dennis/smily.gif" ALT=";-)"
height="24" width="20" align="middle">
Well, I'm writting to you because I have a problem at Xfree86's startup. I'm
useing kernel 2.4, so I have, in Xwrapper.config, nice value set to -10
("nice_value=-10"), but when entering "startx", just before entering
Xfree86, a message is shown: "warning: process set to nice value -11 instead
of -10 as requested". If I then change nice value to -11, then the startx
script changes nice value to -12. If I change it to -12, it changes it to
-13, and so on for any number between [-20, 19]. I've searched for many days
(weeks, in fact) on the web and asked at #debian, but no answers. I hope you
can lend me a hand. Btw, XFree86 runs perfectly ok, it's just that I hate
having error messages.
Thanx a lot for your help!
</STRONG></P>
<BLOCKQUOTE>
[Thomas]
By my knowledge of how X starts up it is not startx which is changing
this. Just out of curiosity, run (as root):
</BLOCKQUOTE>
<blockquote><pre>dpkg-reconfigure xserver-common
</pre></blockquote>
<BLOCKQUOTE>
to see if that fixes anything. I have grepped through the startup files
that I use (I am running debian unstable) and there is nothing besides the
value in <TT>/etc/X11/Xwrapper.config</TT> which sets or changes the nice value of
X.
</BLOCKQUOTE>
<BLOCKQUOTE>
As a long shot (and possibly a complete aside) you don't have the "and"
package installed, do you?
</BLOCKQUOTE>
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.3"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">CPU Support on Linux</FONT></H3>
Sun, 22 Jun 2003 14:10:02 +0100 (BST)
<BR>Ashwin N (<a href="mailto:tag@linuxgazette.net?cc=Shishir_Bagchi@lko.tcs.co.in&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%233">The <em>LG</em> Answer Gang</a>)
<BR>Question by Shishir_Bagchi (Shishir_Bagchi from lko.tcs.co.in)
<P><STRONG>
Upto how many CPUs does Linux Support in --
</STRONG></P>
<P><STRONG>
a) CISC Technology
</STRONG></P>
<P><STRONG>
b) RISC Technology
</STRONG></P>
<BLOCKQUOTE>
[ashwin]
The numbers for the individual architectures for the current kernels can be got
here -
<A HREF="http://www.tldp.org/HOWTO/SMP-HOWTO.html"
>http://www.tldp.org/HOWTO/SMP-HOWTO.html</A>
</BLOCKQUOTE>
<BLOCKQUOTE>
Expect much much better support with the 2.6 series.
</BLOCKQUOTE>
<!-- end 3 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.4"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">mac 5200</FONT></H3>
Wed, 31 Dec 2003 19:53:51 -0500
<BR>Neil Youngman (<a href="mailto:tag@linuxgazette.net?cc=cru1se@comcast.net&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%234">The <em>LG</em> Answer Gang</a>)
<BR>Question by sheldon k feldman (cru1se from comcast.net)
<P><STRONG>
Can I load linux onto this machine? Where do I get the software?
thanks
</STRONG></P>
<BLOCKQUOTE>
[Neil]
MkLinux supports the 5200 see
<A HREF="http://linuxtoday.com/developer/2000080401404OSHWKN"
>http://linuxtoday.com/developer/2000080401404OSHWKN</A>
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Other Mac Linuxes include Yellow dog Linux
<DD><A HREF="http://www.yellowdoglinux.com/support/hardware/breakdown/index.php"
>http://www.yellowdoglinux.com/support/hardware/breakdown/index.php</A>
</DL></BLOCKQUOTE>
<!-- end 4 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.5"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Miller-Daemon</FONT></H3>
Fri, 6 Jun 2003 22:17:25 EDT
<BR>Weswwallace (<a href="mailto:tag@linuxgazette.net?cc=gazette@ssc.com&cc=Weswwallace@aol.com&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%235">Weswwallace from aol.com</a>)
<br>Answered By Jason Creighton
<P><STRONG>
How do I get an E-maikl to above subject? They interrupt my messages.
</STRONG></P>
<BLOCKQUOTE>
[Jason]
What you seem to be asking is "why am I getting messages from Mailer-Daemon"?
A message from "Mailer-Daemon" is probably the MTA (Mail transport agent: The
software that delivers mail.) sending a message that says, in effect, "excuse
me, but you seem to be confused. There is no such mailbox here."
</BLOCKQUOTE>
<P><STRONG>
claim no such addresses exist, etc.,
</STRONG></P>
<BLOCKQUOTE>
[Jason]
The automated message you're recieving means just what it says: No such
address exists. For example, if you try to send email to bob@example.com, and
there is no user bob at example.com, you're probably going to get a bounce
message that says no such address exists.
</BLOCKQUOTE>
<P><STRONG>
yet they cannot be questioned or challenged ever when they are wrong. Help.
</STRONG></P>
<BLOCKQUOTE>
[Jason]
The reason "they" cannot be questioned is because you're getting an automated
message: It was not send by a human.
</BLOCKQUOTE>
<BLOCKQUOTE>
Nobody would know better whether an address exists than the system you're
sending mail to, so I would say that the system you're sending mail to is
right and you are wrong.
</BLOCKQUOTE>
<!-- end 5 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.6"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">what is "no"? (missing prog for binutils compile)</FONT></H3>
Thu, 29 May 2003 15:53:14 -0700
<BR>Faber fedor, Jim Dennis, Alan Mudra (<a href="mailto:tag@linuxgazette.net?cc=&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%236">The <em>LG</em> Answer Gang</a>)
<BR>Question by Karl-Heinz Herrmann
<P><STRONG>
Now -- it's an unbearable situation that my Linux doesn't know "no".... But
I've no idea what it is and you can imagine that a google for "no" even with
linux and some other keywords around are not very helpful.
</STRONG></P>
<P><STRONG>
Any ideas?
</STRONG></P>
<BLOCKQUOTE>
[Faber]
Maybe it's called "nein" on your computer? <grvf>
</BLOCKQUOTE>
<BLOCKQUOTE>
I can't find a "no" on my <A HREF="http://www.redhat.com/">Red Hat</A> 8 box either.
</BLOCKQUOTE>
<BLOCKQUOTE>
[JimD]
I think <TT>/usr/bin/no</TT> was (would be) a counterpart to the old
<TT>/usr/bin/yes</TT> command:
</BLOCKQUOTE>
<blockquote><pre> #!/bin/sh
OUTPUT='y'
[ "$#" -gt 1] && OUTPUT="$*"
while : ; do
echo "$OUTPUT"
done
</pre></blockquote>
<BLOCKQUOTE>
... so "no" could just be an alias or script that calls <TT>/usr/bin/yes</TT>
with the "no" argument:
</BLOCKQUOTE>
<blockquote><pre> /usr/bin/yes no
</pre></blockquote>
<BLOCKQUOTE>
I realize this sounds silly and stupid, and April 1st is long past for
this year. But I'm not kidding. That Makefile (or whatever) seems to
actually want to pipe an endless stream of "n" or "no" lines into some
other process. (<TT>/usr/bin/yes</TT> was traditionally used in a pipeline with
fsck to automate the process of repairing a filesystem that need lots
of work -- then they just added the -y option to the GNU/Linux versions
of fsck.
</BLOCKQUOTE>
<P><STRONG>
I put the question up with bugreports for binutils and got:
</STRONG></P>
<BLOCKQUOTE><BLOCKQuote>
[Alan]
</BLOCKQuote></BLOCKQUOTE>
<blockquote><pre>> /bin/sh: no: command not found
</pre></blockquote>
<BLOCKQUOTE>
This is a result of binutils being stuck on using old buggy autoconf.
Install a new version of GNU gettext, or configure with --disable-nls.
</BLOCKQUOTE>
<BLOCKQUOTE>
--
Alan Modra
IBM OzLabs - Linux Technology Centre
</BLOCKQUOTE>
<P><STRONG>
Got a new gettext which includes some "no"'s
</STRONG></P>
<pre><strong>khh > find ./ -name "no*"
./gettext-runtime/po/no.po
./gettext-runtime/po/no.gmo
./gettext-tools/po/no.po
./gettext-tools/po/no.gmo
</strong></pre>
<P><STRONG>
unfortunately with a new gettext (gettext-0.12.1.tar.gz) and nls enabled I
get a linker error for some gettext symbol. The solution without nls works
for getting binutils compiled. I try that on the 2.5.70 kernel sometime soon.
</STRONG></P>
<P><STRONG>
Does anybody know of a backport to 2.4.X of the preempt patch and or the I/O
scheme patches mentioned on kerneltrap right now? I'm not yet sure what else
will break if I switch to 2.5.X. At least NVdriver, lt_serial+lt_modem and
vmware kernel modules would be nice to have.
</STRONG></P>
<!-- end 6 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.7"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">What is Linux Torvalds wife famous for</FONT></H3>
Thu, 19 Jun 2003 15:00:53 +0100 (BST)
<BR>Ashwin N, Thomas Adam (<a href="mailto:tag@linuxgazette.net?cc=pdrake@northern.wvnet.edu&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%237">The <em>LG</em> Answer Gang</a>)
<BR>Question by Pam Drake (pdrake from northern.wvnet.edu)
<BLOCKQUOTE>
[Thomas]
Well, she's famous for being married to Linus Torvalds.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ashwin]
She is also famous for being Finland's champion in kung-fu or some similar
martial art
<IMG SRC="../gx/dennis/smily.gif" ALT=";-)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<blockquote><font color="#000066">Linus was interviewed in Issue 67 of Linux Journal, by Marjorie
Richardson at the Linux World Expo of that year. Tove was 6 years
running, the Finnish champion for karate, specializing in precise Kata
(the forms), then moved on to other interests.
-- Heather</font></blockquote>
<!-- end 7 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.8"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">pppd problem</FONT></H3>
Thu, 26 Jun 2003 01:30:57 +0530
<BR>Joydeep Bakshi (<a href="mailto:tag@linuxgazette.net?cc=linux-questions-only@ssc.com&cc=joy12@vsnl.net&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%238">joy12 from vsnl.net</a>)
<br>Answered By Thomas Adam
<P>
Hi all,
</P>
<P>
I use kppp under linux to dial-up my isp. but there is a strange problem
happens with me. when I dial-up from windows98 it connects with the isp at
the very first attempt. but under Linux (debian woody) kppp takes at-least
3/4 attempts to connect the isp, and during the failure it shows *pppd can't
be started * . I have also started pppd from root manually at the time of
hooking, but the result is same. could some one please suggest me how to fix
the problem ?
</P>
<P>
thanks in advanced.
</P>
<BLOCKQUOTE>
[Thomas]
You need to ensure that you have a ppp-chat script enabled which is used
by pppd to comminicate with the modem to send certain signals, etc.
</BLOCKQUOTE>
<BLOCKQUOTE>
wvdial will help for this
</BLOCKQUOTE>
<!-- end 8 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.9"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">PPP & ETH won't work concurrently</FONT></H3>
Fri, 5 Dec 2003 09:48:52 -0800 (PST)
<BR>Joe Slobotnik (<a href="mailto:tag@linuxgazette.net?cc=linux-questions-only@ssc.com&cc=cj@rt.nl&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%239">cj from rt.nl</a>)
<br>Answered By Thomas Adam, Karl-Heinz Herrmann
<P><STRONG>
Hi,
</STRONG></P>
<P><STRONG>
I'm running red hat 9 with an ethernet card to a LAN and a modem for dial up. I'm using kppp for the dial up. When the eth0 int is active, kppp will establish a connection but DNS fails. The DNS listed for both interfaces is the dialup one, but I can't resolve names unless the eth0 is shutdown. How can I , an ordinary joe get these things to work at the same time ?
</STRONG></P>
<P><STRONG>
thanks,
<BR>cj
</STRONG></P>
<BLOCKQUOTE>
[Thomas]
There is either a really easy or hard explanation. I think I am right in
saying that you need to have a correct entry in your routing table to use
the two concurrently, since the routing will not know.
</BLOCKQUOTE>
<BLOCKQUOTE>
As far as DNS goes, do you have a valid entry in <TT>/etc/resolv.conf</TT> and also
an entry in <TT>/etc/nsswitch.conf:</TT>
</BLOCKQUOTE>
<blockquote><pre>hosts: files dns
</pre></blockquote>
<BLOCKQUOTE>
like that? If not, add the "dns" after the word "files".
</BLOCKQUOTE>
<BLOCKQUOTE>
[K.-H.]
Well kppp (or pppd which kppp calls) refuses to setup a default route if
one already exists. The magic scrying ball (glass?) would suggest with
eth0 up you've a default route set. On dailup via kppp you won't get a
default route to your ppp0 interface and therefore DNS lookups to the
world outside never reach there.
</BLOCKQUOTE>
<BLOCKQUOTE>
This is how it should look lie with both eth0 and ppp0 (kppp) up (I cut
out three columns which are unimportant):
</BLOCKQUOTE>
<blockquote><pre># route -n
Kernel IP routing table
Destination Gateway Genmask Flags Iface
62.104.218.38 0.0.0.0 255.255.255.255 UH ppp0
192.168.2.3 0.0.0.0 255.255.255.255 UH dummy0
10.10.10.0 0.0.0.0 255.255.255.0 U eth0
172.16.57.0 0.0.0.0 255.255.255.0 U vmnet1
0.0.0.0 62.104.218.38 0.0.0.0 UG ppp0
</pre></blockquote>
<BLOCKQUOTE>
I've two private networks, real ethernet as 10.10.10.0 and
vmware virtual host as 172.16.57.0. The "0" at the end suggests and a
genmask of 255.255.255.0 proves that these are networks, i.e. not a
single host but all hosts 10.10.10.x with 1<x<255 (zero is broadcast
address to all). If you look at the flags "H" means this is only one
single host, "G" means this is a gateway.
</BLOCKQUOTE>
<BLOCKQUOTE>
The last line is the default routing, i.e. if no other routing rule
applies all remaining traffic this way. The way is interface ppp0 and
the target the gateway IP 62.104.218.38, our remote host on the other
end of the modem line (see first line).
</BLOCKQUOTE>
<BLOCKQUOTE>
Now I'm pretty sure that in your case there is a line like:
</BLOCKQUOTE>
<blockquote><pre>0.0.0.0 [some IP] 0.0.0.0 UG eth0
</pre></blockquote>
<BLOCKQUOTE>
If this is the case kppp will not touch it and if you would have looked
carefully in your <TT>/var/log/messages</TT> (or kppp's log) you would have found
an error telling you this.
</BLOCKQUOTE>
<BLOCKQUOTE>
If I guessed right run (as root):
</BLOCKQUOTE>
<blockquote><pre>route del default
</pre></blockquote>
<BLOCKQUOTE>
then start kppp's dialin
</BLOCKQUOTE>
<BLOCKQUOTE>
After that figure out why RedHat sets a default route (I'm with the
lizard and without hats).
</BLOCKQUOTE>
<BLOCKQUOTE>
If I did not guess right you oviously didn't give enough information....
</BLOCKQUOTE>
<!-- end 9 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.10"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Red Hat Linux Install issues</FONT></H3>
Sun, 29 Jun 2003 15:34:59 -0400
<BR>Srinivas Velury (<a href="mailto:tag@linuxgazette.net?cc=linux-questions-only@ssc.com&cc=s_velury@hotmail.com&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%2310">s_velury from hotmail.com</a>)
<br>Answered By Mike Martin
<P><STRONG>
Hi Answer Guy,
</STRONG></P>
<P><STRONG>
I am having a peculiar problem with the <A HREF="http://www.redhat.com/">Red Hat</A> 9 installation. I am trying
to install it on a IBM thinkpad 1721 laptop with a formatted hard drive. The
laptop has a combo floppy/CD ROM drive. The laptop seems to be seeing the CD
ROM dirve but it is not able to read anything off it. The laptop has a
PCMCIA network adapter card which I used to connect to my home networking.
The other laptop on the home networking has Win 2000 running on it. Here are
the following waya I tried to install Linux -
</STRONG></P>
<P><STRONG>
1. I created a Linux boot disk using the pcmcia.img and booted the IBM
laptop and selected NFS install. On the other laptop I copied all the Red
Hat folders from the 3 installation CDs. I selected "Automatic DNS
configuration" to configure the DNS names for the IBM machine. For the NFS
server name I typed in the name (which did not have a domain name since I
log into a workgroup and not a domain) and typed in the actual directory of
the Redhat parent folder (d:\redhat9). But I get an error that the drive
could not be mounted.
</STRONG></P>
<P><STRONG>
Then I grabbed a Freeware called NFSClientServer and installed it on the Win
200 laptop. Here I exported the RedHat directory (d:\RedHat9\RedHat). Then I
followed the above steps on the IBM machine for NFS installation. Even
though my requests form the IBM machine seemed to log in the Server log on
the Win 2000 machine, I still could not mount the directory. What am I
missing?
</STRONG></P>
<P><STRONG>
2. Failing the above attempt, I attached a SCSI CD ROM to my IBM machine.
Then I made a boot disk using the bootdisk.img. After booting the IBM, I
selected "local CDROM" for the source, but I kept getting the message "No
software found in CDROM". Obvously, Linux was not seeing my SCSI CDROM, but
since it detected my internal (failed) CDROM, and could not read off of it,
it was giving me the message. How do I make it look at my SCSI CDROM?
</STRONG></P>
<P><STRONG>
I even tried making a boot disk using the "drvblock.img" file, but for some
reason when I use the disk, I get the message " No operation system found".
When I look at the disk contents the, it seems like the format information
on the disk is lost and Windows explorer asks me if I "want to format the
disk"? I even tried the same using Linux 7.3 (Red Hat), same error.
</STRONG></P>
<P><STRONG>
Please help.
</STRONG></P>
<P><STRONG>
Regards,
<BR>A Wexed Linux Installer.
</STRONG></P>
<BLOCKQUOTE>
[Mike]
OK - your best bet would be a HD install.
If you have copied the folders over you have enough HD space.
</BLOCKQUOTE>
<BLOCKQUOTE>
In w2k make a directory to hold the iso images
In turn copy the cds to this directory (not the contents - I think
Nero should be able to do this)
You should then have three files in this directory, all ending in
.iso
</BLOCKQUOTE>
<BLOCKQUOTE>
Now boot using your boot.img disk.
When you get get prompted for installation type, choose HD
then select the right partition where there are held (probably
<TT>/dev/hda1</TT> on your system if you choose the first partition)
then select the directory you have placed the .iso files in.
</BLOCKQUOTE>
<BLOCKQUOTE>
Then you should be good to go.
</BLOCKQUOTE>
<!-- end 10 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.11"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">pam and ssh</FONT></H3>
Wed, 25 Jun 2003 10:08:28 -0500
<BR>Lou Lohman (<a href="mailto:tag@linuxgazette.net?cc=linux-questions-only@ssc.com&cc=LLohman@WeberMarking.com&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%2311">LLohman from WeberMarking.com</a>)
<br>Answered By Thomas Adam, Michael Gargiullo
<P><STRONG>
Dear Answer Gang,
</STRONG></P>
<P><STRONG>
Try as I might, I am unable to figure out just what to do to allow a trusted
user on a trusted host to use 'scp' to copy files from one system to another
WITHOUT a password prompt. We WANT to do this in order to use 'scp' in
scripts initiated by CRON. We NEED to do this because 'rcp' gives us 'file
too large' responses. I have tried modifying <TT>/etc/pam.d/sshd</TT> (at least to
the limits of my understanding). I can make scp NOT work at all, or require
the password, but I cannot make it work without the password. Changing the
<TT>/etc/ssh/sshd_config</TT> file doesn't make any difference, that I can see, even
though that file now says 'go ahead and use the rhosts files'.
</STRONG></P>
<P><STRONG>
Can someone help me? Anyone? I would offer a carrot, like "I'll subscribe
to LJ", but I already do. I would offer virtual hugs and kisses, but the
respondent might be male, in which case an old homophobe like me is going to
have a problem. How about "undying gratitude"? Yeah, that's the ticket ...
it's easy, it's cheap, I could even teach my kids to sing appropriate
praises .. yeah, that's it .... Where's Jon Lovitz when you really need him?
</STRONG></P>
<P><STRONG>
Lou Lohman
</STRONG></P>
<blockquote><code><font color="#000033"><br>Don't just BELIEVE!! Consume information like a starving person, and then sort it out for yourself.
</font></code></blockquote>
<blockquote><font color="#000066">And we know he reads ask-the-gang.html, he gave us explicit permission
to publish the whole thread just like we ask for
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> Now if we could get
people to remember to turn off HTML in their email...
-- Heather</font></blockquote>
<BLOCKQUOTE>
[Thomas]
You need to run "scp" with the "-B" flag, ie.
</BLOCKQUOTE>
<blockquote><pre>scp -B files thomas@thomas
</pre></blockquote>
<BLOCKQUOTE>
Batchmode doesn't require password authentication. You can also add this
in <TT>/etc/ssh_config</TT> as...
</BLOCKQUOTE>
<blockquote><pre>BatchMode=yes
</pre></blockquote>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
that way, you don't have to pass the -B switch each time.
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
[Mike]
You can also exchange keys from one user/machine to the other. If you
want to copy from machine A to machine B. On machine A, as the user that
needs to copy, run ssh-keygen -t dsa. This will generate the key pair.
Then he'll need to copy the contents of ~/.ssh/id_dsa.pub from machine A
into ~/.ssh/authorized_keys on machine B. Then copying from machine A
to machine B won't require a password for this user. Do the reverse to
copy from B to A.
</BLOCKQUOTE>
<!-- end 11 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.12"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Pctel modem ................NO CARRIER..........?????</FONT></H3>
Thu, 26 Jun 2003 08:22:13 +0530
<BR>Vivek Ravindranath (<a href="mailto:tag@linuxgazette.net?cc=linux-questions-only@ssc.com&cc=vivek_ravindranath@softhome.net&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%2312">vivek_ravindranath from softhome.net</a>)
<br>Answered By Karl-Heinz Herrmann
<P><STRONG>
Hi Answer Gang,
</STRONG></P>
<P><STRONG>
I have some problems trying to connect with my HSP Pctel Micromodem 56.I have
RedHat 9 installed and I use kppp for conneting to the net.When I try to
connect the handshake goes on well and all of a sudden I get this "No
Carrier" message.Can you tell what causes this error and what is the
solution.............please sugget an alternative driver if available.At
present I am using the Pctel drivers available at www.linmodems.org version
0.9.6 . Can any special AT command string help?????? If yes please suggest a
solution.Or using any other dialer will help????
</STRONG></P>
<P><STRONG>
Thanks in advance.
</STRONG></P>
<P><STRONG>
Vivek.
</STRONG></P>
<BLOCKQUOTE>
[K.-H.]
no carrier means the modem is unable to detect the carrier frequency onto
which data would be encoded. As this is a fatal problem it hangs up and tells
you "no carrier".
</BLOCKQUOTE>
<BLOCKQUOTE>
Why is the carrier gone? difficult to tell from here. What do your logfiles
say? kppp has a log button, use it!
</BLOCKQUOTE>
<BLOCKQUOTE>
At <EM>exactly what point</EM> of connection negotiation does the error occur? Do
you get the "connect" in the log window? Then the dialing is finished and
control passed to pppd -- which logs it's messages in <TT>/var/log/messages</TT> or
some such place. Go look for it. You can pass additional option to pppd in
kppp: add "debug". Make sure to press the add button in the kppp window so
the new option is actually used (should show up in the lower larger window).
</BLOCKQUOTE>
<BLOCKQUOTE>
My guess: serial connection gets established, pppd get's into some trouble
negotiating the ppp parameters (user/passwd? pap <-> chap <-> terminal
authentification, compression,.... ) and the other side terminates on you.
Your modem detects the lost carrier and tells you.
</BLOCKQUOTE>
<!-- end 12 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.13"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Which VT? Custom prompts.</FONT></H3>
Mon, 23 Jun 2003 13:59:58 +0100 (BST)
<BR>Toby Poynder (<a href="mailto:tag@linuxgazette.net?cc=linux-questions-only@ssc.com&cc=toby@whatcouldpossibly.com&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%2313">toby from whatcouldpossibly.com</a>)
<P><STRONG>
Here's a suggestion for your 2 cent tips section - I hope you like it.
</STRONG></P>
<P><STRONG>
When working with Linux servers I don't run X, preferring to make use
of the virtual terminals via Alt-F1, Alt-F2, Alt-F3 etc. The problem is
knowing which screen I am looking at, so I have devised a custom
prompt by including the following two lines in my .profile:
</STRONG></P>
<P><STRONG><BLOCKQuote>
TTY=`basename \`tty\"
export PS1="[$TTY] \w$ "
</BLOCKQuote></STRONG></P>
<P>
Cool
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</P>
<P><STRONG>
The first line sets the environment variable TTY to the number of the
current virtual terminal, the second sets my prompt to show that number
and the current working directory as in this example:
</STRONG></P>
<P><STRONG><BLOCKQuote>
[2] <TT>/etc/xinetd.d$</TT>
</BLOCKQuote></STRONG></P>
<P><STRONG>
That's it!
</STRONG></P>
<P><STRONG>
Toby Poynder
London, UK
</STRONG></P>
<P>
I must admit that I often find just typing in "tty" is more efficient than
having it set in one's $PS1 prompt.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> -- Thomas
</P>
<!-- end 13 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.14"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">workaround for black lines on Radeon mobility 7500</FONT></H3>
Wed, 14 Jan 2004 22:06:10 +0000
<BR>Adrian Bridgett (<a href="mailto:tag@linuxgazette.net?cc=adrian@smop.co.uk&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%2314">adrian from smop.co.uk</a>)
<P>
To workaround black lines in XFree86 with Radeon mobility 7500
(thinkpad R40 here), add:
</P>
<blockquote><pre>Option ""XaaNoSolidTwoPointLine""
</pre></blockquote>
<P>
To the drivers section of <TT>/etc/X11/XF86Config</TT>(<TT>-4</TT>)
</P>
<P>
Adrian (aka Wyvern on #hants)
</P>
<!-- end 14 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<P> <A NAME="tips.15"><HR WIDTH="75%" ALIGN="center"></A> <P>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
<FONT COLOR="navy">Cool toy of the week: XaoS</FONT></H3>
Mon, 16 Jun 2003 20:43:40 -0600
<BR>Jason Creighton, Faber Fedor, Ben Okopnik (<a href="mailto:tag@linuxgazette.net?cc=linux-questions-only@ssc.com&subject=%20Re%3A%20%5BLG%2099%5D%202c%20Tips%20%2315">The <em>LG</em> Answer Gang</a>)
<BLOCKQUOTE><DL><DT>
[Jason]
<DD><A HREF="http://xaos.sf.net"
>http://xaos.sf.net</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
What is it, you ask?
</BLOCKQUOTE>
<BLOCKQUOTE>
Real-time fractal zoomer.
</BLOCKQUOTE>
<BLOCKQUOTE>
If that isn't enough to get you to run out and download it, you're probably
not the kind of person who would enjoy it.
<IMG SRC="../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<BLOCKQUOTE>
[Ben]
And don't forget to take a look at the sample fractals that come with
the "xaos" package, located (under <A HREF="http://www.debian.org/">Debian</A>) in <TT>/usr/share/XaoS/examples.</TT>
(I've got all of these converted to JPGs and use them as
randomly-selected desktop backgrounds.) Beautiful.
</BLOCKQUOTE>
<BLOCKQUOTE>
[Faber]
Yes, a very nice toy, but I still miss Fractint for DOS. The X/Windows
version had all the features, but just doesn't cut it somehow. A
Mandelbrot set not being full screen looses something, not to mention
they're slower than the DOS version.
</BLOCKQUOTE>
<BLOCKQUOTE>
I also had an internal IBM program[1] that would map out different phase
space maps stereographically, looking like some of the maps in the
Discrete screen saver in xscreensaver.. Man that was a fun toy; I wish I
could find the source code (it was floating around here on disk years
ago); I'd try to port that to Linux.
</BLOCKQUOTE>
<BLOCKQUOTE>
[1] For those of you that don't know it, IBM has a a mini Internet in
place with their own version of "free software", to wit programs written
by Beamers and distributed to other Beamers for fun and collective
profit. And since some of those people had multiple PhDs and worked on
esoteric stuff, some interesting programs cropped up. It's the only
thing I miss from my IBM days.
</BLOCKQUOTE>
<!-- end 15 -->
<hr>
<CENTER><Font face="Helvetica"><STRONG>
This page edited and maintained by the Editors of <I>Linux Gazette</I><br>HTML script maintained by <A HREF="mailto:star@starshine.org">Heather Stern</a> of Starshine Technical Services, <A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
<HR>
</p>
<!-- *** BEGIN author bio *** -->
<!-- *** END author bio *** -->
<div id="articlefooter">
<p>
Published in Issue 99 of Linux Gazette, February 2004
</p>
</div>
</div>
<br />
<div class="content twdtarticle">
<h1>The Answer Gang</h1>
</b>
</p>
<p>
<center>
<img src="../gx/dennis/qbubble.gif" alt="(?)"
border="0" align="left">
<A NAME="answer"><BIG><BIG><STRONG><FONT COLOR="maroon"
>The Answer Gang</FONT></STRONG></BIG></BIG></a>
<img src="../gx/dennis/bbubble.gif" alt="(!)"
border="0" align="right"><BR>
<STRONG>By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and...
(<a href="../tag/bios.html">meet the Gang</a>) ...
the Editors of <i>Linux Gazette</i>...
and You!
</STRONG></BIG>
</center>
<P>
<center><p>
<br>We have guidelines for <a href="../tag/ask-the-gang.html">asking</a> and <a href="../tag/members-faq.html">answering</a> questions. Linux questions only, please.
</STRONG>
<br><em><font color="#7F0000">We make <b>no guarantees</b> about answers, but you can be <b>anonymous</b> on request.</font></em>
<br>See also: The Answer Gang's
<a href="../tag/kb.html">Knowledge Base</a>
and the <i>LG</i>
<a href="http://www.linuxgazette.net/search.html">Search Engine</a>
</center>
<HR>
<!-- BEGIN message -->
<H3>Contents:</H3>
<dl>
<dt><a href="#tag/greeting"
><strong>¶: Greetings From Heather Stern</strong></A></dl>
<DL>
<!-- index_text begins -->
<dt><A HREF="tag/1.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Backing up with tar</strong></a>
<dt><A HREF="tag/2.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Hunting for new desktop hardware</strong></a>
<dt><A HREF="tag/3.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Software suspend troubles</strong></a>
<dt><A HREF="tag/4.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Oh-oh. This isn't looking good for the moment...</strong></a>
<!-- index_text ends -->
</DL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/greeting"><HR WIDTH="75%" ALIGN="center"></A>
<H3 align="left"><img src="../gx/dennis/hbubble.gif"
height="50" width="60" alt="(¶) " border="0"
>Greetings from Heather Stern</H3>
<!-- begin hgreeting -->
<p>Greetings, gentle readers, and welcome once more to the world of
the Answer Gang. TAG, we're it
<img src="../gx/dennis/smily.gif" alt=":D">
</p>
<p>
I have to confess that I wondered to myself, what should I babble
about this time? As I look at the back issues, I notice some
interesting statistics... apparently, I shouldn't feel surprised
that things here at <em>Linux Gazette</em> are a bit hectic. That's
consistent with all our past Februaries. Ain't tradition grand?
</p>
<p>
February here where I sit, is often considered the month of romance.
I have to admit... I (heart) <em>Linux Gazette</em>.
</p>
<p>
I mean, it's not like I will be buying it chocolates or wondering what
its favorite cologne is. But I put a bunch of work in every month - I
really like knowing you people out there are reading (hint, hint;
<a href="mailto:tag@linuxgazette.net">tell us</a> what you like in this
stuff)! I love seeing what sort of curious troubles are out there to solve
- the most curious, the kinds of things whose answers change over time.
And it's always worth seeing what cool answers are out there.
</p>
<p>
You don't have to actually be a member of the Answer Gang to send us juicy
answers, either. An honorary Answerbubble to folks who send us their good
stuff - or cc us on the the juicy tip they are sending to someone anyway.
When we got the Gang together, the heading mentioned a few of the active
posters... and you. That hasn't changed. It's teamwork that makes this
all happen, and I'm proud to be here. Thomas and I have teamed up to bring
you the juiciest threads this month, and I hope they make your time with
Linux this month - "just a little more fun!"
</p>
<!-- end hgreeting -->
<CENTER><Font face="Helvetica"><STRONG>
<br>Copyright © 2004
</STRONG></font></CENTER>
<SMALL><CENTER><H6 ALIGN="center">HTML script maintained by
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H6></SMALL></CENTER>
<HR>
</p>
<!-- *** BEGIN author bio *** -->
<!-- *** END author bio *** -->
<div id="articlefooter">
<p>
Published in Issue 99 of Linux Gazette, February 2004
</p>
</div>
</div>
<br />
<div class="content twdtarticle">
<h1>Lightweight, (Almost) Crypto-Free Remote System Operation</h1>
<p id="by"><b>By <A HREF="authors/ingles.html">Ray Ingles</A></b></p>
</b>
</p>
<p>
<blockquote>"There are two ways of constructing a software design. One
way is to make it so simple that there are obviously no deficiencies,
and the other is to make it so complicated that there are no obvious
deficiencies." - C.A.R. Hoare</blockquote>
<p>
<blockquote>"Sure I'm paranoid, but am I paranoid
ENOUGH?" - Unknown</blockquote>
<p>
<h2>Introduction</a></h2>
<p>
System administrators frequently want to be able to work on the machines
they run even when they are far away from them. There are secure tools
that allow full remote shell access, like ssh and lsh, but due to their
complexity they have suffered critical exploits from time to time.
In addition, their overhead can be excessive for some purposes. Fortunately,
other options are available that can be used alone or can be combined with
remote shells to create a more secure overall system.
<p>
<h2>Overview</h2>
<p>
Maybe the pager has just gone off when you're home in bed, and the boss
wants you to fix the broken database <i>now</i>. Or perhaps you're out
for lunch and someone calls to tell you the mailserver has been cracked
and is currently spamming the world, and you need to bring it down fast.
Possibly you've checked and your Web server has wedged itself and needs to
be restarted. Or suppose you're just on vacation and find you want to
update your home Web site with some new photos. In all these cases, you'd
like to do something to the machine over the Internet without having to
actually sit in front of it - things you don't want just <i>anybody</i>
to be able to do.
<p>
<h3>The Problem</h3>
<p>
Tools like <a href="http://www.openssh.org/">ssh</a> and <a
href="http://www.lysator.liu.se/~nisse/lsh/">lsh</a> are great for allowing
secure remote access to your system. They offer essentially full, flexible
remote control of a machine, in an encrypted and authenticated manner. But
they are complex pieces of software; there's no way to do what they do
<i>without</i> being complex. And with complexity comes bugs. SSH and lsh,
and related tools like <a href="http://www.webmin.com/">Webmin</a>, have
all had serious flaws that would allow an attacker to get full control over
your system. Leaving them available all the time is a risk - sometimes it's
necessary, but it's still a risk. And in some cases, you'd like to be able
to tell the machine to do something, but it's not even attached to the
network on a regular basis.
<p>
<h3>Some Solutions</h3>
<p>
It would be nice to enable remote shell access only when necessary. And
perhaps (for something like shutting down a mail server) you don't even
need a full shell, just a way to fire off a script remotely. Of course, the
problem then becomes, how do you know that the alternative software is any
more secure than ssh itself? Various people have worked on this problem in
the past, and several potential solutions are available, ranging from the
simple and venerable to the new and exotic.
<p>
<a href="#xringd">Xringd</a> uses a modem to control a machine remotely.
<a href="#mail">Mail filters</a> can be used to trigger actions based on
special messages. Some solutions (like <a href="#knock">'port knocking'</a>
and <a href="#pcap">'Net::Pcap'</a>) use the network, but without requiring
even a single open port. <a href="#lando">Lando</a> runs commands over a
network, using username and password. Most recently, a program specifically
for secure remote execution called <a href="#ost">Ostiary</a> has been
developed.
<p>
<h2>The Options</h2>
<p>
<h3><a name="xringd">Old School Remote Operation - Xringd</a></h3>
<p>
<a href="http://freshmeat.net/projects/xringd/">The eXtended Ring
Daemon</a>, or "Xringd", uses a modem to monitor rings on a phone line. It
counts the number of rings, and the time between them. If a 'sequence'
matches one of the ones that it has been set up to detect, Xringd will run
an associated command.
<p>
This is very nice from a security perspective. Since it uses no network
connection at all, it's entirely immune to network attacks like buffer
overflows. It can be used even when a network connection is unavailable
(it's often used to cause a computer to initiate a dialup connection).
The only 'client' you need is a phone. If you use it to start up ssh on
demand, then the attacker needs to know the right phone number and the
right ring pattern - it's quite hard to sniff that kind of thing remotely.
It's also highly resistant to a <a
href="http://en2.wikipedia.org/wiki/Man-in-the-middle_attack">man in the
middle attack</a>. (If you have to worry about someone rerouting your
phone calls, you're in more trouble than Xringd can save you from.)
<p>
There <i>are</i> some practical issues that may make this unattractive in
some circumstances. You need a modem and a telephone line to the server.
(Fortunately, you don't need a <i>fast</i> modem at all; even a 1200 baud
one will do nicely, but some servers are not placed close to a telephone
jack.) Also, things like answering machines or voicemail (or even other
people answering the telephone) can interfere with Xringd. If you give the
server a dedicated line, you can avoid these problems, but that can be
costly.
<p>
Finally, note that the rings you hear when making a call are not
necessarily synchronized with the ring signals actually sent to the
telephone. In most circumstances, they are close enough, but reliability can
be an issue at times.
<p>
<h3><a name="mail">Procmail And Other Mail Filters</a></h3>
<p>
Most of the mail filtering programs have a way to invoke scripts when
mail matching a pattern is received (in the simplest case, mail to a
particular address). Assuming the server is running an SMTP daemon,
this can be a nice way of <a
href="http://www.appelsiini.net/keitai l/archives/2001 12/0142.html">triggering
actions remotely</a>. Technically, one could even send a shell script
to be run, and have it e-mail the results back to you, giving you the
equivalent of a <i>very</i> slow remote shell. The only client needed
is an e-mail program, or even a webmail account.
<p>
The first problem is that if the box you want to talk to doesn't accept
e-mail, this obviously won't work. (Adding an entire mail server, with the
attendant risks of bugs, spam load, etc., just for remote execution doesn't
make a lot of sense.) Some machines only periodically collect e-mail from
a primary server, so there can be a substantial delay between when a
command is sent and when it is acted upon.
<p>
Furthermore, if you don't encrypt the traffic in some way (or at least
sign it with PGP), then anyone sniffing traffic between you and your server
may be able to take advantage of the same channel to do mischief, or
perform a man-in-the-middle-attack. (E-mail traffic is notoriously easy to
falsify; hence the avalanche of spam these days.)
<p>
<a href="http://cvtsa.sourceforge.net/">CVTSA</a>, or "ClairVoyanT
SysAdmin", is a system designed specifically for running commands
through e-mail. It has some support for using passwords, but does not
(currently) encrypt them in transit, so a sniffer could capture them
and use them again.
<p>
Of course, if the only things you want to do with this type of system
are emergency shutdowns and other such (hopefully rare) crisis management,
then even an unencrypted channel might work. However, you'll need to
change the 'magic trigger pattern' each time after you use it, or you
take the risk that an attacker might capture it and 'replay' it at an
inconvenient time.
<p>
<p>
<h3><a name="knock">Port Knocking</a></h3>
<p>
With <a href=http://www.linuxjournal.com/article.php?sid=6811>port
knocking</a>, a daemon monitors firewall logs, looking for particular
sequences of connection attempts to particular (closed) ports. When it
sees a sequence it recognizes, it runs the associated command. This
isn't terribly bandwidth efficient, but it has some nice properties.
First, it's hard to tell if a server is listening for port knocks.
Second (and most important), it's <i>awfully</i> hard to crack a closed
port. (Linksys routers have had a simple version of this for a while,
BTW, that they call <a
href=http://www.dslreports.com/forum/remark,1020195;root=equip,16;mode=flat>port
triggering</a>.)
<p>
However, a clever attacker with a sniffer could notice this traffic,
and duplicate it for their own use. More complicated encodings could
express something like a PGP signature (indeed, in theory one could
create an entire network protocol based on port knocks), but things
rapidly become difficult to work with. As with 'mail filtering'
solutions, one can either use it sparingly in emergencies, or move to
real cryptography.
<p>
It's also important to realize that this system is critically dependent
on the probe packets actually being delivered, and delivered in the
order that they were sent. This is <i>not</i> guaranteed on the Internet.
What's more, depending on where you're at (e.g., an Internet cafe or
behind a business firewall), you might not be allowed to connect out to
arbitrary ports. The more complex you make the 'knocks', the less
reliable the system will be.
<p>
Also, notice that at least one entire IP packet (28 bytes or so minimum)
is used to transmit roughly one bit of information. In terms of network
efficiency, it's almost hideous. For a simple 'open up ssh' message, it's
not a consideration, but actually adding cryptographic security to this
system could use up a decent chunk of the available bandwidth.
<p>
Finally, this increases the CPU load for each entry in the firewall
log. Depending on how detailed the logs are, and how fast and busy
the network is, this can be a significant drain on resources.
<p>
<h3><a name="pcap">'Sniffer' Triggers - libpcap and friends</a></h3>
<p>
Another interesting approach is to use <a
href=http://www.hackinglinuxexposed.com/articles/20030730.html>Net::Pcap</a>
or other network capturing software to look for specific packets on the
network (e.g., DNS requests) and examine them for particular data (e.g.,
a particular address). If found, it can enable ssh temporarily, or
perform other actions.
<p>
One potential benefit of this approach is that a computer doesn't have
to have an <i>address</i> on a network in order to monitor traffic on
that network. You can set the card to 'promiscuous mode' and examine
all the traffic on the wire. (It's <i>very</i> hard to hack a machine
you don't even know is there.) Once the 'trigger' is spotted, the
sniffer can use other means (a separate network, a serial link, even
Xringd) to open up SSH on a target machine. Of course, you can also
simply run the sniffer directly on the target.
<p>
Again, a clever attacker with their own sniffer may be able to detect
the unusual activity and correlate it. To make this system truly
secure, you would need more complex encoding/encryption of the 'trigger'
traffic.
<p>
Additionally, the CPU load for this solution can be even worse than for
'port knocking' systems. A 'port knocking' daemon monitors firewall
logs, which can have variable levels of detail. By necessity, a
'sniffer' solution must examine <i>every packet on the network
segment</i>, which can be a substantial task for a busy gigabit line.
<p>
<h3><a name="lando">Lando - Simple & Flexible</a></h3>
<p>
<a href="http://www.moonglade.com/lando/">Lando</a> allows a user to
run a preconfigured set of commands remotely, using passwords, and even
allowing the user to supply arguments to them. While it currently has
only a Windows client, and passwords are sent in the clear (making it
suitable only for use on a trusted local network, or perhaps on a VPN),
it can be very useful for, e.g. operating a local firewall box without
going to the trouble of logging in.
<p>
<h3><a name="ost">Okay, A <i>Little</i> Crypto - Ostiary</a></h3>
<p>
All of the above solutions have their advantages, but each has some
practical issues that can make them unsuitable for particular
applications. <a
href="http://ingles.homeunix.org/software/ost/">Ostiary</a> was designed
to be a secure alternative that uses minimal resources. It tackles this
problem with what might be termed "aggressive simplicity". It <i>does</i>
require an active connection to the network (unlike Xringd and sniffing),
but allows for much better default security with very low CPU, RAM, disk,
and network bandwidth requirements.
<p>
An Ostiary server has one open port that it listens on. When someone
connects, the server sends a random fixed length 'salt' message 16
bytes in size - the size of an MD5 <a
href="http://www.rsasecurity.com/rsalabs/faq/2 1 6.html">hash</a>. It
then waits (with a timeout) for a reply from the client. It reads (at
most) 16 bytes of reply, and closes the connection.
<p>
Ostiary has a list of commands to run, with associated passwords. It
runs through the list, and <a
href="http://www.faqs.org/rfcs/rfc2104.html">hashes these passwords with
the 'salt' it sent to the client</a>. If one of these hashes matches the
reply from the client, the associated command is run. (One final touch
is that a record is kept of connections, and clients with too many
failed attempts are 'locked out', and all subsequent communication from
them is ignored.)
<p>
A detailed <a
href="http://ingles.homeunix.org/software/ost/faqs.html">security
analysis</a> is available, but a few things about this system should
be clear. With a protocol this simple, the chances for dangerous
bugs are drastically reduced. Using fixed-length messages essentially
eliminates the chances of a <a
href="http://www.catb.org/esr/jargon/html/B/buffer overflow.html">buffer
overflow</a> or other memory error. (Indeed, Ostiary does no dynamic
memory allocation of any kind - everything is stored in static,
fixed-size data structures.) Replay and man-in-the-middle attacks are
also effectively useless. Ostiary limits how fast it accepts connections,
enforcing low CPU and network usage. (The first production Ostiary server
was a 16MHz 68030 machine.) Client requirements are even lower: Clients
are available for Palm Pilots and even Windows.
<p>
Unlike a procmail-based solution, where you can put arbitrary commands (with
arguments) in the message, Ostiary can only run the fixed set of commands
you have preconfigured. The only argument it supplies to the commands is the
IP address of the client that initiated the command. It requires an active
network connection (unlike Xringd) and an open port (unlike port knocking or
sniffing), which may entail configuring a firewall to open a new port.
(Although one <i>could</i> run Ostiary on, say, port 22, and upon receipt of
the correct command, it could terminate itself and spawn sshd...)
<p>
Since Ostiary uses TCP, it is as reliable as the network it uses to
communicate. Problems with miscounted phone rings (a la Xringd) or randomly
dropped packets (a la port knocking) are not a concern.
<p>
<h2>Summary</h2>
<p>
The following table summarizes the pros and cons of the various systems
outlined above. "Replay" and "Man-in-the-middle" indicate if the default
system is vulnerable to the corresponding attacks. "Command arguments"
indicates if the system can run arbitrary commands with arguments. "CPU
load" indicates that CPU time can be a significant consideration. "Special
client" indicates that a specific client program is needed to work with
that system.
<p>
<TABLE BORDER=1>
<TR><TD>System</TD><TD>Xringd</TD><td>Mail filter</td><td>Port knocking</td><td>Sniffers</td><td>Lando</td><td>Ostiary</td></TR>
<TR><TD>Network Required?</TD><TD> </TD><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></TR>
<TR><TD>Port Required?</TD><TD> </TD><td>Yes</td><td> </td><td> </td><td>Yes</td><td>Yes</td></TR>
<TR><TD>Modem Required?</TD><TD>Yes</TD><td> </td><td> </td><td> </td><td> </td><td> </td></TR>
<TR><TD>Replay?</TD><TD> </TD><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td><td> </td></TR>
<TR><TD>Man-in-the-middle?</TD><TD> </TD><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td><td> </td></TR>
<TR><TD>Command arguments?</TD><TD> </TD><td>Yes</td><td> </td><td> </td><td>Yes</td><td> </td></TR>
<TR><TD>CPU load?</TD><TD> </TD><td>Sometimes</td><td>Yes</td><td>Yes</td><td> </td><td> </td></TR>
<TR><TD>Special client?</TD><TD> </TD><td> </td><td>Sometimes</td><td>Sometimes</td><td>Yes</td><td>Yes</td></TR>
</TABLE>
<p>
None of these approaches is right for everyone. But all of them can be
used to make attacks at least more inconvenient, and in many cases far
more difficult. Remember, though, to analyze their pros and cons
relative to your specific situation. Also remember that true security
is a process, not a goal - you can never just install some software
and be done thinking about it.
</p>
<!-- *** BEGIN author bio *** -->
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
Ray Ingles has been involved with Linux since 1995. In
addition to being an active member of the
<a href="http://www.mdlug.org">Metro Detroit Linux User's Group</a>,
he has made minor contributions to the UPS HOWTO and the Linux
Joystick Driver.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<div id="articlefooter">
<p>
Copyright © 2004, <A HREF="authors/ingles.html">Ray Ingles</A>. Copying license
<a href="http://linuxgazette.net/copying.html">http://linuxgazette.net/copying.html</a>
</p>
<p>
Published in Issue 99 of Linux Gazette, February 2004
</p>
</div>
</div>
<br />
<div class="content twdtarticle">
<h1>XMLTV</h1>
<p id="by"><b>By <A HREF="authors/lovett.html">Bill Lovett</A></b></p>
</b>
</p>
<p>
<p>Where do you go to find out what's on TV? The usual suspects might include
a newspaper, a recent issue of <i>TV Guide</i> magazine, a favorite Web site, or your nearest
TiVo, ReplayTV, or other PVR. But don't forget to add Linux to the top of that
list. You can let the machine do the dirty work and bring the listings to you. XMLTV, a
short bash script, and a cron job are all you need to get started.</p>
<h2>Installation</h2>
<p>First things first: getting the program installed. XMLTV is a suite of Perl
scripts and can be downloaded from
<a href="http://membled.com/work/apps/xmltv/">membled.com/work/apps/xmltv</a>.
There are releases for Unix-like and Windows environments, but, for obvious reasons,
we'll focus on the former. If you're installing from source, it's the usual
routine:</p>
<pre>
% perl Makefile.PL
% make
% make test
% make install
</pre>
<p>If you're on Debian, it's all just an apt-get away
(<code>apt-cache search xmltv</code>). Links to packages for OS X, Red Hat 8, and Red Hat 9 are
available from the project's homepage.</p>
<h2>Configuration</h2> <p>Before XMLTV can be useful, it needs to know where in
the world you are. XMLTV is international— it can fetch TV listings for
Canada and the United States, the United Kingdom, Austria and Germany, New
Zealand, Finland, Italy, Spain, the Netherlands, Denmark, and Hungary. (Belgium
and France are in the works.) The scripts that collect listings for a
particular country are referred to as grabbers, and you'll find them on the
command line under <code>tv_grab_*</code>. We'll use the U.S. grabber,
<code>tv_grab_na</code>.
<p>When you first run the grabber, do so with the <code>--configure</code> option. This
starts a question-and-answer session in which you and the grabber get a little
bit better acquainted, as far as your Zip code, TV service provider, and
channels you want to ignore are concerned. The results of the script are written to
<code>~/.xmltv/tv_grab_na.conf</code>, and can be easily edited by hand.
<p>At this point, XMLTV is ready to do your bidding. Do a <code>man tv_grab_na</code> to learn
about all the available options. For now, just two will suffice:
<pre>
% tv_grab_na --days 1 --output /tmp/tv.xml
</pre>
This tells the grabber to get one day's worth of listings, and save them out to <code>/tmp/tv.xml</code>.</p>
<p>XMLTV's file format doesn't quite make for friendly reading, unless you
enjoy reading raw markup. A few more scripts from the suite can fix that. <code>tv_sort</code>
sorts the contents of an xmltv file date.
<code>tv_grep</code> lets you weed out some of the obvious cruft in the
listings. Here's how I run it:
<pre>
% tv_sort --output /tmp/tv_sorted.xml /tmp/tv.xml
% tv_grep --output /tmp/tv_grepped.xml --ignore-case --not --category Children \
--not --category Sports --not --title "Paid Programming" \
--not --title "Local Origination" \
--on-after now /tmp/tv_sorted.xml
</pre>
The commands above sort the original file and then discard anything
categorized as "Children" or "Sports", and anything with "Paid Programming"
(infomercials) or "Local Origination" (public access) in the title. Also,
we're discarding everything that aired before the script ran.</p>
<p>At this point, we've still got an XML file. Converters to the rescue!
<code>tv_to_text</code> is one of the tools that can help us go from XML to something else.
(Other possibilities include LaTeX, HTML and PDF. Check the readme to see what's
currently available.) After running something like this:
<pre>
% tv_to_text --output /tmp/tv.txt /tmp/tv_grepped.xml
</pre>
We get output like this:
<pre>
21:00--21:30 Spy School 38
21:00--21:30 Designing for the Sexes // European Kitchen 64
21:00--21:30 Chappelle's Show 67
21:00--21:30 The Real World // Las Vegas 71
21:00--22:00 Law & Order: Special Victims Unit // Guilt 44
21:00--22:00 Wild Card // Auntie Venom 45
21:00--22:00 Cold Case Files // The Accidental Killer; Little Sister Lost 57
21:00--22:00 America's Most Wanted: America Fights Back // Top Ten Most Wanted Fugitives 5
21:00--22:00 The FBI Files // The Price of Greed 60
21:00--22:00 Trading Spaces // Nashville: Murphywood Crossing 61
21:00--22:00 Great Chowder Cook-Off 63
21:00--22:00 Ends of the Earth // Secrets of the Holy Land 65
21:00--22:00 The E! True Hollywood Story // The Hilton Sisters 68
...
</pre>
Simple and no frills. Just what we need for the final step: e-mail delivery.</p>
<h2>Delivery</h2>
<p>If we stopped at this point we'd have used several of XMLTV's abilities but
hardly anything else. We'd also be running low on convenience and automation.
Fortunately, we can wrap all the commands we've seen so far into a shell
script, and have it e-mail us the final results. <code>mail</code> can take care
of, well, the mailing:
<pre>
% mail -s "Today's TV listings from XMLTV" user@localhost < /tmp/tv.txt
</pre>
Here's what the full script looks like (<A HREF="misc/lovett/xmltv_daily.sh.txt">text version of this listing</a>):
<pre>
#!/bin/sh
# Grab today's listings:
tv_grab_na --days 1 --output /tmp/tv.xml
# Sort
tv_sort --output /tmp/tv_sorted.xml /tmp/tv.xml
# Grep
tv_grep --output /tmp/tv_grepped.xml --ignore-case --not --category Children \
--not --category Sports --not --title "Paid Programming" \
--not --title "Local Origination" \
--on-after now /tmp/tv_sorted.xml
# Convert To Text
tv_to_text --output /tmp/tv.txt /tmp/tv_grepped.xml
# Email
mail -s "Today's TV listings from XMLTV" user@localhost < /tmp/tv.txt
</pre>
Put that in a cron job that runs once per day, and you've got TV listings with no outside advertising,
and no channels or shows you know you aren't interested in.</p>
<p>More importantly, you've got a foundation to build on. What we've
covered is just the beginning— beyond the command-line scripts, a
GUI client is also available. Of course, there are plenty more things you could do from the
command line, such as:
<ol>
<li>Pull in data from imdb.com via <code>tv_imdb</code></li>
<li>Split the listings into separate files for each day and channel via <code>tv_split</code></li>
<li>Transform the XML with your own XSLT stylesheet.</li>
<li>Only send e-mail if certain keywords are found</li>
</ol>
It all depends on how you want to consume the information, and how cleverly you can chain all the scripts
together.</p>
</p>
<!-- *** BEGIN author bio *** -->
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
Bill Lovett is a Web developer in New York City. He's one of those PHP/MySQL
types. And he has this weird thing about running Linux on old machines that by
all rights should have been trashed years ago. Read more about Bill and his
Open Source projects at <a
href="http://www.ilovett.com">www.ilovett.com</a></i></p>
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<div id="articlefooter">
<p>
Copyright © 2004, <A HREF="authors/lovett.html">Bill Lovett</A>. Copying license
<a href="http://linuxgazette.net/copying.html">http://linuxgazette.net/copying.html</a>
</p>
<p>
Published in Issue 99 of Linux Gazette, February 2004
</p>
</div>
</div>
<br />
<div class="content twdtarticle">
<h1>Let's Build a Cool Linux Toy</h1>
<p id="by"><b>By <A HREF="authors/pramode.html">Pramode C.E</A></b></p>
</b>
</p>
<p>
Many of us make a living out of Linux - but, if
somebody asks us why we are so crazy about it, one
common answer would be `fun'. Playing with Linux is lots
of fun - with the added benefit that, most of the time,
you end up learning a lot. Recently, I happened to come
across a nice <a href="http://www.linuxtoys.net">book</a> which tries to emphasize the `fun' aspect
of Linux - it describes several small `projects' (a jukebox,
a picture frame, etc.) that a moderately experienced Linux
user may be able to implement on her own. One of the projects involved
interfacing with a temperature-sensing element and putting up
the temperature value on a Web page (or including it in your email
signature - and any other crazy stuff which you can imagine!). The
only trouble was that, in the <b>part of the world where
I live</b>, walking up to an electronics store and asking for an
<b>integrated, 1-wire temperature-sensing element</b> is
more likely to yield a hard stare than anything else. Smart sensors that
can be directly interfaced to the PC with the minimum of fuss
are seldom available off-the-shelf - you will mostly have to `roll your own'
- which adds to the fun and excitement. With a low-cost general purpose
microcontroller like the PIC16F628, bits and pieces of cheap, commonly available
electronics components, and LOTS of code, you can build many interesting `toys'
and hook them up to your Linux machine - a really great learning experience
for the hardware hacker who wants to learn Linux, or the Linux hacker who wants
to learn a bit of hardware. This article describes how I went about building
my temperature-sensing project - amateur Linux/hardware hackers might find some
of the ideas useful when they start building things on their own.
<h2>Get a PIC micro, and set it up to work with Linux</h2>
<p>
This is the first step. <a href="http://www.microchip.com">Microchip</a> PIC controllers are commonly
available. If you are like me, working with a soldering iron
for more than 10 minutes would drive you crazy - so you have to
choose the right kind of PIC - the one that can be programmed
with the simplest possible circuit (connected to the PC parallel
port), preferably with a 5V supply. Look no further than the
PIC16F628. This is a cool device that has lots of peripherals (except
the ADC - but then, we can roll our own crude analog-to-digital
converter with the comparator and pulse width modulation facilities
offered by the PIC) and supports a `Low-Voltage Programming Mode'. I
found a nice little circuit (the simplest circuit, and one
that works perfectly, out of the dozens I have seen on the Net)
designed by <b>Jim Paris</b> for a microcontroller programming laboratory
at MIT. Here is the circuit:
<p>
[<A HREF="misc/pramode/lvp.png">diagram</A>]
<p>
I assembled the circuit on a breadboard for testing in a
few minutes' time.
<p>
<img src="misc/pramode/test.png">
<p>
<b>Jim Paris</b> has designed a program (called `jimpic') for
burning machine code onto the flash memory of the microcontroller. It is
available for download from <a href="http://web.mit.edu/6.115/www/pic.shtml">here</a>. I
wrote a simple assembly language program, converted it into
machine code with the help of the `gpasm' assembler available
as part of the <a href="http://gputils.sourceforge.net">GNU PIC
Utilities Project</a> and burned it onto the micro by running `jimpic'
with the `-b' option.
<h2>A Quick Introduction to PIC programming</h2>
<p>
A nice thing
about the PIC is that, if you have some background in general microprocessor
architecture and assembly language programming, you can become productive
with it in just about one or two hours' time. The instruction set is
very compact (35 instructions) and sufficient for most simple bit-twiddling
tasks. The PIC16F628 packs a decent 224 bytes of data memory with 2K of program
(code) memory. The peripherals include general-purpose digital I/O ports,
three timers, two analog comparators, on-chip voltage reference module,
Universal Synchronous-Asynchronous Receiver Transmitter (for serial communication),
and Capture-Compare-PWM module. Special CPU features include a watchdog timer,
brown-out detect circuitry, and an internal RC oscillator (so that you won't be
needing an external crystal if you aren't too concerned about precise timing).
<p>
The general purpose data RAM begins at address 0x20 (the locations below this
are Special Function Registers - basically memory mapped I/O ports,
control registers etc.). Here is an elementary assembly language program, which
simply stores the value 0 into the accumulator (the `W' register, in PIC
terminology).
<p>
[<a href="misc/pramode/a.txt">Listing 1</a>]
<p> (Remove the .txt extension if you download the listing. It's there only to
ensure browsers display it properly.)
<p>
We will now assemble the file:
<pre>
gpasm -a inhx8m a.s
</pre>
<p>
The result is an Intel hex format file, which can be given to `jimpic' for
burning. Each line of the hex file contains a few bytes of machine code,
the address at which the machine code is to be stored (in the flash memory
of the microcontroller), some kind of checksum, and some other information. Here
is the hex file generated by running `gpasm' over our assembly language program:
<pre>
:020000000030CE
:02400E00983FD9
:00000001FF
</pre>
<p>
The first line of our program tells the assembler that
machine code is to be generated for the PIC16F628. The second line includes
a file (available with the `gputils' distribution) that contains lots
of symbol definitions. The third line, a __CONFIG directive, tells the
assembler what special features of the microcontroller (say, the Watchdog
timer) should be enabled/disabled by writing bit patterns to a `magic'
`configuration word' within the PIC; _WDT_OFF means we don't want the watchdog
to be enabled, _INTRC_OSC_NOCLKOUT means we are going to use the internal
oscillator to provide the timing signals necessary for program execution.
You will have to refer to the 16F628 datasheet to know more about these
configuration bits. The fourth line is the only proper assembly language
instruction in the program - it moves the `literal' (constant) value 0
to the `W' register. Note that each line begins with a tab.
<h2>Lighting up an LED</h2>
<p>
Here is a program that lights up an LED connected to the RB0 pin of
the microcontroller:
<p>
[<a href="misc/pramode/led.txt">Listing 2</a>]
<p>
PORTB is an eight-bit port - the direction of each pin (i.e., whether the
pin is to act as input or output) is controlled by individual bits of
the TRISB register - if a TRISB bit is set, the corresponding PORTB pin
is input - otherwise it is output. The PIC has the concept of `banked' addresses, which
is rather confusing to the beginner. (It's a headache even if you
are an `experienced' developer.) You visualize `banks' of special function
registers - the STATUS register is the same across all the banks while
the TRISB register is available only in bank 1. You are by default in bank 0.
To access TRISB, you have to `switch over' to bank 1. This is by setting the
RP0 bit of the status register. (When you read microcontroller manuals, you
will see that not only are the control registers given special names, even
the individual bits are named. Header files available with the development
kit for the microcontroller map these symbolic names to the numbers given in
the manual, making the life of the assembly programmer a bit easier.) The `bsf'
instruction (bit set f - `f' represents the fact that the number that comes
as the operand for the instruction represents a memory address or a special
function register and not a `literal') takes two operands - the first
one being the address of a RAM location or a special function register, and
the second, a bit number. The `movwf' instruction copies the contents of the
`W' register to the memory location whose address is the operand of
the instruction.
<h2>Building a `running' circuit</h2>
<p>
After assembling and burning the above program, we are ready
to see it in action. The running circuit can be built in a
jiffy - place +5V on the VDD pin of the PIC (pin 14), connect
Vss (pin 5) to circuit ground, connect MCLR (pin 4) to +5V through
a 2K resistor, connect the LED between RB0 and Gnd with a current
limiting resistor of say 1K in series - and that's all. You should
see the LED lighting up as soon as you apply power. Your next
attempt will be to make the LED blink - for that you will have
to read a little bit more about the PIC instruction set - the manual
will come in handy at this juncture.
<h2>Debugging tips</h2>
<p>
Here are some things that I have found handy while debugging:
<ul>
<li>Check the power supply
<li>Don't jump into conclusions that the hardware is
wrong - you might have misinterpreted the datasheet, your
program logic might be wrong, or
worse still - the data sheet might be WRONG. Which brings
us to the next rule, which is:
<li>Always read the manufacturers' errata - if they have
one. The 16F628 datasheet contains some errors
- especially concerning writes to EEPROM data memory and
the behavior of the MCLR pin in low-voltage programming
mode.
<li>Don't think the hardware will never malfunction
- for example, the PIC might consume larger current when
writing to the internal data EEPROM; your battery-powered supply might
not be able to deliver the required current, and your program will
misbehave. If you have an external crystal, it might not be working
properly, and the micro might not be getting its clock.
<li>Google Groups is your friend - use it wisely. Search the archive;
somebody might have experienced the same problem before. Post a message
if you feel that your problem is something `original'.
</ul>
<h2>The temperature sensor interfacing project</h2>
<p>
The <b>LM35</b> is a commonly available calibrated temperature sensor
that converts temperature (in degrees Celsius) to
voltage - each degree rise in temperature results in
10mV rise in output voltage. It's a three-pin device -
Vcc, Gnd, and voltage output. You can get the datasheet
from <a href="http://www.national.com/pf/LM/LM35.html">here</a>. Say the current temperature
is 23 degrees Celsius; the voltage output would be 230 millivolts.
<p>
The question is, how do you convert this voltage to a
digital value? The easiest way would be to use a
commodity analog-to-digital converter,
and interface it to the printer port. Another solution
would be to use a PIC with a built in ADC (say the 12F675).
The third would be to use some of the peripherals available
in the 16F628, write some code, and build a crude ADC of
your own. As I had explored the first two options a lot in
the past, I thought of trying out the third one.
<p>
Two peripheral features of the PIC are of interest to
us here - one is the builtin PWM module (Pulse Width
Modulation), which is capable of generating, in, hardware,
a continuous stream of digital on-off pulses whose duty
cycle can be varied simply by storing certain numbers in
specific special function registers. Once the PWM module
is initialized to generate a pulse train of a specific duty
cycle, it will keep on doing so without any software intervention -
our program can do something else.
<p>
The PIC is also equipped with two analog comparators, which
can be configured in a variety of ways. Let's say we are using
just one of the comparators. Two PORTA pins can be programmed
to accept voltage levels and transmit them to the Vin+ and Vin-
pins of the comparator. The comparator output is high if the
Vin+ voltage is greater than the Vin- voltage, and low otherwise.
The output can be made available on another PORTA pin, or it
can be simply read from a particular bit of the Comparator Control
Register, CMCON.
<h3>Filtering PWM pulses</h3>
<p>
<img src="misc/pramode/filter.png">
<p>
The figure shows a PWM pulse (off OV, on +5V) of period T being fed to an RC circuit (R*C >> T).
If the on-off periods are equal, the output seen across the capacitor
will be a constant DC level of magnitude 2.5V. Electrical engineering text books
should give you the reason why it is so - or, if you are not very sure of
the math involved (as I am), play with some R and C values until you get the
desired effect. Now what if you feed a PWM pulse whose on-time is less than
T/2? You will see that the output is again a DC level, but the magnitude has
come down proportionately. What if you increase the on-time? Again, the
output is a DC level, only thing is the magnitude has increased proportionately.
Now you have a cool way to implement a DAC, a digital-to-analog converter.
Say you want to generate a voltage of 0.449V. What if you program the PIC
so as to generate a PWM pulse train of period 256 microseconds and on-time
128micro. The output voltage would be 5V*(128/256.0) = 2.5V. Now, what if
the on-time is 23 micro seconds? The output is 5V*(23.0/256) = 0.449V. (I
use Python to do these quick-and-dirty calculations. It's one of my
favourite uses of this great language.) The
on-time can be altered easily by writing some numbers to two registers, CCPR1L
and CCP1CON. A pure digital way to generate analog voltage!
<h3>From DAC to ADC</h3>
<p>
What has all this got to do with converting the LM35 sensor's analog
voltage output to a numerical value? Well, a DAC, together with a comparator,
builds up an ADC. How? Say the maximum and minimum temperatures at your
place of residence can never go above/below 45 degree Celsius and
20 degree Celsius. So the sensor's output will always be between
.45V and .2V (remember, 10mV per degree change in temperature). We
start generating a PWM signal of period 256 microseconds. The RC-filtered
output is fed to Vin+ of the comparator, and the sensor's output is
fed to Vin-. Let's say the sensor output is .3V. If the PWM on-period
is 23 microseconds, the filtered DC level would be 5*(23.0/256) = 0.449V.
So, Vin+ is greater than Vin-, and the comparator output (as obtained
from a bit of the CMCON register) is high. Now, we start bringing down
the on-time. At a certain point, Vin- will go above Vin+, and the comparator
output drops to zero. The magnitude of the on-time at this point is
a true representation of the analog value of the sensor output. We communicate
this number to a program running on the Linux box through a serial
link. You can download the PIC assembly language program that does
all these tricks:
<p>
[<a href="misc/pramode/pwmadc.txt">Listing 3</a>]
<p>
Instead of performing a `linear' search from the high boundary down to
the lower one, we can think of generating a voltage that lies in the
middle of this range and comparing it with the sensor output. If the
comparator says that the sensor output is higher, we can repeat the
same procedure on the upper half. This is the classical `binary search'
applied to solve a hardware problem! <b>Horowitz and Hill</b>, in their
book <b>The Art of Electronics</b>, have oscilloscope traces of this
binary search in action! Computer programmers should always show a good
amount of skepticism towards code that claims to do binary search -
the algorithm looks deceptively simple - but is in fact not very easy
to implement correctly.
<p>
<h2>Back to Linux</h2>
<p>
The PIC micro sends the temperature data it has gathered out through
a port pin (RB2) in a serial manner - this port pin is directly connected to the
receive pin of the PC serial port. What remains is to write a program
that will read this data and process it in some manner. Even though
the RS-232C serial communication standard defines an `on' voltage to be
between -3 and -12V and an `off' to be between +3 and +12, I have been
able to get satisfactory results using the 0 and 5V logic outputs from
the PIC port pin - if it doesn't work out for you, you will have to
place a device like the MAX232 between the PIC port pin and the
PC serial port receive pin.
<h3>Interfacing with the serial port</h3>
<p>
Let's look at the simplest way to interface an external
circuit to the serial port. (We won't be sending any data
out through the PC serial port - that would make the circuit
a wee bit more complex.) Pin number 2 of
the 9-pin PC serial port connector is the receive pin, 3 the transmit
pin, and 5, Ground. Let's say the PIC is sending data out
through its RB2 pin at 9600 bits per second, 8N1 (8 data bits,
no parity, 1 stop bit) format. The UART that controls the
PC serial port should be programmed for this particular baud
rate and data format. This can be done by writing magic bit
patterns to certain control registers. Once that is done, our
program can keep on polling a bit of the UART status register
to know whether a new data byte has arrived. Here is the code
listing:
<p>
[<a href="misc/pramode/recv.txt">Listing 4</a>]
<p>
The program has two disadvantages. One, it is using low-level
I/O calls, which, if they are to work properly, should be
preceded by an iopl() call. Only the superuser can call
iopl() successfully - so the program should run under root privilege.
We are wasting CPU time when we keep polling for data in
a tight loop; that's another big problem. Both are solved by
not directly interacting with the hardware - we can make use of
system calls to talk to the serial driver within the Linux kernel -
which will do all the low level stuff needed to manage blocking,
interrupt driven I/O.
<h3>Serial I/O in Python</h3>
<p>
The Python `termios' module can be used for doing serial comm
at a higher level. <b>Isaac Barona Martinez</b> has written
a simple wrapper over `termios'. It is called <b>uspp</b> and
is available for download from <a href="http://balder.prohosting.com/ibarona/en/python/uspp/">here</a>. Using
this module, reading from the serial port is a breeze:
<p>
[<a href="misc/pramode/uspp.txt">Listing 5</a>]
<pre>
from uspp import *
# COM1 is initialized at 9600 baud. The
# default data format is 8N1
s = SerialPort("/dev/ttyS0", None, 9600)
s.flush() # discard unread bytes
print ord(s.read()) # s.read() returns a one-character
# string. We convert it into its ascii
# value
</pre>
Once you get this far, let your imagination run riot!
<ul>
<li>Write a simple server that accepts connections over
the network and transmits the current temperature
<li>Write a program that keeps on reading the temperature at
say, half-hour intervals. The temperature reading, together
with some stupid message like `Oh - it's burning hot here' can
be placed at the end of your `.signature' file!
<li>Another idea would be to use something like the Python
`ftplib' to upload the temperature reading to your Web server
periodically.
</ul>
<h2>Acknowledgements</h2>
<p>
Thanks to <b>Christopher Negus</b> and <b>Chuck Wolber</b>
for a really cool book!
<p>
Thanks to <b>Jim Paris, Ariel Rodriguez and Sheldon Chan</b> for the excellent
`jimpic' hardware and software. As I had mentioned earlier
in this article, I find it to be the easiest way to get
started with PIC programming under Linux. Thanks to <b>
Isaac Barona Martinez</b> for <b>uspp</b>, which
simplifies serial programming a lot.
<h2>Conclusion</h2>
<p>
There are two excellent documents that describe serial
programming under Linux. One is the <a href="http://www.tldp.org/HOWTO/Serial-Programming-HOWTO">Serial
Programming HOWTO</a>. The other is <a href="http://www.easysw.com/~mike/serial/">Serial
Programming guide for POSIX operating Systems</a>. The
<a href="http://www.microchip.com">Microchip</a> home page
contains lots of application notes, reading which might give
you ideas for your next Linux hardware hack - just don't
forget to share the fun with LG readers! I can be
contacted via my home page at <a href="http://pramode.net">pramode.net</a>.
</p>
<!-- *** BEGIN author bio *** -->
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
I am an instructor working for IC Software in Kerala, India. I would have loved
becoming an organic chemist, but I do the second best thing possible, which is
play with Linux and teach programming!
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<div id="articlefooter">
<p>
Copyright © 2004, <A HREF="authors/pramode.html">Pramode C.E</A>. Copying license
<a href="http://linuxgazette.net/copying.html">http://linuxgazette.net/copying.html</a>
</p>
<p>
Published in Issue 99 of Linux Gazette, February 2004
</p>
</div>
</div>
<br />
<div class="content twdtarticle">
<h1>OCaml, an Introduction</h1>
<p id="by"><b>By <A HREF="authors/stellingwerff.html">Jurjen Stellingwerff</A></b></p>
</b>
</p>
<p>
<p>Object Caml is an ML type of language. For the non-gurus: it's a functional
language that can also be programmed in a non-functional and object-oriented way.
</p>
<p>This language is really easy to learn. It's powerful and keeps impressing
me with its speed. Programs written in this language are almost always stable
by default. No segmentation faults, only occasional unending loops for the
programmers that still hang on to program their own loops. It is really not
needed to write most loops, since the libraries contain standard functions that
are good enough in 99% of the cases. So try to use those functions: It really
pays off in terms of stability of your programs, and, unless you have intimate
knowledge of the inner works of this language, they tend to be better
optimised.
</p>
<p>The language can be obtained from the website <a href="http://caml.inria.fr">caml.inria.fr</a>. Here, they provide RPMs for the RedHat 7.2/8.0/9 and Mandrake 8.0 distributions. Also MS Windows binaries are available, but not all Unix library functions will work there, for some mysterious reason. The source tarball does compile flawlessly for me. It just has a somewhat unusual makefile layout:
</p>
<pre>
# ./configure
# make world; make opt; make install
</pre>
<p>The normal libraries include many usable data-structures like balanced trees, hash tables, and streams.
Their version of header files (.mli files) contain all the basic documentation you need, and those are directly converted into HTML and published on the Web in their OCaml manual. This manual is not very usable to study this language, so I'll try to explain here some of the basic language constructions. This is just to give you an impression of the power of this language.
</p>
<h3>Modules & Functions
</h3>
<p>
Now some real life examples. I wrote a program to help administrating a computer. It is a subset of a normal file finder, but is a command line tool and very fast. It helps locating large, not-recently-used files to be deleted from the system. It crawls through the directory tree and show the contents in different layouts.
</p>
<p>
Every module in OCaml has its own namespace. Specific definitions can be found by adding the module name, with the first character an upper-case character. You can also change the namespace of the current program to include a total module. Normally, only the standard module '<a href="http://caml.inria.fr/ocaml/htmlman/libref/Pervasives.html">pervasives.mli</a>' is included in the default namespace.
The example program 'show.ml' starts with:</p>
<pre>
open <a href="http://camlserv.sourceforge.net/Basics.html">Basics</a>
open <a href="http://caml.inria.fr/ocaml/htmlman/libref/Unix.html">Unix</a>
open <a href="http://caml.inria.fr/ocaml/htmlman/libref/Unix.LargeFile.html">Unix.LargeFile</a>
</pre>
<p>
This includes my own set of 'basics' functions and 2 standard libraries: 'Unix' and 'Unix.LargeFile'. A module normally consists of 2 files. The first file for exporting definitions 'module.mli' (like the C .h file), and the second one for actual code (the 'module.ml' file). The program uses the function 'string_sub' that provides a foolproof version of the 'String.sub' standard function (from the string.mli module).
The basics.mli file contains the lines:
</p>
<pre>
val string_sub: string -> int -> int -> string
(** Get the sub string from a [string] from position [from] with [length].
This is the same function as String.sub, but it will never raise an exception.
And a negative [from] value is counted from the right side of the string. *)
</pre>
<p>
This gives the definition of this function and the description. There is an automatic documentation generator (ocamldoc) that reads .mli files and writes .html files as basic interface documentation. Normal comments start with (* but the documentation generator only writes comments that start with (** to the .html files. This document contains links to the documentation of the used modules.
This documentation is really helpful to start programming ocaml. The .mli files are all included in the distribution, but the complete <a href="http://caml.inria.fr/ocaml/htmlman/index.html">manual</a> and a <a href="http://caml.inria.fr/oreilly-book/">book</a> can be downloaded from the Web site <a href="http://caml.inria.fr">caml.inria.fr</a>
</p>
<p>
The function is followed by its type. It wants 3 parameters and provides a string. Normally we need to write 'Basics.string_sub' to use this function. But after the 'open Basics' instruction just 'string_sub' is enough.
</p>
<h3>Basic operations and function calls
</h3>
<p>
Now, back to the main program again. The first function is 'gettype'. It will try to return the type of a file. The file type is defined as the part of the filename following the last '.'. When there is no dot, the type is unknown and returned empty.
</p>
<pre>
let gettype file =
try
let pos = String.rindex file '.' in
String.sub file (pos+1) (String.length file-pos-1)
with Not_found -> ""
;;
</pre>
<p>
This function only uses standard functions. First, it catches the Not_found
exception in the 'try' 'with Not_found -> ""' code. All other exceptions will
be passed to the caller to be handled, and can possibly stop the main program.
The local variable pos get is filled with the result of the function <a
href="http://caml.inria.fr/ocaml/htmlman/libref/String.html#VALrindex">rindex</a>.
This function is also the reason to catch the exception; otherwise, the main
program might stop on the first found file with no '.' in it. Local variables
can be declared everywhere inside ocaml with 'let <variable> = <value> in
<code>'. After the completion of the given code, the variable is out of
scope and will be forgotten. The data will be passed to the garbage collector
to be removed from memory.
Function calls do normally use brackets. The function call to '<a href="http://caml.inria.fr/ocaml/htmlman/libref/String.html#VALsub">String.sub</a>' gets 3 parameters the string 'file' the integer '(pos+1)' and the integer '(String.length file-pos-1)'.
The last parameter calls the function 'String.length' with a single parameter 'file'. So, the functions are eager for their parameters; brackets are needed only when the parameters are filled with calculations.
</p>
<p>
Also '<a href="http://caml.inria.fr/ocaml/htmlman/libref/Pervasives.html#VAL(+)">(+)</a>' and '<a href="http://caml.inria.fr/ocaml/htmlman/libref/Pervasives.html#VAL(+)">(-)</a>' are functions of the pervasives module. It is very easy to define your own operators; just add brackets around their definition, and they are ready.
</p>
<h3>If then else
</h3>
<p>
The next routine 'filesize' in the example code is far longer, but largely introduces sub-functions and 'if <bool-expr> then <expr> else <expr>' statements.
This function creates a string from an int64 number for human readable file and directory sizes. The types of parameters are normally not given; they are determined by ocaml through their usage. When something is not clear, the compiler or interpreter will complain about it before executing the code.
</p>
<pre>
let filesize s =
let tostr f =
if f>9.9 then
string_of_int (int_of_float (f +. 0.5))
else
let res = string_of_float (floor (f *. 10.0 +. 0.5) /. 10.0) in
if String.length res=2 then
res ^ "0"
else
res
in
let bytes = Int64.to_float s in
if bytes > 512.0 then
let kb = bytes /. 1024.0 in
if kb > 512.0 then
let mb = kb /. 1024.0 in
if mb > 512.0 then
let gb = mb /. 1024.0 in
tostr gb ^ " Gb"
else
tostr mb ^ " Mb"
else
tostr kb ^ " kb"
else
Int64.to_string s
;;
</pre>
<p>
The ocaml standard library has a set of conversion functions. These functions normally follow the form of 'int_of_float' and 'string_of_float'. Specific types like 'Int64' use shorthand notations like 'Int64.to_float'. String concatenations are done with the operation '(^)'. Normally, functions are defined for only one specific type, so there are new sets of arithmetic functions for floats like '(+.)', '(*.)' and '(/.)'. The 'tostr' sub-function has some extra calculation to change something like '5. Gb' into the nicer form of '5.0 Gb'.
</p>
<h3>List notation and type conversion
</h3>
<p>
The next function, 'converttime', converts a string into a float. OCaml uses floats for date for 2 reasons. The first is to prevent possible Year 2k problems, and can also be used for less than one-second time measurements. The function accepts English acronyms for month names. So let's introduce the list and the pair to create a translation of acronyms into numbers.
</p>
<pre>
let month = [("jan", 0); ("feb", 1); ("mar", 2); ("apr", 3); ("may", 4); ("jun", 5);
("jul", 6); ("aug", 7); ("sep", 8); ("oct", 9); ("nov", 10); ("dec", 11)]
;;
</pre>
<p>
This list is totally static, and can be used easily by the standard function <a href="http://caml.inria.fr/ocaml/htmlman/libref/List.html#VALassoc">List.assoc</a> to convert a string into the corresponding number.
</p>
<pre>
let converttime str =
try
begin match
if str>"a" && str<"z" then
( int_of_string (string_sub str (String.rindex str ' '+1) 99),
List.assoc (string_sub str 0 3) month,
1
)
else
( int_of_string (string_sub str 0 (
try String.index str '-' with Not_found -> 99
)),
( try let pos=String.index str '-'+1 in
int_of_string (string_sub str pos (
try String.index_from str pos '-'-pos with err -> 99
))-1
with err -> 0
),
( try let pos=String.index str '-'+1 in
int_of_string (string_sub str (String.index_from str pos '-'+1) 99)
with err -> 1
)
)
with (yr,mn,md) ->
(* print_string ("Last access before: "^
string_of_int (if yr<50 then yr+2000 else if yr<100 then yr+1900 else yr)^"-"^
string_of_int (mn+1)^"-"^
string_of_int md^"\n");
*)
fst (mktime
{ tm_sec = 0; tm_min = 0; tm_hour = 0;
tm_mday = md; tm_mon = mn;
tm_year = if yr<50 then yr+100 else if yr<100 then yr else yr-1900;
tm_wday = 0; tm_yday = 0; tm_isdst = false
})
end with err ->
print_string ("Cannot decipher this date string '" ^ str ^ "'\n"); max_float
;;
</pre>
<p>
The new operation in this function is the 'match <expr> with <template> -> expr'. This is one of the most versatile instructions of ocaml. It can be used to examine the contents of variables and get the needed information out of it. This function creates the triplet (year, month, day-of-month) out of 2 different date notations.
To debug this function the 'print_string' instruction is included but commented out to prevent clutter in the output of the program. Normally there is some logging mechanism to make the extra messages optional for the user.
The 'print_string' shows the ISO notation of the given date; it creates a 4-digits year and gives a month number with January=1 instead of the internal Unix use of January=0.
</p>
<p>
This function also shows the use of 'try <expr> with err -> <expr>' that caches every possible exception and fills the variable 'err' with the details of the exception. This function can raise quite a lot of different exceptions, and frankly I am not very interested in the details. The routine just complains to the user about the given date string and gets over it. It returns the maximal possible float to include every filename.
</p>
<p>
The main standard function is the '<a href="http://caml.inria.fr/ocaml/htmlman/libref/Unix.html#VALmktime">Unix.mktime</a>' function. It wants to get a <a href="http://caml.inria.fr/ocaml/htmlman/libref/Unix.html#TYPEtm">record</a> filled with numbers about the current time. This function returns a pair with the needed float and a normalized record. With the pervasives function <a href="http://caml.inria.fr/ocaml/htmlman/libref/Pervasives.html#VALfst">fst</a> returns just the first parameter of the pair.
</p>
<p>
The ';' before the 'max_float' indicates that the expression results in a float, but the instructions before the ';' are calculated first. This is the first non-functional instruction inside the example code. OCaml is not strictly functional, but has the full power of other functional languages.
</p>
<h3>Dynamic data structure
</h3>
<p>
Now is the time for a real data structure that is dynamically build and can be used in a lot of different ways.
</p>
<pre>
type entrytype =
| Dir of entry list (* directory with a list of files *)
| File of string (* a file inside a directory *)
and
entry = {
mutable e_name: string; (* name of a file or directory *)
e_type: entrytype; (* what type is this together with type
related information *)
e_atime: float; (* last access time *)
e_size: int64; (* size of the file or size of all the matching
files in the directory *)
}
</pre>
<p>
The 'and' statement is used to glue the two definitions together. They are created at the same time so that 'entrytype' can include 'entry' and vice-versa. 'entrytype' can consist one of 2 things: a directory with a list of entries or a file with its type. The directory entry has a mutable name. This is can be used later on to change a filename info the full path to that file.
</p>
<p>
As with ANSI C, the operators for Boolean algebra are '(&&)' and '(||)'.
</p>
<h3>Recursion
</h3>
<pre>
let rec dirwrite el depth sortfn =
List.iter (
fun e ->
match e.e_type with
| Dir lst ->
if e.e_size <> Int64.of_int 0 then begin
print_string ((String.make (depth*2) ' ') ^ "Directory " ^
e.e_name ^ " = (" ^ filesize e.e_size ^ ")\n");
dirwrite lst (depth+1) sortfn
end
| File string ->
print_string ((String.make (depth*2) ' ') ^ e.e_name ^
" (" ^ filesize e.e_size ^ ")\n")
) (List.sort sortfn el)
;;
</pre>
<p>
Here is the recursive ('rec') function 'dirwrite' that traverses a given tree 'el' and writes the result to the standard output. The parameter 'depth' indicates the amount of spaces to write a tree like structure of filenames. The function sorts all the lists with the given function 'sortfn'.
The new language structure here is 'fun <parm-1> ... <parm-n> -> <expr>'. This construction creates a function without a name. The parameters of this function like construction can be used like a template to match pairs.
</p>
<p>
This function suppresses directories that are 0 bytes in size to reduce clutter.
</p>
<h3>Variables vs. definitions
</h3>
<pre>
(* List of global variables *)
let min_size = ref (Int64.of_int 0) and (* minimum size of a file in bytes *)
last_access = ref max_float and (* last access time in seconds since 1970 *)
has_type = ref "" and (* type of file to show or empty to
show all *)
name_match = ref "" and (* regular expression to match the filename
with; empty is show all *)
name_regexp = ref (Str.regexp "") and (* pre-calculated regular expression *)
no_symlinks = ref false (* don't follow symbolic links to
directories *)
;;
</pre>
<p>
This is a list of variables that can be changed due to the 'ref <expr>' construction. Normally definitions are just a label to their contents. These definitions are pointers to the memory and can be read by '!<variable>' and written by '<variable> := <expr>'. The parameters given to the program can make changes to the way the files are read.
</p>
<pre>
let rec dirread path =
let list = ref [] and
size = ref (Int64.of_int 0) in
try
let dh = opendir path in
while true do
let file = readdir dh in
if file<>".." && file<>"." && file<>"CVS" && String.sub file 0 1 <> "." then
let s=stat (path^"/"^file) in
if s.st_kind = S_DIR &&
(not !no_symlinks || (lstat (path^"/"^file)).st_kind <> S_LNK)
then
let dir = dirread (path^"/"^file) in
list :=
{ e_name = file;
e_type = Dir (fst dir);
e_atime = s.st_atime;
e_size = snd dir
} :: !list;
size := Int64.add !size (snd dir)
else if
(!has_type = "" || gettype file = !has_type) &&
s.st_size > !min_size &&
s.st_atime < !last_access &&
(!name_match = "" || Str.string_match !name_regexp file 0)
then begin
list :=
{ e_name = file;
e_type = File (gettype file);
e_atime = s.st_atime;
e_size = s.st_size;
} :: !list;
size := Int64.add !size s.st_size
end
done;
(!list, !size)
with
| End_of_file -> (!list, !size)
| Unix_error (EACCES, err, parm) -> (!list, !size)
;;
</pre>
<p>
The following functions are introduced in the function 'dirread':
<li>Unix.opendir to start reading a directory.
<li>Unix.readdir to read a filename.
<li>Unix.stat for a record (<a href="http://caml.inria.fr/ocaml/htmlman/libref/Unix.html#TYPEstats">Unix.stats</a>) of statistics on a file.
<li>Unix.lstat for statistics on a link.
<li>Int64.add to add two int64 type of variables
<li>Str.regexp to create a new interpreted regular expression
<li>Str.string_match to match a string against a regular expression
<li>Pervasives.(::) to create a list with an extra element in front of the old one
<li>Pervasives.true as a Boolean constant
<li>Pervasives.snd to return the second part of a pair
<li>exception Unix.Unix_error (EACCESS, err, parm) that is raised when an access denied is encountered.
</li>
There is also a new construction 'while <boolean-expr> do <code> done' it just does what it is supposed to do.
</p>
<h3>Small is beautiful
</h3>
<pre>
let rec flat el path =
List.fold_right (
fun e ls ->
match e.e_type with
| Dir lst -> flat lst (path ^ "/" ^ e.e_name) @ ls
| File string ->
e.e_name <- (path ^ "/" ^ e.e_name);
e :: ls
) el []
;;
</pre>
<p>
This neat little routine 'flat' hits the tree 'el' flat on the ground. It takes every file from every branch and creates a single list of all the encountered files. This is done with one of the most versatile standard routines inside ocaml: the '<a href="http://caml.inria.fr/ocaml/htmlman/libref/List.html#VALfold_right">List.fold_right</a>' routine. This routine introduces a state machine (scarab) that crawls over a list and operates on every encountered element. It produces a new structure (droppings) as a result -- in this case, a flattened list.
</p>
<p>
The construction '<record-field> <- <expr>' changes the contents of a mutable record field. Without mutable fields, you can mutate records only by creating a new one with lots of fields inherited from the old one. This is a shortcut for that.
</p>
<pre>
let name_order a b =
compare a.e_name b.e_name
;;
let type_order a b =
let typea = match a.e_type with Dir ls -> "dir" | File tp -> tp and
typeb = match b.e_type with Dir ls -> "dir" | File tp -> tp in
if compare typea typeb = 0 then
compare a.e_name b.e_name
else compare typea typeb
;;
let atime_order a b =
compare a.e_atime b.e_atime
;;
</pre>
<p>
A set of sorting functions to use inside 'dirwrite'. The function 'compare' results in the widely used values of -1 for lower than, 0 for equal and +1 for higher than.
</p>
<h3>Command line parameters
</h3>
<pre>
let dir = ref "." and
sort = ref name_order and
show = ref 0
in
Arg.parse [
("-t",Arg.Unit (fun () -> sort := type_order),
"Sort by type and filename");
("-l",Arg.Unit (fun () -> sort := atime_order),
"Sort by last access time");
("-n",Arg.Unit (fun () -> show := 1),
"List filenames");
("-b",Arg.Unit (fun () -> show := 2),
"List both filenames and sizes");
("-s",Arg.Unit (fun () -> no_symlinks := true),
"Don't follow symbolic links");
("--before",Arg.String (fun s -> last_access := converttime s),
"Last access older than give date (format 'yyyy-mm-dd' or 'mmm yyyy')");
("--size",Arg.Int (fun i ->
min_size := Int64.mul (Int64.of_int i) (Int64.of_int (1024*1024))
), "File size bigger than size in Mbytes");
("--type",Arg.String (fun s -> has_type := s),
"File is specific type");
("--name",Arg.String (fun s ->
name_match := s; name_regexp := Str.regexp (s ^ "$")
), "Filename matches regular expression")
] (fun d -> dir := d) "show [DIR]";
let res = dirread !dir in
if !show=0 then begin
dirwrite (fst res) 0 !sort;
print_string ("Total size " ^ filesize (snd res) ^ "\n")
end else
List.iter
(fun e ->
print_endline (e.e_name ^ if !show=2 then " ("^filesize e.e_size^")" else "")
) (List.sort !sort (flat (fst res) !dir))
;;
</pre>
<p>
And here is the main routine. It calls the Arg.parse routine to parse the parameters given to the program. But this is too much un-GNU for me. I wrote my own version of it that follows the GNU coding standards a bit more than the default one (<a href="http://camlserv.sourceforge.net/Gnuarg.html">Gnuarg</a>). The other version is a bit more complicated so I will include only the sources that use it.
</p>
<h3>Generating binaries
</h3>
<p>
The code can be obtained from <a href="http://camlserv.sourceforge.net/show.tar.gz">here</a>. Just unpack it somewhere with 'tar -xzf show.tar.gz' and move into the source directory with 'cd show/src'.
There is also a Makefile that compiles to machine code and installs everything. But Makefiles are too rough for sour eyes to show in this article. The nitty-gritty details are there in the source. The general compile form is.
</p>
<pre>
ocamlopt -o show unix.cmxa str.cmxa basics.cmx show.ml
</pre>
<p>
The only non-standard libraries in use here are unix.cmxa and str.cmxa.
</p>
<pre>
make
su
make install
exit
show --help
show -s ~ --size 3 --before "apr 2003"
</pre>
<p>
That concludes this example program.
</p>
<h3>Language features
</h3>
<dl>
<dt>Garbage collector
<dd>Just forget variables that contain complete data structures. Once it gets out of scope, the total structure will be eliminated from memory in due time.
<dt>Flexible data-structures
<dd>Any 2 data structures can be combined without hassle. Just create an array of records that contain 2 fields with hash tables of strings. No problem there... everything in a single variable than can be passed to functions or can be used globally in the program.
<dt>No pointers needed
<dd>A variable can have any type and when a new variable is created
<dt>Flexible in language boundary checks
<dd>The language can check array and string boundaries automatically, or those checks can be turned off for an extra speed boost. Without it, the language can give a segmentation fault, but that is the programmer's choice.
<dt>High quality error handling
<dd>Totally integrated into the language and no notable performance hit.
<dt>Native code generator and byte code interpreter
<dd>All the tools are there -- interpreter (ocaml), byte code (ocamlc) and native code compiler (ocamlopt) -- every wish is granted. The package comes also with a documentation generator (ocamldoc) and a simple to use profiler (ocamlprof) that adds usage counts as comments to the original source code. The language is also compatible with the more sophisticated profilers around.
<dt>ANSI-C compatibility layer
<dd>It is possible to include ANSI C routines inside OCaml programs, and OCaml routines inside C programs. This has a very easy to use API. Slightly less easy is the creation of OCaml data structures inside C; for me, that was the source of many segfaults. So, my routines call exported OCaml routines to fill data structures and create only OCaml strings and numbers in C. That way I won't have the hassle to debug the C code... OCaml is much easier to debug for me.
<dt>Object orientation
<dd>Not my favourite programming paradigm, but it is possible to build object-oriented programs in this language. Those features are not part of this article. I can live without them.
<dt>An active mailing list
<dd>This list is at caml-list@inria.fr and is normally in English. Yes, this originally French project has taken the burden to translate almost everything they got. This is no easy feat for them, so be grateful.
</dl>
<h3>Cons:</h3>
<dl>
<dt>Duplicate efforts in libraries
<dd>There are separate libraries for different type of big arrays, big files, and extra long integers. This isn't a big problem, because you can always just start with the normal structures and drop in the special library when need arises. The naming of the different functions is very much standardized, so renaming of function calls isn't needed much. The extra long integers though are too much different from normal integers. That part of the standard functions really need some tuning.
<dt>Readability
<dd>You need to be familiar with the basis constructions of the language, to make any sense of the actual code. Some constructions can look really weird without intimate knowledge of the language. OCaml is not a very natural language and has a very powerful, short notation for things. But this not much worse than languages like ANSI C, Perl, or lisp.
<dt>Not known enough in the Linux world
<dd>This language has excellent interfaces to standard libraries and easy binding to ANSI C, but still isn't very known. I like to create some articles like this to change that a bit. This is a really great language to program in, and gives you real power without the pitfalls common in other languages. Programmers should give it a try and feel that power once.
</dl>
</p>
<!-- *** BEGIN author bio *** -->
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
Developer at a small technology firm in the Netherlands called V&S bv.
(<A HREF="http://www.v-s.nl/">www.v-s.nl</A>)
We sell firewall, anti-virus and spam boxes based on the Linux OS.
Using more and more the OCaml language to write my applications.
Busy writing a lightweight http server with an internal scripting language
(<A HREF="http://camlserv.sourceforge.net/">camlserv.sourceforge.net</A>,
source code <A HREF="http://camlserv.sourceforge.net/show.tar.gz">here</A>)
Interested in writing AI based computer games. Always trying writing
one, nothing ready yet.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<div id="articlefooter">
<p>
Copyright © 2004, <A HREF="authors/stellingwerff.html">Jurjen Stellingwerff</A>. Copying license
<a href="http://linuxgazette.net/copying.html">http://linuxgazette.net/copying.html</a>
</p>
<p>
Published in Issue 99 of Linux Gazette, February 2004
</p>
</div>
</div>
<br />
</body>
</html>
|