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 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> Linux Gazette Table of Contents LG #63</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000" >
<center>
<!-- A HREF="http://www.linuxgazette.com/">
<H1><IMG SRC="../gx/newlogo.jpg" ALT="LINUX GAZETTE" border="0"></H1></A> -->
<A HREF="http://www.linuxgazette.com/">
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.png"
WIDTH="600" HEIGHT="124" border="0"></H1></A>
<H2>Mid-February (EXTRA) 2001, Issue 63
Published by <I>Linux Journal</I></H2>
<A HREF=../lg_frontpage.html>Front Page</A> |
<A HREF=../lg_frontpage.html>Back Issues</A> |
<A HREF=../lg_faq.html>FAQ</A> |
<A HREF=../mirrors.html>Mirrors</A> |
<A HREF=http://www.linuxgazette.com/wgindex.html>Search</A>
</center>
<!--=================================================================-->
<table>
<TR>
<TD COLSPAN="3" WIDTH="100%" BGCOLOR="#000000"><IMG
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=30 VSPACE=2 HEIGHT=1
WIDTH=1 ALIGN=LEFT></TD>
<TD></TD>
</TR>
<tr><td>
<table>
<tr>
<td VALIGN="top"><H1><font color="#BB0000">Visit Our Sponsors:</font></H1></td></tr>
<!-- *** BEGIN sponsors *** -->
<TR><TD>
<A HREF="http://www.linuxnetworx.com"><IMG ALT="Linux NetworX" SRC="../gx/sponsors/linuxnetworx.gif" BORDER="0" VSPACE="10"></A>
</TD></TR>
<TR><TD>
<A HREF="http://www.penguincomputing.com"><IMG ALT="Penguin Computing" SRC="../gx/sponsors/penguincomputing.gif" BORDER="0" VSPACE="10"></A>
</TD></TR>
<TR><TD>
<A HREF="http://www.tuxtops.com"><IMG ALT="Tuxtops" SRC="../gx/sponsors/tuxtops.gif" BORDER="0" VSPACE="10"></A>
</TD></TR>
<TR><TD>
<A HREF="http://www.elinux.com/xwb00120"><IMG ALT="eLinux.com" SRC="../gx/sponsors/elinux.gif" BORDER="0" VSPACE="10"></A>
</TD></TR>
<TR><TD>
<A HREF="http://www.linuxcare.com"><IMG ALT="LinuxCare" SRC="../gx/linuxcare.gif" BORDER="0" VSPACE="10"></A>
</TD></TR>
<TR><TD>
<A HREF="http://www.linuxmall.com/"><IMG ALT="LinuxMall" SRC="../gx/linuxmall.gif" BORDER="0" VSPACE="10"></A>
</TD></TR>
<!-- *** END sponsors *** -->
</table>
</td>
<!--==================================================================-->
<TD ROWSPAN="3" WIDTH="2" BGCOLOR="#000000" NOSAVE><IMG
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=1 HEIGHT=1 WIDTH=1%></TD>
<td VALIGN=top>
<H1><font color="#BB0000">Table of Contents:</font></H1>
<!-- *** BEGIN toc *** -->
<UL>
<LI> <a HREF="lg_answer63.html">The Answer Gang</A> , <EM>by The <EM>Linux Gazette</EM> Answer Gang</EM>
<LI> <a HREF="lg_tips63.html">More 2-Cent Tips</A>
<LI> <a HREF="andreiana.html">Linux On Your Desktop: Multimedia</A> , <EM>by Marius Andreiana</EM>
<LI> <a HREF="burtch.html">Taming rand() and random()</A> , <EM>by Ken O. Burtch</EM>
<LI> <a HREF="brunton.html">Merchant Empires: Coding your own PHP Universe</A> , <EM>by Bryan Brunton</EM>
<LI> <a HREF="collinge.html">HelpDex</A> , <EM>by Shane Collinge</EM>
<LI> <a HREF="gibbs.html">Installing dict - An On-Line Dictionary</A> , <EM>by Chris Gibbs</EM>
<LI> <a HREF="nielsen.html">Downloading LinuxToday links and Linux Gazette's TOC with Python (and Perl)</A> , <EM>by Mark Nielsen</EM>
<LI> <a HREF="nielsen2.html">Securely Erasing a Hard Drive with Perl</A> , <EM>by Mark Nielsen</EM>
<LI> <a HREF="nielsen3.html">Installing USB, PCMCIA and Kernel 2.2.18 On My Laptop</A> , <EM>by Mark Nielsen</EM>
<LI> <a HREF="okopnik.html">Clearing out the Master Boot Record (MBR)</A> , <EM>by Ben Okopnik</EM>
<LI> <a HREF="sharma.html">IP Spoofing</A> , <EM>by Kapil Sharma</EM>
<LI> <a HREF="washington.html">XML parsing in AOLserver</A> , <EM>by Irving Washington</EM>
<LI> <a HREF="lg_backpage63.html">The Back Page</A>
<UL>
<LI> <a HREF="lg_backpage63.html#authors">About This Month's Authors</A>
<LI> <a HREF="lg_backpage63.html#notlinux">Not Linux</A>
</UL>
</UL>
<!-- *** END toc *** -->
</td>
</tr>
<TR>
<TD COLSPAN="3" WIDTH="100%" BGCOLOR="#000000"><IMG
SRC="../gx/hammel/cleardot.gif"
ALT="-------------------------------------------------------------"
HSPACE=30 VSPACE=2 HEIGHT=1 WIDTH=1 ALIGN=LEFT></TD>
<TD></TD>
</TR>
</table> <!-- ******************************************* -->
<H3 ALIGN="center"><EM>Linux Gazette</EM> Staff and The Answer Gang</H3>
<BLOCKQUOTE>
<STRONG>Editor:</STRONG> Michael Orr<BR>
<STRONG>Technical Editor:</STRONG> Heather Stern<BR>
<STRONG>Senior Contributing Editor:</STRONG> Jim Dennis<BR>
<STRONG>Contributing Editors:</STRONG>
Ben Okopnik, Dan Wilder, Don Marti
</BLOCKQUOTE>
<TABLE WIDTH="100%"><TR>
<TD WIDTH="100%" BGCOLOR="#000000"><IMG
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=30 VSPACE=2 HEIGHT=1
WIDTH=1 ALIGN=LEFT></TD>
</TR></TABLE>
<P> <!-- ************************************************** -->
<table>
<tr><td>
<A HREF="issue63.txt.gz">TWDT 1 (gzipped text file)</A><BR>
<A HREF="issue63.html">TWDT 2 (HTML file)</A><BR>
are files containing the entire issue: one in text format, one in HTML.
They are provided
strictly as a way to save the contents as one file for later printing in
the format of your choice;
there is no guarantee of working links in the HTML version.
</td></tr>
<!--==================================================================-->
<TR>
<TD COLSPAN="3" WIDTH="100%" BGCOLOR="#000000"><IMG
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=30 VSPACE=2 HEIGHT=1
WIDTH=1 ALIGN=LEFT></TD>
<TD></TD>
</TR>
<tr><td>
<center>
<I>Linux Gazette</I><img alt="[tm]" src="../gx/tm.gif">,
<A HREF="http://www.linuxgazette.com/">http://www.linuxgazette.com/</A><BR>
This page maintained by the Editor of <I>Linux Gazette</I>,
<A HREF="mailto: gazette@ssc.com"> gazette@ssc.com</A>
<P>
<H5>Copyright © 1996-2001 Specialized Systems Consultants, Inc.</H5>
</center>
</td></tr>
<TR>
<TD COLSPAN="3" WIDTH="100%" BGCOLOR="#000000"><IMG
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=30 VSPACE=2 HEIGHT=1
WIDTH=1 ALIGN=LEFT></TD>
<TD></TD>
</TR>
</table>
<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"
></a>trouble with diff (fwd) --or--
<dd><A HREF="tag/1.html"
><strong>Why is diff so crazy?</strong></a>
-- Perseverence pays off at last.
<dt><A HREF="tag/2.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
></a>modem --or--
<dd><A HREF="tag/2.html"
><strong>State of the Art in softmodems</strong></a>
<br>winmodem(tm), HSP, ACP, DSP, whatever. Just call my ISP already
<dt><A HREF="tag/3.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Distros</strong></a>
<dt><A HREF="tag/4.html"
><img src="../gx/dennis/bbub.gif" height="28" width="50"
alt="(!)" border="0"
><strong>RE Solaris UNIX?</strong></a>
<dt><A HREF="tag/5.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>linux anti virus?</strong></a>
<dt><A HREF="tag/6.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Por favor Ayuda !</strong></a> It said "OK" a lot, but...
<dt><A HREF="tag/7.html"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>LINUX for SGI Visual Workstation</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>
Welcome to the Extra issue this February. We had a few extra things
in the queue here this time and figured you just couldn't wait, so here
they are!
</p><p>
I have to say I am really very impressed by the Human Genome Project's
results. There seem to be two sides of the camp... but, we can't call
them "the Cathedral and the Bazaar":
</p><ol>
<li>That's already taken
<IMG SRC="../../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">
<li>The fellow the cathedrals are for, already did all the hard
work... * these folks are just studying the results.
</ol><ul>
<li> Unless you feel something or someone else created every living thing.
Still, the fact is, living things already exist, genomes and all, so
this is discovery, not invention.
</ul><p>
Um, let's call them the College and the Commerce. Mr. James Kent in Santa
Cruz wrote, over a fairly short time, a program to have about 100 pentiums help
him assemble the genome data out of public and academic fragments. (I'm not
sure which he used more of, ice packs, or Jolt Cola.)
</p><p>
Meanwhile,
Celera was pouring lots of hours and corporate resources into doing the same
thing. They both succeeded to an announceable degree, within days of each
other. We're not quite at curing cancer yet, but maybe there are enough
resources now to start nailing some of the more clearly genetic diseases.
There's certainly a lot of work to be done. Anyways, you can read a lot
about all this in the New York Times -- I did.
</p><p>
Of course, to read the New York Times online at
<a href="http://www.nytimes.com/"
>http://www.nytimes.com</a>, they want you to register. Sigh.
To access Celera's database, you have to pay for access (but, they might
have more than they published about, too, so maybe you're at least paying
for some serious R&D). Still, what the school system paid for is available
to all of us... though not terribly readable unless you're into genetics:
</p><dl>
<dd><a href="http://genome.ucsc.edu/">http://genome.ucsc.edu</a>
</dl>
<p>Hey wait a minute, I hear you cry. This isn't Linux! Well, I don't
know. It could have been. It doesn't matter. (Gasp! Linux doesn't
matter? What can you mean!?) What's more important is what gets
<em>done</em> with a computer.
</p><p>
The sheer number of people who have contributed to figure out how
we really tick, and the time they continue to put in, since
we aren't nearly at the point where we can run a make script,
have the waldos get out a petri dish, and create even so tiny
a creature as a mouse "from scratch" is just amazing. (Let's see,
if the Creator writes and debugs one line of code a year in us, we're
as big as... er, never mind.) Compared to that, my effort every month
on <em>LG</em> seems like a breeze.
</p>
<!-- end hgreeting -->
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<center>
<H1><A NAME="answer">
<img src="../../gx/dennis/qbubble.gif" alt="(?)"
border="0" align="middle">
<font color="#B03060">The Answer Gang</font>
<img src="../../gx/dennis/bbubble.gif" alt="(!)"
border="0" align="middle">
</A></H1>
<BR>
<H4>By Jim Dennis, Ben Okopnik, Dan Wilder, the Editors of <em>Linux Gazette</em>...
and You!
<br>Send questions (or interesting answers) to
<a href="mailto:tag@ssc.com">tag@ssc.com</a>
</H4>
</center>
<p><hr><p>
<!-- endcut ======================================================= -->
<!-- begin 23 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Why is diff so crazy?</h3>
<h4 align="center">Perseverence pays off at last.</H4>
<p><strong>From sbcs
</strong></p>
<p align="right"><strong>Answered By Heather Stern
<br></strong></p>
<!-- sig -->
<!-- ::
Why is diff so crazy? -- Perseverence pays off at last.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<BLOCKQUOTE>
This is the reformatting and basically kick-in-the-pants of a question
that's been in the mill for a few months. For 3 months this fellow
patiently sent the message again, certain that someday, we would get to him.
</BLOCKQUOTE>
<BLOCKQUOTE>
Before I get started with the actual question, I'd like to make it completely
clear to our readers... we do enjoy answering questions. For some strange
reason, that is part of what is fun about Linux for those of us here in the
Answer Gang. The <EM>Gazette</EM> exists to <EM>make Linux a little more
fun</EM> so here we are.
</BLOCKQUOTE>
<BLOCKQUOTE>
However, we're all volunteers, we all have day jobs and most of us have
families and pillows we like to visit with once in a while. There is no
guarantee that anyone who sends us mail gets an answer.
</BLOCKQUOTE>
<BLOCKQUOTE>
[ He also had some problems that made his mail a good candidate to get
ignored. Since we had another thread elsewhere on features that will help
you get an answer, I moved my comments there, and you saw those in
<a href="../issue62/tag/5.html">Creed of the Querent</a> earlier this month. ]
</BLOCKQUOTE>
<BLOCKQUOTE>
I've added paragraphs, and hit it with my best shot, and maybe the Gang can
help out a bit further. Comments from you, gentle readers, are always
welcome too!
</BLOCKQUOTE>
<BLOCKQUOTE>
So now, on to the tasty question.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I wanted to build a fresh installation on my portable (<A HREF="http://www.redhat.com/">Red Hat</A> 5.2
upgraded to 6.0), but I didn't want to just erase the old one.
</STRONG></P>
<P><STRONG>
So I pulled the notebook's hard drive, plugged it into my server (Red
Hat 6.2) and archived the contents with <tt>cp -a</tt> file file. The -a
(archive) tells cp to preserve links, preserve file attributes if
possible and to copy directories recursively. The copy process didn't
return any errors... so far so good.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
Okay. So far, we have that you wanted to upgrade, so you planned to back
it up. That's a good idea, but the method isn't so hot.
</BLOCKQUOTE>
<BLOCKQUOTE>
<tt>cp -a</tt> really only works if you're root, and I can't tell if you
were, or not. But it's not the method I would use to do a proper backup of
everything. I normally use GNU tar:
</BLOCKQUOTE>
<blockquote><BLOCKQUOTE><code>cd /mnt/otherbox
<br>tar czvfpS /usr/local/otherbox-60-backup.tgz .
</code></BLOCKQUOTE></blockquote>
<BLOCKQUOTE>
The options stand for (in order) [c]reate, use g[z]ip compression, be
[v]erbose, send the output to a [f]ile instead of a tape (this option
needs a parameter), save the [p]ermissions, be careful about [S]parse
files if they exist. The file parameter given has a tgz extension to
remind myself later that it's a tar in gzip format, and I put it in
<TT>/usr/local</TT> because that usually has lots of free space. The
very last parameter is a period, so that I'm indicating the current
directory. I do not want to accidentally mix up any parts from my
server into my otherbox backup.
</BLOCKQUOTE>
<BLOCKQUOTE>
Among other things it properly deals with backing up device files...
all those strange things you'd normally use mknod to create.
</BLOCKQUOTE>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mike]
Before untarring, you MUST do "umask 000" or risk having
/dev/null and other stuff not be world-writable.
</BLOCKQUOTE>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] I haven't encountered that (I think this is what the
p flag for tar solves) but good catch!
Now this works okay for most circumstances and the nice thing is that you
have a very easy way to check it is okay:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><CODE>
tar dzvfpS /usr/local/otherbox-60-backup.tgz .
</CODE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
Where the d stands for diff and all the rest is the same. Diff does have
a glitch, and will complain about one special kind of file called a socket.
X often has at least one of these, the log system usually uses one, and the
mouse often uses one too. It's okay to ignore that because a socket depends
on the context of the program that owns it, and right now, there's no program
running from that disk to give it the right context anyway. (Okay. I'm
guessing. but, that is a theory I have which seems to fit all the ways I
see sockets used.)
</BLOCKQUOTE>
<BLOCKQUOTE>
Now my husband Jim doesn't always trust tar, and sometimes uses cpio. I'll
let him or one of the rest of the Gang answer with a better description of
using cpio correctly. What I will tell you is why. When you are about to
do a full restore of a tarball, it checks to see if can assign the permissions
back to the correct original owners. However, a <EM>complete</EM> restore
will be to an empty disk, which won't have correct passwd and group files
yet. Oops.
</BLOCKQUOTE>
<BLOCKQUOTE>
But there is a fix for this too, and I use it all the time when restoring:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><code>cd /mnt/emptydisk
<br>tar xzvfpS --numeric-owner /usr/local/otherbox-60-backup.tgz .
</code></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>It's just as valid to use midnight commander to create
/mnt/emptydisk/etc, open up the backup tgz file, and copy across
the precious /etc/shadow, /etc/group, and /etc/passwd files
before issuing your restore command.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
But when I ran diff -r file file, I got screen-fulls of errors. The
most obvious problem was that diff was stuck in a loop with
"<TT>/usr/bin/mh</TT>", a symbolic link pointing back to "<TT>/usr/bin</TT>".
<IMG SRC="../../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle"> Make a
pair of directories, each containing a symbolic link pointing back at
the directory it resides in, and then run diff -r on those two
directories and you can see what I mean.
</STRONG></P>
<P><STRONG>
The diff program doesn't fail on all symbolic links... just those that
lead into loops and some others (I didn't take time to explore what it
was about the others). I removed "<TT>/usr/bin/mh</TT>" (I'd have preferred not
to have had to, but I wanted to move along and see what other snags I
could hit), ran diff again with output redirected to a file and
started taking the file apart with grep and wc to find out what
general classes of error I was dealing with... turns out diff was
failing on "character special" files, sockets and "block special"
files.
</STRONG></P>
<P><STRONG>
I don't know what any of those three are, but I used find and wc again
on the file system and discovered that diff was failing on every
single one that it tried to compare. Does anybody know what to do
about these problems?
</STRONG></P>
<P><STRONG>
update: After a week of trying, I'm unable to duplicate the event
above. I installed Red Hat 6.0 on a pair of Gateways... basically the
same procedure as I did for my disk usage article at the other end of
that link.
</STRONG></P>
<P><STRONG>
When I ran the diff, it seemed to start looping somewhere in
"<TT>/tmp/orbit-root</TT>"... I let it run for about 24 hours and the hard
drive light was still flashing the next day, no error message.
</STRONG></P>
<P><STRONG>
I tried 6.0 transplanted into a 6.2 box... same thing. I put 6.0 on my
portable, pulled the drive and attached it to my server, and got the
same thing. I put 5.2 on my portable, upgraded it to 6.0, pulled the
drive and attached it to my server... same circumstances as the
original event... and diff looped somewhere in "<TT>/tmp/.X11-unix</TT>"
instead of "<TT>/tmp/orbit-root</TT>".
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
I simply don't recommend that full backups ever waste any time
capturing /tmp. The point of this directory is to have a big
place where programs can create the files if they need to. Make
the programs do their own dirty work making sure they have the
right parts. In my case, /tmp is a seperate partition, and I
wouldn't even mount it in rescue mode.
</BLOCKQUOTE>
<BLOCKQUOTE>While we're at mentioning filesystems to skip, make sure not
to bother getting the /proc filesystem, either. The -l (little
ell) switch to tar when making a backup, will make sure it won't
wander across filesystem borders unless you specify them on the
command line.
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQUOTE><tt>cd /mnt/otherdisk</tt>
<br>(mount its subvolumes here ... skip tmp, proc, and devfs if you have it)
<br><tt>tar czvfpSl /usr/local/otherbox-60-backup.tgz . usr var home
</tt></BLOCKQUOTE></BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
The diff program definitely has issues with most types of non-regular
files (directories excluded), as well as the problem of at other times
looping without ever generating an error message (which could, of
course, be related to the same basic problem with non-regular files).
Suggestion(s), anyone?
<IMG SRC="../../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
If any of you kind readers have other interesting ways to make sure your
backups <em>work</em> when you do a restore... their only reason for
existence, after all... let us know!
</BLOCKQUOTE>
<!-- sig -->
<!-- end 23 -->
<!-- begin 20 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>State of the Art in softmodems</H3>
<H4 ALIGN="center">winmodem(tm), HSP, ACP, DSP, whatever. Just call my ISP already</H4>
<p><strong>From Marcelo Henrique Gonalves
</strong></p>
<p align="right"><strong>Answered By Heather Stern
<br></strong></p>
<!-- sig -->
<!-- ::
State of the Art in softmodems
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
winmodem(tm), HSP, ACP, DSP, whatever. Just call my ISP already
:: -->
<P><STRONG>
Hi
I have a PCTel HSP Micromodem 56! Yes! Onboard
<IMG SRC="../../gx/dennis/smily.gif" ALT=":]"
height="24" width="20" align="middle">
</STRONG></P>
<P><STRONG>
This modem is compatible with Conectiva Linux, in the site of conectiva
says "no" and yours too!
<IMG SRC="../../gx/dennis/smily.gif" ALT=":]"
height="24" width="20" align="middle">
</STRONG></P>
<P><STRONG>
But can i configure my modem anyway! If a download a rpm or other file?!?!
<br>Thankx
</STRONG></P>
<P><STRONG>
by
<br>BM
<br>OS PIRATA!!!
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
HSP means "Host Signal Processing" and that means the host, your computer,
has to do all the work. It's a software driven modem.
</BLOCKQUOTE>
<BLOCKQUOTE>
There used to be only two of these kind of modems with any hope for them
whatsoever, in both cases very tricky because vendors had created binary
drivers and orphaned them. The only way you can get <EM>more</EM> unsupported than
that is to not have drivers at all.
</BLOCKQUOTE>
<BLOCKQUOTE>
(Can someome out there please spin up a new buzzword for "software released
on the basis that you get no tech support" so we can go back to using
"unsupported" for meaning "doesn't work" ?)
</BLOCKQUOTE>
<BLOCKQUOTE>
Normally for software-modems or controllerless modems (what's the difference?
which chip out of three is missing. <EM>sigh</EM>) we of the Answer Gang simply point
querents at the Linmodems site (<A HREF="http://www.linmodems.org"
>http://www.linmodems.org</A>) and shake our shaggy
heads. It's a lot of work to go through just to use a modem that borrows so
much CPU effort and buckles just when the dataflow gets good anyway.
</BLOCKQUOTE>
<BLOCKQUOTE>
However, I've been watching and it looks like the number of types that can
work (whether "supported" or not) has grown to four.
</BLOCKQUOTE>
<BLOCKQUOTE>
I'll start with yours first because that's what you need. PCTel was one of
the early ones to let a driver sneak out, maintained by PCCHIPS. <A HREF="http://linux.corel.com/">Corel</A> made
a .deb of their driver for 2.2.16, and some unknown hero named Sean turned
that into a .tgz and has also got available an extra site for Thomas Wright's
effort toward the same chipset... a driver for 2.4
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Sean's site:
<DD><A HREF="http://walbran.org/sean/linux/stodolsk"
>http://walbran.org/sean/linux/stodolsk</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Download point for Thomas' 2.4 PCTel driver:
<DD><A HREF="http://www.geocities.com/tom_in_rc/pctel"
>http://www.geocities.com/tom_in_rc/pctel</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
Hopefully that does it for you!
</BLOCKQUOTE>
<BLOCKQUOTE>
Now as for good news for everyone else
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</BLOCKQUOTE>
<BLOCKQUOTE>
Anyone using Lucent controllerless modems. will also want to take a look at
Sean's site, because he keeps a decent listing of useful scripts and kernel
parts that you'll find handy.
</BLOCKQUOTE>
<BLOCKQUOTE>For those who prefer code built completely from scratch, Richard's
LTmodem diagnostic tool moved up to version 0.9.9 ... it can now
answer the phone, and handle voice grade work, so you can use it
for mgetty setup (where you want to be able to dial straight home)
but I think it still isn't good for ppp. Anyone's welccome to let
us and the linmodem crowd know if you get ppp working with it:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Richard's LTModem Page
<DD><A HREF="http://www.close.u-net.com/ltmodem.html"
>http://www.close.u-net.com/ltmodem.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
IBM has a project they're calling "Mauve":
<DD><A HREF="http://oss.software.ibm.com/developer/opensource/linux/projects/mwave"
>http://oss.software.ibm.com/developer/opensource/linux/projects/mwave</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
...which is a driver for the ACP modem found in the IBM Thinkpad 600E. They
say they are working on some licensing issues, but plan to release the source
for it as soon as they can. Meanwhile, they have updated it at least once,
so we know they're fixing bugs.
</BLOCKQUOTE>
<BLOCKQUOTE>
And lastly, Mikhail Moreyra wrote a driver for the Ambient Tech chipset...
that's a DSP-based modem that used to be from Cirrus Logic, just in case
one of you gentle readers has an older box. In theory this may work for
your software-driven modem if it claims to be a "sound card modem" since
that's what the DSP chip really is. Linmodems only points to his tgz but
don't worry, it's source code
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> However, it's not exactly a speedy modem
even once you use the driver, since he's only gotten 14.4, v.34 (32 Kbps)
and v.8 working so far.
</BLOCKQUOTE>
<BLOCKQUOTE>
To the rest of you, sorry. Maybe you should go out and buy a solid external
modem with its very own power supply and line-noise reduction features, or
a Cardbus modem that isn't afraid to use a little real estate to offer a
complete-chipset modem.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 20 -->
<!-- begin 19 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Distros</H3>
<p><strong>From Gerald Saunders
</strong></p>
<p align="right"><strong>Answered By Don Marti, Mike Orr, Heather Stern
<br></strong></p>
<!-- sig -->
<P><STRONG>
How about an (objective) artical on the relative diferences between the
different GNU/LINUX distributions. Newbies have to rely on the
"propaganda" generated by those distributions in order to make decisions
as to which distribution serves their needs best. A realy informed guide
is what is needed. I, for example, think that Mandrake is best for
newbies and <A HREF="http://www.debian.org/">Debian</A> is a more stable
platform (and more philosophically correct!). Am I right though?
</STRONG></P>
<!-- sig -->
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Don]
No, you're utterly wrong! Fool! Infidel! Liar! Your mother runs OS/2!
(That's pretty mild for a response to a distribution comparison actually.)
</BLOCKQUOTE>
<BLOCKQUOTE>
How to pick the best Linux distribution to run:
</BLOCKQUOTE>
<BLOCKQUOTE><ul>
<li> Find the person who you would be most likely to ask for help if you
have a Linux problem.
<li> Run what he or she runs.
</ul></BLOCKQUOTE>
<BLOCKQUOTE>
If you would be most likely to ask on a mailing list for Linux help,
read the list for a while and see what the most helpful posters run.
</BLOCKQUOTE>
<BLOCKQUOTE>
<em>Any technology distinguishable from magic is insufficiently advanced.</em>
</BLOCKQUOTE>
<!-- sig -->
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mike]
Most people would say this, although the stability of Debian is in the
eye of the beholder. As far as an "objective" comparision of distributions,
there are already many out there.
</BLOCKQUOTE>
<blockquote>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] Debian's "potato" aka "stable" is actually quite good
for stability... but I've seen some exciting side effects in "woody" aka
"testing", and "unstable" just plain lives up to its moniker.
</BLOCKQUOTE>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mike]
Oops, I didn't mean to put Mandrake so far ahead of most of the other
distros. Many people find Mandrake easier to install than most
distributions. However, it's far from being "the only distribution
that matters", although Mandrake marketing would like to think so.
</BLOCKQUOTE>
<BLOCKQUOTE>
Different users have different expectations and requirements, so finding
one distribution that's the "best" is as futile as the emacs/vi wars.
</BLOCKQUOTE>
</blockquote>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mike]
<ul>
<li>
<A HREF="http://www.thedukeofurl.org"
>The Duke of URL</A> has been writing
reviews of new distributions as they appear. Read a few reviews, and
that's the same as a comparision.
<li> Links to the Duke's reviews and others are in the past several issues
of <em>LG</em> in the News Bytes column.
<li> Linux Journal has a table comparing several distributions.
<A HREF="http://noframes.linuxjournal.com/lj-issues/distable.html"
>http://noframes.linuxjournal.com/lj-issues/distable.html</A>
It was written July 2000. I'm cc'ing the Editor so they'll know there's
interest in seeing an update.
<li> Several of the web sites that cater to new Linux users have information
about different distributions. Look around
<ul>
<li><A HREF="http://www.linuxnewbie.org"
>http://www.linuxnewbie.org</A>
<li><A HREF="http://www.firstlinux.org"
>http://www.firstlinux.org</A>
<li><A HREF="http://www.linuxlinks.org"
>http://www.linuxlinks.org</A>
<li><A HREF="http://www.linux.com"
>http://www.linux.com</A>
</ul>
and see if you find anything.
<li> Linux Weekly News has the most comprehensive listing of distributions
of any site I know about.
<A HREF="http://www.lwn.net"
>http://www.lwn.net</A>
<li> You may find something at <A HREF="http://www.osopinion.com"
>http://www.osopinion.com</A>, although usually
their focus is on Linux as a whole rather than on the differences between
distributions. Nevertheless, it's a fun place to browse occasionally just
to see what new articles they have.
</ul></BLOCKQUOTE>
<!-- sig -->
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
Recently in The Answer Gang (TAG, we're it
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> ...
<a href="../../issue60/lg_answer60.html#tag/4">issue 60</a>)
someone asked us what was
the best distribution for newbies, and we answered in a great deal of detail
about some of the relative strengths and weaknesses, plus points to consider
like scoring the installer and features you need in that, seperately from
behaviors during use of the system, and even whether what you want to do
is put your Linux setup together from loose parts.
</BLOCKQUOTE>
<BLOCKQUOTE>
It might be worthwhile to come up with some major criteria, and then attempt
to map distributions against those criteria, so that people get a lot more
useful data than "4 penguins, looks great to me."
</BLOCKQUOTE>
<BLOCKQUOTE>
You're right about propaganda, but, a "really informed guide" is going to be
written by ... who? Surely not a newbie. Can a newbie really trust someone
wiser enough than them to write a book, to have any idea what sort of things
are easy or difficult for a newbie anymore?
</BLOCKQUOTE>
<p><strong>
<img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>
Hi Heather!
</strong></p>
<p><strong>
Yeah I suppose you are right on that. If some one is advanced enough
to know heaps about Linux then they probably wouldn't relate well to an
abject newbie! I just thought it was a good Idea as when I was trying
to find info on the different Linux distros I ended up guessing.
There was not much out there to let me make an informed decision. I
ended up trying <A HREF="http://www.debian.org/">Debian</A>, which was a
steep learning curve. I would
probably tried Mandrake or Redhat if I had known how steep. I now use
Mandrake because of Hpt366 (ata66) support, Reiser FS, Cups printing
right out of the box. But my heart is still with Debian!
</strong></p>
<p><strong>
Cheers, Gerald.
</strong></p>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
Well, then, keep an eye on the Progeny project - Ian Murdoch himself and
a handful of trusted friends, are working on putting together a new debian
based distro which is really aimed at desktop users more than the server
and hardcore-linuxer crowd, yet is aware of the "standard" debian project
enough to allow a smooth transition.
</BLOCKQUOTE>
<p><em>Progeny is presently at Beta Two, with downloadable cdrom images
available. See
<a href="http://www.progenylinux.com/news/beta2release.html"
>http://www.progenylinux.com/news/beta2release.html</a> for
the PR, release notes, and a list of discs.
</em></p>
<BLOCKQUOTE>
You might also try <a href="http://www.stormix.com/">Storm</a> Linux,
<A HREF="http://www.libranet.com/">LibraNet</A>, or
<A HREF="http://linux.corel.com/">Corel</A>Linux; all are debian
based commercial distros, so at least, their installer is a bit smoother.
GUI installers drive me crazy, so of the three, I prefer LibraNet.
</BLOCKQUOTE>
<p><strong>
<img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>
Thanks Heather!
</strong></p>
<p><strong>
I will check those out!
</strong></p>
<p><strong>
Thanks again, Gerald.
</strong></p>
<!-- end 19 -->
<!-- begin 11 -->
<H3 align="left"><img src="../../gx/dennis/bbubble.gif"
height="50" width="60" alt="(!) " border="0"
>RE Solaris UNIX?</H3>
<p><strong>From Mitchell Bruntel
</strong></p>
<!-- sig -->
<BLOCKQUOTE>
Gee: I have a question, and an answer.
I sent the question earlier about LILO and not booting hda5 (ugh)
</BLOCKQUOTE>
<font color ="navy"><em>
<p><strong>
Is AIX or Solaris or SunOS or HP-UX a UNIX?
</strong></p>
<BLOCKQUOTE>
[Heather] AIX and Solaris are blessed with this trademark under
"UNIX 98", HP-UX and Tru64 among others are blessed
under "UNIX 95". (You can see the Open Group's Registered Product
Catalog if you care:
<blockquote><A HREF="http://www.opengroup.org/regproducts/catalog.htm"
>http://www.opengroup.org/regproducts/catalog.htm</A>
</blockquote></BLOCKQUOTE>
<BLOCKQUOTE>
I don't think SunOS ever got so blessed; it was a BSD derivitive after
all. You can read some about the confusions between SunOS
and Solaris in this handy note:
<blockquote><A HREF="http://www.math.umd.edu/~helpdesk/Online/GettingStarted/SunOS-Solaris.html"
>http://www.math.umd.edu/~helpdesk/Online/GettingStarted/SunOS-Solaris.html</A>
</blockquote></BLOCKQUOTE>
</em></font>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mitchell]
Here's the deal on SOLARIS.
IT IS UNIX. It still has portions that were (c) 198X by AT&T and USL.
</BLOCKQUOTE>
<BLOCKQUOTE>
Solaris (as opposed to SUN-OS) IS UNIX System V.4
</BLOCKQUOTE>
<BLOCKQUOTE>
AT&T merged Sun-OS back in with System V and got a bunch of stuff.
especially the init systems we love, as well as package-add format.
</BLOCKQUOTE>
<BLOCKQUOTE>
btw, is there any demand in LINUX for users/programmers with SUN system V
package-add experience?
</BLOCKQUOTE>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] I imagine that places which are using Linux to mix
Suns and PCs, with Solaris on their Sparcs, and Linux on the PCs...
possibly even a more SysV-ish distro like Slackware... would find
such programmers handy.
</BLOCKQUOTE>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mitchell]
(so because SUN is STILL the UNIX reference "port" for UNIX System
V.4, --from the old days)
it <em>IS</em> UNIX, and therefore doesn't need the blessing.
</BLOCKQUOTE>
<BLOCKQUOTE>
BTW, Solaris also has the distinction of being BOTH BSD, and System V.4 both
in one.
</BLOCKQUOTE>
<BLOCKQUOTE>
a great deal of the product is now engineered to favor V.4, but there are
still some BSD roots and compatibility there!
</BLOCKQUOTE>
<BLOCKQUOTE>
Mitch Bruntel
<br>(ATT Labs-- maybe that's why I know this trivia?)
</BLOCKQUOTE>
<!-- sig -->
<!-- end 11 -->
<!-- begin 15 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>linux anti virus?</H3>
<p><strong>From Jugs
</strong></p>
<p align="right"><strong>Answered By Mike Orr, Heather Stern
<br></strong></p>
<!-- sig -->
<BLOCKQUOTE>
On Sat, Sep 16, 2000 at 03:59:53PM +0200, jugs wrote:
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
hi
<br>i wonder if you could help?.
<br>i am running a mail/internet server with the red hat linux (6.2) operating
system. Viruses are getting through the end user via emails and are spread
over my local area network.
</STRONG></P>
<P><STRONG>
1) is there any anti virus software that i can get for the linux box?
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Mike]
Yes, but I don't know the names offhand. Check previous issues of The
Answer Gang, News Bytes, the <em>LG</em> search page, and
<a href="www.securityportal.com">www.securityportal.comi</a>.
</BLOCKQUOTE>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
Yes. I'm operating on the assumption that your linux box is the hub through
which all mail is received, maybe even the only place that mail really comes
to, because the typical Windows or Mac client uses POP.
</BLOCKQUOTE>
<BLOCKQUOTE>
You could use:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
AMaViS (A Mail Virus Scanner) ...note, they have a bunch of great links too!
<DD><A HREF="http://www.amavis.org"
>http://www.amavis.org</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
<A HREF="http://www.freshmeat.net/">Freshmeat</A> has a whole section on antivirus daemons
<DD><A HREF="http://freshmeat.net/appindex/Daemons/Anti-Virus.html"
>http://freshmeat.net/appindex/Daemons/Anti-Virus.html</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
Mind you, most of these require that you have the linux version of one of
the commercial vendors' antivirus apps, or, they're meant to deal with problems
which usually break the clients (e.g. poor MIME construction, etc). At least
one of the commercial vendors has a complete solution for us though... and
a handful of other 'Ix flavors too:
</BLOCKQUOTE>
<BLOCKQUOTE><DL><DT>
Trend Micro's Interscan VirusWall
<DD><A HREF="http://www.antivirus.com/products/isvw"
>http://www.antivirus.com/products/isvw</A>
</DL></BLOCKQUOTE>
<BLOCKQUOTE>
...and in case anyone is wondering whether it only works on RH, I have a
few clients who got it working on <A HREF="http://www.suse.com/">SuSE</A> and seem pretty happy with it.
</BLOCKQUOTE>
<BLOCKQUOTE>
For those who prefer to go with all free parts, I have to note, VACina
(a sourceforge project) isn't very far along, and anti-spam stuff can be
twisted only so far if you aren't planning to become an antivirus engineer
on your own.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
2) the option of buying software for each machine wipes my budget out.
preferably the solution that i would like would be to stop the virus at
the server.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
<EM>That</EM> shouldn't be a problem, the stuff I described above works at the
server level. I have to warn you though, thaat I used to work in the
antivirus field, and until those macro viruses (yeah, viruses ... the
biological ones are virii) came around, the vast percentage of infections
were from accidental boots off a floppy. There's also a type of virus
that is carried in programs, but as soon as given a chance, hits the boot
sector too. So going without some sort of resident checker, or if that's
too much, then a downtime window where your staff goes through and checks
all the machines, is not really doing a complete job.
</BLOCKQUOTE>
<BLOCKQUOTE>
A school I did a bunch of work with solved the problem in their labs in this
way: every evening when the lab closed, they'd go around with a spot checker
and take notes what was found. They didn't waste time cleaning any, they
just reformatted and reinstalled the OS from a network image. (Among other
things, that way they didn't have to worry if they missed some new breed.)
But they posted the note on the wall, how many viruses were found the night
before. They also made it easy for students to spot check their disks. Of
course, the school had an educational license to the AV software. You can
think of this as the "free clinic" style of solving it, if you like... though
real illnesses, sadly, can't be solved by reformatting the human.
</BLOCKQUOTE>
<BLOCKQUOTE>
But, I can't say what your budget really is. In the end, you'll have to
decide if you want to spend more time or more money.
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
if you could suggest a solution i would be grateful
</STRONG></P>
<P><STRONG>
thanking you
<br>jugs
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
Everyone else wondering about solutions for their virus ills in a mixed
environment, surely thanks you for asking, Jugs. Good luck in the battle!
</BLOCKQUOTE>
<!-- sig -->
<!-- end 15 -->
<!-- begin 10 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Por favor Ayuda !</H3>
<p><strong>From Carlos Moreno
</strong></p>
<p align="right"><strong>Answered By Felipe E. Barousse Boue
(one of our translators)
<br></strong></p>
<!-- sig -->
<p><em>This message was sent to the gazette mailbox in Spanish. Mike Orr
forwarded it to Felipe for translation.
Sadly, Carlos' accent marks got mangled in the transition.
</em></p>
<BLOCKQUOTE>
Here it goes: (I decided to add a reply to Carlos...by the way, I can tell
by his email that he seems to live in Mexico)
</BLOCKQUOTE>
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Hi Linux friends, I need your help desperately. I just got a Linux disk
(<A HREF="http://www.redhat.com/">Red Hat</A> 6.0) and the installation process was very painful
</STRONG></P>
<P><STRONG>
After finding out how disk druid worked, I started to partition my disk. It
took around 15 minutes to install and configure, at the end I assigned a
password for "root" and reboot the equipment.
</STRONG></P>
<P><STRONG>
A huge amount of text was displayed with many "OK". Finally, it printed
the "login" prompt where I typed out "root" and my password, then it
displays the following message:
</STRONG></P>
<pre><strong>[Bash: root@localhost /root]#
</strong></pre>
<P><STRONG>
I don't know what to do, I can't initialize Linux and it's very
disspointing. I want to start on a <A HREF="http://www.kde.org/">KDE</A> graphical interface and I can't.
Please help me, I ned it a lot.
</STRONG></P>
<P><STRONG>
Regards.
</STRONG></P>
<P><STRONG>
Carlos Moreno.
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Felipe]
Hola Carlos:
</BLOCKQUOTE>
<BLOCKQUOTE>
Welcome to the world if Linux. It seems that you installed Linux correctly
since you are getting all those "OK" prompts after rebooting your system and
at the end you get a "login" prompt. When you type your "root" id and your
password, in fact your ARE now in Linux but, you are in text mode.
</BLOCKQUOTE>
<BLOCKQUOTE>
If you want to initiate the graphical user interface, first you have to ensure
that the graphical environment was installed in first place and, second, that
it is configured correctly for your equipment. To start, give the "startx"
command after you logged in and got the shell command prompt:
</BLOCKQUOTE>
<BLOCKQUOTE><BLOCKQuote>
Bash: <A HREF="mailto:root@localhost"
>root@localhost</A> <TT>/root]#</TT> prompt
</BLOCKQuote></BLOCKQUOTE>
<BLOCKQUOTE>
This will attempt to initialize the Graphics Environment, if, and only if it
is installed and configured correctly. Otherwise, you will have to install it
and set it up. (that is a long question/reply so, lets first find out it if
you are ok at this point.)
</BLOCKQUOTE>
<BLOCKQUOTE>
I will suggest that you take a look at <A HREF="http://www.gacetadelinux.com"
>http://www.gacetadelinux.com</A> which
contains the Spanish edition of <em>Linux Gazette</em> and there we have a new user
forum -in Spanish- where you can get a lot of help related to Linux, including
installations, configurations and Linux use.
</BLOCKQUOTE>
<BLOCKQUOTE>
I can assure that once you learn a little bit about Linux, you will have a
great experience with this operating system.
</BLOCKQUOTE>
<BLOCKQUOTE>
Greetings for now.
</BLOCKQUOTE>
<BLOCKQUOTE>
Felipe Barousse
</BLOCKQUOTE>
<HR width="10%" align="left"><P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Hola amigos de Linux necesito ayuda desesperadamente,acabo de
adquirir el disco de linux (red-hat 6.0) la instalacion fue un
verdadero viacrucis.
</STRONG></P>
<P><STRONG>
Despues de averiguar como funcionaba el disk druid empece a hacer mi
particio linux me tarde aprox. 15 minutos en instalarlo y
configurarlo. y finalamente asigne una contrase?a para "root" y
reinicio el equipo, se desplego una enorme cantidad de texto y
muchos "Ok" Finalmente me pidio el login en el cual puse "root" y mi
contrase?a, entonces desplega el siguiente mensaje
</STRONG></P>
<P><STRONG>
[Bash: <A HREF="mailto:root@localhost"
>root@localhost</A> <TT>/root]#</TT>
</STRONG></P>
<P><STRONG>
y no se que hacer, no puedo iniciar linux y es traumatico kiero
iniciarlo en interfase KDE y no puedo, por favor ayudenme es
indispensable
</STRONG></P>
<P><STRONG>
Atte. Carlos Moreno
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Felipe]
Hola Carlos:
</BLOCKQUOTE>
<BLOCKQUOTE>
Bienvenido al mundo de Linux. Al parecer, por lo que describes,
instalaste correctamente Linux. Esto lo puedo decir por todos los "OK" que
aparecieron cuando re-iniciaste tu equipo. Al final, cuando te pide el
"login" y tu tecleas root y tu password, de hecho ya estas en Linux solo
que en modo de texto.
</BLOCKQUOTE>
<BLOCKQUOTE>
Si quieres iniciar el modo gráfico, primero hay que asegurarse de que lo
hayas instalado en un principio y esté correctamente configurado. Para
ello prueba usar el comando "startx" cuando te aparece el prompt de
comando:
</BLOCKQUOTE>
<blockquote><pre>[Bash: root@localhost /root]# startx
</pre></blockquote>
<BLOCKQUOTE>
Esto intentará iniciar el modo gráfico si y solo si está instalado. En
caso contrario habr que instalarlo o, en todo caso configurarlo
correctamente.
</BLOCKQUOTE>
<BLOCKQUOTE>
Te sugiero visites la edición en Español de <em>Linux Gazette</em> en
<A HREF="http://www.gacetadelinux.com"
>http://www.gacetadelinux.com</A> y ahí, en el foro de principiantes
puedes encontrar mucha ayuda relativa a la instalación, configuración y uso de
Linux.
</BLOCKQUOTE>
<BLOCKQUOTE>
Te puedo asegurar que una vez que aprendas un poco de Linux, tendrás una
muy agradable experiencia con éste sistema operativo
</BLOCKQUOTE>
<BLOCKQUOTE>
Un saludo por ahora.
</BLOCKQUOTE>
<BLOCKQUOTE>
Felipe Barousse Boué
</BLOCKQUOTE>
<!-- sig -->
<!-- end 10 -->
<!-- begin 28 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>SGI Visual Workstation</H3>
<p><strong>From Beth H.
</strong></p>
<p align="right"><strong>Answered By Jim Dennis
<br></strong></p>
<!-- sig -->
<!-- ::
SGI Visual Workstation
~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG>
Hi Answer Guys!
</STRONG></P>
<P><STRONG>
I must install LINUX on an SGI 540 Visual Workstation running
WinNT4.0. I'm using RedHat 6.2 and want to make a dual boot
system with LINUX on the 2nd SCSI drive.
</STRONG></P>
<P><STRONG>
My problem is that I can't boot off the RedHat install floppy or the
CD. I can't get past SGI's system initialization/setup to boot off
either device. I have installed this software on several INTEL Pentium
platforms without any trouble.
</STRONG></P>
<P><STRONG>
Please help me get started and/or provide some useful websites
that will help. I find SGI/MIPS stuff, but can't seem to find anything
else. I checked your answers too so if I missed it, my apologies.
</STRONG></P>
<P><STRONG>
Thanks,
<br>Beth H.
<br>[From a U.S. Navy Address]
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [JimD]
Well, Beth, You've discovered a fundamental truth about the
SGI vis. WS. It's not a PC. It uses an x86 CPU but from what
the SGI folks told me when I was teaching advanced Linux courseware
to some of their tech support and customer service people, the
resemblance pretty much ends at the CPU pins.
</BLOCKQUOTE>
<BLOCKQUOTE>
So you can't boot one with a typical Linux distribution CD or
floppy. I guess we have to find a custom made kernel and prepare
a custom boot floppy or CD therefrom. Did you call SGI's
technical support staff? They probably have a floppy image
tucked away on their web site somewhere; and SGI is certainly
not hostile to Linux. Give them a call; if that doesn't work
I'll try to dig up the e-mail addresses of some of the employees
that took my class and see if I can get a personal answer.
</BLOCKQUOTE>
<BLOCKQUOTE>
After writing this I got to a point where my Ricochet wireless
link could "see bits." (I do all of my e-mail from my laptop
these days, and much of it as during business meetings or at
coffee shops and restaurants; so it's a little harder to do
searches --- I write most of my TAG articles from memory and
locally cached <A HREF="http://www.linuxdoc.org/">LDP</A> docs
--- an 18Gb disk is good for that).
</BLOCKQUOTE>
<BLOCKQUOTE>
So I did a Google!/Linux (<A HREF="http://www.google.com/linux"
>http://www.google.com/linux</A>) search
on the string: 'SGI "visual workstation" boot images' and
found:
</BLOCKQUOTE>
<BLOCKQUOTE><dl>
<dt>Linux for SGI Visual Workstations:
<dd>
Linux 2.2.10 + <A HREF="http://www.redhat.com/">Red Hat</A> 6.0
<br>Updated: July 28, 1999
<br><A HREF="http://oss.sgi.com/www.linux.sgi.com/intel/visws/flop.html"
>http://oss.sgi.com/www.linux.sgi.com/intel/visws/flop.html</A>
</dl></BLOCKQUOTE>
<BLOCKQUOTE>
Luckily the main differences are in the kernel and (possibly)
in the boot loader and a few hardware utilities. I wouldn't
expect programs like hwclock, lspci, isapnp etc work ---
though some of them might. I've seen lspci used on PowerPC
(PReP) systems, and I've used it on SPARC Linux. I seem to
remember that hwclock was modified to use a <TT>/proc</TT> interface
and that most of its core functionality is now in the kernel.
</BLOCKQUOTE>
<BLOCKQUOTE>
The other software element that is very hardware dependent
is the video driver. As more accelerated framebuffer drivers
are being added to the kernel then this becomes less of an
issue (it folds back into the earlier statement: "MOST of the
differences are IN THE KERNEL").
</BLOCKQUOTE>
<BLOCKQUOTE>
So, once you get the boot disk/CD and an X server working most
other software and all of your applications should work just fine.
</BLOCKQUOTE>
<BLOCKQUOTE>
Of course updates to RH6.2 or later, and to newer kernels
might be a bit of a challenge. However, I'll leave those as
exercises to the readership. The source is all out there!
</BLOCKQUOTE>
<!-- sig -->
<!-- end 28 -->
<center>
<H1><A NAME="tips"><IMG ALIGN=MIDDLE ALT="" SRC="../gx/twocent.jpg">
More 2¢ Tips!</A></H1> <BR>
<!-- BEGIN tips -->
Send Linux Tips and Tricks to <A HREF="mailto:gazette@ssc.com">gazette@ssc.com</A></center>
<UL>
<!-- index_text begins -->
<li><A HREF="#tips/1"
><strong>I've got an IDE CD-RW...</strong></a>
<li><A HREF="#tips/2"
><strong>3 legged router: FreeSco</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">iI've got an IDE CD-RW...</FONT></H3>
Wed Feb 14 15:52:09 PST 2001
<BR>Heather Stern <a href="mailto:tag@ssc.com">(The Editor Gal)</a>
<p><strong>Joey Winchester asked:</strong></p>
<p><strong>
I need to use the ide-scsi.o module, but NONE of the 'HOWTOs' help, they
just give the code to check 'cdrecord -scanbus'. Okay, my CD-RW's not
listed, so WHAT DO I DO?? The HOWTOs aren't helpful at ALL. So how can I
recompile the kernel to use my IDE drive as a CD-RW and NOT just a CD-ROM.
</strong><p>
<blockquote>You need to give the kernel an option, to warn it that it
not only requires the hardware level driver (IDE CDROM in this case)
but also the IDE-SCSI interface driver. This applies just as much
if your ATAPI device is builtin, or attached via Cardbus (as mine is).
The easiest place to put this is in your /etc/lilo.conf:
</blockquote>
<blockquote><code>
append="hdc=ide-scsi"
</code></blockquote>
<blockquote>If you have more than one kernel option, though, they have to
be in one big append statement. What will happen is that you'll get
some sort of warning message about a missing driver as the drive
initializes. Ignore it, your device should be able to read fine
without that. But, when you want
to write, then <tt>modprobe ide-scsi</tt> and your virtual SCSI host
will be established. After that the normal instructions for cdrecord
and all its brethren will work.
</blockquote>
<!-- 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">3 legged router: FreeSco</FONT></H3>
Mon, 5 Feb 2001 10:50:42 -0500
<BR>Ray <a href="mailto:tag@ssc.com">(taylor864 from yahoo.com)</a>
<p>
First, let me comment that I think TAG is exceptional. I stumbled upon it
by accident, and ended up reading every question and answer, and after this
email, will be going to look for previous months.
Anyhow, in reference to one of the questions asked about a firewall
(Firewall for a SOHO From Tom Bynum), you suggested a 3 legged Linux box to
do his routing / Firewalling. There is a free router / firewall called
FreeSCo (stands for FREE ciSCO) (http://www.freesco.org) that is essentially
a firewall on a floppy, with support for a DMZ. I uses (I believe) masq and
IPChains. Runs a mimumum of services, etc. You most likely already knew
about it, but I thought I'd pass this along (since the guy lives by your mom
and all).
</p>
<p>Have a good 'un.</p>
<p>-Ray.</p>
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Linux On Your Desktop: Multimedia</font></H1>
<H4>By <a href="mailto:mandreiana@yahoo.com">Marius Andreiana</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<p>
Many people still have the impression that Linux is about servers and typing commands in console.
Well, that isn't all; Linux is being used on the desktop more and more. Why ? Here are some reasons.
</p>
<p>
Everybody likes music. The technology lets people listen to high-quality music on audio CDs. But if
they aren't using a computer, they are missing a lot. Why change the CD because you want to listen to
other album ? Lots of songs can be stored on the hard drive or CD-ROMs.
</p>
<p>
To do that, you'll have to transform the songs from audio CD to computer files.
My favourite tool for that is <a href="http://www.nostatic.org/grip/">grip</a>.
Download <a href="http://bladeenc.mp3.no/">bladeenc</a>
(<a href="ftp://rpmfind.net/linux/conectiva/5.1/cd2/conectiva/RPMS/bladeenc-0.92.0-1cl.i386.rpm">rpm</a>) too, which compresses audio data to mp3 files.
Launch grip, set Config -> MP3 -> Encoder to bladeenc and let it rip!
</p>
<p>
However, you should forget about mp3. A new, open format is available.
mp3 is quite old and has limitations; the encoding software uses
patented algorithms. The alternative, <a href="http://www.vorbis.com/">Ogg Vorbis</a>, is intended for unrestricted private,
public, non-profit and commercial use and does not compromise quality for freedom.
You can already start using the ogg encoder instead of mp3. See
<a href="http://noframes.linuxjournal.com/lj-issues/issue81/4416.html">this article</a> for an introduction Ogg Vorbis.
<br>
Download and install the following RPMs : <a href="http://www.vorbis.com/download.html">XMMS plugin, encoder and libraries</a>
Next set oggenc as encoder in grip.
<p>
You took all your audio CDs collection and encoded it in computer files.
Now you'd like to listen to it, don't you ?
Fire up <a href="http://www.xmms.org">X Multimedia System</a> (I really did :-)
</p>
<p><div align="center"><img src="misc/andreiana/xmms.jpg" width="800" height="600" alt="X Multimedia System fired up near the Christmas tree"></div></p>
<p>
I use a very nice <a href="http://xmms.org/plugins_output.html#79">XMMS plugin for crossfading</a>; when the
current song is near the end, it fades out while the next song
fades in. Let the music play!
<p>
While you listen, how about painting ?
<a href="http://www.gimp.org">GNU Image Manipulation Program</a>, or GIMP for short, is the
best in digital art on Linux. It can be used as a simple paint program, a expert quality photo retouching program,
an online batch processing system, a mass production image renderer, a image format converter, etc.
</p>
<p>I'm not into digital art, but look how Michael Hammel managed to transform his cousin in an alien :</p>
<p><div align="center"><img src="misc/andreiana/phillip.jpg" width="200" height="234" alt="at first look, seems a normal human being"></div></p>
<p><div align="center"><img src="misc/andreiana/alien.jpg" width="395" height="473" alt="but not everything is what it seems to be..."></div></p>
<p>
Never trust relatives :). Visit <a href="http://www.graphics-muse.com">the Graphics Muse site</a> for lots of materials about GIMP and
<a href="http://www.linuxartist.org/">Linux Artist</a> for more resources. For an overview of 3D graphics programs, see
<a href="http://www.linuxgazette.com/issue53/baptista.html">this article</a>.
</p>
<p>
After singing and painting, how about making the computer speak ? Try
<a href="http://www.cstr.ed.ac.uk/projects/festival/">festival</a>,
a free speech synthesizer. As almost always, <a href="http://rpmfind.net/">rpmfind</a> provides links to rpms.
<p>
A free speech recognition engine is available from IBM : <a href="http://www-4.ibm.com/software/speech/">ViaVoice</a>;
it can be used to voice-control xmms for example and simple desktop commands,
but writing entire documents from speech is still something for the future.
<p>
Besides music, I also watch movies on my computer. <a href="http://www.lokigames.com/development/smpeg.php3">smpeg</a> is a nice
GPL mpeg player.
</p>
<p><div align="center"><img src="misc/andreiana/smpeg.jpg" width="800" height="600" alt="'Yes, that is MS Windows', she says"></div></p>
<p>
Having a movie in 320x240 resolution using up more than 1gb isn't so great though. Divx is the choice for now;
a movie in 700x400 takes less than 700mb. Divx requires a better processor;
300Mhz is a good start. Another problem with it is that there isn't yet a native Linux player;
<a href="http://divx.euro.ru">avifile</a> uses Windows DLLs to be able to play.
<p>
Thanks to open-sourcing of Divx at <a href="http://www.projectmayo.com/opendivx/index.php">Project Mayo</a>, a Linux
player will be available too.
<p>
I don't have a TV, in the last year I saw more movies on PC than TV. I do have a TV tuner with remote control which I use from time to time.
<p><div align="center"><img src="misc/andreiana/tv.jpg" width="458" height="374" alt="Tux on TV"></div></p>
<p>
If you don't wanna miss a show/movie and you're busy, set it to record
a channel at a certain time (make sure you have plenty of space) and
watch it later. Or do some <a href="http://noframes.linuxjournal.com/lj-issues/issue81/4382.html">Movie Making on your Linux Box</a>.
<p>
I'll let you now enjoy your Linux desktop. Maybe you even show it to a friend. You can happily
use it and forget about Windows (read <a href="http://www.newsforge.com/article.pl?sid=01/01/11/0556232">On becoming a total Linux user</a>).
English knowledge isn't a requirement, as you see from my screenshots. We continue
to improve GNOME support for Romanian. Visit the <a href="http://developer.gnome.org/projects/gtp/">GNOME translation project</a>
to see how well your language is supported.
<p>
If you are new to Linux, see
<a href="../issue61/andreiana.html">my previous article</a>
showing how to customize GNOME and stay tuned to <a href="http://noframes.linuxjournal.com/lj-issues/issue82/4483.html">Linux as a Video Desktop</a>.
<p>
And finally, don't forget that Linux and applications like the ones I've talked about were done by volunteers. Feel free to join ;-)
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Marius Andreiana.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Taming rand() and random()</font></H1>
<H4>By <a href="mailto:kburtch@mackenziefinancial.com">Ken O. Burtch</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<p>In the lower levels of the Ontario Science Center in Toronto, Canada,
there is a wide circular device made of thin rods of steel. Curious bystanders
can take billiard balls, put there for that purpose, and let them loose
on the machine. The balls whiz along their rails, richocheting off
pins, clanging through wind chimes, grabbed by
counterweighted arms and lifted towards the ceiling. At several
places the balls chose one rail or another purely at random. How
is it that a construct not powered in any way, laid out in a rigid pattern,
still produces unexpected results?
<p>Writing programs that use random numbers requires an understanding of
error estimation, probability theory, statistics and other advanced numeric
disciplines.
<p>Bunk.
<p>Random numbers are about getting your programs to do the unexpected
without a core dump being involved. They're about having fun.
<center>
<h1>
Random But Not Really Random</h1></center>
<p><br>Computers do not use "real world" random numbers. Like the
billiard-ball machine, computers are rigid, constrained by rules and logical
behaviour. For a computer to generate truly random numbers, it would
have to choose numbers by examining real world events. In the early
days, people might roll some 10-sided dice and compose a list of digits
for a program to use.
<p>Unfortunately real-world random numbers can be unexpectedly biased.
As the old saying goes, "the real world
is a special case." Instead, computers rely on mathematics to
generate uniformly distributed (that is, random but not too random) numbers.
They are "pseudo-random", generated by mathematic functions which create
a seemingly non-repeating sequence. Over time, the numbers in the
sequence will reliably occur equally often, with no one number being favoured
over another.
<p>The Linux standard C library (stdlib.h) has two built-in random number
functions. The first, rand(), returns a random integer between 0
and RAND_MAX. If we type
<p><tt> printf( " rand() is %d\n", rand() );</tt>
<br><tt> printf( " rand() is %d\n", rand() );</tt>
<br><tt> printf( " rand() is %d\n", rand() );</tt>
<p>rand() will return values like
<p><tt> rand() is 1750354891</tt>
<br><tt> rand() is 2140807809</tt>
<br><tt> rand() is 1844326400</tt>
<p>Each invocation will return a new, randomly chosen positive integer
number.
<p>The other standard library function, random(), returns a positive long
integer. On Linux, both integer and long integer numbers are the
same size. random() has some other properties that are discussed
below.
<p>There are also older, obsolete functions to produce random numbers
<p> * drand48/erand48 return a random double between 0..1.
<br> * lrand48/nrand48 return a random long between 0 and 2^31.
<br> * mrand48/jrand48 return a signed random long.
<p>These are provided for backward compatibility with other flavours of
UNIX.
<p>rand() and random() are, of course, totally useless as they appear and
are rarely called directly. It's not often we're looking for a number
number between 0 and a really big number: the numbers need to apply to
actually problems with specific ranges of alternatives. To tame rand(),
its value must be scaled to a more useful range such as between 1 and some
specific maximum. The modulus (%) operator works well: when a number
is divided, the remainder is between 0 and 1 less than the original number.
Adding 1 to the modulus result gives the range we're looking for.
<p><tt> <b>int</b> rnd( <b>int</b> max ) {</tt>
<br><tt> <b>return</b> (rand() % max) + 1;</tt>
<br><tt> }</tt>
<p>This one line function will return numbers between 1 and a specified
maximum. rnd(10) will return numbers between 1 and 10, rnd(50) will
return numbers between 1 and 50. Real life events can be simulated
by assigning numbers for different outcomes. Flipping a coin
is rnd(2)==1 for heads, rnd(2)==2 for tails. Rolling a pair of dice
is rnd(6)+rnd(6).
<p>The rand() discussion in the Linux manual recommends that you take the
"upper bits" (that is, use division instead of modulus) because they tend
to be more random. However, the rnd() function above is suitably
random for most applications.
<p>The following test program generates 100 numbers between 1 and 10, counting
how often each number comes up in the sequence. If the numbers were
perfectly uniform, they would appear 10 times each.
<p><tt> <b>int</b> graph[11];</tt>
<br><tt> <b>int</b> i;</tt><tt></tt>
<p><tt> <b>for</b> (i=1; i<=10; i++)</tt>
<br><tt> graph[i] = 0;</tt>
<br><tt> <b>for</b> (i=1; i<=100; i++)</tt>
<br><tt> graph[ rnd(10) ]++;</tt>
<br><tt> printf( "for rnd(), graph[1..10] is " );</tt>
<br><tt> <b>for</b> (i=1; i<=10; i++)</tt>
<br><tt> printf( "%d " , graph[i] );</tt>
<br><tt> printf( "\n" );</tt>
<p>When we run this routine, we get the following:
<p><tt> for rnd(), graph[1..10] is 7 12 9 8 14 9 16 5 11 9</tt>
<p>Linux's rand() function goes to great efforts to generate high-quality
random numbers and therefore uses a significant amount of CPU time. If
you need to generate a lot mediocre quality random numbers quickly, you can use
a function like this:
<p><tt><b>unsigned</b> <b>int</b> seed = 0;</tt><tt></tt>
<p><tt><b>int</b> fast_rnd( <b>int</b> max ) {</tt>
<br><tt> <b>unsigned</b> <b>int</b> offset = 12923;</tt>
<br><tt> <b>unsigned</b> <b>int</b> multiplier = 4079;</tt><tt></tt>
<p><tt> seed = seed * multiplier + offset;</tt>
<br><tt> <b>return</b> (<b>int</b>)(seed % max) + 1;</tt>
<br><tt>}</tt>
<p>This function sacrifices accuracy for speed: it will produce random
numbers not quite as mathematically uniform as rnd(), but it uses only
a few short calculations. Ideally, the offset and multiplier should
be prime numbers so that fewer numbers will be favoured over others.
<p>Replacing rnd with fast_rnd() in the test functions still gives a reasonable
approximation of rand() with
<p><tt> for fast_rnd(), graph[1..10] is 11 4 4 1 8 8 5 7 6 5</tt>
<center>
<h1>
Controlling the Sequence</h1></center>
<p><br>A <i>seed</i> is the initial value given to a random number generator
to produce the first random number. If you set
the seed to a certain value, the sequence of numbers will always repeat,
starting with the same number. If you are writing a game, for example,
you can set the seed to a specific value and use the fast_rnd() to position
enemies in the same place each time without actually having to save any
location information.
<p><tt> seed = room_number;</tt>
<br><tt> num_enemy = fast_rnd( 5 );</tt>
<br><tt> <b>for</b> ( enemy=1; enemy<=num_enemy; enemy++ ) {</tt>
<br><tt> enemy_type[enemy] = fast_rnd( 6
);</tt>
<br><tt> enemy_horizontal[enemy] = fast_rnd(
1024 );</tt>
<br><tt> enemy_vertical[enemy] = fast_rnd(
768 );</tt>
<br><tt> }</tt>
<p>The seed for the Linux rand() function is set by srand(). For example,
<p><tt> srand( 4 );</tt>
<p>will set the rand() seed to 4.
<p>There are two ways to control the sequence with the other Linux
function, random(). First, srandom(), like srand(), will set a seed
for random().
<p>Second, if you need greater precision, Linux provides two functions
to control the speed and precision of random(). With initstate(),
you can give random() both a seed and a buffer for keeping the intermediate
function result. The buffer can be 8, 32, 64, 128 or 256 bytes in
size. Larger buffers will give better random numbers but will take
longer to calculate as a result.
<p><tt> <b>char</b> state[256];
/* 256 byte buffer */</tt>
<br><tt> <b>unsigned</b> <b>int</b> seed = 1;
/* initial seed of 1 */</tt><tt></tt>
<p><tt> initstate( seed, state, 256 );</tt>
<br><tt> printf( "using a 256 byte state, we get %d\n", random()
);</tt>
<br><tt> printf( "using a 256 byte state, we get %d\n", random()
);</tt>
<br><tt> initstate( seed, state, 256 );</tt>
<br><tt> printf( "resetting the state, we get %d\n", random() );</tt>
<p>gives
<p><tt> using a 256 byte state, we get 510644794</tt>
<br><tt> using a 256 byte state, we get 625058908</tt>
<br><tt> resetting the state, we get 510644794</tt>
<p>You can switch random() states with setstate(), followed by srandom()
to initialize the seed to a specific value.
<br>setstate() always returns a pointer to the previous state.
<p><tt> oldstate = setstate( newstate );</tt>
<p>Unless you change the seed when your program starts, your random numbers
will always be the same. To create changing random sequences, the
seed should be set to some value outside of the program or users control.
Using the time code returned by time.h's time() is a good choice.
<p><tt> srand( time( NULL ) );</tt>
<p>Since the time is always changing, this will give your program a new
sequence of random numbers each
time it begins execution.
<center>
<h1>
Randomizing Lists</h1></center>
<p><br>One of the classic gaming problems that seems to stump many people
is shuffling, changing the order of items in a list. While I was
at university, the Computer Center there faced the task of sorting a list
of names. Their solution was to print out the names on paper, cut
the paper with scissors, and pull the slips of paper from a bucket and
retype them into the computer.
<p>So what is the best approach to shuffling a list? Cutting up a
print out? Dubious. Exchanging random items a few thousand
times? Effective, but slow and it doesn't guarantee that all items
will have a chance to be moved. Instead, take each item in the list
and exchange it with some other item. For example, suppose we have
a list of 52 playing cards represented by the numbers 0 to 51. To
shuffle the cards, we'd do the following:
<p><tt> <b>int</b> deck[ 52 ];</tt>
<br><tt> <b>int</b> newpos;</tt>
<br><tt> <b>int</b> savecard;</tt>
<br><tt> <b>int</b> i;</tt><tt></tt>
<p><tt> <b>for</b> ( i=0; i<52; i++ )</tt>
<br><tt> deck[i] = i;</tt>
<br><tt> printf( "Deck was " );</tt>
<br><tt> <b>for</b> ( i=0; i<52; i++ )</tt>
<br><tt> printf( "%d ", deck[i] );</tt>
<br><tt> printf( "\n" );</tt>
<br><tt> <b>for</b> ( i=0; i<52; i++ ) {</tt>
<br><tt> newpos = rnd(52)-1;</tt>
<br><tt> savecard = deck[i];</tt>
<br><tt> deck[i] = deck[newpos];</tt>
<br><tt> deck[newpos] = savecard;</tt>
<br><tt> }</tt>
<br><tt> printf( "Deck is " );</tt>
<br><tt> <b>for</b> ( i=0; i<52; i++ )</tt>
<br><tt> printf( "%d ", deck[i] );</tt>
<br><tt> printf( "\n" );</tt>
<p>The results give us a before and after picture of the deck:
<p><tt> Deck was 0 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</tt>
<br><tt> Deck is 35 48 34 13 6 11 49 41 1 32 23 3 16 43 42 18 28
26 25 15 7 27 5 29 44 2 47 38 39 50 31 17 8 14 22 36 12 30 33 10 45 21
46 19 24 9 51 20 4 37 0 40</tt>
<center>
<h1>
Different Types of Randomness</h1></center>
<p><br>People acquainted with statistics know that many of real life events
do not happen with a uniform pattern. The first major repair for
a car, for example, might happen between 5 and 9 years of after purchase,
but it might be most common around the 7th year. Any year in the
range is likely, but its most likely to be in the middle of the range.
<p>Small unexpected events like these occur in a bell curve shape (called
a normal distribution in statistics). Creating random numbers that
conform to such a complex shape may seem like a duanting task, but it really
isn't. Since our rnd() function already produces nicely uniform "unexpected"
events, we don't need a statistics textbook formula to generate normally
distributed random numbers. All we need to do is call rnd() a few
times and take the average, simulating a normal distribution.
<p><tt><b>int</b> normal_rnd( <b>int</b> max ) {</tt>
<br><tt> <b>return</b> (rnd( max ) + rnd( max ) + rnd( max ) + rnd(
max ) +</tt>
<br><tt> rnd( max ) + rnd(
max ) + rnd( max ) + rnd( max ) ) / 8;</tt><tt></tt>
<p><tt>}</tt>
<p>Using normal_rnd() in the test function, we get values that are clustered
at the mid-point between 1 and max:
<p><tt> for normal_rnd(), graph[1..10] is 0 0 4 26 37 23 10 0 0 0</tt>
<p>Normal random numbers can be used to make a game more life-like, making
enemy behaviour less erratic.
<p>For numbers skewed toward the low end of the range, we can create a
low_rnd() which favours numbers near 1.
<p><tt> <b>int</b> low_rnd( <b>int</b> max ) {</tt>
<br><tt> <b>int</b> candidate;</tt><tt></tt>
<p><tt> candidate = rnd( max );</tt>
<br><tt> <b>if</b> ( rnd( 2 ) == 1 )</tt>
<br><tt> <b>return</b> candidate;</tt>
<br><tt> <b>else</b> <b>if</b> ( max > 1 )</tt>
<br><tt> <b>return</b> low_rnd( max
/ 2 );</tt>
<br><tt> <b>else</b></tt>
<br><tt> <b>return</b> 1;</tt>
<br><tt> }</tt>
<p>In each recursion, low_rnd() splits the range in half, favoring the
lower half of the range. By deducting a low random number from the
top of the range, we could write a corresponding high_rnd() favoring numbers
near the max:
<p><tt> <b>int</b> high_rnd( <b>int</b> max ) {</tt>
<br><tt> <b>return</b> max - low_rnd( max ) + 1;</tt>
<br><tt> }</tt>
<p>The skewing is easily seen when using the test program:
<p><tt> for low_rnd(), graph[1..10] is 36 15 11 8 9 3 4 3 3 8</tt>
<br><tt> for high_rnd(), graph[1..10] is 4 5 8 5 4 10 6 10 14 34</tt>
<center>
<h1>
Random If Statements</h1></center>
<p><br>Arbitrary branches in logic can be done with a odds() function.
<p><tt> <b>int</b> odds( <b>int</b> percent ) {</tt>
<br><tt> <b>if</b> ( percent <=
0 )</tt>
<br><tt> <b>return</b>
0;</tt>
<br><tt> <b>else</b> <b>if</b> ( percent
> 100 )</tt>
<br><tt> <b>return</b>
1;</tt>
<br><tt> <b>else</b> <b>if</b> ( rnd(
100 ) <= percent )</tt>
<br><tt> <b>return</b>
1;</tt>
<br><tt> <b>return</b> 0;</tt>
<br><tt> }</tt>
<p>This function is true the specified percentage of the time making it
easy to incorporate into an if statement.
<p> <tt> <b>if</b> ( odds( 50 ) )</tt>
<br><tt> printf( "The cave did not collapse!\n" )</tt>
<br><tt> <b>else</b></tt>
<br><tt> printf( "Ouch! You are squashed beneath a mountain
of boulders.\n" );</tt>
<p>The standard C library rand() and random() functions provide a program
with uniformly distributed random numbers. The sequence and precision
can be controlled by other library functions and the distribution of numbers
can be altered by simple functions. Random numbers can add unpredictability
to a program and are, of course, the backbone to exciting play in computer
games.
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Ken O. Burtch.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<center>
<H1><font color="maroon">Merchant Empires: Coding your own PHP Universe</font></H1>
<H4>By <a href="mailto:bryan@xlord.dunsinane.net">Bryan Brunton</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<P> Bryan Brunton is the creator of the Merchant Empires Project. Merchant
Empires is a multiplayer, web-based game of space exploration and economic
competition. It is a game of strategy, role-playing, combat, and diplomacy.
Merchant Empires is based on the venerable BBS game Tradewars. In the article
below, Bryan Brunton is interviewed about his experiences in bringing Merchant
Empires to life.<P>
<b>Q:</b> Why did you write ME?<p>
<b>A:</b> A number of reasons. First, I wanted to see if it could be done. I have always been a fan of space based strategy games and I
have always wanted to write one. Although I knew that the efforts of bringing the idea to completion would be at times tedious,
I didn't care. Secondly, I ran across a game called Space Merchant which is a closed-source, ASP-based implementation of Tradewars, and I was
appalled at how badly it had been done. In my opinion, there are many things wrong with the Space Merchant implementation but one thing really
struck me as ridiculous: when playing Space Merchant, occasionally an error screen would pop up that said, "Command not
processed due to an Error Storm. Please log out and try again." The utter inanity of the the concept of an "Error Storm" and that
someone was attempting to pass that explanation off as rational was, to me, hilarious. I said to myself, "Tradewars deserves
better than this." However, at the same time, I don't want to overly disregard the thought and effort that went into Space Merchant. The developers of SM deserve
a lot of credit for their work.<p>
<b>Q:</b> What software have you used to bring ME to life?<p>
<b>A:</b> Here is a brief summary of the open source software used in ME:<p>
<BLOCKQUOTE>
<dl>
<dt><strong>
Apache
</strong></dt>
<dd>
Any webserver that supports PHP could be used.
</dd>
<dt><strong>
PostgreSQL
</strong></dt>
<dd>
</dd>
<dt><strong>
PHP
</strong></dt>
<dd>
</dd>
<dt><strong>
PHPLIB
</strong></dt>
<dd>
This libary provides classes that simplify PHP database access and session tracking.
</dd>
<dt><strong>
Python
</strong></dt>
<dd>
The first version of ME was written entirely in Python. Due to performance considerations, I switched to
PHP. Parts of ME remain in Python.
</dd>
<dt><strong>
PygreSQL
</strong></dt>
<dd>
The ME event processor and map creator gather and update ME data
that is located on a PostgreSQL server using these libraries.
</dd>
<dt><strong>
Medusa Asyncronous Network Libraries
</strong></dt>
<dd>
Medusa is used in the ME event processor. These libraries provide telnet access to the ME event processor.
</dd>
<dd>
The ME event processor and map creator gather and update ME data
that is located on a PostgreSQL server using these libraries.
</dd>
<dt><strong>
KDevelop
</strong></dt>
<dd>
KDevelop is a great editor for HTML/PHP code. I will probably be purchasing the new PHP IDE from Zend.
</dd>
<dt><strong>
Gimp
</strong></dt>
<dd>
Almost every ME image has been created with this excellent tool.
</dd>
</dl>
</BLOCKQUOTE>
<p>
<b>Q:</b> Many of the ME players tell me that the ME site has been, at times, less than stable. What problems have you run across
while developing ME?<p>
<b>A:</b> I ran across a number of bugs and gotchas. The pre-configured scalability of the operating system itself and
applications such as Apache and PostgreSQL in most Linux distributions is really quite horrible. In my opinion, pre-configured
Linux does not provide a stable platform for a medium traffic, database backed website (Apache + PHP + PHPLIB + PostgreSQL).
And when I say pre-configured, I mean as installed on the average PC from any of the popular distro CDs.<p>
Here are a few of the problems that I have run across (most of these caused major headaches):
<UL>
<LI> The maximum amount of shared memory, open files, and file nodes on most Linux distros is set pathetically low.<p>
<LI> Apache, PHP 4, PostgreSQL had (and possibly still have) problems with permanent connections using pg_pconnect(). Either the PHP parser or Apache
does not correctly close database connections when a child http process terminates.<p>
<LI> ReiserFS and PostgreSQL had (and possible still have) issues with using PostgreSQL with the -F option (no fsyncing on each write operation). This would result in corrupted file system and/or
database.<p>
<LI> I purchased a NetGear networking card. The tulip driver for this card fails miserably under high load. In my opinion, the
monolithic Tulip driver is a mistake. It gets rewritten and older NICs suddenly stop working. It doesn't function
consistently across all cards.<p>
<LI> The back-end storage manager for PostgreSQL doesn't dynamically free deleted rows. This has a major impact on performance
on heavily used tables. The PostgreSQL documentation states: "Running VACUUM periodically will increase the speed of the
database in processing user queries." The documentation doesn't define exactly what "periodically" means. Who knows how
many people just like myself have wondered why the load on their web server is at twenty because PostgreSQL is missing
decent documenation on admining the database for a high traffic site. Also, PostgreSQL ships with a back-end process limit of 32. That number
is abysmally low for a site with even medium levels of traffic.<p>
</UL>
<b>Q:</b> Why on earth would anyone want to put away one of today's state-of-the-art games like Quake III
in order to open up a web browser to play ME? Just how interactive can your game be when it doesn't require
the CPUs on your player's computers to make even a single gigaflop of floating point calculations?<p>
<b>A:</b> The stateless void of HTML is certainly the last place a player wants to be when, potentially, an
enemy vessel could be pounding him into space dust. But a browser based gaming environment
has advantages that I value. I looked at a number of similarly directed projects before writing ME.
Many of them had stalled or the developers had spent six months time writing
a server and client with no playable game to show for their efforts. I wanted to spend my time
immediately writing game code. Spending untold hours writing a scalable multiplayer game server was (1) beyond my ability
and (2) boring. Also, I like the lowest common denominator factor involved in playing ME. All you need is
a web browser that supports javascript. You can have access to and play ME from a far greater number
of places than a game that requires client installation and configuration. As far as what makes a good
game, I have always enjoyed intelligent turn-based game play, not frames per second.<p>
<b>Q:</b> The gaming industry as a whole has been very silent concerning Merchant Empires. Recently, when questioning
one industry representative about ME and his company's initiatives in bringing games like ME to the marketplace,
we received nothing but silence and utter denials of any involvement. What commercial interest has been shown
in ME and what future do you see for the "resurrected-from-the-dead, BBS2HTML" gaming market?<p>
<b>A:</b> There is no commercial interest. I despise banner ads. The Merchant Empires site that I run will never use
banner ads. This means that I can probably never afford to purchase additional bandwidth to host ME (it is
currently run on a friend's 768K DSL line). There is always the chance that a well funded organization that wants
the honor and privilege of sponsering ME could provide additional bandwidth. One side note on DSL: while it is
great that such cheap bandwidth can be brought to the masses, the reliability of DSL (as profided by QWest in the
Colorado Springs, US area) is attrocious. Only a company in monopolistic control of the market, as QWEST is, can
afford to provide such lousy service.<p>
<b>Q:</b> How popular is ME?<p>
<b>A:</b> Over 7,000 people have created users. ME has a loyal group of a couple hundred players that play very
regularly. In my opinion, the game is somewhat limited in its playability due to its simplistic economic and political
models. I would like to flesh out these areas so it might have a greater appeal. The possibility for role-playing
is very limited beyond pirating and player-killing.<p>
I enjoy hosting ME because there is something that is just cool about writing a piece of software that gets frequent
use and can potentially generate lots of data. I don't know why but I just like lots of data. The ME database can grow
to over 100 megs before I delete data from old games and players.<p>
<b>Q:</b> What do the ME players most enjoy about the game?<p>
<b>A:</b> The players seem to most enjoy the politics of planning ways to kill each other. The same is true for most
online games that involve combat. In ME, players pick sides and then organize toward the goal of conquering galaxies and then
the entire game universe. It is fascinating to watch the organizational approaches that different alliances take along a
autocratic to democratic continuum. Many of the ME players are also programmers who provide development assistance.
The players definitely enjoy watching the game grow and improve.<p>
<b>Q:</b> What plans do you have for improving ME?<p>
<b>A:</b> IMO, Scalable Vector Graphics (SVG) are the future of the web. SVG is essentially an open implemenation of Flash.
SVG could potentially be more powerful because it is based on open standards such as XML and Javascript. It is unfortunate
that browser-based SVG support on Linux is limited to a some barely functional code in the MathML-SVG build of Mozilla.
On the Windows and Mac side, Adobe provides a high quality SVG plug-in. But as Linux is my current desktop of choice, I am
currently caught in this SVG dilemna.<p>
There are a few big features that I want to put into ME. I'd like to implement a java applet that could provide realtime
game information. I would also like to introduce computer controlled ships and planets. Eventually, a computer controlled
Imperium (the police in ME) will play a larger part in the game.<p>
I would also like to remove ME's dependency on PostgreSQL. I have nothing against PostgreSQL but other people have
inquired about running ME with MySQL. Currently most of ME's database access is through data classes provided by PHPLIB
so removing the few PostgreSQLisms in the code wouldn't require much work.<p>
I am planning on a few major changes in ME 2.0. I want to have hexagon based maps (currently sectors are square). But
to do this right, I need SVG. I want to implement a whole new trading model where there are literally hundreds of different
goods and contract based trading agreements. I'd like to do away with ports as separate entities, making ports simply a feature
of planets. I would like to replace ME's current simple experience point advancement model with one that is skilled based.
These and other ideas are discussed at the ME Wish List over at SourceForge.<p>
<b>Q:</b> It has been noted by your players that your code sucks. Please don't take this the wrong way, but I really must agree.
Before this interview, I was looking through the code to your event processor, the server side Python process that handles
important game events, and I noticed that all of the program's intelligence is crammed into your networking loop.<p>
<b>A:</b> You should first consider that I wrote Merchant Empires as fast as I possibly could. My approach was very simple:
look at a Space Merchant screen shot and reproduce it as quickly as possible. Also, writing Merchant Empires
was quite intentionally a learning process for myself. Parts of Merchant Empires use C++, PHP, and Python. While I had
limited C++ experience, I had never used, and knew nothing about, either PHP or Python. I wanted to learn both of these
languages. Parts of Merchant Empires, such as the inconsistent use of CSS and the combat functionality, are from a coding
standpoint barely at the proof of concept stage. At the time that I wrote the event processor, I barely understood what a
select networking loop was. Today, I have forgotten everything that I learned on that concept and now I am just pleased that
that particular piece of code still works.<p>
<b>Q:</b> So your code is pretty rough around the edges. Have you considering using any recursive programming techniques to spruce it up?<p>
<b>A:</b> Recursion, if properly used, is an awesomely powerful programming tool. However, I have never actually used it. I thought
that by interviewing myself for this article (which is a somewhat recursive process), I could introduce myself to the concept of
recursion, and if I like it, consider using it in the future.<p>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Bryan Brunton.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">HelpDex</font></H1>
<H4>By <a href="mailto:shane_collinge@yahoo.com">Shane Collinge</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<IMG ALT="barbie.jpg" SRC="misc/collinge/barbie.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="concentrate.jpg" SRC="misc/collinge/concentrate.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="prettyprettypls.jpg" SRC="misc/collinge/prettyprettypls.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="creditcard.jpg" SRC="misc/collinge/creditcard.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="dawn.jpg" SRC="misc/collinge/dawn.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="elephant.jpg" SRC="misc/collinge/elephant.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="oops.jpg" SRC="misc/collinge/oops.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="weekend.jpg" SRC="misc/collinge/weekend.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="deposit.jpg" SRC="misc/collinge/deposit.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<IMG ALT="rootpassword.jpg" SRC="misc/collinge/rootpassword.jpg"
WIDTH="750" HEIGHT="303">
<BR CLEAR="all">
<P> Courtesy
<A HREF="http://www.linuxtoday.com/helpdex">
Linux Today</A>, where you can read all the latest <EM>Help Dex</EM> cartoons.
<BLOCKQUOTE><EM>
[Shane invites your suggestions for future HelpDex cartoons.
What do you think is funny about the Linux world? Send him your
ideas and let him expand on them. His address is
<A HREF="mailto:shane_collinge@yahoo.com">shane_collinge@yahoo.com</A>
Suggesters will be acknowledged in the cartoon unless you request not
to be. -Mike.]
</EM></BLOCKQUOTE>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Shane Collinge.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Installing dict - An On-Line Dictionary</font></H1>
<H4>By <a href="mailto:chris@hawklord.uklinux.net">Chris Gibbs</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<H1>Purpose of this Paper</H1>
<P>To advertise the efforts of <A HREF="http://www.dict.org">http://www.dict.org</A> and to
provide the means by which any Linux user regardless of experience,
can install a functional dictionary system either for local or
network use.
</P>
<h3><u>CONTENTS</u></h3>
<p>
<OL>
<LI><a href="#1">Introduction</a>
<LI><a href="#2">The DICT Development Group (www.dict.org)</a>
<LI><a href="#3">Available Dictionaries</a>
<LI><a href="#4">Installation</a>
<OL class="inner">
<LI><a href="#5">dictd, dict and dictzip</a>
<LI><a href="#6">Webster's</a>
<LI><a href="#7">WordNet (r) 1.6</a>
<LI><a href="#8">Jargon File, FOLDOC, The Elements, Easton's Bible Dictionary & Hitchcock's Bible
Names Dictionary</a>
<LI><a href="#9">More up-to-date Jargon File</a>
<LI><a href="#10">US Gazetteer</a>
<LI><a href="#11">The Devils Dictionary</a>
<LI><a href="#111">Who Was Who: 5000 B. C. to Date</a>
<LI><a href="#12">Language Dictionaries</a>
</OL>
<LI><a href="#13">Configuring dictd</a>
<LI><a href="#14">Using dict</a>
<LI><a href="#15">Kdict</a>
<LI><a href="#16">Conclusion</a>
</OL>
</p>
<a name="1"></a>
<H1>Introduction</H1>
<P>I have been using Linux exclusively as my operating system for
over three years now. One of the very few things I miss about <I>"that
other operating system"</I> is the easy availability of cheap or
even free versions of commercial encyclopedias and dictionaries.
</P>
<P>So when I installed a recent version of S.u.S.E. linux I was both
surprised and happy to find a package called <B>Kdict</B> had been
installed on my machine. Reading the documentation that came with the
package revealed that the program was only a front end to another
program, and that though it is possible to install a dictionary
server locally, if I wanted to do so I would have to get everything
else I need from the Internet.
</P>
<a name="2"></a>
<H1>The DICT Development Group (www.dict.org)</H1>
<P><SUB>Note:- This section paraphrases the contents of ANNOUNCE in
the dict distribution.</SUB>
</P>
<P><A HREF="http://www.dict.org/">The DICT Development Group
(www.dict.org)</A> have both developed a <B>Dictionary Server
Protocol</B> (as described in RFC 2229), client/server software in C
as well as clients in other languages such as Java and Perl, and
converted various freely available dictionaries for use with their
software.
</P>
<P>The <B>Dictionary Server Protocol</B> (DICT) is a TCP transaction
based query/response protocol that allows a client to access
dictionary definitions from a set of natural language dictionary
databases.
</P>
<P><B>dict</B>(1) is a client which can access DICT servers from the
command line.
</P>
<P><B>dictd</B>(8) is a server which supports the DICT protocol.
</P>
<P><B>dictzip</B>(1) is a compression program which creates
compressed files in the gzip format (see RFC 1952). However, unlike
gzip(1), dictzip(1) compresses the file in pieces and stores an index
to the pieces in the gzip header. This allows random access to the
file at the granularity of the compressed pieces (currently about
64kB) while maintaining good compression ratios (within 5% of the
expected ratio for dictionary data). dictd(8) uses files stored in
this format.
</P>
<P>Available in separate <CODE>.tar.gz</CODE>
files are the data, conversion programs, and formatted output for
several freely-distributable dictionaries. For any single dictionary,
the terms for commercial distribution may be different from the terms
for non-commercial distribution -- be sure to read the copyright and
licensing information at the top of each database file. Below are
approximate sizes for the databases, showing the number of headwords
in each, and the space required to store the database:
</P>
<CENTER>
<TABLE border=2>
<TR>
<TD>
<P><B>Database</B></P>
</TD>
<TD>
<P><B>Headwords</B></P>
</TD>
<TD>
<P><B>Index</B></P>
</TD>
<TD>
<P><B>Data</B></P>
</TD>
<TD>
<P><B>Uncompressed</B></P>
</TD>
</TR>
<TR>
<TD>
<P>web1913</P>
</TD>
<TD>
<P>185399</P>
</TD>
<TD>
<P>3438 kB</P>
</TD>
<TD>
<P>11 MB</P>
</TD>
<TD>
<P>30 MB</P>
</TD>
</TR>
<TR>
<TD>
<P>wn</P>
</TD>
<TD>
<P>121967</P>
</TD>
<TD>
<P>2427 kB</P>
</TD>
<TD>
<P>7142 kB</P>
</TD>
<TD>
<P>21 MB</P>
</TD>
</TR>
<TR>
<TD>
<P>gazetteer</P>
</TD>
<TD>
<P>52994</P>
</TD>
<TD>
<P>1087 kB</P>
</TD>
<TD>
<P>1754 kB</P>
</TD>
<TD>
<P>8351 kB</P>
</TD>
</TR>
<TR>
<TD>
<P>jargon</P>
</TD>
<TD>
<P>2135</P>
</TD>
<TD>
<P>38 kB</P>
</TD>
<TD>
<P>536 kB</P>
</TD>
<TD>
<P>1248 kB</P>
</TD>
</TR>
<TR>
<TD>
<P>foldoc</P>
</TD>
<TD>
<P>11508</P>
</TD>
<TD>
<P>220 kB</P>
</TD>
<TD>
<P>1759 kB</P>
</TD>
<TD>
<P>4275 kB</P>
</TD>
</TR>
<TR>
<TD>
<P>elements</P>
</TD>
<TD>
<P>131</P>
</TD>
<TD>
<P>2 kB</P>
</TD>
<TD>
<P>12 kB</P>
</TD>
<TD>
<P>38 kB</P>
</TD>
</TR>
<TR>
<TD>
<P>easton</P>
</TD>
<TD>
<P>3968</P>
</TD>
<TD>
<P>64 kB</P>
</TD>
<TD>
<P>1077 kB</P>
</TD>
<TD>
<P>2648 kB</P>
</TD>
</TR>
<TR>
<TD>
<P>hitchcock</P>
</TD>
<TD>
<P>2619</P>
</TD>
<TD>
<P>34 kB</P>
</TD>
<TD>
<P>33 kB</P>
</TD>
<TD>
<P>85 kB</P>
</TD>
</TR>
<TR>
<TD>
<P>www</P>
</TD>
<TD>
<P>587</P>
</TD>
<TD>
<P>8 kB</P>
</TD>
<TD>
<P>58 kB</P>
</TD>
<TD>
<P>135 kB</P>
</TD>
</TR>
</TABLE>
</CENTER>
<P>All of these compressed databases and indices can be
stored in approximately 32MB of disk space.
</P>
<P>Additionally there are a number of bi-lingual
dictionaries to help with translation. Though I have not looked at
these judging from their different sizes some will be more useful
than others (i.e. English to Welsh is unfortunately not very good,
whereas English to German is probably quite useful).
</P>
<P>All the dictionaries seem to be under constant
development so interested people should keep up with latest
developments.
</P>
<a name="3"></a>
<H1>Available Dictionaries</H1>
<DL>
<br>
<DT><B>Webster's Revised Unabridged Dictionary (1913)</B>
</DT><DD><P>
The Oxford English Dictionary this is not! It is however a very
pleasant dictionary. It seems to be an American version of one of
those Dictionary/Encyclopedias, so common at the time of its
writing. Quite often in a definition you will find a poetic quote
and it really is very informative and pleasant to use.
</DD><DT>
<br><br>
<B>WordNet (r) 1.6</B>
</DT><DD><P>
This dictionary seems to be under constant development. The aim
seems to be to provide definitions of all the words people want to
have definitions for! In practice it seems to miss some obvious
words such as "with" and "without". I guess the
idea is to simply provide necessary update to the definitions found
in Webster's. Unfortunately this dictionary is neither as
informative or as pleasant as Webster's. If you need a more up to
date dictionary it is necessary.
</DD><DT>
<br><br>
<B>The Free On-line Dictionary of Computing (15Feb98)</B>
</DT><DD><P>
FOLDOC is a searchable dictionary of acronyms, jargon, programming
languages, tools, architecture, operating systems, networking,
theory, conventions, standards, mathematics, telecoms, electronics,
institutions, companies, projects, products, history, in fact
anything to do with computing. The dictionary is Copyright Denis
Howe 1993, 1997.
</DD><DT>
<br><br>
<B>U.S. Gazetteer (1990)</B>
</DT><DD><P>
This is probably only of interest to people wanting information
about America. The original U.S. Gazetteer Place and Zipcode Files
are provided by the U.S. Census Bureau and are in the Public Domain.
</DD><DT>
<br><br>
<B>Easton's 1897 Bible Dictionary</B>
</DT><DD><P>
These Dictionary topics are from M.G. Easton M.A., D.D., Illustrated
Bible Dictionary, Third Edition, published by Thomas Nelson, 1897.
Due to the nature of etext, the illustrated portion of the
Dictionary has not been included.
</DD><DT>
<br><br>
<B>Hitchcock's Bible Names Dictionary (late 1800's)</B>
</DT><DD><P>
This dictionary is from "Hitchcock's New and Complete Analysis
of the Holy Bible," published in the late 1800s. It contains
more than 2,500 Bible and Bible-related proper names and their
meanings. Some Hebrew words of uncertain meaning have been left out.
It is out of copyright, so feel free to copy and distribute it. I
pray it will help in your study of God's Word. --Brad Haugaard
</DD><DT>
<br><br>
<B>The Elements (22Oct97)</B>
</DT><DD><P>
This dictionary database was created by Jay Kominek <jfk at acm.org>.
</DD><DT>
<br><br>
<B>The CIA World Factbook (1995)</B>
</DT><DD><P>
This somewhat typically short sighted view of the World (sorry I
love America, I lived there for a while - its great, but it is not
ALL THE WORLD!), really only becomes useful if you look in the index
file and see that there are Appendix's, these are though of limited
use to normal people, who think that the world ends at their
keyboard.
</DD><DT>
<br><br>
<B>Jargon File (4.2.0, 31 JAN 2000)</B>
</DT><DD><P>
The Jargon File is a comprehensive compendium of hacker slang
illuminating many aspects of hackish tradition, folklore, and humor.
This bears remarkable similarity to FOLDOC above.
</DD><DT>
<br><br>
<B>THE DEVIL'S DICTIONARY ((C)1911 Released April 15 1993)</B>
</DT><DD><P>
_The Devil's Dictionary_ was begun in a weekly paper in 1881, and
was continued in a desultory way at long intervals until 1906. In
that year a large part of it was published in covers with the title
_The Cynic's Word Book_, a name which the author had not the power
to reject or happiness to approve. Users of the <B>fortune</B>
program will already have some familiarity with this ;-).
</DD><DT>
<br><br>
<B>Who Was Who</B>
</DT><DD><P>
Who Was Who: 5000 B. C. to Date: Biographical Dictionary of the
Famous and Those Who Wanted to Be, edited by Irwin L. Gordon
<br><br>
<B>OTHER DICTIONARIES</B>
</DT><DD><P>
A number of other dictionaries have been made available, see the
<B>dict</B> home page for details. In many cases you may find the
program to convert dictionary data to the format <B>dict</B>
requires has not been written yet ;-(
<br><br>
</DD>
</DL>
<P>
As mentioned elsewhere, there are a number of translation
dictionaries also available (see below).
</P>
<a name="4"></a>
<H1>Installation</H1>
<P>The links given here were correct at the time of writing. If it is
a long time since this paper was published you should visit
<A HREF="http://www.dict.org/">http://www.dict.org</A> to see what has
changed.
</P>
<P>Unfortunately installation of the above mentioned software did not
go quite as easily as it should have, which partly explains why I am
writing this;-).
</P>
<P>The first thing you will need is plenty of disk space. The largest
dictionary available is <B>Webster's 1913</B> dictionary, which will
need about 85Meg to be re-built in.
</P>
<a name="5"></a>
<H2>dictd, dict and dictzip</H2>
<P>Unarchive <A HREF="ftp://ftp.dict.org/pub/dict/dictd-1.5.5.tar.gz">dictd-1.5.5.tar.gz</A>
in the normal manner.
</P>
<P><B>IMPORTANT:-</B> The HTML support has been turned off in this
version of <B>dict</B>. You need to turn it back on if you want to
take advantage of <B>Kdict</B>.
</P>
<P>Load the file <B>dict.c</B> into your favorite editor and remove
the comments from line 1069:-
</P>
<PRE>
{ "raw", 0, 0, 'r' },
{ "pager", 1, 0, 'P' },
{ "debug", 1, 0, 502 },
{ "html", 0, 0, 503 }, //Remove comments from this line
{ "pipesize", 1, 0, 504 },
{ "client", 1, 0, 505 },
</PRE><P>
so the file becomes as above.
</P>
<P>Now you can run <CODE>./configure;make;make install</CODE>. You
will see a great many warnings produced by the compiler, but at the
end you should have working client, server and compression program
installed.
</P>
<a name="5"></a>
<H2>Webster's</H2>
<P>Unpack the files <A HREF="ftp://ftp.dict.org/pub/dict/dict-web1913-1.4.tar.gz">dict-web1913-1.4.tar.gz</A>
and <A HREF="ftp://ftp.dict.org/pub/dict/web1913-0.46-a.tar.gz">web1913-0.46-a.tar.gz</A>:
</P>
<PRE>
$ tar xvzf dict-web1913-1.4.tar.gz
$ tar xvzf web1913-0.46-a.tar.gz
$ cd dict-web1913-1.4
$ mkdir web1913
$ cp ../web1913-0.46-a/* web1913
$ ./configure
$ make
$ make db
</PRE><P>
Now go make a cup of tea, this takes over an hour on my 133MHz box.
When done, decide on a place for your dictionaries to live and copy
them there, I use <CODE>/opt/public/dict-dbs</CODE> as suggested:-
</P>
<PRE>
$ mkdir /opt/public/dict-dbs
$ cp web1913.dict.dz /opt/public/dict-dbs
$ cp web1913.index /opt/public/dict-dbs
</PRE>
<a name="7"></a>
<H2>
WordNet (r) 1.6</H2>
<P>Grab <A HREF="ftp://ftp.dict.org/pub/dict/dict-wn-1.5.tar.gz">dict-wn-1.5.tar.gz</A>
</P>
<P>It is a great shame that one of the most useful dictionaries is
also the one that refuses to compile correctly. To create a viable
dictionary the original data must be parsed by a program. When you do
<CODE>make</CODE> it is this program that is created. Unfortunately
this package uses a <code>Makefile</code> created by <CODE>./configure</CODE>
which does not work. I am unable to correct the <CODE>automake</CODE>
procedure but can assure you that the following will work:
</P>
<PRE>
$ tar xvzf dict-wn-1.5.tar.gz
$ cd dict-wn-1.5
$ ./configure
$ gcc -o wnfilter wnfilter.c
$ make db
</PRE><P>
Again this process takes a considerable amount of time ( > 1 hour
on my 133MHz). Once complete if you have not already created a
directory for your dictionaries do so now and copy the dictionary and
its index there:
</P>
<PRE>
$ cp wn.dict.dz /opt/public/dict-dbs
$ cp wn.index /opt/public/dict-dbs
</PRE>
<a name="8"></a>
<H2>
Jargon File, FOLDOC, The Elements, Easton's Bible Dictionary &
Hitchcock's Bible Names Dictionary</H2>
<P>Grab <A HREF="ftp://ftp.dict.org/pub/dict/dict-misc-1.5.tar.gz">dict-misc-1.5.tar.gz</A>
</P>
<PRE>
$ tar xvzf dict-misc-1.5.tar.gz
$ cd dict-misc-1.5
$ ./configure
$ make
$ make db
$ cp easton.dict.dz /opt/public/dict-dbs
$ cp easton.index /opt/public/dict-dbs
$ cp elements.dict.dz /opt/public/dict-dbs
$ cp elements.index /opt/public/dict-dbs
$ cp foldoc.dict.dz /opt/public/dict-dbs
$ cp foldoc.index /opt/public/dict-dbs
$ cp hitchcock.dict.dz /opt/public/dict-dbs
$ cp hitchcock.index /opt/public/dict-dbs
$ cp jargon.dict.dz /opt/public/dict-dbs
$ cp jargon.index /opt/public/dict-dbs
</PRE>
<a name="9"></a>
<H2>
More up-to-date Jargon File</H2>
<P>Grab <A HREF="ftp://ftp.dict.org/pub/dict/dict-jargon-4.2.0.tar.gz">dict-jargon-4.2.0.tar.gz</A>
</P>
<PRE>
$ tar xvzf dict-jargon-4.2.0.tar.gz
$ cd dict-jargon-4.2.0
$ ./configure
$ make
$ make db
$ cp jargon.dict.dz /opt/public/dict-dbs
$ cp jargon.index /opt/public/dict-dbs
</PRE>
<a name="10"></a>
<H2>
US Gazetteer</H2>
<P>Grab <A HREF="ftp://ftp.dict.org/pub/dict/dict-gazetteer-1.3.tar.gz">dict-gazetteer-1.3.tar.gz</A>
</P>
<PRE>
$ tar xvzf dict-gazetteer-1.3.tar.gz
$ cd dict-gazetteer-1.3
$ ./configure
$ make
$ make db
$ cp gazetteer.dict.dz /opt/public/dict-dbs
$ cp gazetteer.index /opt/public/dict-dbs
</PRE>
<a name="11"></a>
<H2>
The Devils Dictionary</H2>
Grab <A HREF="ftp://ftp.dict.org/pub/dict/pre/devils-dict-pre.tar.gz">devils-dict-pre.tar.gz</A>
</P>
<P>As with the language dictionaries below, the dictionary has
already been created for you. Simply unpack this file in your
dictionary directory.
</P>
<a name="111"></a>
<h2>Who Was Who: 5000 B. C. to Date</h2>
<p>
Grab <a href="http://www.hawklord.uklinux.net/dict/www-1.0.tgz">http://www.hawklord.uklinux.net/dict/www-1.0.tgz</a>
<PRE>
$ tar xvzf www-1.0.tgz
$ cd www-1.0
$ ./configure
$ make
$ make db
$ cp www.dict.dz /opt/public/dict-dbs
$ cp www.index /opt/public/dict-dbs
</PRE>
<a name="12"></a>
<H2>Language Dictionaries</H2>
<P>Visit <A HREF="ftp://ftp.dict.org/pub/dict/pre/www.freedict.de/20000906">ftp://ftp.dict.org/pub/dict/pre/www.freedict.de/20000906</A>
</P>
<P>Installing a language dictionary does not involve re-building the
dictionary from original data, so you just need to unpack each file
into you dictionary directory.
</P>
<a name="13"></a>
<H1>Configuring dictd</H1>
<P><B>dictd</B> expects to find the file <CODE>/etc/dictd.conf</CODE>,
though an alternative file may be specified on the command line. Each
dictionary needs to be specified in this file so <B>dictd</B> can
find the dictionary and its index. For example if you just want to
use Webster's, WordNet and The Devils Dictionary, then the following
entries will be required (assuming you use <CODE>/opt/public/dict-dbs</CODE>
as your dictionary directory):
</P>
<PRE>
database Web-1913 { data "/opt/public/dict-dbs/web1913.dict.dz"
index "/opt/public/dict-dbs/web1913.index" }
database wn { data "/opt/public/dict-dbs/wn.dict.dz"
index "/opt/public/dict-dbs/wn.index" }
database devils { data "/opt/public/dict-dbs/devils.dict.dz"
index "/opt/public/dict-dbs/devils.index" }
</PRE><H2>
Advanced Configuration</H2>
<P>It seems it is possible to implement user access control and other
security measures. I have not tried this. If I were into security
issues the current state of the software gives me no reason to trust
any security feature it might have. But why anyone would want to
restrict access to these dictionaries is completely beyond me, this
is stuff any user has a right to use.
</P>
<P>You should be aware of a number of security issues if you intend
to make <B>dictd</B> available over a local network since not being
aware will leave your server vulnerable to a number of possible
attacks.
</P>
<p>Unless you are installing <b>dictd</b> on a server for a school/college
or for some other large network these issues will probably be of no concern to
you. If you are installing on such a network then you should already
be aware of the issues below.
</p>
<H3>Server Overload, Denial of Service, Heavy Swapping</H3>
<P>All these symptoms can occur if a number of users send queries
like <CODE>MATCH * re .</CODE> at the same time. Such queries return
the whole database index and each instance will require around 5MB
buffer space on the server.
</P>
<P>Possible solutions include limiting the number of connections to
the server, limiting the amount of data that can be returned for a
single query or limiting the number of simultaneous outstanding
searches.
</P>
<H3>Denial of Service</H3>
<P>The server can be driven to a complete stand still by any evil
minded <I>cracker</I> that wants to connect to the server 1,000,000
times.
</P>
<P>To prevent such anti-social behavior simply limit the number of
connections based on IP or mask.
</P>
<H3>Buffer Overflow</H3>
<P>If you experience this kind of problem you should make your
logging routines more robust, use <CODE>strlen</CODE> and examine
<CODE>daemon_log</CODE>.
</P>
<a name="14"></a>
<H1>Using dict</H1>
<P><B>dict</B> expects to find the file <CODE>/etc/dict.conf</CODE>.
This file should contain a line with the name of the machine you wish
to use as your <B>dictd</B> server, though this can be overridden at
the command line.
</P>
<P>The current version of <B>dict</B> is a little disappointing as a
users front-end for <B>dictd</B>. If all you have is a console and
you can't use <B>Kdict</B> then you will just have to get used to
<B>dict</B>. The worst thing about <B>dict</B> is that it can trash
your console and you will need to take action (such as logging out
and back in) to restore the keyboard to normal! This typically occurs
if there is a problem with <B>dictd</B>; such as when it is not
running and you try to use <B>dict</B>.
</P>
<P>Since <B>dict</B> is just a console program, it just sends output
to <B>less</B>. So unless you have a very good memory you will need
to use `cut and paste' to transfer referenced words or phrases back to
the command line.
</P>
<P>There is an option to send output to a pager program. I tried the
command <CODE>dict -html -P lynx luser</CODE>, the result was not a
happy one! Lynx went mad, referencing random help and configuration
files in a manner that reminded me of certain viruses in MS operating
systems.
</P>
<P>Personally I would say if you can avoid using <B>dict</B>
directly, avoid it! It is necessary to have it if you want to use
<B>Kdict</B>, and you <B>do</B> want to use <B>Kdict</B>.
</P>
<a name="15"></a>
<H1>Kdict</H1>
<IMG SRC="misc/gibbs/kdict.gif" ALT="Kdict.gif" WIDTH=578 HEIGHT=559 BORDER=0>
<P>To take full advantage of <B>dict</B> you really <B><I>need</I></B>
Kdict from <A HREF="http://www.rhrk.uni-kl.de/~gebauerc/kdict">http://www.rhrk.uni-kl.de/~gebauerc/kdict</A>.
I have used version 0.2 and cannot speak for any other version.
</P>
<P>To use <B>Kdict</B> you <B><I>must</I></B> turn HTML support back
on for <B>dict</B> as described above.
</P>
<P>The screen shot above shows <B>Kdict</B> in use. <B>Kdict</B>
makes good use of the limited HTML tags provided by <B>dict</B>, and
inserts extra tags so that you can easily cross-reference words. Any
phrase or word shown in red can be clicked on with the mouse to show
its definition.
</P>
<P>What makes <B>Kdict</B> so good is the fact that you can use the
clipboard to highlight a word from any window on the desktop and paste
it into <B>Kdict</B> as a query.
</P>
<a name="16"></a>
<H1>Conclusion</H1>
<P>This is a great project that can only get better, so it is a lot
like <B>Linux</B> and <B>gnu</B> software in general... <B>Give it
your full support</B>!
</P>
<p>
If you get <b>xscrabble</b> from <a href="http://www.belgarath.demon.co.uk/programs/index.html"> Matt Chapman's homepage</a>, you can enhance your enjoyment of the game by looking up the definitions of words you don't know, - as the computer beats the sh*t out of you;-).
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Chris Gibbs.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Downloading LinuxToday links and Linux Gazette's TOC with Python (and Perl)</font></H1>
<H4>By <a href="mailto:articles@gnujobs.com">Mark Nielsen</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<h3>Contents</h3>
<ol>
<li>
<a href="#Introduction">Introduction</a></li>
<li>
<a href="#python">The Python Script</a></li>
<li>
<a href="#cron">Setting up a cron job</a></li>
<li>
<a href="#perl"> A Perl Script I wrote</a> to download <I>Linux Gazette</I> TOC.
<li>
<a href="#perl2">A Perl Script I wrote to download Debian Weekly News</a>
<li>
<a href="#Conclusion">Conclusion</a></li>
<li>
<a href="#REF">References</a></li>
</ol>
<h3>
<a NAME="Introduction"></a>Introduction</h3>
I wanted to add Linux Today's links to my website
<a href="http://www.gnujobs.com">GNUJobs.com</a>, just for the fun of it.
Later, I want to add more headlines from other websites, and perhaps <I>LG</I>'s
latest edition.
I had a choice of Perl or Python. I choose Python because I have been
using it for quite a while for a mathematical project, and it has proven
quite useful. I want to make a habit of using Python now. It tends to be
easier for me to program in Python than Perl. Also, in the future, I wish
to use threading to download many webpages at the same time,
which Python does very well. I might as well
do it in Python now since I know I will use it later.
<p>
Both Perl and Python will let you download webpages off of the internet.
You can do more than just download webpages, such as ftp, gopher, and connect
to other services. Downloading a webpage is just one thing these languages
can do.
<p>
There are several things the programming language has to do:
<ul>
<li> Download the webpage</li>
<li> Parse the data correctly to reformat the data</li>
<li> Reformat the data</li>
<li> Replace the old file with the new file only if it contains valid data</li>
</ul>
<p>
This article isn't going to be too long. I commented the Python code.
<h3>
<a NAME="python"></a>The Python Script</h3>
If you want to include the output of this script to a webpage, then you can use
the Server-Side Include (SSI) module in the Apache webserver and use a command
like:
<pre>
<!--#include virtual="/lthead.html" -->
</pre>
in your webpage. Various programming languages (like PHP, Perl ASP, Perl Mason, etc)
can also include files.
<p>
It is assumed you are using a GNU/Linux
operating system.
Also, I was using Python 1.5.2, which is not the latest version.
You might have to do a
<PRE>
chmod 755 LinuxToday.py
</PRE>
on the script to make it executable.
<A HREF="misc/nielsen/LinuxToday.py.txt">[Text version of this listing.]</A>
<pre>
#!/usr/bin/python
# One obvious thing to do is apply error checking for url download,
# download must contain at least one entry, and we are able to create the
# new file. This will be done later.
### import the web module, string module, regular expression, module
### and the os module
import urllib, string, re, os
### define the new webpage we create and where to get the info
Download_Location = "/tmp/lthead.html"
Url = "http://linuxtoday.com/backend/lthead.txt"
#-----------------------------------------------------------
### Create a web object with the Url
LinuxToday = urllib.urlopen( Url )
### Grab all the info into an array (if big, change to do one line at a time)
Text_Array = LinuxToday.readlines()
New_File = open(Download_Location + "_new", 'w');
New_File.write("<ul>\n")
### Set the default to be invalid
Valid = 0
### Record the number of valid entries
Entry_No = 0;
Entry_Valid = 0
### Setup the defaults
Date = ""
Link = ""
Header = ""
Count = 0
### Create the mattern matching expression
Match = re.compile ("^\&\&")
### Append && to make sure we parse the last entry
Text_Array.append('&&')
### For each line, do the following
for Line in Text_Array :
### If && exists, start from scratch, add last entry
if Match.search(Line) :
### If the current entry is valid and we have skipped the first one,
if (Entry_No > 1) and (Entry_Valid > 0) :
### One thing that Perl does better than Python is the print command. I
### don't like how Python prints (no variable interpolation).
New_File.write('<li> <a href="' + Link + '">' + Header + '</a>. ' + Date + "</li>\n")
## Reset the values to nothing.
Header = ""; Link = ""; Date = ""; Entry_Valid = 0
Count = 0
### Delete whitespace at end of line
Line = string.rstrip(Line)
### If count is equal to 1, header, 2 link, 3 date
if Count == 1: Header = Line
elif Count == 2: Link = Line
elif Count == 3:
Date = Line
### If all fields are done, we have a valid entry
if (Header != "") or (Link != "") or (Date != "") :
Entry_No = Entry_No + 1
Entry_Valid = 1
### Add one to Count
Count = Count + 1
New_File.write("</ul>\n")
New_File.close()
### If we have valid entries, move the new file to the real location
if Entry_No > 0 :
### We could just do:
### os.rename(Download_Location + "_new", Download_Location)
### But here's how to do it with an external command.
Command = "mv " + Download_Location + "_new " + Download_Location
os.system( Command )
</pre>
<h3>
<a NAME="cron"></a>The Cron Script to make it run nightly</h3>
Not the best crontab file, but it will do.
<pre>
#/bin/sh
### Crontab file
### Name the file "Crontab" and execute with "crontab Crontab"
### Download every two hours
*/2 * * * * /www/Cron/LinuxToday.py >> /www/Cron/out 2>&1
</pre>
<h3>
<a NAME="perl"></a>A Perl Script I wrote to download Linux Gazette TOC</h3>
Just so you can compare this to a Perl script, I created a Perl script
which downloads the <I>LG</I>'s TOC for the latest edition.
<A HREF="misc/nielsen/LinuxGazette.pl.txt">[Text version of this listing.]</A>
<pre>
#!/usr/bin/perl
# Copyright Mark Nielsen January 20001
# Copyrighted under the GPL license.
# I am proud of this script.
# I wrote it from scratch with only 2 minor errors when I first tested it.
system ("lynx --source http://www.linuxgazette.com/ftpfiles.txt > /tmp/List.txt");
### Open up the webpage we just downloaded and put it into an array.
open(FILE,'/tmp/List.txt'); my @Lines = <FILE>; close FILE;
### Filter out lines that don't contain magic letters.
my @Lines = grep(($_ =~ /lg\-issue/) || ($_ =~ /\.tar\.gz/), @Lines );
my @Numbers = ();
foreach my $Line (@Lines)
{
## Throw away the stuff to the left
my ($Junk,$Good) = split(/lg\-issue/,$Line,2);
## Throw away the stuff to the right
($Good,$Junk) = split(/\.tar\.gz/,$Good,2);
## If it is a valid number, it is greater than 1, save it
if ($Good > 0) {push (@Numbers,$Good);}
}
### Sort the numbers and pop off the highest
@Numbers = sort {$a<=>$b} @Numbers;
my $Highest = pop @Numbers;
## Create the url we are going to download
my $Url = "http://www.linuxgazette.com/issue$Highest/index.html";
## Download it
system ("lynx --source $Url > /tmp/LG_index.html");
### Open up the index.
open(FILE,"/tmp/LG_index.html"); my @Lines = <FILE>; close FILE;
### Extract out the parts that are between beginning and end of TOC.
my @TOC = ();
my $Count = 0;
my $Start = '<!-- *** BEGIN toc *** -->';
my $End = '<!-- *** END toc *** -->';
foreach my $Line (@Lines)
{
if ($Line =~ /\Q$End\E/) {$Count = 2;}
if ($Count == 1) {push(@TOC, $Line);}
if ($Line =~ /\Q$Start\E/) {$Count = 1;}
}
### Relink all the links to point to the Linux Gazette magazine
my $Relink = "http://www.linuxgazette.com/issue$Highest/";
grep($_ =~ s/HREF\=\"/HREF\=\"$Relink/g, @TOC);
### Save the output
open(FILE,">/tmp/TOC.html"); print FILE @TOC; close FILE;
### Done!
</pre>
<h3>
<a NAME="perl2"></a>A Perl Script I wrote to download Debian Weekly News</h3>
I like to keep track of Debian Weekly News, so I wrote this one also.
One bad thing about programming, is that when you get really good
at programming in a certain way, it is hard to switch to another
programming language. These two Perl scripts I did without
looking at any code. The Python code took me a while, because I am still
not used to it.
<A HREF="misc/nielsen/DebianWeeklyNews.pl.txt">[Text version of this listing.]</A>
<pre>
#!/usr/bin/perl
# Copyright Mark Nielsen January 20001
# Copyright under the GPL license.
system ("lynx --source http://www.debian.org/News/weekly/index.html > /tmp/List2.txt");
### Open up the webpage we just downloaded and put it into an array.
open(FILE,'/tmp/List2.txt'); my @Lines = <FILE>; close FILE;
### Extract out the parts that are between beginning and end of TOC.
my @TOC = ();
my $Count = 0;
my $Start = 'Recent issues of Debian Weekly News';
my $End = '</p>';
foreach my $Line (@Lines)
{
if (($Line =~ /\Q$End\E/i) && ($Count > 0)) {$Count = 2;}
if ($Count == 1) {push(@TOC, $Line);}
if ($Line =~ /^\Q$Start\E/i) {$Count = 1;}
}
### Relink all the links to point to the DWN
my $Relink = "http://www.debian.org/News/weekly/";
grep($_ =~ s/HREF\=\"/HREF\=\"$Relink/ig, @TOC);
grep($_ =~ s/\"\>/\" target=_external\>/ig, @TOC);
### Save the output
open(FILE,">/tmp/D.html"); print FILE @TOC; close FILE;
### Done!
</pre>
<h3>
<a NAME="Conclusion"></a>Conclusion</h3>
The Python script actually is made much more complex than it needs to be.
The reason why I made it longer was to introduce various modules and to be
flexible in case LinuxToday's format changes someday. The only thing the script
lacks is error detection in case it can't download the web page, write the new
file or rename it. Also, watch the regular-expression modules in Python,
because they have been changing in recent versions to increase efficiency and
incorporate Unicode support.
<p>
Python rules as a programming language. I found it very easy to use
the Python modules. It seems like the Python module for handling webpages
is easier than the LWP module in Perl. Because of the many possibilities of
Python, I plan on creating a Python script which will download many webpages
at the same time using Python's threading capbilities.
<h3>
<a NAME="REF"></a>References</h3>
<ol>
<li><a href="http://linuxtoday.com/backend/lthead.txt"> LinuxToday's links</a></li>
<li> <a href="http://www.python.org/doc/current/lib/module-urllib.html">Python's urllib module</a></li>
<li><a href="http://www.gnujobs.com/Articles/13/LT_Python.html">Original site for this article</a> (any updates will be here)
</ol>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Mark Nielsen.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Securely Erasing a Hard Drive with Perl</font></H1>
<H4>By <a href="mailto:articles@gnujobs.com">Mark Nielsen</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<H3>Contents</H3>
<ol>
<li>
<a href="#Introduction">Introduction</a></li>
<li>
<a href="#problems">What problems I have.</a></li>
<li>
<a href="#perl">The Perl Script</a></li>
<li>
<a href="#Conclusion">Conclusion</a></li>
<li>
<a href="#REF">References</a></li>
</ol>
<h3>
<a NAME="Introduction"></a>Introduction</h3>
When moving from Ohio to California, GNUJobs.com had some hard drives
(along with other hardware and software)
which were to be donated to
<a href="http://www.colug.net">COLUG</a> (Central Ohio Linux Users Group).
They needed to be deleted
before they were donated.
2 out of the 3 hard drives had bad sectors on them, and the third
I ended up using as a hard drive for testing purposes, like creating
this article, so I ended up not giving any away. Still, I will need to
wipe a hard drive in the future, so I created this Perl script (which I
will later convert to Python and make it have more options).
<p>
The goal of this Perl script is to just delete the hard drive at /dev/hdb
(the slave drive on the Primary IDE controller) since I have a hard drive
removeable kit there. I want it to delete all partitions, create one
partition that takes up the whole hard drive, and then fill up the
hard drive with garbage data (including some random encrypted data
just to ruin a hacker's day trying to find out what the data is).
<h3>
<a NAME="problems"></a>The Problems</h3>
Here is a list of problems I had and how I solved them:
<ol>
<li> <font size= +1>How do I get it to delete all the partitions?</font>
<p>I remember researching many different options to alter partitions on
a hard drive, and doing it manually yielded the best results. I had used
a Perl Expect script to automate the fdisk program (fdisk partitions hard
drives in Linux) in the past, and I decided to continue to do it
that way. I believe
there are better alternatives for the simple task of deleting all the
partitions, like sfdisk and others, but if one solution covers all
possibilities with 100% power and flexibility, I usually just stick to
one way of doing things so that I don't have to remember too many things
and if it ever gets more complicated, I don't have to learn anything new.
<p>Thus, I used Expect code to simulate a user typing in the commands
for fdisk. The Expect code deleted all the partitions and then
it created one big partition.<p></li>
<li><font size=+1>How do I fill up the hard drive with garbage data?</font>
<p> Just deleting partitions isn't enough to delete the data. I want
to overwrite all old data
with garbage to make sure the previous data was deleted.
I used sfdisk to get the size of the partition that fdisk created.
Then, I created a loop which would continuously print garbage data
until the amount printed was equal or greater than the size of the partition.
<p></li>
<li>
<font size=+1> How do I put binary data on the hard
drive to confuse a hacker?</font>
<P> I created random binary data using the
random function and "chr" function in Perl. Then, I encrypted the random
data using the Perl Blowfish module. If someone manages to decrypt the
data, it will still look like garbage and confuse them. I wanted to encrypt
the data so that it didn't look purely random in a mathematical sense.
<p> </li>
<li> <font size=+1> How do I reformat the big partition?</font>
<P> This was easy. I just used a simple "mkfs" command.
</ol>
<h3>
<a NAME="perl"></a>The Perl Script</h3>
The version of Perl I was using for this Perl script was out of date.
I was using Perl 5.005_03 and I believe Perl is up to 5.6 as of 1/2001.
<p>
There are a lot of things I need to enhance to make this
script more user friendly. There should be a lot more error checking,
considering how dangerous this script is, and prompts to ask a user
if they really want to do so stuff. I am waiting until I restart my MILAS
project (which will be written in Python) before I make this script better.
It was only to get me through moving from Columbus to the Bay Area.
<p> I have commented a lot of the code, so hopefully a novice Perl
programmer can understand most of what I am trying to do.
<A HREF="misc/nielsen2/Wipe_It.pl.txt">(Text version of this listing)</A>
<pre>
#!/usr/bin/perl
##### Things to do
# 1. Make sure we create a brand new directory for temporary mounting
# in order to avoid security risks in case someone is logged in.
# 2. Use perl functions to handle a lot of the system calls.
# 3. Let it autodetect hard drives, and floppy drives, and only perform
# actions on unmounted hard drives and floppy drives.
#####
use strict;
use Expect;
use Crypt::Blowfish;
#-----------------------------------------------
my $Junk;
### Set the drive to the slave drive on the Primary IDE controller.
my $Drive = "hdb";
### Let us do a lot of random stuff, and get the last line from the
### /etc/passwd file to make it really random, assuming one person
### has been added to the computer.
my $time = time();
my $Ran = rand($time);
my $Ran = rand(10000000000000);
my $LastLine = `tail -n 1 /etc/passwd`; chomp $LastLine;
$LastLine = substr ($LastLine,0,30);
my $Blowfish_Key = $LastLine . $Ran . $time;
$Blowfish_Key = substr ($Blowfish_Key,0,20);
while (length ($Blowfish_Key) < 56)
{
$Blowfish_Key .= $Ran = rand($time);
}
$Blowfish_Key = substr ($Blowfish_Key,0,56);
### Done making up random key, now create Blowfish Encryption object.
my $Blowfish_Cipher = new Crypt::Blowfish $Blowfish_Key;
#------------------------------------
system "clear";
print "This will wipe out the hard drive on Drive /dev/$Drive\n";
print "Press enter to continue\n";
my $R = <STDIN>;
### Get the list of mounted partitions on the drive we want to wipe out
my @Mounted = `df`;
@Mounted = grep($_ =~ /\/dev\/hdb/, @Mounted);
### Foreach mounted partition, umount it
foreach my $Mount (@Mounted)
{
my ($Partition,$Junk) = split(/\s+/, $Mount,2);
print "Unmounting $Partition\n";
my $Result = system ("umount $Partition");
if ($Result > 0)
{
print "ERROR, unable to umount $Partition, aborting Script, Error = $Result\n";
exit;
}
}
### Start the expect script, which will simulate someone doing this
### commands manually.
my $Fdisk = Expect->spawn("/sbin/fdisk /dev/$Drive");
### Get a list of mounted partitions by printing the partition table
print $Fdisk "p\n";
my $match=$Fdisk->expect(30,"Device Boot Start");
my $Temp = $Fdisk->exp_after();
my @Temp = split(/\n/, $Temp);
## Get the lines that tell us about the partitions
my @Partitions = grep($_ =~ /^\/dev\//, @Temp);
## Foreach line, delete the partition
foreach my $Line (reverse @Partitions)
{
## Get the /dev/hdb part, and its number
my ($Part,$Junk) = split(/[\t ]/, $Line,2);
my $No = $Part;
$No =~ s/^\/dev\/$Drive//;
print "Deleting no $Drive $No\n";
## Delete command
print $Fdisk "d\n";
$match=$Fdisk->expect(30,"Partition number");
## Which partition number to delete
print $Fdisk "$No\n";
$match=$Fdisk->expect(30,"Command (m for help):");
}
$Fdisk->clear_accum();
### If we had partitions, write changes, or otherwise, just end it
if (@Partitions < 1) {print $Fdisk "q\n"; $Fdisk->expect(2,":");}
else
{
print $Fdisk "w\n";
$Fdisk->expect(30,"Command (m for help):");
}
#-------------------------------
## Get the geometry of the hard drive
my $Geometry = `/sbin/sfdisk -g /dev/$Drive`;
my ($Junk, $Cyl, $Junk2, $Head, $Junk3, $Sector,@Junk) = split(/\s+/,$Geometry);
if ($Cyl < 1)
{print "ERROR: Unable to figure out cylinders for drive. aborting\n"; exit;}
### Create a new expect script to simulate a person using fdisk
my $Fdisk = Expect->spawn("/sbin/fdisk /dev/$Drive");
#### Tell fdisk to create new partition
print $Fdisk "n\n";
$Fdisk->expect(5,"primary");
### Tell it the new partition should be a primary partition
print $Fdisk "p\n";
$Fdisk->expect(5,":");
### Which partition, number 1
print $Fdisk "1\n";
$Fdisk->expect(5,":");
### Start at cylinder 1
print $Fdisk "1\n";
$Fdisk->expect(5,":");
### Go to the end
print $Fdisk "$Cyl\n";
$Fdisk->expect(5,":");
### Write and save
print $Fdisk "w\n";
$Fdisk->expect(30,"Command (m for help):");
#------------------------------------------
### Format the partition and mount it
my $Partition = "/dev/$Drive" . "1";
my $Result = system ("mkfs -t ext2 $Partition");
if ($Result > 0) {print "Error making partition, aborting.\n"; exit;}
### There should be better error checking here
system "umount /tmp/WIPE_IT";
system "rm -rf /tmp/WIPE_IT";
system "mkdir -p /tmp/WIPE_IT";
system "chmod 700 /tmp/WIPE_IT";
## See if we can mount the new partition.
my $Result = system ("mount $Partition /tmp/WIPE_IT");
if ($Result > 0) {print "Error mounting drive, aborting.\n"; exit;}
system "chmod 700 /tmp/WIPE_IT";
#--------------------------------
### Now create the file and stop when we hit the size.
my $Count = 0;
my $Written_Size = 0;
### Open up a new file.
open(FILE,">>/tmp/WIPE_IT/Message.txt");
### If someone actually wants to screw around with your hard drive,
### let us play with them and waste their time by adding a teaser.
my $Ran = rand 259200000; # between now and ten years ago (approx)
($Ran, $Junk) = split(/\./, $Ran, 2);
## New date minus random number of seconds
my $Date = `date --date '-$Ran seconds'`;
print FILE "DATE CREATED $Date\n";
my $Ran = rand 50;
($Ran, $Junk) = split(/\./, $Ran, 2);
$Ran = $Ran + 10;
print FILE "This document is extremely secure. It is a violation to let
any unauthorized persons read it. Known password holders need to
apply Method $Ran in order to decrypt binary data.\n";
### Create random number plus 25000
my $Ran = rand 25000;
($Ran, $Junk) = split(/\./, $Ran, 2);
$Ran = $Ran + 25000;
### Create an array of numbers which we will use most of the time.
my @Blank = (1..$Ran);
### Take the array and make into a string.
my $Blank = "@Blank";
### Empty the array to free up memory.
@Blank = ();
my $B_Length = length $Blank;
### Let us get the amount of real space we have for the partition
my @Temp = `df`;
@Temp = grep($_ =~ /^$Partition/, @Temp);
my $Line = $Temp[0];
my ($Junk,$Blocks,@Junk) = split(/\s+/, $Line,4);
### We are assuming 1k blocks.
my $Size = $Blocks*1000;
## While the file we have written is less than the size of the
## partition, print some more data.
while ($Written_Size < $Size)
{
$Count++;
### 9 out of ten times, we just want to print blank spaces to hurry
### up printing. One out of ten times, print garbage binary.
my $Ran = rand (10);
if ($Ran > 1)
{
print FILE $Blank;
$Written_Size = $Written_Size + $B_Length;
}
else
{
## This part makes a long string (upto 10000 bytes) of random data.
my $Garbage = "";
my $Length = rand(10000);
($Length, $Junk) = split(/\./, $Length, 2);
for (my $i = 0; $i < $Length; $i++)
{
my $Ran = rand 256;
($Ran, $Junk) = split(/\./, $Ran, 2);
$Garbage .= chr $Ran;
}
## This parts encrypts the random data 8 bytes at a time.
my $Temp = $Garbage;
my $Encrypted = "";
while (length $Temp > 0)
{
while (length $Temp < 8) {$Temp .= "\t";}
my $Temp2 = $Blowfish_Cipher->encrypt(substr($Temp,0,8));
$Encrypted .= $Temp2;
if (length $Temp > 8) {$Temp = substr($Temp,8);} else {$Temp = "";}
}
### Print the encrypted random data to file.
print FILE $Encrypted;
$Length = length $Encrypted;
$Written_Size = $Written_Size + $Length;
my $Rest = $Size - $Written_Size;
print "$Size - $Written_Size = $Rest to go\n";
}
### At every 500 prints, start saving to a new file.
if ($Count =~ /500$/)
{
close FILE;
open(FILE,">>/tmp/WIPE_IT/$Count");
}
}
close FILE;
#----------------------------------------------------
my $Result = system ("umount $Partition");
if ($Result > 0) {print "Error unmounting partition $Partition, aborting.\n"; exit; }
### Let us reformat the partition. Doesn't delete data, just removes it
### from the directory.
my $Result = system ("mkfs -t ext2 $Partition");
if ($Result > 0) {print "Error making partition, aborting.\n"; exit;}
</pre>
<h3>
<a NAME="Conclusion"></a>Conclusion</h3>
Using Expect was not necessary (other programs could have solved
the simple problems I had). Using Blowfish was not necessary. As a matter
of fact, the whole darn script was way too long if you just wanted to
wipe a hard drive and fill it with blanks. However, I wanted to use
fdisk because I always want to use fdisk, Expect is such a powerful tool,
it is good to let people see how it works, and putting random garbage
encrypted binary data in to confuse a hacker is just an extra touch.
<p>
I don't understand the complete complexity of hard drives, so I am not
sure if there are residual data left on the hard drive.
For my purposes, and my level of security, it does exactly what
I need. As I develop MILAS more, I am sure there will be tighter checks
and enhancements to delete all data off of a hard drive.
<p>
I tend to look forward in time trying to anticipate things which might be
needed in the future, which always causes a programmer to work more than is
required for the project at hand. However, the mood struck me, and I like
the direction the script is going, and so, it doesn't bother me to write
up this article on an airplane flight. Making something cool doesn't
wear me out, unlike having to do work for someone else, which is real work.
<h3>
<a NAME="REF"></a>References</h3>
<ol>
<li><a href="http://www.perl.com">Perl.com</a> website.
<li><a href="http://www.perl.com/CPAN-local/modules/by-category/21_File_Handle_Input_Output/Expect/Expect-1.10.readme">Expect Perl Module</a></li>
<li><a href="http://www.perl.com/CPAN-local/modules/by-category/14_Security_and_Encryption/Crypt/Crypt-Blowfish-2.06.readme">Blowfish Perl Module</a></li>
<li><a href="http://www.gnujobs.com/Articles/14/Wipe_It.html">Original site for this article. - http://www.gnujobs.com/Articles/14/Wipe_It.html</a>
(any updates will be placed here)</li>
</ol>
<BLOCKQUOTE><EM>
[You can also use /dev/random or /dev/urandom to overwrite
a disk. See<BR>
<A HREF="../issue60/lg_answer60.html#tag/9">The Answer Gang: "Classified Disk - Low-level Format"</A>
in issue 60. But it doesn't do encryption. -Mike.]
</EM></BLOCKQUOTE>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Mark Nielsen.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Installing USB, PCMCIA and Kernel 2.2.18 On My Laptop</font></H1>
<H4>By <a href="mailto:articles@gnujobs.com">Mark Nielsen</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<BLOCKQUOTE><EM>
[<STRONG>Editor's note:</STRONG> Linux users are currently
migrating from kernel series 2.2 to 2.4. Linux 2.4 includes
vastly improved USB support. Most distributions and users have not
yet made the switch, but will during the next several months. The
steps below were written for kernel 2.2.8. See the links in the
<A HREF="#REF">References</A> section below (especially the Linux-USB
Guide), for the latest information on getting USB to work with Linux.
<P> Also, the 2.4 kernel includes PCMCIA support, so try that first.
Those drivers don't work for everyone; if you're one of the unlucky few,
get the pcmcia-cs package.
</EM></BLOCKQUOTE>
<H3>Contents</H3>
<ol>
<li>
<a href="#Introduction">Introduction</a></li>
<li>
<a href="#kernel">Installing 2.2.18</a></li>
<li>
<a href="#lilo">Configuring Lilo to use the old and new kernels</a></li>
<li>
<a href="#usb">Setting up USB</a></li>
<li>
<a href="#ricochet">Changing the Ricochet modem from serial to USB.</a></li>
<li>
<a href="#problems">Some problems with laptop and resources.</a></li>
<li>
<a href="#Conclusion">Conclusion</a></li>
<li>
<a href="#REF">References</a></li>
</ol>
<h3>
<a NAME="Introduction"></a>Introduction</h3>
I wanted to use my Ricochet modem on my laptop using the USB port.
I had successfully downloaded kernel 2.2.18 and used USB with my
other computers. I didn't feel like getting kernel 2.4 at the time.
<p>
The problem with my laptop was the fact it was using pcmcia devices.
I found out later that I had to download pcmcia-cs and install it
after I installed the new kernel 2.2.18.
<p>
Getting USB to work on my laptop meant I had to do several things,
<ol>
<li> Install the new kernel 2.2.18.
<li> Install the pcmcia drivers.
<li> Configure Lilo to use the old kernel and the new kernel.
<li> Make sure the usb modules are loaded at boot time.
<li> Create a node under /dev/usb for the Ricochet modem.
<li> Reconfigure my ppp settings.
<li> When I was confident the new kernel was working good, make it the
default when the computer boots.
<li>Unfortunately, because of the stupidity of the BIOS on my laptop
and because of this stupid plug-and-pray garbage, I can only have
my USB port working when neither of the pcmcia slots are in use. This means
I can't hook up my laptop to the my local network using my pcmcia ethernet
card. This isn't the Linux kernels fault, but the dumb computer.
</ol>
<h3>
<a NAME="kernel"></a>Installing 2.2.18</h3>
Here are the steps I used to install the kernel and the pcmcia drivers.
<ol>
<li> Configure and install
the new kernel with console drivers, usb support, and pcmcia.
I also selected a bunch of other options. </li>
<li> Download pcmcia-cs and install using the src directory from the new
kernel. </li>
</ol>
Here are the commands I used to install the new kernel
<pre>
## change to the src directory for the linux kernel
## for xconfig, I selected the usb options and VESA VGA graphics console
## under console drivers for my laptop
make xconfig
make clean
make dep
make bzImage
make install
make modules
make modules_install
</pre>
Here are the steps I used to install pcmcia-cs.
<pre>
tar -zxvf pcmcia-cs-3.1.23.tar.gz
### Make sure you specify the root directory for the new kernel
### mine was /usr/src/linux-2.2.18/linux
### I didn't change the other default options.
make config
make all
### This puts the modules under /lib/modules/2.2.18
make install
</pre>
<h3>
<a NAME="lilo"></a>Configuring lilo to use the old and new kernel.</h3>
Here is the old and new configuration I had for /etc/lilo.conf.
I highly recommend that you do not use this for yourself, as I customized
lilo.conf for my own needs. After I edited /etc/lilo.conf to the new
configuration, I just typed "lilo" at the command prompt.
Then, when I rebooted my computer, I had a choice of "linux_new" or "linux".
After I was confident the new kernel was working, I changed it to be the
default.
<p>
Old configuration.
<pre>
### Configuration for GNUJobs.com test laptop
vga=791
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=linux
image=/boot/vmlinuz-2.2.12-32
label=linux
initrd=/boot/initrd-2.2.12-32.img
read-only
append="hdc=ide-scsi"
# ramdisk_size=40000
root=/dev/hda5
</pre>
New lilo.conf configuration.
<pre>
### Configuration for GNUJobs.com test laptop
### New kernel installed. Remember to install console drivers
### into new kernels otherwise vga=791 doesn't work.
vga=791
#vga=ask
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=linux_new
image=/boot/vmlinuz-2.2.18
label=linux_new
read-only
append="hdc=ide-scsi"
### /dev/hda5 is root for GNUJobs.com laptop
root=/dev/hda5
image=/boot/vmlinuz-2.2.12-32
label=linux
initrd=/boot/initrd-2.2.12-32.img
read-only
append="hdc=ide-scsi"
### /dev/hda5 is root for GNUJobs.com laptop
root=/dev/hda5
</pre>
<h3>
<a NAME="usb"></a>Setting up USB</h3>
In order to setup USB, I had to put these commands into my /etc/rc.d/rc.local file.
<pre>
### This command mounts the filesystem for usb to /proc/bus/usb.
mount -t usbdevfs none /proc/bus/usb
### Load a generic usb module -- choose one of these three depending on your
### motherboard or USB card. I have been able to use
### uhci or usb-uhci on all my motherboards so far. If you aren't sure
### which module to use, see "Basic USB Configuration" in the Linux-USB Guide
### at http://www.linux-usb.org/USB-guide/c122.html#AEN124
insmod /lib/modules/2.2.18/usb/uhci.o
# insmod /lib/modules/2.2.18/usb/usb-uhci.o
# insmod /lib/modules/2.2.18/usb/usb-ohci.o
### Load the module for modems, like Ricochet
insmod /lib/modules/2.2.18/usb/acm.o
</pre>
<h3>
<a NAME="ricochet"></a>Changing the Ricochet modem from serial to USB</h3>
In order to change my Ricochet modem to use the new usb, I had to load
the modules described in the previous section, and then create a new
node and make my ppp configuration use the new node.
<pre>
mkdir /dev/usb
mknod /dev/usb/ttyACM0 c 166 0
</pre>
<P> Again, I changed my modem from using /dev/ttyS0 to /dev/usb/ttyACM0.
Now my Ricochet modem is working, and it seems like it is going faster
than the serial modem, like it should be, but it could be my imagination.
Note that <EM>these</EM> two commands are permanent: you only need to run them
once. Also, this is /dev/usb, not /proc/bus/usb (explained in the Linux-USB
Guide). Kernel files magically appear and disappear in /proc/bus/usb as
devices are plugged in and unplugged, but that's not what this file is. USB
Ricochet modems require a /dev entry; some other USB devices don't. The
usbdevfs manages /proc/bus/usb, not /dev/usb.
<h3>
<a NAME="problems"></a>
Some problems with laptop and resources</h3>
I installed the new kernel on my laptop from DELL.
I did have some problems. It seems like my stupid laptop doesn't have
enough irqs to handle using the USB port. Thus, I now have to buy a
USB mouse (and maybe keyboard) to free up some irqs. I also had this problem
when I tried to use my pcmcia modem and pcmcia ethernet card at the same time.
I haven't been able to solve this problem. Now when I use the USB port, I can't
use either pcmcia card. It is extremely annoying that I can't get anything
to use irq 10, and that I can't disable the parallel port, serial port, and
internal ps/2 mouse. The DELL computer was by far the best Linux laptop
I had seen, but now it will become outdated soon. I imagine with kernel
2.4, there will be a lot more commercial support for Linux.
Why on earth the software evil empire and the
hardware evil empire came together to create the user-friendly plug-and-pray
nonsense is beyond me. I know my laptop has free resources but I cannot
force it to use those resources. Very annoying. I am extremely unimpressed
with the BIOS of the particular DELL laptop I got.
<p>
I bought another laptop for one of my employees at GNUJobs.com from
Emperor Linux, and it was properly configured, and I grilled the salesperson
to make sure I got everything working without any problems. I am much
happier with the laptop I got from Emperor Linux.
<p>
Another goofy thing I did was I forgot to install the iso9660 format into
the kernel (or as a module). Now I can't read cdroms. I will have to compile
the kernel one more time and specify to include the iso9660 filesystem format
as a module.
<h3>
<a NAME="Conclusion"></a>Conclusion</h3>
I am extremely impressed with the USB support in the Linux kernel
2.2.18. After Kernel 2.4.1 comes out, I will most likely upgrade
my kernel to 2.4. I have read all the new features about kernel
2.4, and it looks exciting!
<p>
Overall, I am impressed with the fact that is was pretty painless to
install the new kernel. Installing one kernel didn't blow away
earlier kernels, which made it so I could test out the new kernel
without getting rid of the old one. This is helpful if I want to revert
back to the old kernel. For example, before I installed pcmcia-cs for the
new kernel, my laptop's ethernet card didn't work, and hence, it was
helpful that I could boot to the old kernel where the ethernet card would
still work. Had this happened in a lame operating system which just forces
upgrades and wouldn't let you choose how to control your system, I might
have been screwed.
<p>
Even though the installation was fairly easy for me, it might be easier
for other people to just use rpms and to rely on their favorite
Linux distribution to help them out. This is the easiest installation
of the kernel and pcmcia drivers for a laptop that I have ever experienced.
It is nice to see the installation getting easier and easier. After years
of having to fight with the kernel for one reason or another, it is nice
to see all these technologies come together.
<p> I don't see how the
evil empire will be able to resist its downfall considering the fact that
GNU/Linux (and
<a href="http://www.openbsd.org">OpenBSD</a> and
<a href="http://www.freebsd.org">FreeBSD</a>) are technologically
superior and are
providing user friendliness with
<a href="http://www.gnome.org">GNOME</a> and
<A href="http://www.kde.org">KDE</a>. The evil empire has never
cared about technology, but marketing and user-friendliness.
Some of the evil commercial
UNIX vendors only cared about technology and did not care about making
their environment pleasant to use or user-friendly. Since
<a href="http://www.gnu.org">GNU</a>/Linux
is merging technology with user-friendliness, which is the way people want
it, we get the best of both worlds, instead of having evil empires
dictate to us what they think is best (or how to control us so that they
can milk us).
<h3>
<a NAME="REF"></a>References</h3>
<ol>
<li>Taken directly from linux/Documentation/usb/usb-help.txt
<pre>
2000-July-12
For USB help other than the readme files that are located in
linux/Documentation/usb/*, see the following:
Linux-USB project: <A HREF="http://www.linux-usb.org">http://www.linux-usb.org</A>
mirrors at <A HREF="http://www.suse.cz/development/linux-usb/">http://www.suse.cz/development/linux-usb/</A>
and <A HREF="http://usb.in.tum.de/linux-usb/">http://usb.in.tum.de/linux-usb/</A>
Linux USB Guide: <A HREF="http://www.linux-usb.org/USB-guide/book1.html">http://www.linux-usb.org/USB-guide/book1.html</A>
<STRONG>READ THIS!</STRONG> (or other Linux-USB mirrors)
Linux-USB device overview (working devices and drivers):
<A HREF="http://www.qbik.ch/usb/devices/">http://www.qbik.ch/usb/devices/</A>
The Linux-USB mailing lists are:
linux-usb-users@lists.sourceforge.net for general user help
linux-usb-devel@lists.sourceforge.net for developer discussions
</pre>
</li>
<li><a href="ftp://ftp.kernel.org/pub/linux/kernel/v2.2/linux-2.2.18.tar.gz">Linux Kernel 2.2.18</a></li>
<li> <a href="http://www.ibiblio.org/pub/Linux/kernel/pcmcia/pcmcia-cs-3.1.23.tar.gz">PCMCIA-CS source</a></li>
<li><a href="http://www.gnujobs.com/Articles/11/Ricochet.html">
Using the wireless modem Ricochet </a></li>
<li><a href="http://www.gnujobs.com/Articles/15/USB.html">
Original site for this article - http://www.gnujobs.com/Articles/15/USB.html.</a> (any updates will be here)
</ol>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Mark Nielsen.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Clearing out the Master Boot Record (MBR)</font></H1>
<H1>--Danger, Will Robinson!</H1>
<H4>By <a href="mailto:ben-fuzzybear@yahoo.com">Ben Okopnik</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
Experimentation is fun. After all, one of the things that makes Linux
so interesting to a number of people is the ability to twiddle settings
and see what happens - I'll admit that it's a major factor for me. One
of the problems with that, though, is that some types of twiddling can
lead to <EM>serious</EM> problems. A bit like sawing off the branch you're
sitting on, in fact...
<p>A number of people write to the Answer Gang with a query that goes something
like this:
<BLOCKQUOTE>
"Dear TAG: I have a stick of dynamite strapped to the CPU, and I'm not
afraid to use it. Now that I have your undivided attention: I ran into
a problem while trying to reinstall..."
</BLOCKQUOTE>
<p>What it turns out to be - after the police, the fire department, and
the burly men in the white coats have come and gone - is that they've run
into the classic "fried MBR" problem: install Linux, realize that Windows
will screw up the boot record, delete the Linux partition, try to install
Windows first... OOPS. The Windows setup runs into a problem and stops.
<p>The reason for all of the above is that they forgot to uninstall LILO,
which would have written out the original MBR; as it is, the boot code
in the MBR is trying to pass control to the Linux kernel - and that's no
longer there.
<p>Nothing helps. The undocumented "fdisk/mbr" option that is supposed
to write a clean Master Boot Record seems to have no effect; "fdisk" in
interactive mode refuses to delete the "Non-DOS" partition; even the detonator
fails to explode. What to do, what to do...
<p>By the way, a factor in the first two problems might be the Windows
"lock" command - by default, 'raw writes' to disk are disallowed, and "lock
c:" 'locks' the drive to allow writing to it. (For the last problem, stick
to the bridge-wire type detonators from Dynamit Nobel, and store them
<br>properly. :)
<br> <b><tt><font size=-1></font></tt></b>
<p><b><tt><font size=-1> * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * *</font></tt></b>
<br><b><tt><font size=-1> Note: The following advice
will <u>completely</u> wipe your Master Boot Record,</font></tt></b>
<br><b><tt><font size=-1> which contains all your partition
information. DO NOT DO THIS unless you</font></tt></b>
<br><b><tt><font size=-1> know that this is exactly the
result you want - it will leave your HD in</font></tt></b>
<br><b><tt><font size=-1> an unbootable state, in effect
bringing it back to "factory-fresh", i.e.,</font></tt></b>
<br><b><tt><font size=-1> empty of data and requiring
partitioning and formatting.</font></tt></b>
<br><b><tt><font size=-1> * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * *</font></tt></b>
<br> <b></b>
<p><b>Linux-based solution</b>
<p>If you can still somehow fire up Linux - say, via
<A HREF="http://www.toms.net/rb/">Tom's Root-Boot</A> floppy
- you can simply invoke "dd", like so:
<p><tt>dd if=/dev/zero of=/dev/hda bs=512 count=1</tt>
<p>Yep, that's it. That MBR is <EM>gone</EM>. Obviously, you have to be root
to do this.
<br>
<p><b>DOS-based solution</b>
<p>Boot with a DOS floppy that has "debug" on it; run "debug". At the '-'
prompt, "block-fill" a 512-byte chunk of memory with zeroes:
<p><tt>f 9000:0 200 0</tt>
<p>Start assembly mode with the 'a' command, and enter the following code:
<p><tt>mov dx,9000</tt>
<br><tt>mov es,dx</tt>
<br><tt>xor bx,bx</tt>
<br><tt>mov cx,0001</tt>
<br><tt>mov dx,0080</tt>
<br><tt>mov ax,0301</tt>
<br><tt>int 13</tt>
<br><tt>int 20</tt>
<p>Press <Enter> to exit assembly mode, take a deep breath - and press
"g" to execute, then "q" to quit "debug". Your HD is now in a virgin state,
and ready for partitioning and installation.
<p>Obviously, you have to be root... oh, oops. <b>Anybody</b> that walks
up with a DOS floppy can do this to your system in about a minute, including
boot time. Let's see; where was that article about securing your box, again?...
<H3>References</H3>
<p>The "dd" man page.
<p>DOS-based fix: Original idea and code by Mark Minasi, used for clearing
infected/damaged MBRs in a course of his that I used to teach; all code/command
modifications mine.
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Ben Okopnik.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">IP Spoofing</font></H1>
<H4>By <a href="mailto:kapil@linux4biz.net">Kapil Sharma</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<p>A spoofing attack involves forging one's source address. It is the act of using
one machine to impersonate another. Most of the applications and tools in UNIX
rely on the source IP address authentication. Many developers have used the
host based access controls to secure their networks. Source IP address is a
unique identifier but not a reliable one. It can easily be spoofed.<br>
To understand the spoofing process, First I will explain about the <b>TCP and
IP authentication process</b> and then how an attacker can <b>spoof you network</b>.</p>
<p>The client system begins by sending a SYN message to the server. The server
then acknowledges the SYN message by sending SYN-ACK message to the client.
The client then finishes establishing the connection by responding with an ACK
message. The connection between the client and the server is then open, and
the service-specific data can be exchanged between the client and the server.
Client and server can now send service-specific data </p>
<p> TCP uses sequence numbers. When a virtual circuit establishes between two
hosts , then TCP assigns each packet a number as an identifying index. Both
hosts use this number for error checking and reporting. <br>
Rik Farrow, in his article "Sequence Number Attacks", explains the
sequence number system as follows:<br>
<BLOCKQUOTE>
"The sequence number is used to acknowledge receipt of data. At the
beginning of a TCP connection, the client sends a TCP packet with an initial
sequence number, but no acknowledgment. If there is a server application running
at the other end of the connection, the server sends back a TCP packet with
its own initial sequence number, and an acknowledgment; the initial number from
the client's packet plus one. When the client system receives this packet, it
must send back its own acknowledgment; the server's initial sequence number
plus one."
</BLOCKQUOTE>
<p></p>
<p>Thus an attacker has two problems:<br>
1) He must forge the source address.<br>
2) He must maintain a sequence number with the target. </p>
<p>The second task is the most complicated task because when target sets the initial
sequence number, the attacker must response with the correct response. Once the
attacker correctly guesses the sequence number, he can then synchronize with
the target and establish a valid session.</p>
<p><b>Services vulnerable to IP Spoofing:</b><br>
Configuration and services that are vulnerable to IP spoofing :</p>
<ul>
<li> RPC (Remote Procedure Call services)</li>
<li>Any service that uses IP address authentication</li>
<li>The X Window system</li>
<li>The R services suite (rlogin, rsh, etc.)</li>
</ul>
<p><b>TCP and IP spoofing Tools:</b><br>
1) Mendax for Linux<br>
<a href="http://rootshell.com/archive-j457nxiqi3gq59dv/199711/mendax_linux.tgz">Mendax</a>
is an easy-to-use tool for TCP sequence number prediction and rshd spoofing.
</p>
<p>2) spoofit.h<br>
<a href="http://air.csc.ncsu.edu/xzhao/docs/DogPack/spoofers/sp/spoofit.h">spoofit.h</a>
is a nicely commented library for including IP spoofing functionality into your
programs. <EM>[Current URL unknown. -Ed.]</EM></p>
<p>3) ipspoof<br>
<a href="http://www.ryanspc.com/spoof/ipspoof.c">ipspoof</a> is a TCP and IP
spoofing utility.</p>
<p>4) hunt<br>
<a href="http://www.ryanspc.com/sniffers/hunt-1.3.tgz">hunt</a> is a sniffer
which also offers many spoofing functions.</p>
<p>5) dsniff<br>
<a href="http://www.monkey.org/%7Edugsong/dsniff/">dsniff </a>is a collection
of tools for network auditing and penetration testing. dsniff, filesnarf, mailsnarf,
msgsnarf, urlsnarf, and webspy passively monitor a network for interesting data
(passwords, e-mail, files, etc.). arpspoof, dnsspoof, and macof facilitate the
interception of network traffic. </p>
<p><br>
<b>Measures to prevent IP Spoofing Attacks:</b></p>
<ul>
<li>Avoid using the source address authentication. Implement cryptographic authentication
systemwide.</li>
<li>Configuring your network to reject packets from the Net that claim to originate
from a local address. This is most commonly done with a router.</li>
<li>If you allow outside connections from trusted hosts, enable encryption sessions
at the router.<br>
<br>
</li>
</ul>
<p><b>Conclusion:<br>
</b>Spoofing attacks are very dangerous and difficult to detect. They are becoming
more and more popular now. The only way to prevent these attacks are to implement
security measures like encrypted authentication to secure your network. </p>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Kapil Sharma.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">XML parsing in AOLserver</font></H1>
<H4>By <a href="mailto:irvingw@pobox.com">Irving Washington</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<h3>AOLserver</h3>
<a href="http://www.aolserver.com">AOLserver</a> is an open-source,
multi-threaded, high-performance web server. AOLserver is less known
than Apache but it has a few features that put it ahead of
Apache: rich and well-thought extension API, superior database
connectivity API, embedded and tightly integrated Tcl interpreter.
Read my <a href="../issue58/washington.html">previous LG article </a> to
learn more about AOLserver.
<h3>XML</h3>
If you're going to do serious work with XML you'll have to learn about
it and you'll have to do it somewhere else. The best summary of XML
I've seen is: XML is an (inefficient) way to to represent data in
tree form as text (ASCII) files. Text is good because it's simple.
Tree is good because a lot can be represented as trees
(e.g., a non-circular list is just a degenerated tree and a circular
list can be described with multiple trees). Inefficient is bad but it
usually makes an engineering sense to trade inefficiency for
extensibility and wide adoption that XML enjoys (lots of tools,
lots of information).
<h3>XML support in AOLserver</h3>
XML processing (parsing and modification of XML documents) in
AOLserver is possible thanks to an <b>ns_xml</b> module written
by <a href="http://www.arsdigita.com">ArsDigita</a>. This module is a
wrapper around version 2.x (>2.2.5) of <a
href="http://www.xmlsoft.org/">libxml</a> library and adds
<code>ns_xml</code> command to the embedded Tcl interpreter.
You can <a
href="http://www.aolserver.com/download/index.adp?dir=%2fmodules%2fnsxml">
download the source</a> or get it directly from the CVS repository doing:
<pre>
cvs -d:pserver:anonymous@cvs.aolserver.sourceforge.net:/cvsroot/aolserver login
cvs -z3 -d:pserver:anonymous@cvs.aolserver.sourceforge.net:/cvsroot/aolserver co nsxml
</pre>
You need to press <i>Enter</i> after first command since CVS is
waiting for a password (which is empty).
<p>
As of Dec. 2000 Linux distributions usually come with
version 1.x of libxml library so chances are that you'll need to
install 2.x by yourself (this will change in the future since
everyone is migrating to 2.x). To install <code>nsxml</code> module go
into <tt>nsxml</tt> directory, optionally edit a path in
<code>Makefile</code> to point into AOLserver source directory. Then
run <code>make</code>. You should get <code>nsxml.so</code> module
that should be placed in AOLserver bin directory (the same that has
main <code>nsd</code> executable). Add the following to your
<code>nsd.tcl</code> config file:
<pre>
ns_section "ns/server/${servername}/modules"
ns_param nsxml ${bindir}/ns_xml.so
</pre>
and restart AOLserver. You can verify that the module gets loaded by
watching server.log, I usually use a shell window with:
<pre>
tail -f $AOLSERVERDIR/log/server.log
</pre>
This is also a great way to debug Tcl scripts since AOLserver will
dump detailed debug information every time there is an error in the
script.
<h3>XML Quick reference</h3>
Here's a quick reference of all commands available through ns_xml.
<p>
<table bgcolor=#ffffff cellspacing=1>
<tr> <td bgcolor=wheat> <b><code>
set doc_id [<font color=gray>ns_xml parse</font> <font color=red>?-persist? $string</font>]
</code> </b> </td> </tr>
<tr> <td>
Parse the XML document in a <font color=red>$string</font> and return document id
(handle to in-memory parsed tree). If you don't provide
<font color=red>?-persist?</font> flag the memory will be automatically freed when the
script exits. Otherwise you'll have to free the memory by calling
<font color=gray>ns_xml doc free</font>. You need to use <font color=red>-persist</font> flag if you want
to share parsed XML docs between scripts.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set doc_stats [<font color=gray>ns_xml doc stats</font> <font color=red>$doc_id</font>]
</code> </b> </td> </tr>
<tr> <td>
Return document's statistics.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
<font color=gray>ns_xml doc free</font> <font color=red>$doc_id</font>
</code> </b> </td> </tr>
<tr> <td>
Free a document. Should only be called on a document if
<font color=red>?-persistent?</font> flag has been passed to either
<font color=gray>ns_xml parse</font> or <font color=gray>ns_xml doc create</font>
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set node_id [<font color=gray>ns_xml doc root</font> <font color=red>$doc_id</font>]
</code> </b> </td> </tr>
<tr> <td>
Return the node id of the document root (you start traversal of the
document tree from here.)
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set children_list [<font color=gray>ns_xml node children</font> <font color=red>$node_id</font>]
</code> </b> </td> </tr>
<tr> <td>
Return a list of children nodes of a given node.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set node_name [<font color=gray>ns_xml node name</font> <font color=red>$node_id</font>]
</code> </b> </td> </tr>
<tr> <td>
Return the name of a node.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set node_type [<font color=gray>ns_xml node type</font> <font color=red>$node_id</font>]
</code> </b> </td> </tr>
<tr> <td>
Return the type of a node. Possible types: <i>element, attribute,
text, cdata_section, entity_ref, entity, pi, comment, document,
document_type, document_frag, notation, html_document</i>
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set content [<font color=gray>ns_xml node getcontent</font> <font color=red>$node_id</font>]
</code> </b> </td> </tr>
<tr> <td>
Get a content (text) of a given node.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set attr [<font color=gray>ns_xml node getattr</font> <font color=red>$node_id $attr_name</font>]
</code> </b> </td> </tr>
<tr> <td>
Return the value of an attribute of a given node.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set doc_id [<font color=gray>ns_xml doc create</font> <font color=red>?-persist? $doc-version</font>]
</code> </b> </td> </tr>
<tr> <td>
Create a new document in memory. If <font color=red>-persist</font> flag is given you'll
have to explicitely free the memory taken by the document with
<font color=gray>ns_xml doc free</font>, otherwise it'll be freed automatically after
execution of the script. <font color=red>$doc_version</font> is a version of an XML
doc, if not specified it'll be "1.0".
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set xml_string [<font color=gray>ns_xml doc render</font> <font color=red>$doc_id</font>]
</code> </b> </td> </tr>
<tr> <td>
Generate XML from the in-memory representation of the document.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set node_id [<font color=gray>ns_xml doc new_root</font> <font color=red>$doc_id $node_name $node_content</font>]
</code> </b> </td> </tr>
<tr> <td>
Create a root node for a document.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set node_id [<font color=gray>ns_xml node new_sibling</font> <font color=red>$node_id $name $content</font>]
</code> </b> </td> </tr>
<tr> <td>
Create a new sibling of a given node.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
set node_id [<font color=gray>ns_xml node new_child</font> <font color=red>$node_id $name $content</font>]
</code> </b> </td> </tr>
<tr> <td>
Create a child of a given node.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
<font color=gray>ns_xml node setcontent</font> <font color=red>$node_id $content</font>
</code> </b> </td> </tr>
<tr> <td>
Set a content for a given node.
</td></tr>
<tr> <td bgcolor=wheat> <b><code>
<font color=gray>ns_xml node setattr</font> <font color=red>$node_id $attr_name $value</font>
</code> </b> </td> </tr>
<tr> <td>
Set the value of an attribute in a given node.
</td></tr>
</table>
<h3>A simple example</h3>
An educational and simple thing to do is to parse a document and print
out its tree structure. Stripped to bare bones the process is:
<ul>
<li> use <font color=gray> <code>ns_xml parse $xml_doc</code></font>
to parse XML document in string <font color=gray>$xml_doc</font> and get
its document id
<li> use <font color=gray> <code>ns_xml doc root $doc_id</code>
</font> to get the id of a root node
<li> use <font color=gray> <code>ns_xml node children
$node_id</code> </font> to traverse document tree and <font
color=gray> <code>ns_xml node ...</code> </font>commands to get
node content and attributes
</ul>
If you provide <font color=gray> <code>-persist</code> </font> flag to
<font color=gray><code>ns_xml parse</code> </font>
you'll have to explicitly call <font color=gray> <code>ns_xml doc
free $doc_id </code> </font> to free memory associated with this
document, otherwise it will get automatically freed after execution of
a script.
<p>
In code it could look like this:
<pre>
proc dump_node {node_id level} {
set name [ns_xml node name $node_id]
set type [ns_xml node type $node_id]
set content [ns_xml node getcontent $node_id]
ns_write "<li>"
ns_write "node id=$node_id name=$name type=$type"
if { [string compare $type "attribute"] != 0 } {
ns_write " content=$content\n"
}
}
proc dump_tree_rec {children} {
ns_write "<ul>\n"
foreach child_id $children {
dump_node $child_id
set new_children [ns_xml node children $child_id]
if { [llength $new_children] > 0 } {
dump_tree_rec $new_children
}
}
}
proc dump_tree {node_id} {
dump_tree_rec [list $node_id] 0
}
proc dump_doc {doc_id} {
ns_write "doc id=$doc_id<br>\n"
set root_id [ns_xml doc root $doc_id]
dump_tree $root_id
}
set xml_doc "<test version="1.0">this is a
<blind>test</blind> of xml</test>"
set doc_id [ns_xml parse $xml_doc]
dump_doc $doc_id
</pre>
<font color=gray> <code>ns_xml parse</code> </font> command will throw
an error if XML document is not valid (e.g., not well formed) so in
production code we should catch it and display a meaningful error
message, e.g.:
<pre>
if { [catch {set doc_id [ns_xml parse $xml_doc]} err] } {
ns_write "There was an error parsing the following XML document: "
ns_write [ns_quotehtml $xml_doc]
ns_write "Error message is:"
ns_write [ns_quotehtml $err]
ns_write "</body></html>\n"
return
}
</pre>
Code like this takes more time to write but some day it may save a lot of
debugging time (and a day like this always comes).
<p>
<a href="http://www.fifthgate.org/articles/aolserver/xml/test_xml.tcl">See how the code works</a> in practice
[external site running AOLserver]
and <a href="misc/washington/test_xml.tcl.txt">get the full
source</a> [included in <I>Linux Gazette</I>]. It's a bit more complex than the
above snippet. You can see the structure of an arbitrary XML document by typing
it in the provided text area. The script also shows how to parse form data and
has more robust error handling.
<h3> Real life example</h3>
XML is better than other similar formats because it is a standard, it
has gained wide acceptance and its usage is growing rapidly.
One of the possible usages of XML is as a way of communication between
web sites (web services). The simplest scenario is that of one web server
grabbing information in XML format from another web server. A popular
example of such communication is a congregation of headlines, e.g., if
you go to <a
href="http://www.freshmeat.net">freshmeat.net</a> you'll see that they
provide current headlines from
<a href="http://www.linuxtoday.com">linuxtoday.com</a>. We'll do the
same thing (vive l'originalite!). <p>
In the past it could've been done in a rather distasteful way by
grabbing the whole HTML page and trying to extract relevant
information. It would be hard to program and fragile (a change in the
way HTML page is generated would most likely break such parsing).
<p>
Today the site that wants to provide headlines for others can
publish this data in an easily to parse XML format under some URL.
In our case the data are provided at
<a href="http://www.linuxtoday.com/backend/linuxtoday.xml">
http://www.linuxtoday.com/backend/linuxtoday.xml</a>.
<a href="misc/washington/test_xml.tcl.txt">See the format of this
file</a> (using previously developed script). <!-- ?show_linuxtoday_p=1 -->
<p>
As you can see XML document represent headlines on LinuxToday site. It
is a set of stories, each story having
title, url, author etc. We know that after parsing the XML document we
would like to have a way to easily extract the information.
Let's use a "wishful-thinking" (in other words top-down) method of
writing the code advocated in a <a
href="http://sicp.arsdigita.org">Structure and interpretation of
computer programs</a> (a truly great CS book). Let's assume that we've
converted XML representation into an object. To build an
HTML table showing the data we need the following procedures:
<ul>
<li> get total number of stories: <font color=gray><code>headlines_get_stories_count $headlines</code> </font>
<li> get n-th story: <font color=gray><code>headlines_get_story $headline $story_no</code></font>
<li> get URL of a given story: <font color=gray><code>story_get_url $story</code></font>
<li> get title of a given story: <font color=gray><code>story_get_title $story</code></font>
</ul>
For simplicity I only use URL and title but extending this to more
attributes should be trivial.
<p>
Having those procedures we can generate the simplest (but rather ugly)
table:
<pre>
proc story_to_html_table_row { story } {
set url [story_get_url $story]
set title [story_get_title $story]
return "- <a href=\"$url\"><font color=#000000>$title</font></a><br>\n"
}
# given headlines generate HTML code of the table with this data
proc headlines_to_html_table { headlines } {
set to_return "<table border=0 cellspacing=1 cellpadding=3>"
append to_return "<tr><td><small>"
set stories_count [headlines_get_stories_count $headlines]
for {set i 0} {$i < $stories_count} {incr i} {
set story [headlines_get_story $headlines $i]
append to_return [story_to_html_table_row $story]
}
append to_return "</td></tr></table>\n"
return $to_return
}
</pre>
Tcl doesn't give us much choice for representing this object; we'll
use lists.
<pre>
proc headlines_get_stories_count { headlines } {
return [llength $headlines]
}
proc headlines_get_story { headlines story_no } {
return [lindex $headlines $story_no]
}
proc story_get_url { story } {
return [lindex $story 0]
}
proc story_get_title { story } {
return [lindex $story 1]
}
</pre>
Note that if we forget about purity (just for a while) we can rewrite
the following part of <code>headlines_to_html_table</code>:
<pre>
set stories_count [headlines_get_stories_count $headlines]
for {set i 0} {$i < $stories_count} {incr i} {
set story [headlines_get_story $headlines $i]
append to_return [story_to_html_table_row $story]
}
</pre>
in a bit more terse way:
<pre>
foreach story $headlines {
append to_return [story_to_html_table_row $story]
}
</pre>
Now the most important part: converting XML doc into the
representation we've chosen.
<pre>
# does a name of the node identified by $node_id equals $name
proc is_node_name_p { node_id name } {
set node_name [ns_xml node name $node_id]
if { [string_equal_p $name $node_name] } {
return 1
} else {
return 0
}
}
# does a type of the node identified by $node_id equals $type
proc is_node_type_p { node_id type } {
set node_type [ns_xml node type $node_id]
if { [string_equal_p $type $node_type] } {
return 1
} else {
return 0
}
}
# is this an node of type "attribute"?
proc is_attribute_node_p { node_id } {
return [is_node_type_p $node_id "attribute"]
}
# raise an error if node name is different than $name
proc error_if_node_name_not {node_id name} {
if { ![is_node_name_p $node_id $name] } {
set node_name [ns_xml node name $node_id]
error "node name should be $name and not $node_name"
}
}
# raise an error if node type is different than $type
proc error_if_node_type_not {node_id type} {
if { ![is_node_type_p $node_id $type] } {
set node_type [ns_xml node type $node_id]
error "node type should be $type and not $node_type"
}
}
# given url and title construct a story object with
# those attributes
proc define_story { url title } {
return [list $url $title]
}
# convert a node of name "story" into an object
# that represents story
proc story_node_to_story {node_id} {
set url ""
set title ""
# go through all children and extract content of url and title nodes
set children [ns_xml node children $node_id]
foreach node_id $children {
# we're only interested in nodes whose name is "url" or "title"
if { [is_attribute_node_p $node_id]} {
if { [is_node_name_p $node_id "url"] || [is_node_name_p $node_id "title"]} {
set node_children [ns_xml node children $node_id]
# those should only have one children node with
# the name "text" and type "cdata_section"
if { [llength $node_children] != 1 } {
set name [ns_xml node name $node_id]
error "$name node should only have 1 child"
}
set one_node_id [lindex $node_children 0]
error_if_node_type_not $one_node_id "cdata_section"
error_if_node_name_not $one_node_id "text"
set txt [ns_xml node getcontent $one_node_id]
if { [is_node_name_p $node_id "url"] } {
set url $txt
}
if { [is_node_name_p $node_id "title"]} {
set title $txt
}
}
}
}
return [define_story $url $title]
}
# convert XML doc to headlines object
proc xml_to_headlines { doc_id } {
set headlines [list]
set root_id [ns_xml doc root $doc_id]
# root node should be named "linuxtoday" and of type "attribute"
error_if_node_name_not $root_id "linuxtoday"
error_if_node_type_not $root_id "attribute"
set children [ns_xml node children $root_id]
foreach node_id $children {
# only interested in attribute type nodes whose name is "story"
if { [is_node_name_p $node_id "story"] && [is_attribute_node_p $node_id]} {
set story [story_node_to_story $node_id]
lappend headlines $story
}
}
return $headlines
}
</pre>
The code is rather straightforward. We use the knowledge about the
structure of XML file. In this case we know that root node is named
<tt>linuxtoday</tt> and should have a child named
<tt>story</tt>. Each <tt>story</tt> node should have children named
<tt>url</tt> and <tt>title</tt> etc. The previous script that dumps
general structure of the tree helped me a lot in writing this
function. Note the usage of <font color=gray> <tt>error</tt> </font>
command to abort the script if XML doesn't look good to us.
<p>
Having an intermediate representation of the data might look like an
excess given that it costs us more code and some performance but there
are very good reasons to have it. We could have written a proc
<code>xml_to_html_table</code> that would create HTML table directly
from XML document but such code would be more complex, more buggy and
harder to modify. Separation that we've made provides an abstraction
that reduces complexity, which is always good. It also gives us more
flexibility: we can easily imagine writing another
<code>headlines_to_html_table</code> procedure that gives us slightly
different table.
<p>
<a
href="http://www.fifthgate.org/articles/aolserver/xml/test_linuxtoday_xml.tcl">
See how it works in practice</a>
[external site running AOLserver]
and
<a href="misc/washington/test_linuxtoday_xml.tcl.txt">get the source</a>
[included in <I>Linux Gazette</I>]. It should
produce something like this:
<p>
<center>
<TABLE WIDTH="40%" BORDER="0" CELLSPACING="1" CELLPADDING="3">
<TR>
<TD ALIGN="center" BGCOLOR="#cccccc">
<B>
<FONT FACE="Lucida,Verdana,Helvetica,Arial">
<A href="http://linuxtoday.com">
<FONT color="#000000">linuxtoday</FONT>
</A>
</FONT>
</B>
</TD>
</TR>
<TR>
<TD BGCOLOR="#eeeeee">
<SMALL><FONT FACE="Lucida,Verdana,Helvetica,Arial">
- <A HREF="http://linuxtoday.com/news_story.php3?ltsn=2000-12-28-001-04-OS-DB"><FONT COLOR="#000000">Kernel Cousin Debian Hurd #73 By Paul Emsley And Zack Brown</FONT></A><BR>
- <A HREF="http://linuxtoday.com/news_story.php3?ltsn=2000-12-27-006-04-OS-SW"><FONT COLOR="#000000">Zope 2.2.5 b1 released</FONT></A><BR>
- <A HREF="http://linuxtoday.com/news_story.php3?ltsn=2000-12-27-014-06-SC"><FONT COLOR="#000000">O#39;Reilly Network: Insecurities in a Nutshell: SAMBA, pine, ircd, and More</FONT></A><BR>
- <A HREF="http://linuxtoday.com/news_story.php3?ltsn=2000-12-27-005-04-OP-HW"><FONT COLOR="#000000">ZDNet: Linux Laptop SuperGuide</FONT></A><BR>
- <A HREF="http://linuxtoday.com/news_story.php3?ltsn=2000-12-27-004-04-OP-MS"><FONT COLOR="#000000">ComputerWorld: Think tank warns that Microsoft hack could pose national security risk</FONT></A><BR>
</FONT></SMALL>
</TD>
</TR>
</TABLE>
</center>
<p>
One thing missing in this code is caching. As it is, it
will grab the XML file from other people's server everytime it is
invoked. This is not nice. It would be fairly easy to add a logic to
cache XML file (or its in-memory representation) and only
fetch a new version if, say, 1 hour passed since it was last retrieved.
<h3>Conclusion about XML as a data exchange language</h3>
Is this data exchange thing between web servers a novel idea? No. You
could do everything described here with the first generation of web
servers. You would probably use different technologies (C code running
inside a web server or a CGI script instead of an embedded scripting
language; some ad-hoc text or binary format instead of XML) but the
idea would be the same: one web server acts as a client, grabs the
data from the other server using HTTP protocol and does something
useful with the data. The other web server acts as a server providing
data for others. It's just another implementation of
a client-server paradigm. It's nothing new. It is just a sign that web
programming is maturing. After 5+ years we've finally solved most of the
problems with presenting static html pages or generating dynamic web
pages from the data kept on the server (e.g., in a database). Now we
enter the times of providing services and data for other web
sites. Today state-of-the-art is pretty much limited to exchanging
headlines and similar trivia but possibilities are bigger, ranging
from simple things like providing stock quotes or dictionary
definitions to executing complex (e.g., financial) transactions
following an agreed upon protocol.
<p>
<h3>Conclusion about XML parsing in AOLserver</h3>
Beside parsing you can also create and manipulate XML documents in
memory and convert them to XML ASCII representation. It is not
covered in this article but it's so straightforward that you should
be able to do it just by looking at the API.
<p>
ns_xml module provides basics of XML processing. Although you can do
quite a bit with it one could wish to do more. Things that are
obviously missing:
<ul>
<li> SAX API (it's already present in libxml so this would only
require extending ns_xml)
<li> support for XSLT (support for XSLT, although planned, is not yet
present in libxml)
</ul>
An alternative approach to ns_xml module would be to:
<ul>
<li> use <a href="http://pywx.idyll.org">PyWx</a>, a Python
interpreter embedded inside AOLserver and standard
<a href="http://www.python.org/sigs/xml-sig/">PyXML</a> Python module
<li> write another module wrapping some other XML parsing library
<li> use pure Tcl parser
</ul>
<h3>Links</h3>
<ul>
<li> to find out more about AOLserver read
<a href="../issue58/washington.html">
intro in December 2000 issue of LG</a> or
<a
href="http://www.arsdigita.com/asj/aolserver/introduction-1">part
one</a> and <a
href="http://www.arsdigita.com/asj/aolserver/introduction-2">part
two</a> of another intro
<li> <a href="http://www.aolserver.com">AOLserver</a> home page
<li> <a href="http://www.arsdigita.com/books/panda">Philip and Alex's
Guide to Web Publishing</a>, a book
that will make you a better web programmer
<li> <a href="http://sicp.arsdigita.org/">Structure and Interpretation
of Computer Programs</a>, a book that will make you a better
programmer
<li> <a href="http://www.arsdigita.com/books/tcl">Tcl for Web
Nerds</a>, a handy book on Tcl
<li> everybody has a web page and <a
href="http://www.fifthgate.org"> this one is mine </a>
</ul>
<address> If you have comments or suggestions,
<a href="mailto:irvingw@pobox.com">send them in</a>. </address>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright © 2001, Irving Washington.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <hr> <P>
<H1><font color="maroon">The Back Page</font></H1>
<ul>
<li><a HREF="#authors">About This Month's Authors</a>
<li><a HREF="#notlinux">Not Linux</a>
</ul>
<a name="authors"></a>
<P> <HR> <P>
<!--======================================================================-->
<center><H3><font color="maroon">About This Month's Authors</font></H3></center>
<P> <HR> <P>
<!--======================================================================-->
<!-- BEGIN bio -->
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Marius Andreiana</H4>
Marius is 20 years old, student in the second year at Politehnica
Bucharest, Romania
and working as a web developer. Besides Linux, he also loves music (from
rock to dance), dancing, having fun, spending time with friends.
He is interested also in science in general (and that quantum spooky
connection :)
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Bryan Brunton</H4>
With a degree in philosophy and as a reformed Visual Basic programmer,
Bryan Brunton is a software engineer who wants to work with whatever
tools allow him to never again use pointers while remaining platform
agnostic.
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Shane Collinge</H4>
Part computer programmer, part cartoonist, part Mars Bar. At night, he runs
around in a pair of colorful tights fighting criminals. During the day... well,
he just runs around. He eats when he's hungry and sleeps when he's sleepy.
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Matteo Dell'Omodarme</H4>
I'm a student at the University of Pisa and a Linux user since 1994.
Now I'm working on the administrations of Linux boxes at the Astronomy section
of the Department of Physics, with special experience about security. My
primary email address is
<A HREF="mailto:matt@martine2.difi.unipi.it">matt@martine2.difi.unipi.it</A>.
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Chris Gibbs</H4>
I'm a mad, sad geek with three dogs, a network and a cat living
on top of a mountain in a Welsh valley. So I'm a contradiction! All
that is good is either caffine, chocolate or Linux, so send me lots of
chocolate or just point me at more great stuff to run on a salvaged 486!
<A HREF="mailto:chocolate@hawklord.uklinux.net">chocolate@hawklord.uklinux.net</A>
<p>
<h4><img align=bottom alt="" src="../gx/note.gif">Mark Nielsen</h4>
Mark works at ZING
(<A HREF="http://www.genericbooks.com">www.genericbooks.com</A>) and
<A HREF="http://GNUJobs.com">GNUJobs.com</A>. Previously,
Mark founded <A HREF="http://www.gnujobs.com">The Computer Underground</A>.
Mark works on non-profit and volunteer projects which promote free literature
and software. To make a living, he recruits people for GNU related jobs and
also provides solutions for web/database problems using Linux, FreeBSD, Apache,
Zope, Perl, Python, and PostgreSQL.
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Ben Okopnik</H4>
A cyberjack-of-all-trades, Ben wanders the world in his 38' sailboat, building
networks and hacking on hardware and software whenever he runs out of cruising
money. He's been playing and working with computers since the Elder Days
(anybody remember the Elf II?), and isn't about to stop any time soon.
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Kapil Sharma</H4>
Kapil is a Linux and Internet security consultant. He has been
working on various Linux/Unix systems and Internet Security for more than
2 years. He maintains a web site
(<A HREF="http://www.linux4biz.net">http://linux4biz.net</A>) for providing
free as well as commercial support for web, Linux and Unix solutions.
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Irving Washington</H4>
Irving Washington (pseud.), as witnessed by his personal server
<a href="http://www.fifthgate.org">www.fifthgate.org</a>, is mostly
interested in creating useful web services.
<!-- END bio -->
<a name="notlinux"></a>
<P> <hr> <P>
<!--====================================================================-->
<center><H3><font color="maroon">Not Linux</font></H3></center>
<P> <HR> <P>
<!--======================================================================-->
<P>
<!-- *** BEGIN Not Linux *** -->
<P> Here are some screenshots of lesser-known features of Microsoft Office.
<A HREF="mailto:dgd@vaxer.net">David Deckert</A> made the last one. Neither of
us know where the other three came from.
<CENTER>
<IMG ALT="[Word menu with options for 'Read Boss's Mind', 'Adjust Subordinate's Attitude', etc.]" SRC="misc/backpage/sv8538544.jpg"
WIDTH="441" HEIGHT="414" VSPACE="20">
<BR CLEAR="all">
<IMG ALT="[Office Assistant that looks like a superhero dog offering to hump your leg, chase a car or shit on the carpet.]" SRC="misc/backpage/sv8538545.jpg"
WIDTH="320" HEIGHT="226" VSPACE="20">
<BR CLEAR="all">
<IMG ALT="[Default Settings dialog with options to crash every 2 hours, create incredibly large files, and to disable the ability to type during auto saves.]" SRC="misc/backpage/sv8538546.jpg"
WIDTH="420" HEIGHT="448" VSPACE="20">
<BR CLEAR="all">
<IMG ALT="[The ever-helpful Office Assistant says, 'It looks like you're writing a suicide note! Office Assistant can help you write your suicide note. First, tell us how you plan to kill yourself. Pills, Jump, Pastry?']" SRC="misc/backpage/sv8538548.jpg"
WIDTH="581" HEIGHT="476" VSPACE="20">
<BR CLEAR="all">
</CENTER>
<HR NOSHADE WIDTH="80%"> <!-- ************************************** -->
<P>
<IMG ALT="[Linux Gazette mini-logo]" SRC="../gx/minilogos/lglogo_200x41.png"
WIDTH="200" HEIGHT="41">
<BR CLEAR="all">
We have changed the <I>Linux Gazette</I> logo at the top of the page to an 8K
PNG image for your fast-downloading pleasure. Thanks to
<A HREF="mailto:k.-h.herrmann@fz-juelich.de">Karl-Heinz Herrmann</A> for the
suggestion and the image. Here is also a small version (200 pixels wide)
for those who want an icon on their site to link to <I>LG</I> site with.
<P> Happy Linuxing!
<P> Michael Orr<br>
Editor, <A HREF="http://www.linuxgazette.com/"><i>Linux Gazette</i></A>, <A
HREF="mailto:gazette@ssc.com">gazette@ssc.com</a>
<BR CLEAR="all">
<!-- *** END Not Linux *** -->
<!-- *** BEGIN copyright *** -->
<P> <hr> <P>
<H5 ALIGN=center>
Copyright © 2001, the Editors of <I>Linux Gazette</I>.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 63 of <i>Linux Gazette</i>, Mid-February (EXTRA) 2001</H5>
<!-- *** END copyright *** -->
</BODY></HTML>
|